#screen-gameplay {
  background: var(--assets-wood, #6b4a2e);
  background-image:
    radial-gradient(120% 90% at 50% 40%, #f4ead0b3, #6b4a2ee0),
    url('../../assets/backgrounds/wood_1.png');
  background-size: cover;
  background-position: center;
}
#screen-gameplay .gp-grain { opacity: .5; }

/* ---- Top bar ---- */
#screen-gameplay .gp-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #0f3d3de6, #0f3d3d00);
  z-index: 5;
}
#screen-gameplay .gp-topbar-left { display: flex; gap: 8px; }
#screen-gameplay .gp-status-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 12px;
  border-radius: var(--r-pill);
  background: #0e3b3ad9;
  border: 1.5px solid #f7c36459;
}
#screen-gameplay .gp-status-wordmark { font: 400 24px/1 var(--font-display); color: var(--c-gold-light); }
#screen-gameplay .gp-status-divider { width: 1px; height: 18px; background: #ffffff33; }
#screen-gameplay .gp-status-modes { display: flex; align-items: center; gap: 6px; font: 700 11px var(--font-body); color: var(--c-cream); }
#screen-gameplay .gp-mode-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }
#screen-gameplay .gp-topbar-right { display: flex; gap: 8px; align-items: center; }
#screen-gameplay .gp-info-pill {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: #0e3b3ad9;
  border: 1.5px solid #ffffff2b;
  font: 700 11px var(--font-body);
  color: var(--c-cream);
}
#screen-gameplay .gp-timer-pill { font-family: var(--font-mono); }

/* ---- Play grid ---- */
#screen-gameplay .gp-grid-wrap {
  position: absolute;
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
  padding: 9px;
  border-radius: 22px;
  background: #3b2a1747;
  border: 1.5px solid #ffffff2b;
  box-shadow: inset 0 1px 0 #ffffff26;
}
#screen-gameplay .gp-grid {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  grid-template-rows: repeat(7, 36px);
  gap: 4px;
}
#screen-gameplay .gp-tile {
  width: 36px; height: 36px;
  border-radius: var(--r-tile);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
/* Tap collider larger than the 36px art — flagged in the design handoff's
   open decisions as required for touch accuracy. */
#screen-gameplay .gp-tile::before {
  content: '';
  position: absolute;
  inset: -4px;
}
#screen-gameplay .gp-tile.is-empty { background: #f5ecd524; border: 1.5px dashed #f6f0dd52; }
#screen-gameplay .gp-tile.has-card {
  border: 1.5px solid #f6f0dd;
  box-shadow: 0 2px 6px #3a230f66;
  cursor: pointer;
}
#screen-gameplay .gp-tile.has-card img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-tile); }
#screen-gameplay .gp-card-label {
  position: absolute;
  bottom: 1px; left: 1px; right: 1px;
  font: 800 7px var(--font-body);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
  text-align: center;
  pointer-events: none;
}
#screen-gameplay .gp-hand-card .gp-card-label { font-size: 10px; bottom: 4px; }
#screen-gameplay .gp-hand-card .gp-card-label.is-number {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 1px 3px #000, 0 0 8px #000, 0 0 2px #000;
}
#screen-gameplay .gp-tile .gp-card-label.is-number { font-size: 10px; font-weight: 800; }
#screen-gameplay .gp-tile.is-playable { box-shadow: 0 0 0 2px var(--c-gold-light), 0 2px 6px #3a230f66; }
#screen-gameplay .gp-tile.is-blocked img { filter: saturate(.45) brightness(.8); }
#screen-gameplay .gp-tile.is-blocked::after {
  content: '';
  position: absolute; inset: 0;
  background: #134a4a73;
  border: 1.5px solid #cfd7adb3;
  border-radius: var(--r-tile);
  box-shadow: inset 0 0 0 2px #134a4a66;
}

/* ---- Deck ---- */
#screen-gameplay .gp-deck {
  position: absolute;
  left: 52px;
  top: 96px;
}
#screen-gameplay .gp-zone-label {
  font: 700 9px var(--font-body);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #f8efd9;
  text-shadow: 0 1px 3px #00000099;
  margin-bottom: 6px;
  text-align: center;
}
#screen-gameplay .gp-deck-stack { position: relative; width: 96px; height: 96px; cursor: pointer; }
#screen-gameplay .gp-deck-stack .shim {
  position: absolute; inset: 0;
  border-radius: 14px;
}
#screen-gameplay .gp-deck-stack .shim.shim-2 { background: #24505ab3; transform: translate(5px, 5px); }
#screen-gameplay .gp-deck-stack .shim.shim-1 { background: #1b3a3f80; transform: translate(2.5px, 2.5px); }
#screen-gameplay .gp-deck-stack img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 14px;
  border: 2px solid #f6f0dd;
  box-shadow: 0 6px 16px #3a230f80;
  object-fit: cover;
}
#screen-gameplay .gp-deck-count {
  position: absolute;
  bottom: -8px; right: -8px;
  min-width: 28px;
  padding: 3px 7px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, #fbd489, var(--c-gold-base));
  border: 2px solid #fff6e2;
  font: 800 13px var(--font-body);
  color: var(--c-gold-text);
  text-align: center;
}

/* ---- Discard ---- */
#screen-gameplay .gp-discard { position: absolute; right: 52px; top: 96px; text-align: center; }
#screen-gameplay .gp-discard-well {
  width: 96px; height: 96px;
  border-radius: 14px;
  border: 2px dashed #f6f0dd99;
  background: #4b311a4d;
  position: relative;
}
#screen-gameplay .gp-discard-well img {
  position: absolute; inset: 4px;
  width: calc(100% - 8px); height: calc(100% - 8px);
  border-radius: 11px;
  object-fit: cover;
  opacity: .9;
  filter: saturate(.7) brightness(.92);
}
/* ---- Hand tray ---- */
#screen-gameplay .gp-hand-zone {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(0deg, #0f3d3df2, #0f3d3d00);
  display: flex;
  align-items: flex-end;
  padding: 0 26px 12px;
  gap: 16px;
}
#screen-gameplay .gp-hand-label-col { display: flex; flex-direction: column; align-items: center; }
#screen-gameplay .gp-hand-tray {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px;
  border-radius: 24px;
  background: #0b3232b3;
  border: 1.5px solid #ffffff2b;
  box-shadow: inset 0 1px 0 #ffffff26;
  min-height: 74px;
}
#screen-gameplay .gp-hand-card {
  width: 74px; height: 74px;
  border-radius: 12px;
  border: 2px solid #f6f0dd;
  cursor: pointer;
  transition: transform .15s ease-out, box-shadow .15s ease-out, border-color .15s, border-width .15s;
  overflow: hidden;
}
#screen-gameplay .gp-hand-card img { width: 100%; height: 100%; object-fit: cover; }
#screen-gameplay .gp-hand-card:nth-child(odd) { transform: translateY(-6px) rotate(-2deg); }
#screen-gameplay .gp-hand-card:nth-child(even) { transform: translateY(-6px) rotate(2deg); }
#screen-gameplay .gp-hand-card.is-sending {
  opacity: .5;
  border-color: #ffffff80;
  border-style: dashed;
  pointer-events: none;
}
#screen-gameplay .gp-hand-card.is-selected {
  transform: translateY(-34px) rotate(0deg) scale(1.14);
  border-color: var(--c-gold-light);
  border-width: 3px;
  box-shadow: 0 14px 28px #000000b0, 0 0 0 4px #f7c36466, 0 0 22px #f7c36455;
  z-index: 3;
}

#screen-gameplay .gp-hand-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#screen-gameplay .gp-hand-actions .btn-destructive { padding: 10px 18px; font-size: 12px; white-space: nowrap; }

/* ---- Toast (transient feedback, e.g. "can't afford this play") ---- */
#screen-gameplay .gp-toast {
  position: absolute;
  left: 50%;
  bottom: 132px;
  transform: translateX(-50%) translateY(8px);
  max-width: 420px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: #1a1006ee;
  border: 1.5px solid var(--c-gold-base);
  color: #ffe9c9;
  font: 700 12px/1.4 var(--font-body);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 25;
}
#screen-gameplay .gp-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- End-of-voyage banner ---- */
#screen-gameplay .gp-end-banner {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: #0a2a30d9;
  flex-direction: column;
  gap: var(--sp-4);
}
#screen-gameplay .gp-end-banner.is-visible { display: flex; }
#screen-gameplay .gp-end-title { font: 400 48px/0.9 var(--font-display); color: var(--c-gold-light); position: relative; z-index: 1; }

/* Win-only flourish: crops the boat out of the title art and sails it off
   the edge of the stage. Purely decorative — reduce-motion's blanket
   animation-duration:0 rule (base.css) snaps it straight to its end state. */
#screen-gameplay .gp-end-ship {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 340px;
  height: 280px;
  margin-left: -170px;
  margin-top: -140px;
  background-image: url('../../assets/branding/title_dark.png');
  background-size: 1040px auto;
  background-position: -310px -260px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55));
  animation: gp-sail-off 3.4s cubic-bezier(.4, 0, .7, 1) .5s forwards;
  z-index: 0;
}
@keyframes gp-sail-off {
  0% { transform: translate(-30px, 6px) rotate(-1deg); opacity: 1; }
  12% { transform: translate(0, -4px) rotate(1deg); opacity: 1; }
  100% { transform: translate(1000px, -70px) rotate(3deg); opacity: 0; }
}
