/* ============================================================================
   FLY DUEL  ·  play mode  (ui/play/play.js)
   ----------------------------------------------------------------------------
   Crisp: hard 1-3 px outlines, no blur, no glow, no soft shadows, no
   gradient backgrounds. A playable card has a 2 px white outline; the
   selected card a 3 px one. Seat colours mark seat things only (A cyan,
   B magenta). --dmg red marks attackers and life loss on the table only.
   Layouts by [data-layout] on .pl (ui/play/layout.js):
     phone        one column: cards, backs, table, bar, buttons, hand
     phone-land   scorecards in a left column, table at the right
     tablet / desktop  scorecards at the top corners, table in the middle
   Every control is 44 px or more on a coarse pointer. Every box at an
   edge keeps clear of the safe area (--sat --sab --sal --sar, and
   --base = the hand peek plus the home bar).
   GREP MAP
     .pl            root grid          .pl-hc      a hand card
     .pl-handbox    the fan box        .pl-perm    a creature on the table
     .pl-stack      a land stack       .pl-arrows  attack / block lines
     .pl-dock       turn plate, phase ladder, big button (ui/play/turnbar.js)
     .pl-actions    the two buttons    .pl-bar     the prompt line
     .pl-sheet      setup/coin/mull    .pl-insp    the inspector
     .pl-hint       message at control .pl-last    the last action chip
     .pl-peek       hovered version    (ui/play/peek.js)
     .pl-turn       the one turn indicator (is-new: the pause between turns)
     .pl-3d         full bleed 3D      .pl-seatbtn back to seat (orbit)
   ========================================================================== */
[hidden] { display: none !important; }

.pl {
  --bg: #05070c; --panel: #0b0e15; --panel2: #111623; --fig: #03050a;
  --ink: #eef0f5; --ink2: #c2c7d4; --dim: #8a91a5; --faint: #394155;
  --hair: rgba(255,255,255,0.10); --hair2: rgba(255,255,255,0.22);
  --flyA: #39d0f0; --flyB: #f26ad6; --dmg: #ff4d4d; --heal: #3ee89a;
  --hand-w: 96px; --hand-h: 134px; --peek: 96px; --btn-h: 52px; --btn-w: 148px; --zoom-w: 300px;
  /* the dock (DOCK in ui/play/turnbar.js): plate and ladder rows, the
     smallest width, the whole height (rows, gaps and 4 px padding) */
  --dock-plate: 22px; --dock-rung: 26px; --dock-w: 176px;
  --dock-h: calc(var(--dock-plate) + var(--dock-rung) + var(--btn-h) + 18px);
  --bronze: #c9a45a; --bronze-dim: #6e5a32; --bronze-line: rgba(201,164,90,0.34);
  --tome: #0e0c09; --tome2: #16120c; --parch: #f1e5cc; --parch2: #d9c9a6; --parch-ink: #2a1e10;
  /* the safe area (notch, home bar): every box at an edge keeps clear of it */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --base: calc(var(--peek) + var(--sab));
  position: relative; overflow: hidden; box-sizing: border-box;
  width: 100%; height: 100%; min-height: 480px;
  display: grid; gap: 6px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto var(--peek);
  grid-template-areas: "cards" "opp" "table" "bar" "act" "hand";
  padding: calc(8px + var(--sat)) calc(8px + var(--sar)) var(--sab) calc(8px + var(--sal));
  background: var(--bg); color: var(--ink);
  font: 14px/1.4 var(--sci-sans, Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.pl *, .pl *::before, .pl *::after { box-sizing: border-box; }
.pl-cv { display: block; }

/* --------------------------------------------------------------- areas */
.pl-cards { grid-area: cards; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.pl-sc { min-width: 0; }
.pl-opp { grid-area: opp; display: flex; justify-content: center; }
.pl-table { grid-area: table; position: relative; min-height: 0; border: 1px solid var(--hair); border-radius: 10px; background: var(--fig); overflow: hidden; }
.pl-table.is-3d { border: 0; background: none; }
.pl-table.is-3d > canvas { width: 100%; height: 100%; display: block; }
/* "Back to my seat" (ui/play/orbit.js): shows only while the camera is
   away from the seat; an icon and the words, bold, with a bright edge */
.pl-seatbtn { position: absolute; z-index: 35; left: 50%; top: 8px; transform: translateX(-50%); min-height: 40px; padding: 0 16px 0 12px;
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 2px solid var(--ink); box-shadow: 0 2px 12px rgba(0,0,0,0.55); }
.pl-seatico { flex: none; }
@media (pointer: coarse) { .pl-seatbtn { min-height: 44px; } }
.pl-seatbtn[hidden] { display: none !important; }
.pl-bar { grid-area: bar; display: grid; align-items: center; }
.pl-dock { grid-area: act; justify-self: end; position: relative; z-index: 60; }
.pl-actions { justify-self: stretch; display: flex; align-items: stretch; }
/* the small button stands just left of the dock, at the height of the
   big one, so the dock stays --dock-w wide */
.pl-actions .pl-sec { position: absolute; right: calc(100% + 8px); bottom: 4px; }
.pl-menubtn { grid-area: act; justify-self: start; z-index: 60; }

/* ------------------------------------------------------------- dock
   ui/play/turnbar.js. A dark tome plate with a bronze rule; the turn
   plate and the lit step take the colour of whose turn it is (data-who:
   you = parchment, A = cyan, B = magenta). Done steps are dim bronze,
   steps to come are faint. The big button is parchment with a bronze
   rim when your press moves the game on (data-state go), a tome face
   with a bronze line for Cancel (quiet), and a dark, dim face while the
   fly acts (wait). Crisp: hard rims only, no glow. */
.pl-dock { --who: var(--parch); --who-ink: var(--parch-ink);
  display: grid; gap: 5px; justify-items: end; min-width: var(--dock-w); padding: 4px;
  background: rgba(14,12,9,0.82); border: 1px solid var(--bronze-line); border-radius: 8px; }
.pl-dock[data-who="you"] { --who: var(--parch); --who-ink: var(--parch-ink); }
.pl-dock[data-who="A"] { --who: var(--flyA); --who-ink: #04161c; }
.pl-dock[data-who="B"] { --who: var(--flyB); --who-ink: #1c0618; }
.pl-dock[data-who="none"] { --who: var(--ink2); --who-ink: var(--bg); }
.pl-plate { justify-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--dock-plate);
  padding: 0 6px 0 8px; border-left: 3px solid var(--who); border-bottom: 1px solid var(--bronze-line);
  font: 600 14px/1 var(--sci-serif, 'STIX Two Text', Georgia, serif); font-variant: small-caps; letter-spacing: 0.04em; white-space: nowrap; }
.pl-turn { color: var(--who); padding: 0; border: 0; }
.pl-turn.is-new { text-decoration: underline 2px var(--bronze); text-underline-offset: 3px; }
.pl-phase { color: var(--ink2); font-size: 12px; letter-spacing: 0.08em; }
.pl-rungs { justify-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pl-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 5px; }
.pl-steps li { position: relative; width: var(--dock-rung); height: var(--dock-rung); display: grid; place-items: center;
  border: 1px solid var(--bronze-line); border-radius: 50%; color: var(--faint); background: var(--tome, #0e0c09); }
.pl-steps li + li::before { content: ""; position: absolute; right: 100%; top: 50%; width: 5px; border-top: 1px solid var(--bronze-line); }
.pl-steps svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pl-steps li.done { color: var(--bronze-dim); border-color: var(--bronze-dim); }
.pl-steps li.now { color: var(--who-ink); background: var(--who); border: 2px solid var(--bronze); }
.pl-turnno { font: 600 11px var(--sci-mono, ui-monospace, Menlo, monospace); font-variant-numeric: tabular-nums; color: var(--dim); }
.pl-prompt { margin: 0; font-size: 13px; color: var(--ink2); min-height: 1.4em; }
/* a message for the player, next to the control used (play.js flash) */
.pl-hint { position: absolute; z-index: 95; margin: 0; max-width: min(300px, calc(100% - 16px)); padding: 6px 10px; background: var(--panel);
  border: 1px solid var(--dmg); border-radius: 4px; font-size: 12px; line-height: 1.35; color: var(--ink); pointer-events: none; }
.pl-hint[data-at="button"] { right: calc(8px + var(--sar)); bottom: calc(var(--base) + var(--dock-h) + 16px); }
.pl-hint[data-at="hand"] { left: 50%; transform: translateX(-50%); bottom: calc(var(--base) + 8px); }
.pl-hint[data-at="table"] { left: 50%; transform: translateX(-50%); top: 38%; }

/* ----------------------------------------------------------- buttons */
.pl-btn {
  appearance: none; font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1; color: var(--ink);
  background: var(--panel); border: 1px solid var(--hair2); border-radius: 8px;
  min-height: 44px; padding: 0 14px; cursor: pointer; touch-action: manipulation;
}
.pl-btn:focus-visible, .pl-hc:focus-visible, .pl-perm:focus-visible, .pl-deck:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pl-btn:disabled { color: var(--dim); cursor: default; }
.pl-pri { position: relative; flex: 1 1 auto; min-width: var(--btn-w); min-height: var(--btn-h); padding: 0 18px; overflow: hidden;
  font: 700 17px/1 var(--sci-serif, 'STIX Two Text', Georgia, serif); font-variant: small-caps; letter-spacing: 0.05em; }
.pl-pri[data-state="go"] { background: var(--parch); color: var(--parch-ink); border: 2px solid var(--bronze); box-shadow: inset 0 0 0 2px var(--parch2); }
.pl-pri[data-state="go"][data-tone="next"] { background: var(--parch2); }
.pl-pri[data-state="go"][data-tone="attack"] { box-shadow: inset 6px 0 0 0 var(--dmg), inset 0 0 0 2px var(--parch2); }
.pl-pri[data-state="quiet"] { background: var(--tome2); color: var(--parch); border: 1px solid var(--bronze); }
.pl-pri[data-state="wait"] { background: var(--panel); color: var(--dim); border: 1px solid var(--bronze-line); font-weight: 600; }
.pl-pri:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
.pl-sec { min-height: var(--btn-h); min-width: 72px; background: var(--tome2); color: var(--parch2); border-color: var(--bronze-line);
  font: 600 14px/1 var(--sci-serif, 'STIX Two Text', Georgia, serif); font-variant: small-caps; letter-spacing: 0.04em; }
.pl-timer { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; background: var(--flyA); }
.pl-timer.low { background: var(--dmg); }
.pl-timer-n { position: absolute; right: 5px; top: 4px; font: 700 12px var(--sci-mono, ui-monospace, Menlo, monospace); font-variant-numeric: tabular-nums; }
.pl-timer-n.low { color: var(--dmg); }
.pl[data-human="1"] .pl-timer:not(.low) { background: var(--flyB); }

/* -------------------------------------------------------------- hand */
.pl-handbox {
  position: absolute; left: var(--sal); right: var(--sar); z-index: 40;
  bottom: calc(var(--base) - var(--hand-h));
  height: calc(var(--hand-h) * 1.36);
  /* not bounded (ui/play/layout.js fanLayout): no scroll, no clip; more
     cards overlap more, a hovered card rises by --lift into full view */
  overflow: visible; touch-action: none;
  pointer-events: none;   /* the empty rise room must not block the buttons */
}
.pl-fan { position: relative; height: 100%; }
.pl-hc {
  position: absolute; left: 0; top: calc(var(--hand-h) * 0.34);
  width: var(--hand-w); height: var(--hand-h); padding: 0; margin: 0; border: 0; background: none; border-radius: 6px;
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transform-origin: 50% 130%;
  transition: transform 120ms cubic-bezier(0.2, 0, 0, 1);
  cursor: grab; touch-action: none; pointer-events: auto;
}
.pl-hc.is-play { outline: 2px solid var(--ink); outline-offset: 1px; }
.pl-hc.is-sel { outline: 3px solid var(--ink); outline-offset: 2px; }
.pl-hc.is-dark .pl-cv { filter: brightness(0.5) saturate(0.7); }
.pl-hc.is-drag { transition: none; cursor: grabbing; transform: translate(calc(var(--x) + var(--dx, 0px)), calc(var(--y) + var(--dy, 0px))) rotate(0deg) scale(1.08); z-index: 200 !important; }
.pl-hc.is-armed { outline: 3px solid var(--heal); outline-offset: 2px; }
.pl-hc.is-back { transition: transform 220ms cubic-bezier(0.2, 0, 0, 1); }
/* the drop line (ui/play/hand.js): a card released above it is played */
.pl-dropline { position: absolute; left: 12px; right: 12px; top: -8px; height: 0; border-top: 2px dashed var(--hair2); pointer-events: none;
  font-size: 11px; line-height: 1; color: var(--dim); text-align: center; padding-top: 4px; }
.pl-dropline.is-armed { border-top: 2px solid var(--heal); color: var(--heal); }
/* hover (a fine pointer) or a touch hold (.is-peek, ui/play/hand.js): the
   card rises, stands straight and grows in place; its hovered version
   shows above it (.pl-peek) */
.pl-hc { -webkit-touch-callout: none; }
.pl-hc.is-peek:not(.is-drag) { transform: translate(var(--x), calc(0px - var(--lift))) rotate(0deg) scale(1.16); z-index: 120 !important; }
@media (hover: hover) and (pointer: fine) {
  .pl-hc:hover:not(.is-drag) { transform: translate(var(--x), calc(0px - var(--lift))) rotate(0deg) scale(1.16); z-index: 120 !important; }
}

.pl-opphand { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.pl-backs { display: flex; }
.pl-backs .pl-back + .pl-back { margin-left: -12px; }
.pl-oppn { font: 600 11px var(--sci-mono, ui-monospace, Menlo, monospace); color: var(--dim); }

/* ------------------------------------------------------------- board */
.pl-board { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) 20px minmax(0, 1fr); padding: 6px 6px 10px; }
.pl-side { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 0; }
.pl-top { flex-direction: column; }
.pl-bot { flex-direction: column; }
.pl-crs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; min-height: 0; flex: 1; align-content: center; }
.pl-lands { display: flex; gap: 10px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.pl-mid { position: relative; display: grid; align-items: center; }
.pl-midline { height: 1px; background: var(--hair); }

.pl-perm {
  position: relative; width: var(--w); height: var(--h); padding: 0; margin: 0; border: 0; background: none; border-radius: 5px;
  display: grid; place-items: center; cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1), opacity 160ms;
}
.pl-perm .pl-cv { transition: transform 120ms cubic-bezier(0.2, 0, 0, 1); }
.pl-perm.is-tapped .pl-cv { transform: rotate(90deg); }
.pl-perm.is-new { transform: translateY(16px); opacity: 0; }
.pl-top .pl-perm.is-new { transform: translateY(-16px); }
.pl-perm.is-gone { opacity: 0.25; transform: scale(0.85); pointer-events: none; }
.pl-perm.is-elig { outline: 2px solid var(--ink); outline-offset: 2px; }
.pl-perm.is-atk { outline: 2px solid var(--dmg); outline-offset: 2px; }
.pl-bot .pl-perm.is-atk { transform: translateY(-12px); }
.pl-top .pl-perm.is-atk { transform: translateY(12px); }
.pl-perm.is-incoming { outline: 2px solid var(--dmg); outline-offset: 2px; }
.pl-perm.is-blk { outline: 3px solid var(--ink); outline-offset: 2px; }
.pl-perm.is-target { outline: 3px dashed var(--ink); outline-offset: 3px; }
.pl-perm.is-pend { outline: 3px solid var(--flyA); outline-offset: 3px; }
.pl[data-human="1"] .pl-perm.is-pend { outline-color: var(--flyB); }

.pl-stack { position: relative; cursor: pointer; }
.pl-stack .pl-cv { position: relative; border-radius: 4px; }
.pl-edges { position: absolute; inset: 0; border-radius: 4px; background: #1e1309; border: 1px solid #5a3e24; transform: translate(4px, 4px); }
.pl-stack.is-single .pl-edges { display: none; }
.pl-stack { transition: transform 120ms cubic-bezier(0.2, 0, 0, 1); }
.pl-stack.is-paid { transform: translateY(-8px); }
.pl-stack.is-paid .pl-cv { outline: 2px solid var(--ink); outline-offset: 1px; }
.pl-stack.is-spent .pl-cv { filter: brightness(0.55); }
.pl-cnt { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 1px 6px; border-radius: 999px; background: var(--panel); border: 1px solid var(--hair2); font: 600 11px var(--sci-mono, ui-monospace, Menlo, monospace); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-pay { position: absolute; right: -6px; top: -6px; padding: 1px 5px; border-radius: 4px; background: var(--ink); color: var(--bg); font: 700 11px var(--sci-mono, ui-monospace, Menlo, monospace); font-style: normal; }

.pl-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pl-arrows line { stroke-width: 2.5; stroke-linecap: square; }
.pl-arrows .atk { stroke: var(--dmg); fill: var(--dmg); }
.pl-arrows .blk { stroke: var(--ink); fill: var(--ink); }
.pl-arrows .drag { stroke-dasharray: 6 4; }
.pl-arrows polygon { stroke: none; }

/* ------------------------------------------------- last action chip */
.pl-last { position: absolute; z-index: 30; left: 50%; top: 40%; transform: translate(-50%, -50%); display: flex; gap: 10px; align-items: center; max-width: min(92%, 420px); padding: 8px 12px 8px 8px; background: var(--panel); border: 1px solid var(--hair2); border-left: 3px solid var(--flyA); border-radius: 8px; pointer-events: none; }
.pl-last[data-seat="1"] { border-left-color: var(--flyB); }
.pl-last-t { font-size: 13px; color: var(--ink); }

/* -------------------------------------------------- the cast preview
   ui/play/castview.js, MTG Arena style: the cast card shows large at the
   left (left, top, width, height from castRect), holds, then flies down
   onto the mat (transform translate + scale, .is-down) and fades. The
   rim takes the seat colour of the caster. No pointer events. */
.pl-cast { position: absolute; z-index: 90; pointer-events: none; border-radius: 3% / 2.2%; border: 2px solid var(--flyA); background: var(--bg);
  transform-origin: 50% 50%; transition-property: transform, opacity; transition-timing-function: cubic-bezier(0.5, 0, 0.75, 0); }
.pl-cast[data-seat="1"] { border-color: var(--flyB); }
.pl-cast .pl-cv { width: 100%; height: 100%; }
.pl-cast.is-in { animation: pl-cast-in 180ms cubic-bezier(0.2, 0, 0, 1); }
.pl-cast.is-down:not(.is-in) { opacity: 0; transition-duration: 140ms !important; }
@keyframes pl-cast-in { from { transform: translateX(-40px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------- menu */
.pl-menu { position: absolute; z-index: 150; left: calc(8px + var(--sal)); bottom: calc(var(--base) + var(--btn-h) + 14px); width: min(300px, calc(100% - 16px)); display: grid; gap: 6px; padding: 10px; background: var(--panel); border: 1px solid var(--hair2); border-radius: 10px; }
.pl-keys { margin: 0; font-size: 12px; color: var(--ink2); }
.pl-log { position: absolute; z-index: 140; right: calc(8px + var(--sar)); top: calc(8px + var(--sat)); bottom: calc(var(--base) + 8px); width: min(360px, calc(100% - 16px)); display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--panel); border: 1px solid var(--hair2); border-radius: 10px; }
.pl-log header { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--hair); }
.pl-log ol { list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; font: 12px/1.5 var(--sci-mono, ui-monospace, Menlo, monospace); color: var(--ink2); user-select: text; -webkit-user-select: text; }
.pl-log li[data-seat="0"] { box-shadow: inset 2px 0 0 0 var(--flyA); padding-left: 6px; }
.pl-log li[data-seat="1"] { box-shadow: inset 2px 0 0 0 var(--flyB); padding-left: 6px; }

/* ------------------------------------- the hovered version of a card
   ui/play/peek.js: a large copy of the card beside or above the card
   under the pointer (left and top from peekPlace), a dark 1 px rim, the
   keyword reminders under it. It takes no pointer events. Over the hand
   (z 40) and the buttons (z 60), under the inspector (z 300). */
.pl-peek { position: absolute; z-index: 130; left: 0; top: 0; pointer-events: none; display: grid; gap: 4px; justify-items: center; }
.pl-peek-cv { display: block; border: 1px solid #000; border-radius: 3% / 2.2%; background: var(--bg); }
.pl-peek-kw { margin: 0; max-width: 100%; padding: 4px 8px; font-size: 12px; line-height: 1.35; color: var(--ink2); background: var(--panel); border: 1px solid var(--hair2); border-radius: 4px; }


/* --------------------------------------------------------- inspector */
.pl-insp { position: absolute; z-index: 300; inset: 0; display: grid; place-items: center; background: rgba(3,5,10,0.94); overflow-y: auto; overscroll-behavior: contain; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
.pl-insp-in { display: grid; justify-items: center; gap: 12px; max-width: min(100%, 440px); }
.pl-insp-txt { font-size: 14px; color: var(--ink2); width: 100%; }
.pl-insp-txt ul { margin: 0; padding-left: 18px; }
.pl-insp-txt p { margin: 4px 0; }
.pl-insp-own { color: var(--ink); font-weight: 600; }
.pl-insp-cr { color: var(--dim); font-size: 12px; }
.pl-insp-x { min-width: 120px; }

/* ------------------------------------------------------------ sheets */
.pl-sheet { position: absolute; z-index: 250; inset: 0; display: grid; place-items: center; background: rgba(3,5,10,0.9); overflow-y: auto; overscroll-behavior: contain; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
.pl-sheet-in { width: min(100%, 560px); background: var(--panel); border: 1px solid var(--hair2); border-radius: 12px; padding: 18px 16px; display: grid; gap: 10px; }
.pl-sheet h2 { margin: 0; font: 400 1.35rem/1.2 var(--sci-serif, 'STIX Two Text', Georgia, serif); }
.pl-sheet h3 { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.pl-sheet p { margin: 0; color: var(--ink2); }
.pl-fine { font-size: 12px; color: var(--dim) !important; }
.pl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pl-row .pl-btn { flex: 1 1 140px; min-height: 48px; }
.pl-go { background: var(--ink); color: var(--bg); border-color: var(--ink); min-height: 48px; }
.pl-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-seg button { flex: 1 1 0; min-width: 0; min-height: 44px; display: grid; gap: 2px; align-content: center; padding: 6px 10px; text-align: left; font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--hair2); border-radius: 8px; cursor: pointer; }
.pl-seg button em { font-style: normal; font-size: 11px; color: var(--dim); }
.pl-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pl-seg button[aria-pressed="true"] em { color: var(--panel2); }
.pl-decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pl-deck { min-height: 64px; display: grid; gap: 3px; align-content: start; text-align: left; padding: 8px 10px; font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--hair2); border-radius: 8px; cursor: pointer; }
.pl-deck b { font-size: 14px; }
.pl-deck em { font-style: normal; font-size: 11px; color: var(--dim); }
.pl-deck.on { box-shadow: 0 0 0 2px var(--ink); border-color: var(--ink); }
.pl-pips { display: flex; gap: 3px; }
.pl-pips i { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.5); }
.pl-sel select { width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--hair2); border-radius: 8px; padding: 0 10px; }
/* the opening hand (ui/play/opening.js): the cards come off the library
   at the lower left one at a time into a large row, then the choice bar
   shows under the row. Places come from openingLayout (px, transform). */
.pl-open { position: absolute; z-index: 240; inset: 0; background: rgba(3,5,10,0.72); overflow: hidden; }
.pl[data-opening] .pl-handbox { visibility: hidden; }
.pl-open-deck { position: absolute; border-radius: 6px; }
.pl-open-deck .pl-cv { width: 100%; height: 100%; }
.pl-open-n { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 1px 6px; border-radius: 999px; background: var(--panel); border: 1px solid var(--hair2); font: 600 11px var(--sci-mono, ui-monospace, Menlo, monospace); font-variant-numeric: tabular-nums; }
.pl-open-deck.is-shuffle { animation: pl-shuffle 220ms ease-in-out 3; }
@keyframes pl-shuffle { 0%, 100% { transform: translateX(0) rotate(0deg); } 30% { transform: translateX(-6px) rotate(-4deg); } 70% { transform: translateX(6px) rotate(4deg); } }
.pl-open-row { position: absolute; inset: 0; }
.pl-oh { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; transform-origin: 0 0;
  transition: transform 360ms cubic-bezier(0.2, 0, 0, 1); }
.pl-oh .pl-cv { width: 100%; height: 100%; }
.pl-open-bar { position: absolute; left: 50%; transform: translateX(-50%); width: min(calc(100% - 24px), 520px); display: grid; gap: 8px; justify-items: center; text-align: center;
  padding: 12px; background: var(--panel); border: 1px solid var(--hair2); border-radius: 12px; }
.pl-open-bar p { margin: 0; color: var(--ink2); }
.pl-open-bar .pl-row { width: 100%; }
.pl-keep { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pl-coinface { justify-self: center; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); border: 3px solid var(--ink); font: 700 34px var(--sci-serif, 'STIX Two Text', Georgia, serif); }

/* ------------------------------------------------------------ layouts */

.pl[data-layout="phone-land"] {
  grid-template-columns: 190px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto var(--peek);
  grid-template-areas: "cards opp" "cards table" "cards bar" "menu act" "hand hand";
}
.pl[data-layout="phone-land"] .pl-cards { grid-template-columns: 1fr; align-content: start; overflow-y: auto; }
.pl[data-layout="phone-land"] .pl-menubtn { grid-area: menu; }

.pl[data-layout="tablet"], .pl[data-layout="desktop"] {
  padding: 12px 12px 0;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(220px, 300px);
  grid-template-rows: auto minmax(0, 1fr) auto auto var(--peek);
  grid-template-areas: "sc0 opp sc1" "sc0 table sc1" "bar bar bar" "menu . act" "hand hand hand";
}
.pl[data-layout="tablet"] { grid-template-columns: minmax(200px, 250px) minmax(0, 1fr) minmax(200px, 250px); }
.pl[data-layout="tablet"] .pl-cards, .pl[data-layout="desktop"] .pl-cards { display: contents; }
.pl[data-layout="tablet"] .pl-sc0, .pl[data-layout="desktop"] .pl-sc0 { grid-area: sc0; align-self: start; }
.pl[data-layout="tablet"] .pl-sc1, .pl[data-layout="desktop"] .pl-sc1 { grid-area: sc1; align-self: start; }
.pl[data-layout="tablet"] .pl-menubtn, .pl[data-layout="desktop"] .pl-menubtn { grid-area: menu; }
.pl[data-layout="tablet"] .pl-bar, .pl[data-layout="desktop"] .pl-bar { justify-self: center; width: min(100%, 760px); text-align: center; }
.pl[data-layout="desktop"] .hd-brain { height: 96px; }

/* -------------------------------------------- full bleed 3D table
   With the 3D table (.pl-3d, ui/play/play.js) the canvas fills the play
   box, so the flies get the whole frame. The HUD lies over it: slim
   scorecards in the top corners (ui/hud/hud.css .hd-slim), the dock at
   the lower right over the hand line (right thumb), the menu at the
   lower left with the prompt line above it, clear of the dock. The
   opposing card backs go: the 3D table shows them. */
.pl.pl-3d { display: block; padding: 0; }
.pl.pl-3d .pl-table { position: absolute; inset: 0; border-radius: 0; }
.pl.pl-3d .pl-opp { display: none; }
.pl.pl-3d .pl-cards { position: absolute; z-index: 50; top: calc(6px + var(--sat)); left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.pl.pl-3d .pl-sc { pointer-events: auto; width: min(250px, calc(50% - 4px)); }
.pl.pl-3d .pl-sc1 { margin-left: auto; }
.pl.pl-3d .pl-bar { position: absolute; z-index: 45; left: calc(8px + var(--sal)); bottom: calc(var(--base) + var(--btn-h) + 20px);
  width: max-content; max-width: calc(100% - var(--dock-w) - 40px - var(--sal) - var(--sar)); padding: 3px 8px; border-radius: 6px; background: rgba(14,12,9,0.6); }
.pl.pl-3d .pl-bar:has(.pl-prompt:empty) { display: none; }
.pl.pl-3d .pl-prompt { font-size: 12px; min-height: 0; }
.pl.pl-3d .pl-dock { position: absolute; right: calc(8px + var(--sar)); bottom: calc(var(--base) + 8px); }
.pl.pl-3d .pl-menubtn { position: absolute; left: calc(8px + var(--sal)); bottom: calc(var(--base) + 6px); }
.pl.pl-3d .pl-seatbtn { top: auto; bottom: calc(var(--base) + var(--dock-h) + 24px); }
.pl.pl-3d[data-layout="phone-land"] .pl-cards { flex-direction: column; right: auto; width: 200px; }
.pl.pl-3d[data-layout="phone-land"] .pl-sc { width: 100%; }
.pl.pl-3d[data-layout="phone-land"] .pl-sc1 { margin-left: 0; }

@media (prefers-reduced-motion: reduce) {
  .pl-hc, .pl-hc.is-peek, .pl-perm, .pl-perm .pl-cv, .pl-stack, .pl-oh { transition: none !important; }
  .pl-open-deck.is-shuffle, .pl-cast.is-in { animation: none; }
  .pl-perm.is-new { transform: none; opacity: 1; }
}
