:root {
  /* "Corner HUD v2" palette - deeper indigo-violet ground (vs. the old flat grey) with the same
     amber="you"/teal="opponent" semantic mapping the app already shipped with (kept deliberately -
     users have already learned it; only the shades were refreshed toward the approved mockup). */
  --ink: #0a0d1a;
  --panel: #131a30;
  --panel-2: #1b2440;
  --panel-3: #232f54;
  --line: #2b3660;
  --line-bright: #3d4a80;
  --text: #eef1fb;
  --text-dim: #8d96c2;
  --hero: #e0a23f;
  --hero-deep: #b23a2e;
  --tide: #35c9c1;
  --tide-deep: #1d5c58;
  --good: #4ade80;
  --bad: #ff5a52;
  /* Match-log event colors (see logLineIcon in app.js): attacks orange, foundation actions grey,
     blitzes pink, responses green, enhance/keyword abilities yellow. */
  --evt-attack: #ef9a3d;
  --evt-found: #9aa3c4;
  --evt-blitz: #f472b6;
  --evt-response: #56d98a;
  --evt-keyword: #f0dd63;
  --c-foundation: #8b93a1;
  --c-attack: #d9622f;
  --c-asset: #3f8f6b;
  --c-action: #3d6fa8;
  --c-backup: #b8558f;
  --c-character: #8a6fb0;
  --felt: #0f1a35;
  --felt-2: #182448;
  /* Dedicated to "How to Play" tutorial mode (briefing + guided-match overlay) - deliberately
     distinct from every existing click-to-act glow color (gold/teal/violet/blue/magenta each already
     mean something specific on the board) since this is a different kind of UI, not another board
     mechanic. */
  --tutorial: #6c7fe0;
  --tutorial-soft: rgba(108, 127, 224, 0.2);
}

* { box-sizing: border-box; }

/* A same-specificity-or-higher `display` rule on an element (several below use an ID selector,
   which outranks the attribute selector the [hidden] default relies on) silently defeats the
   hidden attribute. Force it to actually hide regardless of what else targets the element. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  padding: 1.5rem;
}

/* Once a match starts, the page becomes a single fixed viewport (no page scroll) so the whole
   board is visible at once - see #board.in-match below. Before that, normal document flow. */
body.in-match {
  /* 100vh on mobile means "viewport with the URL bar retracted", which is TALLER than what you can
     actually see while it's showing - so the flow bar (the thing you have to tap) sits below the
     fold in a layout that also sets overflow:hidden, i.e. unreachable. 100dvh tracks the real
     visible height. The 100vh line stays as a fallback for browsers without dvh; they simply
     ignore the second declaration. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0.6rem;
  /* Keep the board clear of the notch / home indicator when viewport-fit=cover is in play. Resolves
     to 0 everywhere else, so desktop padding is unchanged. */
  padding-left: max(0.6rem, env(safe-area-inset-left));
  padding-right: max(0.6rem, env(safe-area-inset-right));
  padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

h1 { font-family: "Rockwell", "Roboto Slab", Georgia, serif; margin-bottom: 0.25rem; letter-spacing: 0.02em; }
h1 .accent { color: var(--hero); }
.subtitle { color: var(--text-dim); margin-top: 0; }
/* Superseded by .char-select's own title-bar once a match hasn't started - kept in the DOM (app.js
   reads/hides it by ID on match start) but visually replaced, not duplicated. */
#introHead { display: none; }

button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.5rem 1rem; cursor: pointer; font-family: inherit; font-size: 0.9rem;
}
button:hover:not(:disabled) { border-color: var(--hero); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--hero-deep); border-color: var(--hero); color: var(--on-hero-deep, white); }

/* ---- Battle Setup ("Character Select" screen) ----
   Deliberately its own scoped palette (--cs-*), separate from the app-wide tokens at :root - this
   screen intentionally does NOT match the in-match board's look (a retro fighting-game character
   select, per the approved mockup at claude.ai/code/artifact/994f3738-e0d8-44d8-aa92-81d72edd4703),
   while the board itself is untouched. */
/* Declared on :root too (not just .char-select) so elements that live outside the character-select
   screen's DOM subtree - the auth widget and the friends/history/gameover overlays, all body-level
   so they stay reachable mid-match - can still use these tokens. Values aren't duplicated: .char-
   select's own declaration below simply wins for anything inside it, same as any CSS custom property. */
:root, .char-select {
  /* "Elemental" palette — night blue + the UniVersus resource-symbol spectrum (matches the portal).
     The token NAMES are kept (gold / crimson) so every existing rule recolors in place: --cs-gold* is
     now the primary AIR-CYAN accent, --cs-crimson* the VOID-PURPLE brand/CTA accent. The loss/danger
     semantic no longer rides on crimson — it uses --cs-bad (red) directly, so "defeat" still reads red. */
  --cs-void: #0a0e1c;
  --cs-void-2: #0d1330;
  --cs-panel: #121834;
  --cs-panel-2: #171f42;
  --cs-panel-3: #1e2552;
  --cs-line: #283264;
  --cs-line-bright: #3d4a86;
  --cs-gold: #7fc7e8;
  --cs-gold-dim: #4f7f9a;
  --cs-gold-bright: #a9defa;
  --cs-crimson: #7d5bb0;
  --cs-crimson-bright: #a481d6;
  --cs-text: #eaf0ff;
  --cs-text-dim: #96a1c8;
  --cs-p1: #7fc7e8;
  --cs-p2: #a481d6;
  --cs-bad: #ff5a52;
}
/* Box-model/visual properties must stay on .char-select alone - the combined selector above is
   only for sharing the --cs-* custom properties with body-level elements (auth widget, gameover
   overlay). Putting these on :root/`html` too was a real bug: it capped and centered the WHOLE
   page (including the in-match board) at 1200px, not just the character-select screen. */
.char-select {
  max-width: 1200px; margin: 0 auto; position: relative;
  background:
    radial-gradient(ellipse 90% 55% at 22% -8%, rgba(127,199,232,0.20), transparent 60%),
    radial-gradient(ellipse 90% 55% at 82% -8%, rgba(164,129,214,0.24), transparent 60%),
    linear-gradient(180deg, var(--cs-void-2), var(--cs-void) 40%);
  border: 1px solid var(--cs-line);
  padding-bottom: 0.5rem;
}
.char-select::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay; opacity: 0.3;
}

.title-bar { text-align: center; padding: 1.1rem 1rem 0.3rem; position: relative; z-index: 1; }
.title-bar .eyebrow { font-size: 0.64rem; letter-spacing: 0.4em; color: var(--cs-gold-dim); text-transform: uppercase; }
.title-bar h1 {
  font-family: Impact, "Arial Narrow Bold", "Haettenschweiler", sans-serif;
  font-size: clamp(1.7rem, 4.5vw, 2.8rem); letter-spacing: 0.05em; margin: 0.1rem 0 0; color: var(--cs-text);
  text-shadow: 0 0 18px rgba(127,199,232,0.42), 0 2px 0 #000; transform: skewX(-6deg); text-wrap: balance;
}
.title-bar h1 span { background: linear-gradient(100deg, var(--cs-gold), var(--cs-crimson-bright)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title-bar .format { margin-top: 0.3rem; font-size: 0.68rem; letter-spacing: 0.12em; color: var(--cs-text-dim); text-transform: uppercase; }

/* Fixed (not absolute) since this is now a body-level element, not nested inside .title-bar -
   fixed keeps it pinned to the viewport corner in both the setup screen's normal document flow and
   the in-match board's fixed-viewport layout (body.in-match). */
.auth-widget { position: fixed; top: 0.8rem; right: 1rem; z-index: 40; }
.auth-widget button {
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 2px; padding: 0.3rem 0.6rem; font-size: 0.7rem; cursor: pointer;
}
.auth-widget button:hover { border-color: var(--cs-gold); }
.signed-in-as { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: var(--cs-text-dim); }
.signed-in-as img { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--cs-line-bright); }

/* Mid-match, enterMatch() reparents the real #authWidget node into #matchTopbar (right beside the
   debug button, per request) instead of its fixed top-right corner - overrides the fixed
   positioning back to a normal topbar flex child (returnToSetup() moves the node back out to
   <body> and this override stops applying). */
#matchTopbar .auth-widget { position: static; z-index: auto; flex: 0 0 auto; }
#matchTopbar .signed-in-as { flex-wrap: nowrap; }

/* w21110 (Discord "Suggestions for the new layout"): on phones the home screen's Friends / History / Sign out move into a dropdown opened
   by tapping the profile button. Desktop and the in-match top bar keep the plain row: there the toggle is not rendered and the menu
   wrapper is display:contents (its buttons lay out exactly as before). The menu shows while the toggle has aria-expanded="true". */
.w21110-acct-btn, .w21110-acct-who { display: none; }
.w21110-acct-menu { display: contents; }
@media (max-width: 820px), (max-height: 520px) {
  body > .auth-widget .w21110-acct-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; overflow: hidden;
    background: var(--t-accent, var(--cs-panel-2)); color: var(--t-on-accent, var(--cs-text)); border: 2px solid var(--cs-line-bright);
    font-size: 16px; font-weight: 800; line-height: 1; box-shadow: 0 2px 8px rgb(0 0 0 / 0.35);
  }
  body > .auth-widget .w21110-acct-btn[aria-expanded="true"] { border-color: var(--cs-gold); }
  body > .auth-widget .w21110-acct-btn img { width: 100%; height: 100%; border: 0; border-radius: 0; object-fit: cover; display: block; }
  body > .auth-widget #authAvatar, body > .auth-widget #authName { display: none; }
  body > .auth-widget .w21110-acct-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 41; flex-direction: column; align-items: stretch; gap: 2px;
    min-width: 176px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 6px; border-radius: 12px;
    background: var(--t-surf, var(--cs-panel-2)); border: 1px solid var(--cs-line-bright); box-shadow: 0 14px 34px rgb(0 0 0 / 0.45);
  }
  body > .auth-widget .w21110-acct-btn[aria-expanded="true"] ~ .w21110-acct-menu { display: flex; }
  body > .auth-widget .w21110-acct-menu button {
    min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--t-text, var(--cs-text));
    font-size: 15px; font-weight: 600; text-align: left; width: 100%;
  }
  body > .auth-widget .w21110-acct-menu button:hover, body > .auth-widget .w21110-acct-menu button:focus-visible { background: var(--t-surf2, var(--cs-panel)); }
  body > .auth-widget .w21110-acct-who {
    display: block; padding: 4px 12px 6px; font-size: 12px; color: var(--t-muted, var(--cs-text-dim)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body > .auth-widget .w21110-acct-who:empty { display: none; }
}

.overlay-panel {
  position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--scrim, #000) 70%, transparent);
  display: flex; align-items: center; justify-content: center;
}
/* Friends/History can be opened FROM the gameover overlay (its "View Match History" button) or
   independently via the always-visible auth widget while a finished match is still showing behind
   it - either way they need to render ABOVE gameover, not fight it for stacking. Deliberately NOT
   solved by hiding/re-showing #gameoverPanel around every open/close (a prior version did exactly
   that for History specifically and lost the ability to get back to the gameover screen once
   History was closed) - z-index alone means neither panel ever needs to touch the other's visibility. */
#friendsPanel, #historyPanel, #bugReportPanel { z-index: 51; }
.bug-report-type-row { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.bug-report-type-btn {
  flex: 1; background: var(--cs-panel-2); color: var(--cs-text-dim); border: 1px solid var(--cs-line-bright);
  border-radius: 4px; padding: 0.4rem 0.5rem; font-size: 0.76rem; cursor: pointer; font-family: inherit;
}
.bug-report-type-btn:hover { border-color: var(--cs-gold-dim); }
.bug-report-type-btn.active { background: var(--cs-panel-3); color: var(--cs-gold-bright); border-color: var(--cs-gold); font-weight: bold; }
#bugReportPanel textarea {
  width: 100%; margin-top: 0.6rem; background: var(--cs-panel-2); color: var(--cs-text);
  border: 1px solid var(--cs-line-bright); border-radius: 4px; padding: 0.5rem; font-family: inherit;
  font-size: 0.85rem; resize: vertical;
}
.bug-report-actions { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.6rem; }
.bug-report-actions .key-hint { font-size: 0.72rem; color: var(--cs-text-dim); }
.bug-report-screenshot-row { margin-top: 0.6rem; }
#bugReportAttachBtn {
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 4px; padding: 0.35rem 0.7rem; font-size: 0.78rem; cursor: pointer; font-family: inherit;
}
#bugReportAttachBtn:hover { border-color: var(--cs-gold); }
.bug-report-preview {
  position: relative; margin-top: 0.5rem; display: inline-block; max-width: 100%;
  border: 1px solid var(--cs-line-bright); border-radius: 4px; overflow: hidden;
}
.bug-report-preview img { display: block; max-width: 100%; max-height: 180px; }
#bugReportPreviewRemove {
  position: absolute; top: 0.2rem; right: 0.2rem; background: rgba(10,5,5,0.85); color: var(--cs-text);
  border: 1px solid var(--cs-line-bright); border-radius: 50%; width: 1.4rem; height: 1.4rem;
  font-size: 0.7rem; line-height: 1; cursor: pointer; padding: 0;
}
#bugReportPreviewRemove:hover { border-color: var(--cs-bad); color: var(--cs-bad); }
.overlay-card {
  position: relative; background: var(--cs-panel, #1a1010); border: 1px solid var(--cs-gold);
  border-radius: 4px; padding: 1.2rem 1.4rem; max-width: 420px; width: 90%;
  max-height: 80vh; max-height: 80dvh; overflow-y: auto;
  color: var(--cs-text);
}
.overlay-card h3 { margin: 0 0 0.6rem; color: var(--cs-gold); font-family: Impact, sans-serif; letter-spacing: 0.04em; }
.overlay-card h4 { margin: 0.8rem 0 0.4rem; font-size: 0.75rem; color: var(--cs-text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.overlay-close {
  position: absolute; top: 0.6rem; right: 0.6rem; background: none; border: none; color: var(--cs-text-dim);
  font-size: 1rem; cursor: pointer;
}
.overlay-close:hover { color: var(--cs-gold); }
.friend-row, .history-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--cs-line); font-size: 0.75rem;
}
.friend-row:last-child, .history-row:last-child { border-bottom: none; }
.history-row .result-win { color: color-mix(in srgb, #4caf50, var(--text) var(--ink-mix, 0%)); font-weight: bold; }
.history-row .result-loss { color: var(--cs-bad); font-weight: bold; }

.gameover-card { text-align: center; max-width: 460px; }
.gameover-result {
  font-family: Impact, "Arial Narrow Bold", sans-serif; font-size: 2.4rem; letter-spacing: 0.06em;
  margin: 0.3rem 0 0.15rem; text-transform: uppercase;
}
.gameover-result.result-win { color: color-mix(in srgb, #4caf50, var(--text) var(--ink-mix, 0%)); text-shadow: 0 0 20px rgba(76,175,80,0.45); }
.gameover-result.result-loss { color: var(--cs-bad); text-shadow: 0 0 20px rgba(255,90,82,0.4); }
.gameover-detail { color: var(--cs-text-dim); font-size: 0.85rem; margin-bottom: 0.9rem; }
.gameover-history-note { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.gameover-history-note p { margin: 0; }
.gameover-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
/* s51108: with the Grandmaster review's key moments the card outgrows the screen and Rematch / Back to Character Select fell below
   the fold of the scrolling card - keep them pinned to its bottom edge. */
.gameover-card .gameover-actions { position: sticky; bottom: -1.2rem; background: var(--cs-panel, #1a1010); padding: 0.6rem 0 1.2rem; margin-bottom: -1.2rem; box-shadow: 0 -10px 14px -8px color-mix(in srgb, var(--shade, #000) 55%, transparent); z-index: 2; }

/* Side columns are bounded to roughly their real content width (the portrait/plate/roster/drawer
   all cap out around 260-300px) instead of an open-ended 1fr - the leftover width that used to sit
   as dead margin beside each portrait now goes to the center column instead, which is the one
   that's actually short on room (Match Setup's dropdowns were clipping). */
.select-stage { display: grid; grid-template-columns: minmax(260px, 400px) minmax(320px, 1fr) minmax(260px, 400px); justify-content: center; gap: 0; position: relative; z-index: 1; padding-top: 0.4rem; }
/* P1 used to mirror P2 (right-aligned, flex-end) as a deliberate "facing across the center"
   fighting-game effect - reverted per direct feedback: it made the player's OWN Character Data box
   (tags, stats, and especially the ability-text paragraph) read as flipped/backwards rather than
   just stylized, a real readability cost for content you actually need to read. Both sides now use
   the exact same plain left-aligned layout - only the side-label's accent color (gold vs cyan,
   below) and which physical column each half occupies still differ. */
.fighter-half { display: flex; flex-direction: column; padding: 0.7rem 1.2rem 0.9rem; min-width: 0; color: var(--cs-text); }
.fighter-half.p1, .fighter-half.p2 { align-items: flex-start; text-align: left; }

.side-label {
  font-family: Impact, "Arial Narrow Bold", sans-serif; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.12rem 0.8rem; margin-bottom: 0.45rem;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.p1 .side-label { background: linear-gradient(90deg, transparent, var(--cs-p1) 40%); color: #1a1005; }
.p2 .side-label { background: linear-gradient(270deg, transparent, var(--cs-p2) 40%); color: #051318; }

/* Shows the full, uncropped card - no diagonal clip-path (it was slicing straight through the
   printed art at an angle, which read as broken rather than stylized) and object-fit:contain
   instead of cover, so nothing gets cut off regardless of the frame's aspect ratio. 5/7 matches a
   real card's ~2.5x3.5in proportions closely enough that there's little to no visible letterboxing
   in practice. */
.fighter-portrait {
  position: relative; width: 100%; max-width: 280px; aspect-ratio: 5 / 7;
  border: 2px solid var(--cs-line-bright); background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel));
  overflow: hidden; box-shadow: 0 8px 22px rgba(0,0,0,0.5);
}
.fighter-portrait img { width: 100%; height: 100%; object-fit: contain; }
.fighter-portrait .portrait-empty { padding: 0.8rem; font-size: 0.72rem; color: var(--cs-text-dim); font-style: italic; display: flex; align-items: center; justify-content: center; height: 100%; text-align: center; }

/* Deck-loading state - fills the portrait frame while a decklist resolves/imports (see
   showPortraitLoading in app.js), replaced by the real character art (or the empty placeholder) the
   moment it finishes. Three card-backs continuously fan out and gather back. The loop is
   deliberately NOT gated behind prefers-reduced-motion: it's the signal that the screen isn't
   frozen, and it's a small, contained motion rather than large/parallax movement. */
.fighter-portrait .portrait-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.3rem; }
.fighter-portrait .deck-shuffle { position: relative; width: 52px; height: 74px; }
.fighter-portrait .deck-shuffle .card {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 4px;
  border: 1.5px solid var(--cs-gold-dim); transform-origin: center bottom;
  background: repeating-linear-gradient(135deg, var(--cs-panel-2) 0 6px, var(--cs-panel-3) 6px 12px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}
.fighter-portrait .deck-shuffle .card:nth-child(1) { animation: deckFanL 1.3s ease-in-out infinite; }
.fighter-portrait .deck-shuffle .card:nth-child(2) { animation: deckFanU 1.3s ease-in-out infinite; }
.fighter-portrait .deck-shuffle .card:nth-child(3) { animation: deckFanR 1.3s ease-in-out infinite; }
@keyframes deckFanL { 0%,100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(-34px,9px) rotate(-24deg); } }
@keyframes deckFanU { 0%,100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(0,-20px) rotate(0deg) scale(1.04); } }
@keyframes deckFanR { 0%,100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(34px,9px) rotate(24deg); } }
.fighter-portrait .loading-cap { font-family: Impact, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.72rem; color: var(--cs-gold-bright); text-shadow: 0 1px 3px #000; }
.fighter-portrait .loading-cap .dots::after { content: ""; animation: loadDots 1.4s steps(4, end) infinite; }
@keyframes loadDots { 0% { content: ""; } 25% { content: "\00b7"; } 50% { content: "\00b7\00b7"; } 75% { content: "\00b7\00b7\00b7"; } 100% { content: ""; } }

.stat-plate { margin-top: 0.6rem; width: 100%; max-width: 260px; border: 1px solid var(--cs-line); background: rgba(0,0,0,0.28); font-size: 0.74rem; }
.plate-head {
  font-family: Impact, sans-serif; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.68rem;
  padding: 0.28rem 0.55rem; background: var(--cs-panel-2); color: var(--cs-gold); border-bottom: 1px solid var(--cs-line);
}
.stat-plate .tag-row { display: flex; gap: 0.3rem; flex-wrap: wrap; padding: 0.38rem 0.55rem; margin: 0; border-bottom: 1px solid rgba(92,34,41,0.4); }
.stat-plate .elem-tag {
  font-size: 0.6rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.1rem 0.4rem;
  border: 1px solid var(--cs-gold-dim); border-radius: 2px; color: var(--cs-gold);
}
.plate-rows { display: grid; grid-template-columns: 1fr 1fr; }
.plate-row {
  display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.55rem;
  border-bottom: 1px solid rgba(92,34,41,0.4); grid-column: span 1;
}
.plate-row .stat-label { color: var(--cs-text-dim); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.64rem; }
.plate-row .stat-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--cs-text); }

.stat-plate .ability-preview {
  background: none; border: none; border-radius: 0; padding: 0.42rem 0.55rem;
  font-size: 0.7rem; line-height: 1.4; color: var(--cs-text-dim); max-height: 84px; overflow-y: auto; margin-bottom: 0;
}

/* A wrapping 5-wide grid instead of a horizontal scroll strip - real fighting-game character-select
   feel (the actual ask), and it structurally can't hide the first tile off-screen the way the old
   overflow-x strip did (a real bug found live: right-packed flex content's default scroll position
   showed the END of the row, not the start) - a grid just adds more rows as needed, nothing to
   scroll at all for a typical saved-deck count. */
.roster-strip {
  margin-top: 0.55rem; width: 100%; max-width: 260px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem;
}
.roster-tile {
  width: 100%; aspect-ratio: 1; padding: 0;
  border: 2px solid var(--cs-line); background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel-2));
  cursor: pointer; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--cs-text-dim); font-size: 0.6rem;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.roster-tile img { width: 100%; height: 100%; object-fit: cover; }
.roster-tile:hover { transform: translateY(-2px); border-color: var(--cs-gold-dim); }
.roster-tile.selected { border-color: var(--cs-gold-bright); box-shadow: 0 0 0 2px rgba(127,199,232,0.30), 0 5px 12px rgba(0,0,0,0.5); }
.roster-tile.new-slot { font-size: 1.2rem; color: var(--cs-text-dim); border-style: dashed; }
.roster-empty-hint { font-size: 0.62rem; color: var(--cs-text-dim); margin-top: 0.4rem; font-style: italic; }

/* Pre-Built Decks - character-art tiles with a build-type badge (see app.js loadFeaturedOpponents) */
.featured-opponents { margin-top: 0.7rem; width: 100%; max-width: none; align-self: stretch; } /* fills the opponent column (was 260px) */
.featured-head { font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cs-gold-bright); margin-bottom: 0.4rem; }
.featured-head .featured-sub { color: var(--cs-text-dim); font-weight: 400; text-transform: none; letter-spacing: 0; }
.featured-search { width: 100%; box-sizing: border-box; margin: 0.4rem 0 0.5rem; padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid var(--border, #3a3a44); background: var(--panel, #1c1c22); color: inherit; font-size: 0.9rem; }
.featured-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 0.35rem; max-height: 340px; overflow-y: auto; }
.featured-tile {
  width: 100%; aspect-ratio: 3 / 4; padding: 0; position: relative; overflow: hidden;
  border: 2px solid var(--cs-line); border-radius: 5px;
  background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel-2));
  cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease;
}
.featured-tile .featured-art { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.featured-tile .featured-art-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; color: var(--cs-text-dim); }
.featured-tile:hover { transform: translateY(-2px); border-color: var(--cs-gold-dim); }
.featured-tile.selected { border-color: var(--cs-gold-bright); box-shadow: 0 0 0 2px rgba(127,199,232,0.32), 0 4px 10px rgba(0,0,0,0.5); }
/* corner badge marking the build type */
.featured-badge {
  position: absolute; top: 3px; left: 3px; z-index: 2;
  font-size: 0.46rem; font-weight: 800; letter-spacing: 0.03em; line-height: 1;
  padding: 2px 4px; border-radius: 3px; color: #0b0f1c; text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.badge-champion { background: linear-gradient(135deg, #ffd970, #e0a020); }        /* gold - tournament winner */
.badge-aibuild  { background: linear-gradient(135deg, #7fe0ff, #34a0d0); }        /* cyan - built by the AI */
.badge-featured { background: linear-gradient(135deg, #b7c0e0, #7d86ad); }        /* silver - self-play finalist */
.badge-new      { background: linear-gradient(135deg, #ffa27a, #e0583a); }        /* coral - newest set */
/* caption strip over the bottom of the art */
.featured-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: baseline; gap: 3px;
  padding: 6px 4px 3px; font-size: 0.5rem; line-height: 1.1; color: var(--text);
  background: linear-gradient(to top, rgba(6,9,18,0.92), rgba(6,9,18,0.55) 60%, transparent);
}
.featured-caption b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.featured-caption span { color: var(--cs-gold-bright); font-weight: 700; flex-shrink: 0; }
/* Sort toggle + "By set" shelves: one horizontally scrolling row per set (newest set first); "See all" opens the
   set as the 4-across grid; older sets collapse into chips at the bottom. */
.featured-sort { display: flex; gap: 4px; padding: 3px; margin-top: 0.2rem; border: 1px solid var(--cs-line); border-radius: 8px; background: var(--cs-panel-2); }
.featured-sort button { flex: 1; min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--cs-text-dim); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.featured-sort button[aria-pressed="true"] { background: var(--cs-gold); color: #0b0f1c; }
.featured-strip.by-set { display: block; max-height: 460px; }
.featured-set { margin-bottom: 0.6rem; }
.featured-set-head { display: flex; align-items: baseline; gap: 6px; margin: 0 0 0.3rem; }
.featured-set-name { flex: 1; min-width: 0; font-size: 0.74rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.featured-set-meta { flex-shrink: 0; font-size: 0.6rem; color: var(--cs-text-dim); }
.featured-set-new { flex-shrink: 0; font-size: 0.5rem; font-weight: 800; letter-spacing: 0.03em; padding: 2px 4px; border-radius: 3px; background: #ff8a65; color: #1a0d07; }
.featured-set-all { flex-shrink: 0; padding: 2px 0; border: 0; background: none; color: var(--cs-gold-bright); font-size: 0.62rem; font-weight: 700; cursor: pointer; }
.featured-shelf { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.featured-shelf .featured-tile { flex: 0 0 76px; scroll-snap-align: start; }
.featured-shelf.all { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); overflow: visible; }
.featured-shelf.all .featured-tile { flex: none; }
.featured-older { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-top: 0.4rem; border-top: 1px dashed var(--cs-line); }
.featured-older-label { width: 100%; font-size: 0.62rem; color: var(--cs-text-dim); }
.featured-older button { padding: 4px 8px; border-radius: 999px; border: 1px solid var(--cs-line); background: var(--cs-panel-2); color: var(--text); font-size: 0.62rem; cursor: pointer; }
.featured-older button:hover, .featured-set-all:hover { color: var(--cs-gold-bright); }
/* dark, thin scrollbars (the default light Windows bars clashed with the night-blue panel) */
.featured-strip, .featured-shelf { scrollbar-width: thin; scrollbar-color: var(--cs-line) transparent; }
.featured-strip::-webkit-scrollbar, .featured-shelf::-webkit-scrollbar { width: 6px; height: 6px; }
.featured-strip::-webkit-scrollbar-track, .featured-shelf::-webkit-scrollbar-track { background: transparent; }
.featured-strip::-webkit-scrollbar-thumb, .featured-shelf::-webkit-scrollbar-thumb { background: var(--cs-line); border-radius: 3px; }
.featured-strip::-webkit-scrollbar-thumb:hover, .featured-shelf::-webkit-scrollbar-thumb:hover { background: var(--cs-gold-dim); }

.center-console { display: flex; flex-direction: column; align-items: center; padding: 1.1rem 1rem 0; width: 100%; max-width: 380px; margin: 0 auto; }
.vs-emblem {
  width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--cs-gold);
  background: radial-gradient(circle, var(--cs-panel-3), var(--cs-panel) 70%);
  display: flex; align-items: center; justify-content: center;
  font-family: Impact, sans-serif; font-size: 1.65rem; color: var(--cs-gold-bright);
  box-shadow: 0 0 0 5px rgba(0,0,0,0.4), 0 0 20px rgba(164,129,214,0.38); transform: rotate(-4deg);
}
.timer-banner { margin-top: 0.8rem; width: 100%; border-top: 1px solid var(--cs-line-bright); border-bottom: 1px solid var(--cs-line-bright); padding: 0.35rem 0; text-align: center; }
.timer-banner .tb-label { font-size: 0.6rem; letter-spacing: 0.18em; color: var(--cs-text-dim); text-transform: uppercase; }
.timer-banner .tb-val { font-family: Impact, sans-serif; font-size: 1.3rem; color: var(--cs-text); letter-spacing: 0.04em; }

.console-block { margin-top: 0.9rem; width: 100%; border: 1px solid var(--cs-line); background: rgba(0,0,0,0.3); padding: 0.8rem 0.9rem; }
.console-block h4 { margin: 0 0 0.6rem; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cs-gold); font-family: Impact, sans-serif; text-align: center; }
.console-block .testing-toggle { font-size: 0.74rem; color: var(--cs-text-dim); display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.65rem; line-height: 1.35; }
/* Mode roster (Goldfish / Local AI / Claude AI / vs Friend) - the visible replacement for the old
   manual-mode checkbox + opponent-AI dropdown, surfacing all four modes up front. */
.console-block .mode-roster { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.65rem; }
.console-block .mode-option {
  display: flex; align-items: center; gap: 0.6rem; text-align: left; width: 100%;
  background: var(--cs-panel); border: 1px solid var(--cs-line); border-left-width: 3px;
  color: var(--cs-text); padding: 0.5rem 0.6rem; cursor: pointer; border-radius: 3px;
  font-family: inherit; transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.console-block .mode-option:hover { border-color: var(--cs-line-bright); }
.console-block .mode-option:focus-visible { outline: 2px solid var(--cs-gold-bright); outline-offset: 1px; }
.console-block .mode-option .mode-ic { font-size: 1.25rem; line-height: 1; width: 1.5rem; text-align: center; flex: 0 0 auto; }
.console-block .mode-option .mode-txt { display: flex; flex-direction: column; gap: 0.08rem; }
.console-block .mode-option .mode-nm { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; }
.console-block .mode-option .mode-ds { font-size: 0.64rem; color: var(--cs-text-dim); line-height: 1.3; }
.console-block .mode-option[aria-checked="true"] {
  border-color: var(--cs-gold); border-left-color: var(--cs-gold-bright);
  background: linear-gradient(90deg, rgba(127,199,232,0.14), transparent 70%);
  box-shadow: 0 0 12px rgba(127,199,232,0.20);
}
.console-block .mode-option[aria-checked="true"] .mode-nm { color: var(--cs-gold-bright); }
.console-block .local-ai-controls { display: flex; flex-direction: column; gap: 0.45rem; }
.console-block .ai-opponent-controls { display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.74rem; color: var(--cs-text-dim); margin-bottom: 0.65rem; }
.console-block .ai-opponent-controls label { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.console-block .ai-opponent-controls select {
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 2px; padding: 0.2rem 0.4rem; font-size: 0.72rem; max-width: 210px;
}
.console-block .error { font-size: 0.68rem; margin: 0.4rem 0 0; text-align: center; }
/* Why Engage is greyed out, spelled out where you're already looking - updateStartButton() fills
   this in with the specific unresolved-card/missing-deck reason instead of leaving a disabled
   button with no explanation (a real complaint: it silently didn't work for one deck pairing with
   no visible reason, and the only clue - the resolve-results list - is hidden inside a collapsed
   per-side drawer you'd have no reason to reopen once you already resolved the deck once). */
.engage-blockers {
  font-size: 0.7rem; color: var(--cs-bad); text-align: center; margin: 0 0 0.5rem;
  line-height: 1.4;
}
/* Same "don't make them go hunting for why" fix, at the source: a small red count badge right on
   the (possibly collapsed) drawer summary for whichever side actually has the problem. */
.drawer-unresolved-badge {
  background: var(--cs-bad); color: #fff; border-radius: 999px; font-size: 0.62rem;
  font-weight: 700; padding: 0.05rem 0.4rem; margin-left: 0.3rem;
}
.console-block .claude-api-key-label {
  display: flex !important; flex-direction: column; align-items: stretch !important; gap: 0.3rem;
}
/* Real bug: this rule's own `display: flex !important` outranks [hidden]'s `display: none
   !important` on specificity (two classes vs. one attribute selector), so wireAiOpponentControlsVisibility
   setting the hidden attribute for Local AI/PvP mode had no visible effect - the field stayed shown
   regardless of which opponent mode was selected. [hidden] always needs the final word here. */
.console-block .claude-api-key-label[hidden] { display: none !important; }
.console-block .claude-api-key-label input {
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 2px; padding: 0.3rem 0.45rem; font-size: 0.72rem; font-family: monospace;
}
.console-block .claude-api-key-label .key-hint { font-size: 0.65rem; color: var(--cs-text-dim); line-height: 1.35; }
.console-block .claude-api-key-label .key-hint a { color: var(--cs-gold); }
.console-block .pvp-controls { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.65rem; }
.console-block .pvp-controls > .key-hint { font-size: 0.66rem; color: var(--cs-text-dim); line-height: 1.4; margin: 0; }
.console-block .pvp-waiting { text-align: center; border: 1px dashed var(--cs-line-bright); padding: 0.5rem; }
.console-block .pvp-waiting p { margin: 0 0 0.3rem; font-size: 0.7rem; }
.console-block .pvp-waiting .pvp-cancel-btn { margin-top: 0.35rem; font-size: 0.7rem; padding: 0.3rem 0.9rem; } /* agX4-1106 (Discord "Cancel Room") */
.console-block .pvp-room-code {
  font-family: monospace; font-size: 1.4rem; letter-spacing: 0.25em; color: var(--cs-gold);
  font-weight: bold; margin-bottom: 0.3rem;
}
.console-block .pvp-join-row { display: flex; gap: 0.4rem; }
.console-block .pvp-join-row input {
  flex: 1; background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 2px; padding: 0.3rem 0.45rem; font-size: 0.75rem; font-family: monospace; text-transform: uppercase;
}
.console-block .pvp-join-row button { font-size: 0.7rem; padding: 0.3rem 0.6rem; white-space: nowrap; }

.engage-btn {
  background: linear-gradient(100deg, var(--cs-gold), var(--cs-crimson-bright)); color: #071018;
  border: 2px solid var(--cs-gold); font-family: Impact, sans-serif; font-weight: 400;
  letter-spacing: 0.06em; font-size: 1rem; padding: 0.55rem 1rem; text-transform: uppercase;
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%); width: 100%; margin-top: 0.3rem;
  box-shadow: 0 5px 14px rgba(127,199,232,0.40);
}
.engage-btn:hover:not(:disabled) { filter: brightness(1.12); }
.engage-btn:disabled { filter: grayscale(0.6) brightness(0.55); box-shadow: none; }

.control-bar {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  gap: 1.4rem; flex-wrap: wrap; padding: 0.6rem 1rem 0.9rem; margin-top: 0.4rem;
  border-top: 1px solid var(--cs-line); background: linear-gradient(0deg, rgba(0,0,0,0.4), transparent);
}
.control-chip { display: flex; align-items: center; gap: 0.35rem; font-size: 0.64rem; color: var(--cs-text-dim); letter-spacing: 0.02em; }
.control-chip .key {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 0.28rem;
  border: 1px solid var(--cs-gold-dim); color: var(--cs-gold); font-size: 0.58rem; font-family: monospace;
  background: rgba(0,0,0,0.4); border-radius: 2px;
}

@media (max-width: 900px) {
  .select-stage { grid-template-columns: 1fr; }
  .center-console { width: 100%; max-width: 340px; margin: 0 auto; order: 3; }
  .fighter-half.p1, .fighter-half.p2 { align-items: center; text-align: center; order: 1; }
  .fighter-half.p2 { order: 2; }
  .p1 .side-label, .p2 .side-label { clip-path: none; }
  /* NOT justify-content: center on the roster grid itself - the same "overflow hides the start"
     bug fixed earlier for the old roster-strip scroll behavior; margin: auto on the container
     centers the whole (now-wrapping, non-scrolling) grid instead, which has no such risk. */
  .p1 .roster-strip, .p2 .roster-strip { margin-left: auto; margin-right: auto; }
}

/* ---- Loadout editor: the existing <details>/<summary> paste/resolve/sideboard/save panel is
   still exactly what powers this - the SAME open/closed state machine already toggled by app.js
   (the "+" roster tile, delete-then-reopen, auto-collapse-once-a-deck-is-saved) - only how an OPEN
   <details> renders changes here, from an inline collapsible drawer to a centered modal with a
   backdrop, so paste/check/alt-art/sideboard/save no longer permanently eats scroll space on the
   base screen (a real complaint: "I have to scroll half the page"). CLOSED, the <summary> is just a
   real-looking button now ("✏️ Edit Deck / Paste New") instead of a drawer toggle label. */
.deck-import-details { width: 100%; max-width: 320px; margin-top: 0.5rem; color: var(--cs-text); }
.deck-import-details .key-hint { font-size: 0.68rem; color: var(--cs-text-dim); line-height: 1.45; margin: 0 0 0.6rem; }
.deck-import-details .key-hint a { color: var(--cs-gold); }
.deck-import-details .inline-link-btn {
  background: none; border: none; padding: 0; color: var(--cs-gold); text-decoration: underline;
  font-size: inherit; font-family: inherit; cursor: pointer;
}
.deck-import-details .inline-link-btn:hover { color: var(--cs-gold-bright); border: none; }
.deck-import-details summary {
  cursor: pointer; font-size: 0.74rem; letter-spacing: 0.03em; color: var(--cs-gold-bright);
  padding: 0.5rem 1rem; border: 1px solid var(--cs-gold-dim); border-radius: 4px;
  background: var(--cs-panel-2); list-style: none; text-align: center; display: inline-block;
}
.deck-import-details summary::-webkit-details-marker { display: none; }
.deck-import-details summary:hover { border-color: var(--cs-gold); background: var(--cs-panel-3); }
/* Open: the <details> itself becomes the fixed backdrop, the <summary> (already the open/close
   toggle) hides since the close button inside .drawer-body takes over that job while open. */
.deck-import-details[open] {
  position: fixed; inset: 0; z-index: 60; max-width: none; margin-top: 0;
  background: rgba(0,0,0,0.72); display: flex; align-items: flex-start; justify-content: center;
  padding: 3rem 1rem; overflow-y: auto;
}
.deck-import-details[open] > summary { display: none; }
.drawer-body {
  border: 1px solid var(--cs-line-bright); background: rgba(0,0,0,0.4); padding: 0.7rem; text-align: left;
}
/* Only inside the open modal state - the drawer-body becomes the actual modal card (closed state
   never renders drawer-body at all, <details> hides non-summary children natively). */
.deck-import-details[open] .drawer-body {
  border: 1px solid var(--cs-gold); border-radius: 6px; background: var(--cs-panel);
  max-width: 480px; width: 100%; padding: 1.3rem 1.5rem 1.5rem; position: relative;
}
.drawer-close {
  position: absolute; top: 0.6rem; right: 0.7rem; background: none; border: none;
  color: var(--cs-text-dim); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0.2rem;
}
.drawer-close:hover { color: var(--cs-gold); }
.drawer-body label { display: block; font-size: 0.62rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cs-gold-dim); margin-bottom: 0.2rem; }
.deck-import-details input, .deck-import-details textarea {
  width: 100%; box-sizing: border-box; margin-bottom: 0.55rem; font-family: inherit;
  background: var(--cs-panel); color: var(--cs-text); border: 1px solid var(--cs-line); border-radius: 0; padding: 0.45rem; font-size: 0.78rem;
}
.deck-import-details button {
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.deck-import-details button:hover:not(:disabled) { border-color: var(--cs-gold); color: var(--cs-gold); }
.deck-import-details #importHuman, .deck-import-details #importOpponent { background: var(--cs-crimson); border-color: var(--cs-gold-dim); color: #fff; margin-bottom: 0.55rem; }

.save-deck-row { display: flex; gap: 0.4rem; margin-top: 0.6rem; align-items: center; flex-wrap: wrap; }
.save-deck-row input { flex: 1; min-width: 100px; margin-bottom: 0; }
.save-deck-row button { font-size: 0.7rem; padding: 0.35rem 0.55rem; white-space: nowrap; }

.deck-import-details .resolve-results {
  font-size: 0.76rem; max-height: 160px; overflow-y: auto;
  border: 1px solid var(--cs-line); padding: 0.45rem; background: var(--cs-panel); color: var(--cs-text-dim); margin-bottom: 0.55rem;
}
.deck-import-details .resolve-results .unresolved { color: var(--cs-bad); }
.deck-import-details .resolve-results .fuzzy { color: var(--cs-gold); }
.deck-import-details .alt-art-toggle {
  font-size: 0.68rem; padding: 0.05rem 0.35rem; margin-left: 0.3rem;
  background: var(--cs-panel-2); border: 1px solid var(--cs-line); color: var(--cs-text-dim); cursor: pointer;
}
.deck-import-details .alt-art-toggle:hover { color: var(--cs-text); border-color: var(--cs-gold); }

.deck-import-details .sideboard-editor { margin-top: 0.3rem; }
.deck-import-details .sideboard-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.deck-import-details .sb-col {
  border: 1px solid var(--cs-line); padding: 0.4rem;
  background: var(--cs-panel); font-size: 0.72rem; max-height: 180px; overflow-y: auto; color: var(--cs-text-dim);
}
.deck-import-details .sb-col h4 { margin: 0 0 0.3rem; font-size: 0.66rem; color: var(--cs-gold-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.deck-import-details .sb-row { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.12rem 0; }
.deck-import-details .sb-move { padding: 0.12rem 0.4rem; font-size: 0.68rem; }
.deck-import-details .sb-hint { font-size: 0.68rem; color: var(--cs-bad); margin: 0.3rem 0 0; }

#matchTopbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 1rem; flex: 0 0 auto;
  padding: 0 0.2rem;
}

/* ---- Rules reference (data/rules-summary.md served via GET /api/rules) - same fixed-corner +
   <details>-as-modal pattern as .auth-widget / .deck-import-details[open], reachable regardless of
   whether setup, mid-match, or gameover is showing. */
.rules-details { position: fixed; top: 0.8rem; left: 1rem; z-index: 40; }
.rules-details > summary {
  list-style: none; cursor: pointer; background: var(--cs-panel-2); color: var(--cs-gold);
  border: 1px solid var(--cs-gold-dim); border-radius: 4px; padding: 0.4rem 0.7rem; font-size: 0.78rem;
}
.rules-details > summary::-webkit-details-marker { display: none; }
.rules-details > summary:hover { border-color: var(--cs-gold); background: var(--cs-panel-3); }
.rules-details[open] {
  position: fixed; inset: 0; z-index: 70;
  background: color-mix(in srgb, var(--scrim, #000) 78%, transparent); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.rules-details[open] > summary { display: none; }
.rules-drawer-body {
  border: 1px solid var(--cs-gold); border-radius: 6px; background: var(--cs-panel);
  max-width: 720px; width: 100%; max-height: 82vh; max-height: 82dvh; padding: 0; position: relative;
  display: flex; flex-direction: column; overflow: hidden;
}
.rules-drawer-head {
  display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--cs-line-bright); flex: 0 0 auto;
}
.rules-drawer-head h3 { margin: 0; font-family: Impact, sans-serif; letter-spacing: 0.04em; color: var(--cs-gold); font-size: 1rem; text-transform: uppercase; }
.rules-drawer-close { background: none; border: none; color: var(--cs-text-dim); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0.2rem; }
.rules-drawer-close:hover { color: var(--cs-gold); }
.rules-body-shell { display: flex; flex: 1 1 auto; min-height: 0; }
.rules-toc { width: 190px; flex: 0 0 auto; border-right: 1px solid var(--cs-line); background: color-mix(in srgb, var(--shade, #000) 25%, transparent); overflow-y: auto; padding: 0.5rem; }
.rules-toc button {
  display: block; width: 100%; text-align: left; background: none; border: none; color: var(--cs-text-dim);
  font-size: 0.72rem; padding: 0.45rem 0.5rem; border-radius: 3px; cursor: pointer; line-height: 1.35; margin-bottom: 0.1rem;
}
.rules-toc button.on { background: color-mix(in srgb, var(--cs-gold) 16%, transparent); color: var(--cs-gold); font-weight: bold; }
.rules-toc button:hover { color: var(--cs-text); }
.rules-content { flex: 1 1 auto; overflow-y: auto; padding: 1rem 1.2rem; font-size: 0.82rem; line-height: 1.6; color: var(--cs-text-dim); }
.rules-content h2 { color: var(--cs-text); font-size: 1rem; margin: 0 0 0.6rem; }
.rules-content p { margin: 0 0 0.7rem; }
.rules-content strong { color: var(--cs-text); }
.rules-content ul, .rules-content ol { margin: 0 0 0.7rem; padding-left: 1.2rem; }
.rules-content li { margin-bottom: 0.25rem; }
.rules-content .rc-table-wrap { overflow-x: auto; margin: 0.6rem 0 0.8rem; }
.rules-content table { border-collapse: collapse; font-size: 0.74rem; min-width: 280px; }
.rules-content th, .rules-content td { border: 1px solid var(--cs-line); padding: 0.3rem 0.5rem; text-align: center; }
.rules-content th { background: var(--cs-panel-2); color: var(--cs-text); }

@media (max-width: 640px) {
  .rules-body-shell { flex-direction: column; }
  .rules-toc { width: 100%; border-right: none; border-bottom: 1px solid var(--cs-line); max-height: 140px; }
}

/* ---- "How to Play" tutorial mode: deck briefing (character/archetype/synergies/win condition,
   shown on the char-select screen) + guided-match overlay (spotlight + tooltip, shown mid-match). ---- */

/* Play/Tutorial nav - own section per the approved mockup (Variant A), not a button bolted onto the
   Play tab's existing Match Setup console. */
.setup-nav { display: flex; justify-content: center; gap: 0; border-bottom: 1px solid var(--cs-line); margin: 0.6rem 0 0; position: relative; z-index: 1; }
.setup-nav-item {
  background: none; border: none; padding: 0.55rem 1.1rem; font-size: 0.74rem; font-weight: bold;
  color: var(--cs-text-dim); border-bottom: 2px solid transparent; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em;
}
.setup-nav-item.active { color: var(--cs-gold-bright); border-bottom-color: var(--cs-gold); }
.setup-nav-item.tutorial-tab.active { color: var(--tutorial); border-bottom-color: var(--tutorial); }
.setup-nav-item:hover:not(.active) { color: var(--cs-text); }
.setup-nav-feedback {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: none; border: 1px solid var(--cs-line); border-radius: 5px;
  padding: 0.3rem 0.7rem; font-size: 0.7rem; font-weight: bold; color: var(--cs-text-dim);
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em;
}
.setup-nav-feedback:hover { color: var(--cs-gold-bright); border-color: var(--cs-gold); }
@media (max-width: 560px) {
  .setup-nav-feedback { position: static; transform: none; margin-left: 0.5rem; }
  .setup-nav { flex-wrap: wrap; }
}

.tutorial-section { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 0.4rem 1rem 1rem; }
.tutorial-section-head { text-align: center; margin-bottom: 1rem; }
.tutorial-section-head h2 { font-family: Impact, sans-serif; letter-spacing: 0.03em; font-size: 1.3rem; margin: 0.4rem 0 0.3rem; color: var(--cs-text); }
.tutorial-section-head h2 span { color: var(--tutorial); }
.tutorial-section-head p { font-size: 0.76rem; color: var(--cs-text-dim); margin: 0; }

.tutorial-deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.7rem; }
.tutorial-deck-card {
  background: var(--cs-panel); border: 1px solid var(--cs-line); border-radius: 6px; padding: 0.6rem;
  cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; text-align: left;
}
.tutorial-deck-card:hover { border-color: var(--cs-gold); transform: translateY(-2px); }
.tutorial-deck-card.selected { border-color: var(--tutorial); box-shadow: 0 0 0 2px var(--tutorial-soft); }
.tutorial-deck-portrait {
  width: 100%; aspect-ratio: 3/4; border-radius: 4px; overflow: hidden;
  background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel)); border: 1px solid var(--cs-line-bright);
  display: flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: bold;
  color: var(--cs-gold-bright); text-align: center; padding: 0.4rem; margin-bottom: 0.4rem;
}
.tutorial-deck-portrait img { width: 100%; height: 100%; object-fit: cover; }
.tutorial-archetype-badge {
  display: inline-block; font-size: 0.55rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem; border-radius: 999px; margin-bottom: 0.3rem;
}
.tutorial-archetype-badge.aggro { background: rgba(230,102,109,0.16); color: #e6666d; }
.tutorial-archetype-badge.control { background: rgba(95,194,217,0.16); color: var(--cs-p2); }
.tutorial-archetype-badge.balanced { background: rgba(230,193,90,0.16); color: #e6c15a; } /* o51108: the new-set Tutorial decks */
.tutorial-deck-name { font-size: 0.72rem; font-weight: bold; color: var(--cs-text); margin: 0 0 0.1rem; line-height: 1.3; }
.tutorial-deck-char { font-size: 0.62rem; color: var(--cs-text-dim); margin: 0; }

.tutorial-deck-detail {
  margin-top: 1rem; padding: 1rem; background: var(--cs-panel-2); border: 1px solid var(--cs-line-bright); border-radius: 8px;
}
.tutorial-deck-detail-top { display: flex; gap: 1rem; align-items: center; }
.tutorial-deck-detail-portrait {
  width: 72px; height: 100px; border-radius: 5px; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel)); border: 1px solid var(--cs-gold-dim);
  display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-weight: bold; color: var(--cs-gold-bright); text-align: center;
}
.tutorial-deck-detail-portrait img { width: 100%; height: 100%; object-fit: cover; }
.tutorial-deck-detail-body { flex: 1; }
.tutorial-deck-detail-body h3 { margin: 0 0 0.2rem; font-size: 0.9rem; color: var(--cs-text); }
.tutorial-deck-detail-body p { margin: 0; font-size: 0.7rem; color: var(--cs-text-dim); }
.tutorial-learn-btn {
  background: var(--tutorial); color: #0a0d1a; border: none; font-weight: bold; font-size: 0.76rem;
  padding: 0.5rem 1rem; border-radius: 6px; white-space: nowrap;
}
.tutorial-learn-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tutorial-opponent-picker { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--cs-line); }
.tutorial-opponent-picker .top-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cs-text-dim); margin: 0 0 0.5rem; }
.tutorial-opp-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tutorial-opp-chip {
  display: flex; align-items: center; gap: 0.4rem; background: var(--cs-panel); border: 1px solid var(--cs-line);
  border-radius: 999px; padding: 0.25rem 0.6rem 0.25rem 0.25rem; cursor: pointer; font-size: 0.68rem; color: var(--cs-text-dim);
}
.tutorial-opp-chip:hover { border-color: var(--cs-gold-dim); }
.tutorial-opp-chip.selected { border-color: var(--tutorial); background: var(--tutorial-soft); color: var(--cs-text); }
.tutorial-opp-chip .opp-thumb {
  width: 22px; height: 30px; border-radius: 3px; overflow: hidden; flex-shrink: 0;
  background: var(--cs-panel-3); display: flex; align-items: center; justify-content: center; font-size: 0.4rem; color: var(--cs-gold-bright);
}
.tutorial-opp-chip .opp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tutorial-ai-note { margin-top: 0.6rem; font-size: 0.65rem; color: var(--tutorial); line-height: 1.5; }

@media (max-width: 640px) {
  .tutorial-deck-detail-top { flex-direction: column; align-items: stretch; text-align: center; }
}

.tutorial-briefing {
  position: fixed; inset: 0; z-index: 65; background: color-mix(in srgb, var(--scrim, #000) 78%, transparent);
  display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.tutorial-briefing-card {
  position: relative; border: 1px solid var(--tutorial); border-radius: 8px; background: var(--cs-panel);
  max-width: 560px; width: 100%; padding: 1.6rem 1.7rem 1.3rem; color: var(--cs-text);
}
.tutorial-slide-badge {
  display: inline-block; background: var(--tutorial-soft); color: var(--tutorial); font-size: 0.62rem;
  font-weight: bold; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2rem 0.55rem;
  border-radius: 999px; margin-bottom: 0.7rem;
}
.tutorial-slide h2 { margin: 0 0 0.6rem; font-family: Impact, sans-serif; letter-spacing: 0.03em; font-size: 1.15rem; color: var(--cs-text); }
.tutorial-slide p { font-size: 0.82rem; line-height: 1.6; color: var(--cs-text-dim); margin: 0 0 0.6rem; }
.tutorial-slide-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 1.1rem; }
.tutorial-nav-btn {
  background: var(--cs-panel-2); border: 1px solid var(--cs-line-bright); color: var(--cs-text);
  font-size: 0.76rem; font-weight: bold; padding: 0.45rem 0.8rem; border-radius: 4px;
}
.tutorial-nav-btn:disabled { opacity: 0.35; }
.tutorial-nav-btn.primary { background: var(--tutorial); border-color: var(--tutorial); color: var(--on-tutorial, #0a0d1a); }
.tutorial-dots { display: flex; gap: 5px; }
.tutorial-dots .d { width: 6px; height: 6px; border-radius: 50%; background: var(--cs-line-bright); }
.tutorial-dots .d.on { background: var(--tutorial); width: 16px; border-radius: 3px; }

.tutorial-char-panel { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; }
.tutorial-char-portrait {
  width: 58px; height: 80px; border-radius: 5px; background: var(--c-character); border: 1px solid #ffffff2a;
  display: flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: bold;
  color: #fff; text-align: center; flex-shrink: 0; padding: 3px;
}
.tutorial-char-stats { display: flex; flex-direction: column; gap: 0.3rem; }
.tutorial-char-stat {
  display: flex; justify-content: space-between; gap: 1rem; font-size: 0.72rem;
  background: var(--cs-panel-2); border: 1px solid var(--cs-line); border-radius: 4px; padding: 0.25rem 0.55rem; min-width: 150px;
}
.tutorial-char-stat b { color: var(--cs-text); font-variant-numeric: tabular-nums; }
.tutorial-note {
  margin-top: 0.5rem; background: var(--tutorial-soft); color: var(--tutorial); border-radius: 6px;
  padding: 0.5rem 0.65rem; font-size: 0.76rem; line-height: 1.5;
}
.tutorial-note b { color: var(--cs-text); }

.tutorial-synergy-chain { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0.4rem 0; }
.tutorial-synergy-node {
  background: var(--cs-panel-2); border: 1px solid var(--cs-line); border-radius: 5px; padding: 0.35rem 0.5rem;
  font-size: 0.68rem; font-weight: bold; color: var(--cs-text); text-align: center;
}
.tutorial-synergy-arrow { color: var(--tutorial); font-size: 0.9rem; font-weight: bold; flex-shrink: 0; }
.tutorial-synergy-explain { font-size: 0.76rem; color: var(--cs-text-dim); line-height: 1.5; margin: 0.2rem 0 0.7rem; }
.tutorial-key-card {
  display: flex; gap: 0.5rem; align-items: flex-start; background: var(--cs-panel-2); border: 1px solid var(--cs-line);
  border-radius: 5px; padding: 0.4rem 0.55rem; margin-top: 0.4rem;
}
.tutorial-key-card .kc-role {
  flex-shrink: 0; font-size: 0.6rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--tutorial); background: var(--tutorial-soft); border-radius: 3px; padding: 0.15rem 0.4rem; margin-top: 0.1rem;
}
.tutorial-key-card .kc-name { font-weight: bold; font-size: 0.76rem; color: var(--cs-text); margin: 0 0 0.15rem; }
.tutorial-key-card .kc-blurb { font-size: 0.7rem; color: var(--cs-text-dim); line-height: 1.45; margin: 0; }

/* "Anatomy of a Card" - a stylized (not photographic) card face with the 3 corner regions the rules
   text itself names explicitly (difficulty top-left, symbols bottom-left, check value bottom-right,
   big blue number) - see data/rules-summary.md section 2/5. Deliberately drawn rather than overlaid
   on a real card photo, since exact pixel position of these regions is a fixed template across every
   card but the ART underneath varies per card - a drawn diagram stays correct for any example. */
.tutorial-anatomy-wrap { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 0.6rem; }
.tutorial-anatomy-card {
  position: relative; width: 128px; aspect-ratio: 5 / 7; flex-shrink: 0; margin: 0 auto;
  background: linear-gradient(160deg, var(--cs-panel-3), var(--cs-panel)); border: 2px solid var(--cs-gold-dim);
  border-radius: 7px; display: flex; flex-direction: column; padding: 5px;
}
.tutorial-anatomy-card .ac-name { font-size: 0.5rem; font-weight: bold; text-align: center; color: var(--cs-text); border-bottom: 1px solid var(--cs-line); padding-bottom: 2px; }
.tutorial-anatomy-card .ac-art { flex: 1; margin: 3px 0; background: rgba(0,0,0,0.3); border-radius: 3px; }
.tutorial-anatomy-card .ac-text { font-size: 0.38rem; color: var(--cs-text-dim); line-height: 1.25; padding: 2px; border-top: 1px solid var(--cs-line); min-height: 1.6em; }
.tutorial-anatomy-card .ac-badge {
  position: absolute; font-size: 0.5rem; font-weight: bold; border-radius: 3px; padding: 1px 4px; line-height: 1.4;
  background: var(--cs-panel-2); border: 1px solid var(--tutorial); color: var(--tutorial); white-space: nowrap;
}
.tutorial-anatomy-card .ac-difficulty { top: 3px; left: 3px; }
.tutorial-anatomy-card .ac-symbols { bottom: 3px; left: 3px; background: #2e4a2e; border-color: #6fae6f; color: #cdeecd; }
.tutorial-anatomy-card .ac-check { bottom: 3px; right: 3px; background: #1c3654; border-color: var(--cs-p2); color: var(--cs-p2); font-size: 0.62rem; }
.tutorial-anatomy-legend { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.tutorial-anatomy-row { display: flex; gap: 0.4rem; align-items: baseline; font-size: 0.68rem; line-height: 1.4; }
.tutorial-anatomy-row .ar-label { flex-shrink: 0; font-weight: bold; color: var(--tutorial); min-width: 62px; }
.tutorial-anatomy-row .ar-text { color: var(--cs-text-dim); }
.tutorial-anatomy-strip { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.tutorial-anatomy-chip {
  background: var(--cs-panel-2); border: 1px solid var(--cs-line); border-radius: 5px; padding: 0.3rem 0.5rem;
  font-size: 0.66rem; color: var(--cs-text-dim); flex: 1; min-width: 130px;
}
.tutorial-anatomy-chip b { color: var(--cs-text); display: block; font-size: 0.68rem; margin-bottom: 0.1rem; }

@media (max-width: 480px) {
  .tutorial-anatomy-wrap { flex-direction: column; align-items: center; }
}

/* Guided-match overlay - repositioned every render() by repositionTutorialOverlay(). Higher than the
   board/sidebar (z-index ~10-20 typically) but below real interrupting modals (card picker/gameover
   at 70, debug overlay at 200), so those still take priority if one happens to open mid-tutorial. */
.tutorial-guide { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
.tutorial-spot {
  position: absolute; border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--tutorial), 0 0 0 6000px rgba(6,8,18,0.72);
  transition: all 0.3s ease; opacity: 0;
}
.tutorial-spot.on { opacity: 1; }
.tutorial-tooltip {
  position: absolute; width: 260px; background: var(--panel-2); border: 1px solid var(--tutorial);
  border-radius: 8px; padding: 0.7rem 0.8rem; font-size: 0.76rem; line-height: 1.5; color: var(--text);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--shade, #000) 50%, transparent); transition: left 0.3s ease, top 0.3s ease; opacity: 0;
  pointer-events: none;
}
.tutorial-tooltip.on { opacity: 1; pointer-events: auto; }
.tutorial-tooltip .tt-step {
  font-size: 0.62rem; font-weight: bold; color: var(--tutorial); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.3rem;
}
.tutorial-tooltip .tt-tag {
  display: inline-block; margin-top: 0.4rem; background: var(--tutorial-soft); color: var(--tutorial);
  font-size: 0.6rem; font-weight: bold; padding: 0.1rem 0.4rem; border-radius: 999px;
}
.tutorial-guide-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 0.6rem; gap: 0.5rem; }
.tutorial-guide-nav { display: flex; gap: 0.35rem; }
.tutorial-guide-nav .tutorial-nav-btn { font-size: 0.68rem; padding: 0.3rem 0.55rem; }
.tutorial-skip-btn {
  background: none; border: none; color: var(--text-dim); font-size: 0.68rem; text-decoration: underline;
  cursor: pointer; padding: 0;
}

@media (max-width: 640px) {
  .tutorial-tooltip { width: 210px; }
}

.debug-info-btn {
  font-size: 0.78rem; color: var(--text-dim); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.25rem 0.55rem; cursor: pointer;
}
.debug-info-btn:hover { color: var(--text); border-color: var(--hero); }
.exit-match-btn { color: var(--bad); border-color: rgba(255,90,82,0.4); }
.exit-match-btn:hover { color: #fff; background: var(--bad); border-color: var(--bad); }

.debug-fallback-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.debug-fallback-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; width: min(600px, 90vw); display: flex; flex-direction: column; gap: 0.6rem;
}
.debug-fallback-box textarea {
  width: 100%; height: 300px; font-family: monospace; font-size: 0.78rem;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.5rem; resize: vertical;
}

/* ---- board / table frame ---- */
#board { flex: 1; min-height: 0; }
#board.in-match { display: flex; flex-direction: column; }

/* Row layout: .sidebar (log + action panel, real document flow) beside .table (the board itself) -
   see render()'s own comment on why this replaced absolutely-positioning them inside .table. */
.board-layout { flex: 1; min-height: 0; display: flex; flex-direction: row; gap: 0.6rem; }
/* margin-top aligns .log's top edge with where the board content itself starts inside .table
   (below .hud-status, the top breadcrumb strip - see .half.opp's own top offset) rather than the
   very top of .table, which .hud-status itself occupies. */
/* Slim log rail: narrow by default so the board keeps the width. In a PvP match the Chat tab widens
   it (.chat-wide) to a comfortable chat column, then it snaps back; the collapse toggle can shrink it
   to a thin strip (.collapsed). flex-basis is transitioned so the widen/collapse eases rather than jumps. */
.sidebar { flex: 0 0 176px; display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; margin-top: 2.6rem;
  transition: flex-basis 0.26s cubic-bezier(0.2,0.7,0.3,1); }
.sidebar.chat-wide { flex-basis: 288px; }

.table {
  position: relative; flex: 1; min-height: 480px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at center, var(--felt-2), var(--felt));
}
.watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: clamp(3rem, 8vw, 5.5rem);
  color: color-mix(in srgb, var(--hi, #fff) 4%, transparent); letter-spacing: 0.1em; pointer-events: none;
}

/* ---- HUD chrome: top strip, log, action panel, utility icons ---- */
/* Persistent full-width strip (was a centered floating pill) - turn/phase/step breadcrumb plus a
   Progressive Difficulty readout, always visible regardless of which of the app's 16 action-context
   types is active. Everything else in .table shifts down to clear it (see .half/.log below). */
.hud-status {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  background: var(--panel); border-bottom: 1px solid var(--line);
  /* right padding: the strip's right end sits under the pinned gear button - keep its chips clear of it (Discord: "OP: Breaker" was covered) */
  padding: 0.45rem 3.4rem 0.45rem 1rem; font-size: 0.78rem; display: flex; align-items: center; gap: 1rem;
  white-space: nowrap;
}
.hud-status .t { font-family: "Rockwell", "Roboto Slab", Georgia, serif; }
.hud-status .whose-turn { color: var(--tide); font-weight: 700; }
.hud-status .sub { color: var(--text-dim); font-size: 0.72rem; }
.hud-status .spacer { flex: 1; }
.hud-status .diff-chip {
  background: var(--panel-2); border: 1px solid var(--line-bright); border-radius: 3px;
  padding: 0.15rem 0.55rem; font-size: 0.7rem; color: var(--text-dim);
}
.hud-status .diff-chip b { color: var(--hero); font-variant-numeric: tabular-nums; }
.hud-status .diff-chip.breaker-chip { border-color: var(--bad); margin-right: 0.4rem; }
.hud-status .diff-chip.breaker-chip b { color: var(--bad); }
.hud-status .diff-chip.stack-chip { border-color: var(--hero); margin-right: 0.4rem; }
/* queued on the attack stack (Beauregard): bottom-center pill, clear of the four corner badges */
.card-slot .attack-stack-badge {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); z-index: 6; white-space: nowrap;
  background: var(--hero); color: var(--on-hero-badge, #10131c); border-radius: 999px; padding: 0.05rem 0.4rem; font-size: 0.62rem; font-weight: 700; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}
.hud-status .winprob { display: flex; align-items: center; gap: 0.4rem; cursor: help; }
.hud-status .winprob-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.6rem; }
.hud-status .winprob-track {
  position: relative; width: 90px; height: 7px; border-radius: 5px; overflow: hidden;
  background: linear-gradient(90deg, #b3402f, #d97a34); border: 1px solid var(--line-bright);
}
.hud-status .winprob-you {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #1f8a4c, #34c56e); transition: width 0.4s ease;
}
.hud-status .winprob-pct { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.4em; text-align: right; color: var(--text); }

/* Post-game review (gameover panel): win-chance eval graph + biggest-swing callout. */
.gameover-review { margin: 0.6rem 0; }
.gameover-review .review-title {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 0.3rem;
}
.gameover-review .review-graph {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px;
}
.gameover-review .review-graph svg { width: 100%; height: 90px; display: block; }
.gameover-review .review-line { fill: none; stroke: #34c56e; stroke-width: 2; vector-effect: non-scaling-stroke; }
.gameover-review .review-mid { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.5; vector-effect: non-scaling-stroke; }
.gameover-review .review-callout {
  margin-top: 0.5rem; padding: 0.5rem 0.7rem; font-size: 0.8rem; line-height: 1.4;
  background: var(--panel-2); border-left: 3px solid var(--hero); border-radius: 4px; color: var(--text);
}
.gameover-review .review-callout b { color: var(--hero); }

/* Coach hint button (hud) + floating tip. */
.hud-status .coach-btn {
  background: var(--panel-2); border: 1px solid var(--line-bright); border-radius: 4px;
  color: var(--text); font-size: 0.7rem; padding: 0.15rem 0.55rem; cursor: pointer; white-space: nowrap;
}
.hud-status .coach-btn:hover { border-color: var(--hero); }
.hud-status .coach-btn:disabled { opacity: 0.6; cursor: default; }
#coachTip {
  position: fixed; top: 3.2rem; left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 60; max-width: 30rem; display: flex; align-items: flex-start; gap: 0.5rem;
  background: var(--panel-3); color: var(--text); border: 1px solid var(--hero); border-radius: 8px;
  padding: 0.6rem 0.9rem; font-size: 0.85rem; line-height: 1.4; box-shadow: 0 6px 24px color-mix(in srgb, var(--shade, #000) 40%, transparent);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
#coachTip.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); cursor: pointer; }
#coachTip .coach-tip-icon { font-size: 1rem; }

/* Training puzzles: setup button, list panel, and in-match status strip. */
.training-btn {
  margin-top: 0.5rem; width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line-bright); border-radius: 6px; padding: 0.55rem; cursor: pointer; font-size: 0.9rem;
}
.training-btn:hover { border-color: var(--hero); }
.overlay-card.puzzle-card { max-width: 40rem; }
.puzzle-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.6rem; max-height: 60vh; max-height: 60dvh; overflow-y: auto; }
.puzzle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.7rem;
}
.puzzle-row-info { display: flex; flex-direction: column; gap: 0.15rem; }
.puzzle-row-sub { font-size: 0.72rem; color: var(--text-dim); }
.puzzle-diff { color: var(--hero); letter-spacing: 0.1em; }
.puzzle-strip {
  display: flex; align-items: center; gap: 0.8rem; flex: 1; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--hero); border-radius: 6px; padding: 0.3rem 0.7rem; margin-right: 0.5rem;
}
.puzzle-goal { font-size: 0.82rem; color: var(--text); flex: 1; min-width: 0; }
.puzzle-goal.solved { color: color-mix(in srgb, #34c56e, var(--text) var(--ink-mix, 0%)); font-weight: 700; }
.puzzle-goal.failed { color: var(--bad); font-weight: 700; }
.puzzle-actions { display: flex; gap: 0.4rem; }
.puzzle-btn {
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line-bright); border-radius: 4px;
  font-size: 0.72rem; padding: 0.2rem 0.6rem; cursor: pointer; white-space: nowrap;
}
.puzzle-btn:hover { border-color: var(--hero); }
.puzzle-btn:disabled { opacity: 0.6; cursor: default; }

.log {
  /* Was position:absolute inside .table (top-left corner) - now a normal-flow sidebar child,
     given more breathing room (flex-basis 220px vs. the old fixed 150px) since it no longer has to
     stay small enough to avoid overlapping the board underneath it. */
  flex: 1 1 auto; min-height: 90px; overflow-y: auto; /* agX4-1106 (Discord "[Desktop] LOG"): the open log fills the rail down to the flow bar (was capped at 220px) */
  background: var(--panel); border: 1px solid var(--line); border-bottom: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  padding: 0.55rem 0.7rem; backdrop-filter: blur(2px);
}
.log h3 { margin: 0 0 0.35rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.log ul { margin: 0; padding: 0; list-style: none; font-size: 0.7rem; line-height: 1.5; color: var(--text-dim); }
.log li { display: flex; gap: 0.35rem; }
.log li b { color: var(--text); }
/* agK-1105: card names in the match log (linkLogCardNames) - bold + a soft underline; hover = full-art preview, tap/click = Card Info. */
.log-card {
  font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}
.log-card:hover { text-decoration-color: currentColor; }
.log li .log-icon { flex: 0 0 auto; width: 0.9rem; text-align: center; }
.log li .log-ts { color: var(--log-ts, #5a6494); }
.log li.ai-narration { color: var(--tide); font-style: italic; }

/* PvP-only Log/Chat tab switcher (see renderLogOrChat) - reuses .log's own background/border/
   clip-path/padding, just overrides its overflow so the tab bar stays put while only the content
   below it (.log-scroll or .chat-pane) scrolls. */
.chat-tab-box { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-tabs { display: flex; gap: 0.3rem; margin-bottom: 0.4rem; flex: 0 0 auto; }
.sidebar-tabs button {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 4px; padding: 0.28rem; font-size: 0.66rem; cursor: pointer; font-family: inherit;
  text-transform: uppercase; letter-spacing: 0.04em; position: relative;
}
.sidebar-tabs button.active { background: var(--panel-3); border-color: var(--tide); color: var(--text); }
.sidebar-tabs button:hover:not(.active) { border-color: var(--line-bright); }
.unread-badge {
  background: var(--tide); color: var(--ink); border-radius: 999px; font-size: 0.6rem;
  padding: 0.02rem 0.35rem; margin-left: 0.3rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.log-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.log-scroll ul { margin: 0; padding: 0; list-style: none; font-size: 0.7rem; line-height: 1.5; color: var(--text-dim); }
.log-scroll li { display: flex; gap: 0.35rem; }
.log-scroll li .log-icon { flex: 0 0 auto; width: 0.9rem; text-align: center; }
.log-scroll li .log-ts { color: var(--log-ts, #5a6494); }
.log-scroll li.ai-narration { color: var(--tide); font-style: italic; }

/* ---- Match-log event color coding (both the slim rail .log and the PvP tabbed .log-scroll).
   The category class is set by logLineIcon() in app.js; each tints its icon + message text, while
   the [T/phase] timestamp prefix stays muted (.log-ts above). ---- */
.log li.evt-attack   .log-icon, .log li.evt-attack   .log-msg,
.log-scroll li.evt-attack   .log-icon, .log-scroll li.evt-attack   .log-msg { color: var(--evt-attack); }
.log li.evt-foundation .log-icon, .log li.evt-foundation .log-msg,
.log-scroll li.evt-foundation .log-icon, .log-scroll li.evt-foundation .log-msg { color: var(--evt-found); }
.log li.evt-blitz    .log-icon, .log li.evt-blitz    .log-msg,
.log-scroll li.evt-blitz    .log-icon, .log-scroll li.evt-blitz    .log-msg { color: var(--evt-blitz); }
.log li.evt-response .log-icon, .log li.evt-response .log-msg,
.log-scroll li.evt-response .log-icon, .log-scroll li.evt-response .log-msg { color: var(--evt-response); }
.log li.evt-keyword  .log-icon, .log li.evt-keyword  .log-msg,
.log-scroll li.evt-keyword  .log-icon, .log-scroll li.evt-keyword  .log-msg { color: var(--evt-keyword); }

.chat-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; }
.chat-msgs .empty-note { font-size: 0.72rem; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.rival { align-self: flex-start; align-items: flex-start; }
.msg .bubble { padding: 0.35rem 0.55rem; border-radius: 8px; font-size: 0.74rem; line-height: 1.35; word-break: break-word; }
.msg.me .bubble { background: var(--hero-deep); color: var(--on-hero-deep, white); border-bottom-right-radius: 2px; }
.msg.rival .bubble { background: var(--panel-2); border: 1px solid var(--line-bright); border-bottom-left-radius: 2px; }
.msg .who { font-size: 0.58rem; color: var(--text-dim); margin: 0.1rem 0.15rem 0; text-transform: uppercase; letter-spacing: 0.04em; }
.msg.me .who { color: var(--hero); }
.msg.rival .who { color: var(--tide); }
.chat-input-row { display: flex; gap: 0.35rem; margin-top: 0.4rem; flex: 0 0 auto; }
.chat-input-row input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 0.35rem 0.5rem; color: var(--text); font-size: 0.74rem; font-family: inherit;
}
.chat-input-row input::placeholder { color: var(--text-dim); }
.chat-input-row button {
  background: var(--tide-deep); border: 1px solid var(--tide); color: var(--on-tide-deep, white); border-radius: 5px;
  padding: 0.35rem 0.6rem; font-size: 0.74rem; cursor: pointer; font-family: inherit;
}
.chat-input-row button:hover { border-color: var(--tide); filter: brightness(1.1); }

.action-panel {
  /* Was position:absolute inside .table (bottom-left corner, max-height hacked to clear
     .hud-status above it) - now a normal-flow sidebar child that just takes whatever vertical
     space .log (above it) leaves behind, scrolling internally if its own content overflows. */
  flex: 1; min-height: 0; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--hero);
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%, 0 14px);
  padding: 0.75rem 0.85rem; backdrop-filter: blur(2px);
  /* Pinned back to the ORIGINAL fixed card size, deliberately not inheriting :root's new
     viewport-responsive --card-w (see the ---- card display ---- block below) - that scaling was
     meant for the big open board (.half/.hand), not this fixed-width 300px HUD box. Real bug this
     fixes: on a wide window --card-w/--card-h scaled up enough that a full-size card slot (square,
     sized to fit either rotation - see .card-slot) barely fit ONE per row here instead of 2-3,
     turning every card picker this panel renders (mulligan hand, pending-check commit picker,
     ability-source rows, etc.) into a tall, overflowing single-column list.
     BOTH --card-w and --card-h must be redeclared together here, same as .card-slot.mini already
     does below - a var() reference inside --card-h's calc() does NOT recompute just because
     --card-w is overridden at a different selector, it stays bound to whatever --card-w was in
     scope where --card-h itself was declared (:root). Setting only --card-w here (the first,
     wrong version of this fix) changed nothing - .card-slot's actual box size reads --card-h,
     which was still resolving against :root's scaled value the whole time. */
  --card-w: 92px;
  --card-h: 128.8px;
}
.action-panel h3 { margin: 0 0 0.5rem; font-size: 0.88rem; }
.action-panel p, .ability-focus-rail p { font-size: 0.82rem; }

/* The board and its flow bar stack in a column beside the sidebar, so the flow bar spans only the
   board's width (not the whole window) and stays centered under it. */
.board-col { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.6rem; }

/* Flow-bar variant: the action panel docked as a board-width horizontal bar under the board (see
   render()), instead of a vertical sidebar column. Content is CENTERED - title, status text and the
   flow buttons cluster in the middle of the bar (right under where your eyes are on the board),
   rather than being flung to the left/right edges. A simple window (Pass/Continue) reads as a slim
   centered bar; a rich window (Roman Cancel, Echo, end-turn pickers) grows taller and scrolls.
   Keeps every case's content and logic untouched. */
.action-panel.flow-bar {
  flex: 0 0 auto;
  max-height: 34vh; max-height: 34dvh; overflow-y: auto;
  clip-path: none; border-radius: 10px;
  /* Compact: title + status text flow together on ONE centred line, buttons drop to a centred line
     below - roughly half the height of the old stacked column, while everything stays centred under
     the board. Vertical padding is halved too (0.3 vs the base 0.75rem). */
  padding: 0.3rem 0.85rem;
  display: block; text-align: center;
  /* Floor = a normal title-line + button-row window, so the bar stops jumping up and down between the one-line
     "Opponent is thinking" state and your own windows (suggested on Discord). Taller windows still grow. */
  min-height: 4.4rem;
}
/* The one-line "Opponent is thinking" / "Waiting for your friend" state sits in the middle of the bar's minimum height (Discord). */
.action-panel.flow-bar.flow-waiting { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }
/* r57 (Discord "Skip"): a window passing itself shows its step chip and one quiet line - its Pass (and the rest) is hidden, not clickable. */
.action-panel.flow-bar.r57ui-skipping > :not(.aw-chip):not(.r57ui-skip-note) { display: none !important; }
.action-panel.flow-bar.r57ui-skipping > .aw-chip { margin: 0 0.5rem 0 0; }
.action-panel.flow-bar > p.r57ui-skip-note { margin: 0; font-size: 0.76rem; color: var(--muted, #9aa4b8); }
.action-panel.flow-bar > h3 { display: inline; margin: 0 0.45rem 0 0; font-size: 0.82rem; color: var(--hero); }
.action-panel.flow-bar > p { display: inline; margin: 0 0.4rem 0 0; font-size: 0.76rem; }
.action-panel.flow-bar .attack-stack-summary { display: inline; margin: 0 0.45rem 0 0; }
/* Button groups, standalone buttons, and picker rows each drop to their own centred line. */
.action-panel.flow-bar .actions { display: flex; justify-content: center; gap: 0.4rem; margin: 0.3rem 0 0; }
.action-panel.flow-bar > button { display: block; margin: 0.3rem auto 0; }
/* Picker rows (momentum/foundation chips) stay a centred horizontal row; the staged-pick confirm
   box stacks its label/name/buttons in a centred column. */
.action-panel.flow-bar .row { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0.25rem auto 0; }
/* In the flow bar the Review/Block confirmation REPLACES the step text in the same window - no second bordered box inside
   it (suggested on Discord, twice): "Review & discard <card>?" on the text line, Cancel / Confirm where the step button was. */
.action-panel.flow-bar .confirm-box { display: block; text-align: center; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; }
.action-panel.flow-bar .confirm-box .confirm-box-label, .action-panel.flow-bar .confirm-box .confirm-box-name { display: inline; font-size: 0.8rem; text-transform: none; letter-spacing: 0; margin: 0; color: var(--text); }
.action-panel.flow-bar .confirm-box .confirm-box-label::after { content: " "; }
.action-panel.flow-bar .confirm-box .confirm-box-name::after { content: "?"; }

/* Window colors (see ACTION_WINDOW_KINDS in app.js): each step tints the bar and its chip so the
   step reads without the text. Keyword windows reuse the printed keyword colors; every Response
   window, damage ones included, is green. */
.action-panel.flow-bar { --aw: var(--hero); --aw-bg: var(--panel); --aw-ink: var(--on-hero, #1a1205); background: var(--aw-bg); border: 2px solid var(--aw); }
.action-panel.flow-bar.aw-form     { --aw: #b4dcea; --aw-bg: #13212b; --aw-ink: #0b1a22; }
.action-panel.flow-bar.aw-blitz    { --aw: #e6aec9; --aw-bg: #2c1824; --aw-ink: #2a0f1c; }
.action-panel.flow-bar.aw-enhance  { --aw: #f2e420; --aw-bg: #2a2a12; --aw-ink: #1a1a05; }
.action-panel.flow-bar.aw-response { --aw: #b5d865; --aw-bg: #1f2a12; --aw-ink: #14200a; }
.action-panel.flow-bar.aw-block    { --aw: #ef9a3d; --aw-bg: #2e1f0e; --aw-ink: #241405; }
.action-panel.flow-bar.aw-choose   { --aw: #b49cf0; --aw-bg: #1f1834; --aw-ink: #170f2c; }
.action-panel.flow-bar.aw-phase    { --aw: #9aa3c4; --aw-bg: #191d2c; --aw-ink: #11131c; }
.action-panel.flow-bar.aw-rival    { --aw: #35c9c1; --aw-bg: #10282a; --aw-ink: #04201f; }
.aw-chip {
  display: inline-block; vertical-align: middle; margin: 0 0.45rem 0 0; padding: 0.1rem 0.55rem;
  border-radius: 999px; background: var(--aw); color: var(--aw-ink);
  font-weight: 800; font-size: 0.68rem; letter-spacing: 0.06em; white-space: nowrap;
}
.action-panel.flow-bar > h3 { color: var(--text); }
.action-panel.flow-bar > h3:empty { display: none; }
/* The attack line ("Hunter's Ally 5 dmg / 6 spd / zone H") sits inline after the chip, unboxed. */
.action-panel.flow-bar .attack-stack-summary { background: none; border: 0; padding: 0; font-size: 0.82rem; }
.action-panel.flow-bar .attack-stack-summary .as-label { color: var(--text); font-weight: 700; font-family: inherit; }
.action-panel.flow-bar .attack-stack-summary .as-vals { color: var(--text); white-space: nowrap; }

/* Auto-skip settings dropdown in the match top bar (buildAutoSkipControl). */
.autoskip-control { position: relative; font-size: 0.74rem; }
.autoskip-control > summary {
  list-style: none; cursor: pointer; padding: 0.3rem 0.55rem; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim); white-space: nowrap;
}
.autoskip-control > summary::-webkit-details-marker { display: none; }
.autoskip-control[open] > summary, .autoskip-control > summary:hover { border-color: var(--hero); color: var(--text); }
.autoskip-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; min-width: 250px;
  display: flex; flex-direction: column; gap: 0.45rem; padding: 0.6rem 0.7rem;
  background: var(--panel); border: 1px solid var(--line-bright); border-radius: 8px; box-shadow: 0 8px 24px color-mix(in srgb, var(--shade, #000) 45%, transparent);
}
.autoskip-menu label { display: flex; align-items: center; gap: 0.35rem; color: var(--text); cursor: pointer; }
/* r81sw (Discord "Settings WIndow"): app.js r81swOpen - Settings is its own centred window (no longer a dropdown inside the gear pop-up, which
   grew taller than the screen and couldn't be scrolled or closed). Never taller than the screen: the header and the Done footer stay put and
   the grouped list scrolls between them. In the top bar it's a plain button; the list waits there hidden. */
.autoskip-control > .autoskip-menu { display: none !important; }
.autoskip-control > .r81sw-open { font-size: 0.74rem; cursor: pointer; padding: 0.3rem 0.55rem; border-radius: 6px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text-dim); white-space: nowrap; }
.autoskip-control > .r81sw-open:hover { border-color: var(--hero); color: var(--text); }
.r81sw-backdrop { position: fixed; inset: 0; z-index: 140; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--shade, #000) 55%, transparent); }
.r81sw-panel { width: min(620px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--hero); border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 40px color-mix(in srgb, var(--shade, #000) 60%, transparent); }
.r81sw-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); }
.r81sw-head h3 { margin: 0; font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 1.1rem; }
.r81sw-x { min-width: 36px; min-height: 36px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-size: 1rem; }
.r81sw-x:hover { border-color: var(--hero); }
.r81sw-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.5rem 0.9rem 0.8rem; }
.r81sw-body > .autoskip-menu { position: static; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; padding: 0; margin: 0;
  background: none; border: 0; box-shadow: none; font-size: 0.86rem; }
.r81sw-body > .autoskip-menu label { align-items: flex-start; gap: 0.5rem; line-height: 1.35; }
.r81sw-body > .autoskip-menu label input { flex: 0 0 auto; margin: 0.12rem 0 0; width: 16px; height: 16px; }
.r81sw-body > .autoskip-menu .z61110-keys-btn { align-self: flex-start; }
.r81sw-sec { margin: 0.55rem 0 0; padding-top: 0.45rem; border-top: 1px solid var(--line); font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--hero); }
.r81sw-body > .autoskip-menu > .r81sw-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.r81sw-foot { flex: 0 0 auto; display: flex; justify-content: flex-end; padding: 0.55rem 0.9rem; border-top: 1px solid var(--line); }
.r81sw-foot button { min-width: 7rem; min-height: 38px; }
@media (max-width: 820px) {
  .r81sw-backdrop { padding: 8px; }
  .r81sw-panel { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .r81sw-body > .autoskip-menu { gap: 0.6rem; }
  .r81sw-body > .autoskip-menu label { min-height: 28px; }
  .r81sw-foot button { flex: 1 1 auto; min-height: 44px; }
}
.log li.autoskip-note { opacity: 0.6; font-size: 0.92em; }
/* agZ2-1106 (Discord "NO RESPONSE/NO ENHANCE"): the No Response quick toggle beside the gear (app.js z2SyncNrToggle), the Full Pass bar,
   the hold-to-Full-Pass fill on Enhance's Pass, and the phone deck badge for a next-check penalty (the toggle takes the strip's right end). */
.z2-nr-toggle { display: none; }
body.in-match .z2-nr-toggle {
  display: inline-flex; align-items: center; gap: 0.3rem; position: fixed; top: 0.5rem; right: 3.7rem; z-index: 94;
  padding: 0.3rem 0.6rem; font-size: 0.74rem; line-height: 1.2; border-radius: 6px; cursor: pointer; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line-bright); color: var(--text-dim);
}
body.in-match .z2-nr-toggle:hover { border-color: var(--hero); color: var(--text); }
.z2-nr-toggle b { color: var(--text); letter-spacing: 0.05em; }
.z2-nr-toggle[data-mode="on"] { border-color: var(--bad); }
.z2-nr-toggle[data-mode="on"] b { color: var(--bad); }
.z2-nr-toggle[data-mode="auto"] { border-color: #b5d865; }
.z2-nr-toggle[data-mode="auto"] b { color: color-mix(in srgb, #b5d865, var(--text) var(--ink-mix, 0%)); }
.z2-nr-toggle .z2-nr-lab-s { display: none; }
body.z2-nr-shown .hud-status { padding-right: 12.5rem; }
.z2-hold-pass { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.z2-hold-fill { position: absolute; inset: 0; background: rgba(242, 228, 32, 0.38); transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.z2-hold-pass.z2-holding .z2-hold-fill { transform: scaleX(1); transition: transform 0.5s linear; }
.action-panel.flow-bar.z2-fullpass .z2-fullpass-text b { color: var(--aw); letter-spacing: 0.08em; font-size: 0.86rem; }
.action-panel.flow-bar.z2-fullpass > button.z2-fullpass-cancel { display: inline-block; margin: 0 0 0 0.6rem; }
.z2-deck-penalty { display: none; }
@media (max-width: 820px) {
  body.in-match .z2-nr-toggle { right: 3.45rem; padding: 0.12rem 0.4rem; font-size: 0.66rem; }
  .z2-nr-toggle .z2-nr-lab { display: none; }
  .z2-nr-toggle .z2-nr-lab-s { display: inline; }
  body.z2-nr-shown .hud-status { padding-right: 8.2rem; }
  body.z2-nr-shown .hud-status .breaker-chip { display: none; }
  body.z2-nr-shown .pile-mini { position: relative; }
  body.z2-nr-shown .z2-deck-penalty {
    display: inline-block; position: absolute; bottom: -5px; right: -7px; z-index: 5; padding: 0 0.3rem; border-radius: 999px;
    background: var(--bad); color: #fff; font-weight: 800; font-size: 0.62rem; line-height: 1.35; font-variant-numeric: tabular-nums;
  }
}
@media (max-width: 820px) and (min-height: 521px) {
  body.in-match .z2-nr-toggle { top: 1.6rem; }
}

/* Log collapse toggle: sits atop the sidebar; collapsed, the sidebar shrinks to just this button
   (turned vertical) so the board column reclaims the width. */
.log-toggle {
  flex: 0 0 auto; align-self: flex-start; margin-bottom: 0.4rem;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 6px; padding: 0.3rem 0.5rem; cursor: pointer;
  font-size: 0.66rem; font-family: inherit; text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.3rem;
}
.log-toggle:hover { border-color: var(--hero); color: var(--text); }
.log-toggle-icon { font-size: 0.85rem; line-height: 1; }
.sidebar.collapsed { flex: 0 0 auto; }
.sidebar.collapsed .log-toggle { flex-direction: column; margin-bottom: 0; padding: 0.5rem 0.35rem; gap: 0.4rem; }
.sidebar.collapsed .log-toggle-text { writing-mode: vertical-rl; text-orientation: mixed; }
.action-panel .actions, .ability-focus-rail .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.action-panel .row, .ability-focus-rail .row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

/* Shared staged-pick confirm box (Review Step, Block Step, Roman Cancel Blue) - appears once a card
   is staged on the board (see chip()'s reviewPick/blockPick/rcBluePick/selected/dimmed params),
   never before. Green border matches the .selected ring the staged card itself shows on the board,
   tying the two together. */
.confirm-box { background: var(--panel-2); border: 1px solid var(--good); border-radius: 8px; padding: 0.55rem 0.65rem; margin-bottom: 0.5rem; }
.confirm-box-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 0.15rem; }
.confirm-box-name { font-weight: 700; }

/* Roman Cancel Blue's idle-state "arm it" badge - see rcBlueArmed's own comment for why this stays
   quiet (no board glow) until clicked, unlike every other click-to-act moment. */
.rc-badge {
  display: inline-flex; align-items: center; gap: 0.3rem; background: var(--panel-2); border: 1px solid var(--c-backup);
  color: var(--c-backup); border-radius: 999px; padding: 0.3rem 0.65rem; font-size: 0.74rem; cursor: pointer; margin-bottom: 0.5rem;
}
.rc-badge:hover { background: var(--panel-3); }
.rc-badge.armed { background: var(--c-backup); color: white; border-color: var(--c-backup); }

/* Printed-vs-current stats for the active attack, e.g. "3/4 -> 4/7" - no itemized per-modifier
   breakdown (that needs new engine-side tracking on attackSequence, out of scope for this pass). */
.attack-stack-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  background: var(--panel-2); border: 1px solid var(--line-bright); border-radius: 4px;
  padding: 0.4rem 0.6rem; margin-bottom: 0.6rem; font-size: 0.74rem;
}
.attack-stack-summary .as-label { color: var(--text-dim); font-family: "Rockwell", "Roboto Slab", Georgia, serif; }
.attack-stack-summary .as-vals { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.attack-stack-summary .as-vals b { color: var(--hero); }

.hud-util { position: absolute; bottom: 0.6rem; right: 0.6rem; z-index: 20; display: flex; gap: 0.4rem; }
.hud-util button { padding: 0.3rem 0.55rem; font-size: 0.78rem; }

.thinking-dots::after { content: ""; animation: thinking-dots 1.2s steps(4, end) infinite; }
@keyframes thinking-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }

/* ---- board halves ---- */
/* Each half is a 3-column grid: an empty balance column, a centered Stage+Card-Pool stack, and the
   character dossier at one outer edge - the dossier lands near the sidebar for the opponent, at
   the far edge for you (see renderSide() in app.js, "opposite corners": the two dossiers sit in
   diagonally opposite corners rather than both on the same wall). Card Pool always sits closest to
   the midline: Stage-then-Pool for the opponent (their block sits above the line, so Pool has to
   be their bottom row to end up nearest it), Pool-then-Stage for you (your block sits below the
   line, so Pool at the top is already nearest it) - the SAME order can't be reused for both halves,
   this was a real bug caught in the approved mockup (naively using one shared order put Stage
   nearest the middle for the opponent instead of Pool). */
.half {
  position: absolute; left: 0; right: 0; height: 44%;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.half.opp { top: 3.6rem; }
.half.me { bottom: 1.6rem; }

.half-grid {
  flex: 1; min-height: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 1rem; padding: 0 0.5rem;
}
/* Extra clearance on the side the Hand pokes in from (below for "me", above for "opp") - content
   was vertically centering itself right up against that edge, close enough for the fanned hand
   cards (rendered on top, higher z-index) to visually cover the bottom/top row. */
.half.me .half-grid { padding-bottom: 1.5rem; }
.half.opp .half-grid { padding-top: 1.5rem; }

.zone-label { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); white-space: nowrap; }

.card-slot.lib-stack { width: 73px; height: 73px; }
.card-slot.lib-stack.mini { width: 48px; height: 48px; }
.lib-face {
  width: 52px; height: 73px; border-radius: 6px; position: relative;
  background: repeating-linear-gradient(135deg, var(--panel-2) 0 6px, var(--panel) 6px 12px);
  border: 2px solid var(--line); box-shadow: 3px 3px 0 -2px var(--ink), 3px 3px 0 -1px var(--line);
  display: flex; align-items: center; justify-content: center;
}
.card-slot.lib-stack.mini .lib-face { width: 100%; height: 100%; }
.lib-face .count { font-weight: 700; font-size: 0.85rem; background: color-mix(in srgb, var(--shade, #000) 45%, transparent); border-radius: 999px; padding: 0.15rem 0.5rem; }
.card-slot.lib-stack.mini .lib-face .count { font-size: 0.68rem; padding: 0.1rem 0.35rem; }

/* Discard renders as a face-up stack showing only the most recently discarded card - a count
   badge (opposite corner from the frozen/stamina badges) hints there's more underneath, and
   clicking it opens the full pile via openPileViewer() rather than fanning every card in place
   (which is what used to overflow the strip and produce a "sliver" of each card). */
.disc-count {
  position: absolute; top: -4px; left: -4px; z-index: 5;
  background: var(--hero-deep); color: var(--on-hero-deep, white); border-radius: 999px; padding: 0.05rem 0.35rem;
  font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}

/* Stage and Card Pool are now one centered stack per half (see .half's own comment above for the
   Pool-always-nearest-the-midline ordering rule) - .zone-row is shared by both, and now also by
   Assets/Backups once built (they used to be confined to a separate cramped column beside the
   character; there's real room for them here now, mixed in with Foundations). */
.center-stack { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 0; justify-content: center; }
.zone-row { display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
/* r75az Auto-Zoom (desktop): an overfull stage / card pool row shrinks its own cards - app.js r75azFitRow sets --card-w / --card-h /
   --r75az-f / --r75az-h inline. The gaps shrink with the cards and the row keeps its normal one-card height, so the card pool stays put. */
.zone-row.r75az-fit { gap: calc(0.5rem * var(--r75az-f, 1)); min-height: var(--r75az-h, auto); align-content: flex-start; }
.half.opp .zone-row.r75az-fit { align-content: flex-end; } /* the shrunk cards sit on the centre-line side, away from the hand */
.dossier-edge.r75az-measure { width: max-content !important; } /* r75azFitBoard reads the dossier's natural width (one layout, then removed) */
.zone-row.r75az-fit > .stage-stack:not(.r31111-tok-pile) { margin-right: calc(0.5rem * var(--r75az-f, 1)); }

.stage-header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; width: 100%; margin-top: 0.2rem; }
.stage-header .stage-counts { font-weight: 600; letter-spacing: 0.02em; text-transform: none; }
.stage-header .stage-deadlock { margin-left: 0.4rem; color: var(--bad); font-weight: 700; text-transform: none; }
/* agQ2-1108 (Discord "Stage Indicator"): "F 9 (4R / 2C) | A 3 | B 1" - the ready / committed split is a lighter weight, the bar a dim divider. */
.stage-header .stage-counts .q21108-rc { font-weight: 500; opacity: 0.85; }
.stage-header .stage-counts .q21108-sep { opacity: 0.45; }
/* In a match the top bar is crowded - the avatar identifies you (the name is its tooltip). Suggested on Discord. */
#matchTopbar .signed-in-as #authName { display: none; }

/* Consecutive same-card runs in the Stage row (see groupAdjacentStageIds) fan into one compact
   group instead of rendering every physical instance edge to edge - same half-overlap fan as
   .mom-stack/.power-token-row above, just applied to the Stage row's duplicate copies. Each card
   underneath is still its own full chip (drag-reorderable, click-to-act eligible) - this is a pure
   render-time grouping, not a merge. */
.stage-stack { position: relative; display: flex; align-items: center; margin-right: 0.5rem; }
.stage-stack .card-slot { margin-left: calc(var(--card-h) * -0.5); }
.stage-stack .card-slot:first-child { margin-left: 0; }
/* agR3-1111 (Discord "Stage"): identical stage tokens (Power tokens) pile up like the discard pile - one card + the xN badge; the tokens under
   the top one only show the pile's edge (up to 3 layers). */
.stage-stack.r31111-tok-pile .card-slot { margin-left: 0; }
.stage-stack.r31111-tok-pile .card-slot.r31111-tok-under { position: absolute; left: 0; top: 0; pointer-events: none;
  transform: translate(calc(var(--r31111-d, 1) * 3px), calc(var(--r31111-d, 1) * -3px)); filter: brightness(0.7); }
.stage-stack.r31111-tok-pile .card-slot.r31111-tok-top { position: relative; z-index: 2; }
.stage-stack.r31111-tok-pile { margin-right: calc(0.5rem + 9px); }
/* agR3-1111 (Discord "Highlight"): the rival's last Enhance keeps its stage-edge glow while its card glows (no fade). */
.w31110-edge.r31111-edge-persist { animation: none; opacity: 0.9; }
.stack-count {
  position: absolute; bottom: -4px; left: -4px; z-index: 5;
  background: var(--hero-deep); color: var(--on-hero-deep, white); border-radius: 999px; padding: 0.05rem 0.35rem;
  font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}

/* Stage and hand cards are both drag-reorderable (purely a display convenience - order has no
   rules meaning). The *-slot classes keep the default cursor sane; .dragging dims the card being
   moved; .drop-target highlights whichever card it's currently hovering over. */
.draggable-stage-slot, .draggable-hand-slot { cursor: grab; }
.draggable-stage-slot.dragging, .draggable-hand-slot.dragging { opacity: 0.4; }
.draggable-stage-slot.drop-target .card-face.front, .draggable-hand-slot.drop-target .card-face.front { outline: 2px dashed var(--hero); outline-offset: 2px; }
/* agZ7-1110 (Discord "Stage"): dropping a stage card on the lower part of another card (or just below it) groups them - a blue dashed
   outline + "Group" hint, distinct from the move outline. The xN badge of a stack is a button that ungroups it. */
.z71110-grp-over { outline: 2px dashed #60a5fa !important; outline-offset: 3px; border-radius: 10px; }
.z71110-drop-hint { position: fixed; transform: translateX(-50%); z-index: 10060; pointer-events: none; background: #60a5fa; color: #0a0d1a;
  font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.stack-count.z71110-ungroup { cursor: pointer; }
.stack-count.z71110-ungroup::before { content: ""; position: absolute; inset: -8px; }

/* The character dossier - now pinned to one outer edge of the half-grid (see .half's comment)
   instead of sitting beside a full-width Stage row. DOM order inside is always
   [momentum+character row, Deck/Discard/Remove row] or the reverse, decided in app.js based on
   which side needs to sit nearest that player's own Card Pool (see renderSide's comment) - CSS
   only handles the LEFT-RIGHT mirroring within each row, not the vertical stacking order. */
.dossier-edge { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; z-index: 2; flex: 0 0 auto; }
.dossier-edge.at-start { justify-self: start; }
.dossier-edge.at-end { justify-self: end; }

/* Momentum sits directly beside the character (not stacked above it), on whichever side actually
   faces the center of the table. DOM order is always [momentum, character]; .at-start (the
   opponent's dossier, near the sidebar) reverses it so momentum still ends up on the center-facing
   side without needing separate markup per placement - same treatment for the Deck/Discard/Remove
   row below, so the two dossiers are a true left-right mirror of each other, not independent
   copies in the same order. */
.char-momentum-row { display: flex; align-items: center; gap: 0.5rem; }
.dossier-edge.at-start .char-momentum-row { flex-direction: row-reverse; }
.mom-stack { display: flex; align-items: center; min-height: 1.2rem; }
/* Half-overlapping fan instead of fully separate cards - each card shows about half of itself. */
.mom-stack .card-slot { margin-left: calc(var(--card-h) * -0.5); }
.mom-stack .card-slot:first-child { margin-left: 0; }
.mom-count { font-size: 0.58rem; color: var(--text-dim); white-space: nowrap; margin-left: 0.2rem; }
.hand-count { display: none; font-size: 0.58rem; color: var(--text-dim); white-space: nowrap; margin-left: 0.4rem; }

.piles-row { display: flex; align-items: flex-end; gap: 0.6rem; }
.dossier-edge.at-start .piles-row { flex-direction: row-reverse; }
.pile-mini { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }

/* Power tokens fan the same way momentum does (see .mom-stack above) - placed below the character
   for you, above for the opponent (see renderSide's dossier assembly order). */
.power-token-row { display: flex; align-items: center; justify-content: center; min-height: 1.2rem; }
.power-token-row .card-slot { margin-left: calc(var(--card-h) * -0.5); }
.power-token-row .card-slot:first-child { margin-left: 0; }
.power-token-count { font-size: 0.58rem; color: var(--text-dim); white-space: nowrap; margin-left: 0.2rem; }

/* The character chip's HP badge (see .char-wrap .hp-badge below) pokes 0.7rem above its own top
   edge - harmless when nothing sits above it in the dossier's vertical stack, but when the
   Deck/Discard/Remove row renders first (see renderSide's ordering comment) the badge would
   otherwise overlap its labels. Applied unconditionally rather than only on the side that needs
   it - a little extra top margin is harmless on the side where nothing's above it either. */
.dossier-edge .char-wrap { margin-top: 0.8rem; }

/* Mirrors the top margin above (for the HP badge poking above char-wrap): .name-badge pokes
   1.1rem below char-wrap's own box (position: absolute, out of flow, doesn't reserve space) - the
   next dossier row (.side-controls, the Power+/Counter buttons) would otherwise start right where
   it visually sits and overlap it. 0.75rem covers the 1.1rem poke minus .dossier-edge's own 0.35rem
   flex gap. */
.char-wrap { position: relative; margin-bottom: 0.75rem; }
.char-wrap .hp-badge {
  position: absolute; top: -0.7rem; right: -0.8rem; z-index: 4;
  background: color-mix(in srgb, var(--glass, #0a0d11) 92%, transparent); border-radius: 999px; padding: 0.22rem 0.55rem;
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.78rem;
}
.panel-a-color { border: 2px solid var(--hero); color: var(--hero); }
.panel-b-color { border: 2px solid var(--tide); color: var(--tide); }
.char-wrap .name-badge {
  position: absolute; bottom: -1.1rem; left: 50%; transform: translateX(-50%); z-index: 4;
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; white-space: nowrap;
  font-size: 0.72rem; background: color-mix(in srgb, var(--glass, #0a0d11) 88%, transparent); border-radius: 999px; padding: 0.2rem 0.55rem;
  /* Safety net for a genuinely long single name: cap the width and ellipsize rather than let the
     badge run off the board's left/right edge (the dossier sits at the very edge, so a wide badge
     centered on the portrait overflows the viewport and gets clipped). Full text is on `title`. */
  max-width: 11rem; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box;
}
/* s51108: the dossier sits at the board's edge, so a badge centred on the portrait ran past the board and was clipped
   ("xus Dreyar, Lightning Dra..." / "Sergei Dragunov - Deat"): anchor it to the inner side instead. */
.dossier-edge.at-start .char-wrap .name-badge { left: -0.4rem; transform: none; }
.dossier-edge.at-end .char-wrap .name-badge { left: auto; right: -0.4rem; transform: none; }
.half.opp .char-wrap .name-badge { color: var(--tide); }
.half.me .char-wrap .name-badge { color: var(--hero); }

.side-controls { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; justify-content: center; z-index: 2; }
.side-controls button { padding: 0.2rem 0.5rem; font-size: 0.68rem; }

.hand { position: absolute; left: 50%; transform: translateX(-50%); display: flex; z-index: 6; }
.hand.opp-hand { top: -1.5rem; }
.hand.my-hand { bottom: -1.6rem; }
.hand .card-slot { margin-left: -20px; transition: transform 0.15s; }
.hand .card-slot:first-child { margin-left: 0; }
.hand.my-hand .card-slot:hover { transform: translateY(-16px); z-index: 7; }

/* A tall stage (many built cards) can grow underneath the absolutely-positioned hand row above -
   each hand's own hide-btn (appended as the hand's last flex child, so it docks to the end of the
   fan at any hand size) collapses just that hand's cards so the stage behind it is reachable. */
.hand.hidden-cards .card-slot { display: none; }
.hand-hide-btn {
  flex: 0 0 auto; margin-left: 0.55rem; width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line-bright); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
  cursor: pointer; padding: 0; z-index: 7;
}
.hand-hide-btn:hover { border-color: var(--hero); color: var(--hero); }

/* Hand peeks (TTS-style): each player's hand is relocated (in render()) into a peek strip pinned to
   the board's bottom (you) or top (opponent) edge. It rests translated mostly off the edge - .table's
   overflow:hidden clips the hidden part - so only the tab + a sliver of card shows, keeping the board
   tall. Hovering the tab raises it; clicking your tab pins it up (.up / handPinnedUp). The hand node
   inside keeps all its wiring; we only override its floating positioning to a static centred row. */
.hand-peek {
  position: absolute; left: 0; right: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center;
  transition: transform 0.24s cubic-bezier(0.2,0.7,0.3,1); pointer-events: none;
}
.hand-peek > * { pointer-events: auto; }
.hand-peek-tab {
  font-size: 0.66rem; color: var(--text); cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-bright);
  padding: 2px 14px; display: flex; gap: 6px; align-items: center; box-shadow: 0 0 12px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}
.hand-peek-tab:hover { border-color: var(--hero); }
.hand-peek-tab .hp-chev { color: var(--hero); font-size: 0.6rem; }
.hand-peek-cards {
  /* "safe center": centred while the hand fits, start-aligned once it overflows - plain "center" pushed the first cards past the
     left edge, where the sideways scroll can't reach (reported on Discord: 7+ cards on a phone, the leftmost card untouchable). */
  display: flex; justify-content: safe center; padding: 6px 10px 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--glass-3, #131a30) 72%, transparent), color-mix(in srgb, var(--glass-2, #0a0d1a) 96%, transparent));
  border: 1px solid var(--line-bright); max-width: 100%;
}
.hand-peek-cards .hand { position: static; transform: none; left: auto; top: auto; bottom: auto; }
/* Peek hand cards use the fixed HUD card size (not :root's viewport-scaled size) so the raised hand
   stays a sensible size. Both vars must be set together - the slot box reads --card-h. */
.hand-peek-cards .hand .card-slot { --card-w: 84px; --card-h: 117.6px; }

/* Your hand: bottom edge, tab on top of the cards; rests peeking up, hover/pin raises it. */
.hand-peek.you { bottom: 0; transform: translateY(calc(100% - 32px)); }
.hand-peek.you .hand-peek-tab { border-bottom: none; border-radius: 8px 8px 0 0; }
.hand-peek.you .hand-peek-cards { border-top: none; }
.hand-peek.you:hover, .hand-peek.you.up { transform: translateY(0); }

/* Opponent hand: top edge, tab under the cards; rests peeking down, hover lowers it. */
.hand-peek.opp { top: 0; transform: translateY(calc(-100% + 32px)); }
.hand-peek.opp .hand-peek-tab { border-top: none; border-radius: 0 0 8px 8px; }
.hand-peek.opp .hand-peek-cards { border-bottom: none; }
.hand-peek.opp:hover, .hand-peek.opp.up { transform: translateY(0); }
/* q31112 (Discord "glitchy"): a hand card / hand peek rebuilt by render() under a resting mouse starts in its hovered position (no slide)
   until the browser re-applies :hover - see app.js q31112KeepHover. Same values as the :hover rules above. */
.hand.my-hand .card-slot.q31112-hov { transform: translateY(-16px); z-index: 7; transition: none; }
.hand.my-hand .card-slot.q31112-hov .card-chip.clickable .card-face.front { border-color: var(--hero); }
.hand.my-hand .card-slot.q31112-hov .card-chip.inspectable .card-face.front,
.hand.my-hand .card-slot.q31112-hov .card-chip.inspectable .card-face.back { outline: 2px solid var(--hero); outline-offset: 1px; }
.hand-peek.you.q31112-hov, .hand-peek.opp.q31112-hov { transform: translateY(0); transition: none; }

/* Drag a card from your hand onto your card pool to move it there (manual - see renderSide's pool
   drop wiring). The pool block highlights while a valid hand drag hovers it; a little padding + a
   min-height keep it an easy target even when the pool is empty. */
.pool-block { border-radius: 8px; padding: 0.2rem 0.3rem; min-height: 2.2rem; transition: box-shadow 0.12s ease, background 0.12s ease; }
.pool-block.pool-drop-target { box-shadow: inset 0 0 0 2px var(--hero); background: color-mix(in srgb, var(--hero) 10%, transparent); }

/* Attack stat modifier chips (Option C): sit beside the active attack card, showing net SPD/DMG
   change from the printed base - green = buffed, red = nerfed - so you can read what's applied at a
   glance without the log. Absolutely positioned so they don't disturb the card row's layout. */
.stat-mods { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 4px;
  display: flex; flex-direction: column; gap: 3px; z-index: 8; pointer-events: none; }
.stat-mod { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap;
  font-size: 0.62rem; font-weight: 800; border-radius: 999px; padding: 1px 7px; border: 1px solid;
  background: color-mix(in srgb, var(--glass, #0a0d11) 92%, transparent); box-shadow: 0 1px 4px color-mix(in srgb, var(--shade, #000) 50%, transparent); font-variant-numeric: tabular-nums; }
.stat-mod .sm-arrow { font-size: 0.5rem; }
.stat-mod .sm-src { font-weight: 600; color: var(--text-dim); } /* source card name, dimmer than the ±value */
.stat-mod.up { color: color-mix(in srgb, #43c47a, var(--text) var(--ink-mix, 0%)); border-color: #43c47a; }
.stat-mod.down { color: color-mix(in srgb, #e0574d, var(--text) var(--ink-mix, 0%)); border-color: #e0574d; }

/* Response / choice options (rival-choice-pick): compact centred buttons, card thumbnail when the option is about one card. */
.choice-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0.35rem auto 0; max-width: 980px; }
.choice-options .choice-opt { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 340px; text-align: left; white-space: normal;
  line-height: 1.25; padding: 0.35rem 0.6rem; font-size: 0.78rem; }
.choice-options .co-thumb { width: 34px; height: 47px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; box-shadow: 0 1px 3px color-mix(in srgb, var(--shade, #000) 50%, transparent); }
.choice-options .co-thumb-solo { padding: 2px; margin-right: 1.4rem; background: transparent; border: 1px solid color-mix(in srgb, var(--hi, #fff) 18%, transparent); border-radius: 6px; flex: 0 0 auto; }
.choice-options .co-thumb-solo .co-thumb { width: 44px; height: 61px; display: block; }
@media (max-width: 820px) { .choice-options .choice-opt { min-height: 3rem; min-width: 7rem; font-size: 1.05rem; } }
.choice-options .choice-decline { align-self: center; font-size: 0.78rem; padding: 0.35rem 0.8rem; }
/* Attack stat badges (zone / SPD / DMG) - always shown beside the active attack; each opens its history (buildAttackStatBadges). */
/* Capped at the card's height and wrapping into further columns: at a small card size (phones at 35%) the three stacked badges were
   taller than the card-pool row, which clipped the zone and DMG badges away (Discord). */
.stat-badges { pointer-events: auto; gap: 4px; flex-wrap: wrap; align-content: flex-start; max-height: 100%; }
.stat-badge { display: inline-flex; align-items: baseline; justify-content: center; gap: 4px; min-width: 2.2rem; cursor: pointer;
  font-size: 0.78rem; font-weight: 800; border-radius: 8px; padding: 2px 8px; border: 1.5px solid var(--line-bright);
  background: color-mix(in srgb, var(--glass, #0a0d11) 95%, transparent); color: var(--text); box-shadow: 0 1px 4px color-mix(in srgb, var(--shade, #000) 50%, transparent); font-variant-numeric: tabular-nums; }
.stat-badge .sb-lab { font-size: 0.56rem; letter-spacing: 0.05em; color: var(--text-dim); font-weight: 700; }
.stat-badge.zone-h { border-color: #e0574d; color: color-mix(in srgb, #ff8b80, var(--text) var(--ink-mix, 0%)); }
.stat-badge.zone-m { border-color: #ef9a3d; color: color-mix(in srgb, #ffb766, var(--text) var(--ink-mix, 0%)); }
.stat-badge.zone-l { border-color: #f2e420; color: color-mix(in srgb, #f6ec6a, var(--text) var(--ink-mix, 0%)); }
.stat-badge.up { border-color: #43c47a; } .stat-badge.up .sb-val { color: color-mix(in srgb, #43c47a, var(--text) var(--ink-mix, 0%)); }
.stat-badge.down { border-color: #e0574d; } .stat-badge.down .sb-val { color: color-mix(in srgb, #e0574d, var(--text) var(--ink-mix, 0%)); }
.stat-history { margin-top: 2px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-bright); background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent);
  font-size: 0.68rem; line-height: 1.45; white-space: nowrap; box-shadow: 0 4px 12px color-mix(in srgb, var(--shade, #000) 60%, transparent); }
.stat-history .sh-title { font-weight: 800; color: var(--hero); margin-bottom: 2px; }
/* z51110 (Discord "Action Cards"): room for the live attack's stat badges before the next card in the card pool (app.js z51110PoolBadgeRoom). */
.zone-row > .card-slot.z51110-atk-room { margin-right: var(--z51110-room, 4.6rem); }
/* w31110 (Discord "Highlight"): a sideways-scrolling stage / card pool row glows on the edge a card scrolled out of view played an ability
   from - the ability's colour (p51108-k-*; Enhance yellow), the card flashes' 1.2s timing (app.js w31110EdgeGlows). */
.w31110-edge-host { position: relative; }
.w31110-edge { position: absolute; width: 12px; pointer-events: none; z-index: 6; border-radius: 6px;
  animation: w31110-edge 1.2s ease-out var(--p51108-delay, 0ms) 1 both; }
.w31110-edge-left { background: linear-gradient(to right, var(--p51108-c), transparent); }
.w31110-edge-right { background: linear-gradient(to left, var(--p51108-c), transparent); }
.w31110-edge.p51108-k-enhance { --p51108-c: #ffd84a; }
@keyframes w31110-edge {
  0% { opacity: 0; box-shadow: 0 0 0 0 transparent; }
  12%, 70% { opacity: 1; box-shadow: 0 0 14px 4px var(--p51108-c); }
  100% { opacity: 0; box-shadow: 0 0 14px 4px var(--p51108-c); }
}
/* Current-value totals (base → current) - more prominent than the delta chips: the resulting stat. */
.stat-total { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap;
  font-size: 0.72rem; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line-bright);
  background: color-mix(in srgb, var(--glass, #0a0d11) 95%, transparent); box-shadow: 0 1px 4px color-mix(in srgb, var(--shade, #000) 50%, transparent); font-variant-numeric: tabular-nums; }
.stat-total .st-lab { font-size: 0.56rem; letter-spacing: 0.05em; color: var(--text-dim); font-weight: 700; }
.stat-total .st-old { color: var(--text-dim); text-decoration: line-through; font-size: 0.62rem; }
.stat-total .st-arrow { color: var(--text-dim); font-size: 0.58rem; }
.stat-total .st-cur { font-weight: 800; color: var(--text); }
.stat-total.up { border-color: color-mix(in srgb, #43c47a 60%, var(--line-bright)); }
.stat-total.up .st-cur { color: color-mix(in srgb, #43c47a, var(--text) var(--ink-mix, 0%)); }
.stat-total.down { border-color: color-mix(in srgb, #e0574d 60%, var(--line-bright)); }
.stat-total.down .st-cur { color: color-mix(in srgb, #e0574d, var(--text) var(--ink-mix, 0%)); }

/* ---- card display ---- */
/* Was a fixed 92px regardless of viewport size - the whole in-match board is built to fit one
   viewport (see body.in-match), so on a very wide window the cards just stayed small and centered,
   leaving large empty margins on both edges instead of using the space. Scales with the SMALLER of
   viewport width/height (min()) so a tall-but-narrow window can't push cards into vertical overflow
   the same way a wide one pushes them horizontally; clamped to today's 92px as the floor (zero
   visual change on a normal-sized window) and 132px as a deliberately modest ceiling (not verified
   in a real browser this session - if it still looks cramped or, at the other end, too large/
   overflowing on some window sizes, the ceiling/vw-vh ratio here is the one place to retune). */
/* --card-scale is a user-set multiplier (the in-match "card size" slider, persisted per browser -
   see buildCardSizeControl/applyCardScale). It scales every board card that sizes off :root's
   --card-w (stage, pool, character, momentum, opponent), giving the felt more or less room; fixed
   overrides (action panel, hand peek, focus rail, mini) set --card-w directly and so are unaffected. */
:root { --card-scale: 0.9; --card-w: calc(clamp(92px, min(6vw, 9vh), 132px) * var(--card-scale)); --card-h: calc(var(--card-w) * 7 / 5); }

/* In-match card-size slider (lives in the match top bar). */
.card-size-control { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--text-dim); }
.card-size-control .cs-label { white-space: nowrap; }
.card-size-control input[type="range"] { width: 96px; height: 3px; accent-color: var(--hero); cursor: pointer; }
.card-size-control .cs-val { font-variant-numeric: tabular-nums; color: var(--text); min-width: 2.4em; text-align: right; }

/* Fixed square-ish slot so a 90deg-rotated (committed) card doesn't collide
   with its neighbors in the row - the slot is sized to fit either orientation. */
.card-slot {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-h);
  height: var(--card-h);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* --card-h is declared once at :root as calc(var(--card-w) * 7 / 5) - a nested var() reference
   inside a custom property does NOT recompute just because the referenced property (--card-w) is
   overridden lower in the cascade; it keeps resolving against the root's --card-w (92px) unless
   --card-h is ALSO redeclared at this same selector. Without this second line, a "mini" card's
   width shrinks to 52px but its height stays at the full 128.8px - a squished, sliver-like render. */
.card-slot.mini { --card-w: 52px; --card-h: 72.8px; }
/* agAA2-1106 Block Total Difficulty: over the block icon in the card's top-right corner (.card-slot is a card-h square, the card is
   centred in it, so the card's right edge sits (card-h - card-w) / 2 in from the slot's) */
.card-slot .aa2-bt {
  position: absolute; z-index: 6; top: 1px; right: calc((var(--card-h) - var(--card-w)) / 2 + 1px);
  min-width: calc(var(--card-w) * 0.26); padding: 0.05em 0.25em; border-radius: 5px; text-align: center;
  font-size: max(9px, calc(var(--card-w) * 0.15)); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums;
  color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.55); border: 1px solid rgba(0,0,0,0.45); pointer-events: none; white-space: nowrap;
}
.card-slot .aa2-bt-H { background: #d32f2f; }
.card-slot .aa2-bt-M { background: #ef7d00; }
.card-slot .aa2-bt-L { background: #f5c400; color: #1d1a00; }
/* z31110: a check modifier next to the block difficulty ("13H +5") - smaller, on a dark chip so it reads as a separate number */
.card-slot .aa2-bt .z31110-bt-c { margin-left: 0.2em; padding: 0 0.22em; border-radius: 4px; font-size: 0.82em; background: rgba(0,0,0,0.42); color: #fff; }
.card-slot .aa2-bt .z31110-bt-c.z31110-pos { color: #9dffb0; }
.card-slot .aa2-bt .z31110-bt-c.z31110-neg { color: #ffb3b3; }

.card-chip {
  width: var(--card-w);
  cursor: default;
}
.card-chip.clickable .card-flip-outer { cursor: pointer; }
/* agT3-1111: a face down attack (Lady Nagant / Unexpected Outcomes / Beauregard) - its attack on the card back */
.card-chip.t31111-fd-atk-chip { position: relative; }
.t31111-fd-atk { position: absolute; left: 6%; right: 6%; bottom: 8%; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 4px; border-radius: 6px; background: rgba(12, 14, 22, 0.86); color: #f4f4f8; border: 1px solid #ffa94d; font-size: 0.62rem; line-height: 1.15; text-align: center; }
.t31111-fd-atk.zone-h { border-color: #ff6b6b; }
.t31111-fd-atk.zone-l { border-color: #ffd84a; }
.t31111-fd-atk .t3-n { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t31111-fd-atk .t3-s { opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.i-fd-back.t31111-fd-back { position: relative; }
.i-fd-back.t31111-fd-back .t31111-fd-atk { font-size: 0.85rem; }
.t31111-fd-note { opacity: 0.85; }
@media (max-width: 820px) { .action-panel.flow-bar .empty-note.t31111-echo-note { display: block; text-align: center; } } /* agT3-1111: why Echo cannot replay it - shown on phones too */
@media (max-width: 820px) { .action-panel.flow-bar .empty-note.gp1-taunt-note { display: block; text-align: center; } } /* gp1 The Smiling Titan: why only that backup is offered - shown on phones too */
.empty-note.r79fm-note { color: var(--hero); font-style: normal; } /* r79fm: why the Combat Phase pass was refused */
@media (max-width: 820px) { .action-panel.flow-bar .empty-note.r79fm-note { display: block; text-align: center; } } /* r79fm: shown on phones too */
.card-chip.clickable:hover .card-face.front { border-color: var(--hero); }
.card-chip.selected .card-face.front { outline: 3px solid var(--good); outline-offset: -3px; }
/* Click-to-act: a legal ability source pulses gold right where it already sits on the board -
   character portrait, stage, hand, card pool - so there's no need to hunt a row of chips inside
   the side panel to find it. Once actually selected it stops pulsing and shows the same green
   ring .selected already uses everywhere else (the 3-class .eligible.selected selector below wins
   specificity over .eligible alone, so this never depends on CSS source order). */
.card-chip.eligible .card-face.front { outline: 3px solid var(--hero); outline-offset: -3px; animation: eligible-pulse 1.4s ease-in-out infinite; }
.card-chip.eligible.selected .card-face.front { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
/* A card whose Response is being offered right now (engine offerResponse): a green pulse - the Response color. */
.card-chip.response-offer .card-face.front { outline: 3px solid #b5d865; outline-offset: -3px; animation: response-offer-pulse 1.4s ease-in-out infinite; }
@keyframes response-offer-pulse { 0%, 100% { outline-color: #b5d865; } 50% { outline-color: transparent; } }
@keyframes eligible-pulse { 0%, 100% { outline-color: var(--hero); } 50% { outline-color: transparent; } }
/* Review Step click-to-act: teal instead of the gold .eligible uses elsewhere, since reviewing
   discards the card - a different, one-way outcome from playing it, so it deliberately doesn't look
   like "this card is about to be played." Selecting one (before Confirm) reuses the same green
   .selected ring as everywhere else; every OTHER hand card dims (see chip()'s `dimmed` param) so
   the pending pick reads clearly while it's still awaiting confirmation. */
.card-chip.review-pick .card-face.front { outline: 3px solid var(--tide); outline-offset: -3px; animation: review-pulse 1.4s ease-in-out infinite; }
.card-chip.review-pick.selected .card-face.front { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
@keyframes review-pulse { 0%, 100% { outline-color: var(--tide); } 50% { outline-color: transparent; } }
.card-chip.dimmed { opacity: 0.45; }
.card-chip.dimmed .card-face.front { animation: none; outline-color: transparent; }
/* Commit-to-check click-to-act: violet (reuses --c-character, already the character-card-type
   accent) so it reads as its own distinct thing from gold "play" and teal "review" - committing
   toward a check is a cost paid on the character/stage cards themselves, not a card being played or
   discarded. Selecting one reuses the same green .selected ring as everywhere else. */
.card-chip.commit-pick .card-face.front { outline: 3px solid var(--c-character); outline-offset: -3px; animation: commit-pulse 1.4s ease-in-out infinite; }
.card-chip.commit-pick.selected .card-face.front { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
@keyframes commit-pulse { 0%, 100% { outline-color: var(--c-character); } 50% { outline-color: transparent; } }
/* Block Step click-to-act: blue (reuses --c-action, already the Action-card-type accent) - its own
   distinct color from gold "play", teal "review", and violet "commit". Selecting one reuses the same
   green .selected ring as everywhere else. */
.card-chip.block-pick .card-face.front { outline: 3px solid var(--c-action); outline-offset: -3px; animation: block-pulse 1.4s ease-in-out infinite; }
.card-chip.block-pick.selected .card-face.front { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
@keyframes block-pulse { 0%, 100% { outline-color: var(--c-action); } 50% { outline-color: transparent; } }
/* Roman Cancel Blue click-to-act: magenta (reuses --c-backup, already the Backup-card-type accent) -
   only ever applied to the RIVAL's stage (see canRcBlueTargetPick in renderSide), and only once
   armed via the sidebar badge - this one deliberately does NOT glow just because it's legally
   available, see rcBlueArmed's own comment. Selecting one reuses the same green .selected ring. */
.card-chip.rc-blue-pick .card-face.front { outline: 3px solid var(--c-backup); outline-offset: -3px; animation: rc-blue-pulse 1.4s ease-in-out infinite; }
.card-chip.rc-blue-pick.selected .card-face.front { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
@keyframes rc-blue-pulse { 0%, 100% { outline-color: var(--c-backup); } 50% { outline-color: transparent; } }
/* A FACE-DOWN card in a pick state shows its BACK face (the front is scaleX(0)/opacity:0, see
   .card-chip.flipped rules below), so the selectable glow above - applied to .front - was invisible.
   A face-down card in your stage is a valid foundation to commit toward a check, so this made
   face-down foundations look un-selectable (reported: "can't select face down foundations to pass
   checks"). Mirror each pick glow (and the green selected ring) onto the back face when flipped. */
.card-chip.commit-pick.flipped .card-face.back { outline: 3px solid var(--c-character); outline-offset: -3px; animation: commit-pulse 1.4s ease-in-out infinite; }
.card-chip.commit-pick.selected.flipped .card-face.back { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
.card-chip.block-pick.flipped .card-face.back { outline: 3px solid var(--c-action); outline-offset: -3px; animation: block-pulse 1.4s ease-in-out infinite; }
.card-chip.block-pick.selected.flipped .card-face.back { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
.card-chip.rc-blue-pick.flipped .card-face.back { outline: 3px solid var(--c-backup); outline-offset: -3px; animation: rc-blue-pulse 1.4s ease-in-out infinite; }
.card-chip.rc-blue-pick.selected.flipped .card-face.back { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
/* r51c (Discord "Target window face down", Andy 2026-11-16): every selection window (y1SelWindow in the card-focus rail or centered, the
   older pile / rail pickers, singlePickerRow, multiPickerRow) marks a picked card .selected, and its green ring was drawn on the FRONT
   face only. A face down card shows its BACK (a rival's face down card, a Goldfish-hidden card, a server-hidden face down momentum card),
   so picking one only moved the "1 of 2 selected" count. Same ring on the back face; your own see-through face down cards
   (pick-facedown: the back at 55% over the art) get it on the back too so it reads full green. Like a face up card, the hover ring
   still shows while a mouse pointer rests on the card (the :not(:hover) keeps the see-through case the same). Touch screens: a tap leaves
   :hover stuck on the tapped card, so there the hover ring hid the ring of the card you had just picked (face up or down) - on a
   hover-less screen the selected ring wins. */
.card-chip.selected.flipped .card-face.back,
.card-slot.pick-facedown .card-chip.selected:not(:hover) .card-face.back { outline: 3px solid var(--good); outline-offset: -3px; }
@media (hover: none) {
  .card-chip.selected.inspectable:not(.longpress-armed):hover .card-face.front,
  .card-chip.selected.flipped.inspectable:not(.longpress-armed):hover .card-face.back,
  .card-slot.pick-facedown .card-chip.selected.inspectable:not(.longpress-armed):hover .card-face.back { outline: 3px solid var(--good); outline-offset: -3px; }
}
.card-chip.inspectable .card-flip-outer { cursor: pointer; }
.card-chip.inspectable:hover .card-face.front,
.card-chip.inspectable:hover .card-face.back { outline: 2px solid var(--hero); outline-offset: 1px; }

/* A 2D scale+crossfade flip instead of a true 3D rotateY: headless/software
   rendering can fail to composite <img> content inside a backface-visibility:
   hidden layer even at 0deg, so this avoids perspective/preserve-3d/backface
   entirely while still reading as a "flip" - squish to an edge, reveal the
   other face, unsquish. */
.card-flip-outer {
  width: var(--card-w);
  height: var(--card-h);
  position: relative;
}
.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
}
.card-face {
  position: absolute; inset: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--shade, #000) 45%, transparent);
  background: var(--panel-2);
  transition: transform 0.28s ease, opacity 0.22s ease;
}
.card-face.front { transform: scaleX(1); opacity: 1; }
.card-face.back { transform: scaleX(0); opacity: 0; }
.card-chip.flipped .card-face.front { transform: scaleX(0); opacity: 0; }
.card-chip.flipped .card-face.back { transform: scaleX(1); opacity: 1; }
.card-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-face.back {
  background: repeating-linear-gradient(135deg, var(--panel-2) 0 10px, var(--panel) 10px 20px);
  display: flex; align-items: center; justify-content: center;
}
/* agG-1105 (Discord "Facedown Cards"): the Card Info window of a rival's private face down card - just a card back. */
.inspector .i-art .i-fd-back {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, var(--panel-2) 0 10px, var(--panel) 10px 20px);
}
.inspector .i-art .i-fd-back .glyph {
  width: 55%; aspect-ratio: 1; border: 3px solid var(--tide); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--tide);
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 1.6rem;
}
/* agG-1105 Drag Mode (touch): the lifted card follows the finger; the drop target gets a dashed ring. */
.td-ghost { position: fixed; z-index: 10050; pointer-events: none; margin: 0; opacity: 0.92; transform: scale(1.06) rotate(-2deg); filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--shade, #000) 55%, transparent)); }
.card-slot.td-source { opacity: 0.35; }
.td-over { outline: 2px dashed var(--good); outline-offset: 3px; border-radius: 10px; }
body.td-dragging { user-select: none; -webkit-user-select: none; }
.card-face.back .glyph {
  width: 55%; aspect-ratio: 1; border: 3px solid var(--tide); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--tide);
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 1.4rem;
}
/* No art available (fallback): show type-colored placeholder with the name */
.card-face.no-art {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0.3rem; font-size: 0.56rem; gap: 0.2rem;
  border-left: 4px solid var(--c-foundation); color: var(--text);
}
.card-face.no-art.foundation { border-left-color: var(--c-foundation); }
.card-face.no-art.attack { border-left-color: var(--c-attack); }
.card-face.no-art.asset { border-left-color: var(--c-asset); }
.card-face.no-art.action { border-left-color: var(--c-action); }
.card-face.no-art.backup { border-left-color: var(--c-backup); }
.card-face.no-art.character { border-left-color: var(--c-character); }
.card-face.no-art.token { border-left: none; }

/* committed = physically rotated 90deg clockwise, per the actual rule */
.card-chip.committed { transform: rotate(90deg); }
/* (No gold border on committed cards any more: it was the same color as the "you can play this" glow, so a committed card looked
   like it was prompting an activation - suggested on Discord. The 90deg turn already says "committed".) */

/* Tap / untap animation (requested: "animations of the cards committing and readying ... people do
   like to see their cards tap"). These are one-shot ANIMATIONS rather than a `transition: transform`
   because render() rebuilds the board from scratch every frame - a newly-created chip already
   carrying .committed has no previous transform to transition from, so a transition would never
   play. app.js diffs committed state between renders (computeCommitAnimations) and only stamps
   .tap-commit / .tap-ready on the chips that actually changed this frame.
   Each animation ENDS on the orientation the chip's own resting rule already gives it (90deg with
   .committed, 0 without), so nothing snaps back when the animation finishes. The slight overshoot
   past 90 lands with a bit of physical weight, like tapping a real card. */
.card-chip.tap-commit { animation: tap-commit 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) both; }
.card-chip.tap-ready { animation: tap-ready 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) both; }
@keyframes tap-commit { from { transform: rotate(0deg); } to { transform: rotate(90deg); } }
@keyframes tap-ready { from { transform: rotate(90deg); } to { transform: rotate(0deg); } }
/* Respect a reduced-motion preference: the orientation still changes, it just doesn't sweep. */
@media (prefers-reduced-motion: reduce) {
  .card-chip.tap-commit, .card-chip.tap-ready { animation: none; }
}

.card-chip.hidden .card-face { display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-style: italic; font-size: 0.62rem; }
.card-chip.hidden.inspectable .card-flip-outer { cursor: default; }

/* frozen: a small badge in the corner instead of a text label - space is tight on the board */
.card-slot.frozen::after {
  content: "❄"; position: absolute; top: -4px; right: -4px; z-index: 5;
  background: var(--tide-deep); color: var(--on-tide-deep, white); border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 0.65rem; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}

/* sealed: same corner-badge look as frozen, but a real child element (not ::before/::after) -
   frozen and stamina already claim both pseudo-element slots on .card-slot, and a sealed Backup
   can need to show its stamina badge at the same time. Top-left corner, opposite frozen. A sealed
   card stays face up (no flip transform), only its abilities are disabled. */
.card-slot .facedown-badge {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  background: rgba(10,14,30,0.88); color: #fff; border: 1px solid var(--hero); border-radius: 999px; padding: 0.1rem 0.5rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; pointer-events: none;
}
.card-slot .sealed-badge {
  /* centered ABOVE the card rather than at its corner (suggested on Discord) */
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--c-character); color: white; border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 0.62rem; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}

/* backup stamina: current/max, bottom-right corner (opposite the frozen badge) so a frozen backup
   can show both at once without collision */
.card-slot.has-stamina::before {
  content: attr(data-stamina); position: absolute; bottom: -4px; right: -4px; z-index: 5;
  background: var(--bad); color: white; border-radius: 999px; padding: 0.05rem 0.35rem;
  font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}

/* generic named counters (King Ghidorah/Blood/Destoroyah/Kiryu, etc.): a strip along the TOP of the
   card. Every corner is already taken - sealed (top-left), frozen (top-right), stamina
   (bottom-right), and bottom-left holds BOTH the old counter pills and .stack-count, which collided
   outright on any fanned duplicate stage stack.

   Sized to the CARD, not the slot: .card-slot is a square sized to fit a 90deg-rotated committed
   card, so its left/right edges sit ~(--card-h - --card-w)/2 outside the card's own edges. Centering
   a --card-w-wide strip and insetting it 5px from the card's top clears the sealed/frozen badges
   (which sit at the slot's outer corners, 4px further out again) in both axes. Left-aligned so the
   first counter stays visible on a half-overlapped stack, where later cards cover the right side. */
.counter-gems {
  position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: calc(var(--card-w) - 10px); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 3px; align-items: flex-start; pointer-events: none;
}
/* A committed card is rotated 90deg inside the same square slot, so its visible top edge drops to
   (--card-h - --card-w)/2 and it spans the slot's full width. Without this the strip hangs in the
   empty space above the rotated card, reading as detached from it. */
.card-slot.rotated .counter-gems {
  top: calc((var(--card-h) - var(--card-w)) / 2 + 5px);
  width: calc(var(--card-h) - 10px);
}
/* Role, not counter name: 16 names today and every set adds more, but stock/scale/hazard is stable.
   Deliberately outside the amber="you" / teal="opponent" semantics the board already teaches - these
   describe a card's own state, not whose card it is. */
.counter-gem {
  --cg: var(--c-foundation);
  display: flex; align-items: center; gap: 0.22rem;
  background: linear-gradient(180deg, var(--panel-3), var(--panel));
  border: 1px solid var(--cg); border-left: 3px solid var(--cg); border-radius: 4px;
  padding: 0.08rem 0.28rem 0.08rem 0.22rem;
  box-shadow: 0 2px 7px color-mix(in srgb, var(--shade, #000) 55%, transparent);
  max-width: 100%; overflow: hidden;
}
.counter-gem.role-stock  { --cg: #d9a441; }
.counter-gem.role-scale  { --cg: #4fb8c9; }
.counter-gem.role-hazard { --cg: #e0574f; }
.counter-gem .cg-n {
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 0.74rem; font-weight: 700;
  line-height: 1; color: var(--cg); font-variant-numeric: tabular-nums;
}
.counter-gem .cg-of { font-size: 0.5rem; color: var(--text-dim); font-variant-numeric: tabular-nums; line-height: 1; }
.counter-gem .cg-lbl {
  font-size: 0.5rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700;
  color: var(--text-dim); line-height: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 5.5em;
}
/* One step from a hazard threshold firing (Nagoriyuki at 3 of 4 Blood). Gated that tightly on
   purpose - a badge that pulses all game stops being a warning. */
.counter-gem.armed { animation: counter-armed 1.5s ease-in-out infinite; }
.counter-gem.armed .cg-of { color: var(--cg); }
@keyframes counter-armed {
  0%, 100% { box-shadow: 0 2px 7px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
  50% { box-shadow: 0 0 0 2px rgba(224,87,79,0.45), 0 2px 7px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
}
/* Mini chips (52px) have no room for a name - the count and its role colour still carry. This is
   the one place the strip takes pointer events: with the label hidden, the title tooltip is the
   only way to read which counter it is. At full size the label is already on screen, so the strip
   stays click-through (above) and can never intercept a click meant for the card itself - it spans
   the card's full width, unlike the 18px corner badges that already sit in the click path. */
.card-slot.mini .counter-gems { top: 3px; gap: 2px; }
.card-slot.mini .counter-gem { padding: 0.05rem 0.2rem; border-left-width: 2px; pointer-events: auto; }
.card-slot.mini .counter-gem .cg-lbl { display: none; }
@media (prefers-reduced-motion: reduce) {
  .counter-gem.armed { animation: none; box-shadow: 0 0 0 2px rgba(224,87,79,0.5), 0 2px 7px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
}

/* ---- tokens ---- */
/* agC-1103 (suggested on Discord): a token is drawn as a real card - its printed art in a portrait card shape - not a round marker.
   Round 7e (Discord, "Turn the Token Cards Back to regular card size"): the same size as any other card; Power tokens stack into one
   pile beside the character (app.js powerTokenPile) instead of fanning out sideways. */
.token-chip {
  width: var(--card-w); height: var(--card-h); border-radius: 6px;
  background: linear-gradient(160deg, #4a5568, #1a2029 75%);
  border: 1px solid rgba(245, 197, 66, 0.75);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-weight: 700; font-size: 0.62rem; line-height: 1.1;
  color: var(--hero); box-shadow: 0 3px 8px color-mix(in srgb, var(--shade, #000) 45%, transparent); cursor: default; flex: 0 0 auto;
  overflow: hidden; /* clips the card art to the rounded card corners */
}
.token-chip .token-name { padding: 0 2px; }
.token-chip.clickable { cursor: pointer; }
.token-chip.clickable:hover { border-color: var(--good); }
.token-chip.selected { outline: 2px solid var(--good); outline-offset: 2px; }
/* Real printed art (Roman Cancel / Power / Heat token), when available - fills the same small card the name fallback above uses, so a
   missing/broken image (wireArtFallback, app.js) swaps back with no layout shift. */
.token-chip img {
  width: 100%; height: 100%; object-fit: cover;
}

.token-badge {
  background: color-mix(in srgb, var(--glass, #0a0d11) 85%, transparent); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.2rem 0.55rem; font-size: 0.62rem; color: var(--text); white-space: nowrap;
}

.empty-note { color: var(--text-dim); font-size: 0.8rem; font-style: italic; }

.check-modifier { font-size: 0.85em; font-weight: 600; }
.check-modifier.positive { color: color-mix(in srgb, #4caf7d, var(--text) var(--ink-mix, 0%)); }
.check-modifier.negative { color: color-mix(in srgb, #e05a5a, var(--text) var(--ink-mix, 0%)); }

/* ---- inspector: hover to peek, double-click to pin (see wireInspect). Fixed-position slide-in
   panel on the right edge of the viewport (board-level, sibling of .board-layout - see render()'s
   own comment) instead of a normal-flow sidebar block, so peeking a card never eats into or
   resizes the Action Panel/log above/below it, and the board itself can use the full width the
   sidebar used to reserve. Slides in via `transform` (not `right`, cheaper to animate) driven by
   the .visible class; hidden state still renders off-screen so the slide has something to animate
   from/to rather than popping in. cancelHideInspector()/scheduleHideInspector() give it a short
   grace period so moving the mouse from the trigger card into the panel itself doesn't dismiss it
   mid-transit.
   Deliberately height-to-content (no `bottom` anchor stretching it to the viewport edge) - an
   earlier version filled the whole right edge top-to-bottom, which blanketed the board's own
   top-right corner (where an opponent's character/attack card can sit) and made it unclickable
   for Enhance while the panel was showing. `max-height` is just a safety cap for unusually long
   card text, not the normal resting height. */
.inspector {
  position: fixed; top: 4.2rem; right: 0.6rem; width: 300px; max-width: calc(100vw - 20px);
  max-height: calc(100vh - 5rem);
  background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent); border: 1px solid var(--hero); border-radius: 10px;
  padding: 0.7rem; box-shadow: 0 10px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent);
  overflow-y: auto; z-index: 44;
  transform: translateX(calc(100% + 20px)); transition: transform 0.18s ease;
  pointer-events: none;
}
/* Above the ability-focus view (60) and the pile/picker backdrop (70): a card hovered inside a picker still shows
   its text readably instead of sitting dimmed behind the overlay (suggested on Discord). */
.inspector { z-index: 80; }
.hover-zoom {
  position: fixed; z-index: 85; pointer-events: none; border-radius: 12px; overflow: hidden;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--shade, #000) 60%, transparent); opacity: 0; transition: opacity 0.12s ease;
}
.hover-zoom.visible { opacity: 1; }
.hover-zoom img { display: block; width: 100%; height: auto; }
.inspector.visible { transform: translateX(0); pointer-events: auto; }
.inspector.empty .i-content { display: none; }
.inspector .i-art {
  width: 100%; aspect-ratio: 5 / 7; border-radius: 8px; margin-bottom: 0.5rem; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: rgba(255,255,255,0.92); font-size: 0.8rem; text-align: center; padding: 0.4rem;
  border: 2px solid var(--line); background: var(--panel-2);
}
.inspector .i-art img { width: 100%; height: 100%; object-fit: cover; }
/* agO4-1108: an arena is printed landscape - Card Info shows the whole card in its own shape (not a portrait crop of its middle). */
.inspector .i-art:has(> img.o41108-land) { aspect-ratio: 7 / 5; }
.inspector .i-art img.o41108-land { object-fit: contain; }
.inspector .i-name { font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 0.95rem; margin-bottom: 0.1rem; }
.inspector .i-type { font-size: 0.64rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.inspector .i-stats { font-size: 0.64rem; color: var(--text-dim); margin-bottom: 0.35rem; line-height: 1.5; }
.inspector .i-desc { font-size: 0.7rem; line-height: 1.4; color: var(--text); max-height: 160px; overflow-y: auto; }
/* agF-1105 (Discord "[MOBILE] Card Info Text"): app.js formatCardTextHtml - one ability per line, the timing keywords in the printed
   keyword colours (same as the gained-keyword pills and the flow bar), reminder text in parentheses smaller and italic. */
.inspector .i-desc .ct-line + .ct-line { margin-top: 0.38em; }
.inspector .i-desc .ct-kw {
  display: inline-block; padding: 0 0.34em; border-radius: 3px; line-height: 1.3;
  font-family: "Chakra Petch", Impact, sans-serif; font-weight: 700; font-size: 0.92em; letter-spacing: 0.02em; color: #14170a;
}
.inspector .i-desc .ct-enhance { background: #f2e420; }
.inspector .i-desc .ct-response { background: #b5d865; }
.inspector .i-desc .ct-blitz { background: #e6aec9; }
.inspector .i-desc .ct-form { background: #b4dcea; }
.inspector .i-desc .ct-reminder { font-style: italic; font-size: 0.86em; color: var(--text-dim); }
.inspector .i-desc .ct-reminder-line { line-height: 1.3; }
.inspector .i-desc .ct-face-break { border-top: 1px dashed var(--line); margin: 0.45em 0; }
/* ug1114 (Discord "Keyword ability text"): the keyword ability lines Card Info adds (app.js k21112KwLinesHtml: "EX 2 Enhance Discard ...")
   read like printed reminder text - "(Deadlock—This ability can only be played if ...)": small, italic, dim, in parentheses, no keyword boxes. */
.inspector .i-desc .k21112-kwline { font-style: italic; font-size: 0.86em; line-height: 1.3; color: var(--text-dim); }
.inspector .i-desc .k21112-kwline::before { content: "("; }
.inspector .i-desc .k21112-kwline::after { content: ")"; }
.inspector .i-desc .k21112-kwline .ct-kw { background: none; color: inherit; padding: 0; border-radius: 0; font: inherit; letter-spacing: 0; line-height: inherit; display: inline; }
/* r21109 (Discord round 28 "Card Info"): the shared card-text renderer (app.js r21109Pills) - Card Info, the "Choose an action" window,
   offered Response / cancel windows, skill trees, the character preview. Ability headers keep their keyword prefix in the timing word's
   printed box ("Brawler/Brute Enhance", "First Form", "Deadlock Blitz"), keyword abilities take the colour of the ability they grant
   (static ones light blue), keyword traits stay plain. Same box colours as the flow bar / gained-keyword pills. */
.ct-kw {
  display: inline-block; padding: 0 0.34em; border-radius: 3px; line-height: 1.3;
  font-family: "Chakra Petch", Impact, sans-serif; font-weight: 700; font-size: 0.92em; letter-spacing: 0.02em; color: #14170a;
}
.ct-kw.ct-enhance { background: #f2e420; }
.ct-kw.ct-response { background: #b5d865; }
.ct-kw.ct-blitz { background: #e6aec9; }
.ct-kw.ct-form { background: #b4dcea; }
.ct-kw.ct-static { background: #a9d4f5; }
.ct-reminder .ct-kw { font-style: normal; font-size: 0.9em; line-height: 1.2; }
.r21109-ct .ct-reminder, .ability-preview .ct-reminder { font-style: italic; font-size: 0.86em; color: var(--text-dim); }
.ability-preview .ct-line + .ct-line { margin-top: 0.3em; }
.inspector .i-keywords .ct-trait { color: var(--text); }
.inspector .i-keywords .ct-kwa-enhance { color: color-mix(in srgb, #f2e420, var(--text) var(--ink-mix, 0%)); }
.inspector .i-keywords .ct-kwa-response { color: color-mix(in srgb, #b5d865, var(--text) var(--ink-mix, 0%)); }
.inspector .i-keywords .ct-kwa-blitz { color: color-mix(in srgb, #e6aec9, var(--text) var(--ink-mix, 0%)); }
.inspector .i-keywords .ct-kwa-static { color: color-mix(in srgb, #a9d4f5, var(--text) var(--ink-mix, 0%)); }
.inspector .i-keywords .ct-sep, .inspector .i-keywords .ct-gained { color: var(--text-dim); font-weight: 400; }
.inspector .i-close {
  position: absolute; top: 0.45rem; right: 0.55rem; cursor: pointer; color: var(--text-dim);
  display: none; font-size: 0.8rem; line-height: 1; background: var(--panel-2); border-radius: 50%;
  width: 18px; height: 18px; align-items: center; justify-content: center;
}
.inspector.locked .i-close { display: flex; }
.inspector .i-hint { font-size: 0.58rem; color: var(--text-dim); margin-top: 0.45rem; font-style: italic; border-top: 1px solid var(--line); padding-top: 0.35rem; }
/* q41112 (Discord "[DESKTOP] Context Menu"): Card Info on desktop - the flip button of a double-sided card, and the card's state notes in
   the keyword reminder look (.z51110-kw-reminder: small, italic, dim). Touch screens never get these (app.js q41112AfterShow). */
.inspector .q41112-flipbar { display: flex; justify-content: flex-end; margin: -0.15rem 0 0.4rem; }
.inspector .q41112-flip {
  font: inherit; font-size: 0.7rem; line-height: 1.2; padding: 0.22rem 0.6rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--hero); background: var(--panel-2); color: var(--text);
}
.inspector .q41112-flip:hover { background: var(--panel-3); }
.inspector .q41112-notes { margin: 0 0 0.45rem; padding-top: 0.1rem; border-top: 1px solid var(--line); }
.inspector .q41112-note { margin: 0.35rem 0.1rem 0; font-size: 0.72rem; line-height: 1.35; font-style: italic; color: var(--text-dim); }
/* Pinned on desktop (.q41112-wide): the art beside the printed text (an alternate art may not print it), the notes and hint below - about
   as tall as the art-only window it replaces, so it covers no more of the board's right edge. */
.inspector.q41112-wide { width: 450px; }
.inspector.q41112-wide .i-content { display: grid; grid-template-columns: 172px minmax(0, 1fr); column-gap: 0.75rem; align-items: start; }
.inspector.q41112-wide .i-art { grid-column: 1; grid-row: 1; margin-bottom: 0.4rem; }
.inspector.q41112-wide .q41112-flipbar { grid-column: 1; grid-row: 2; justify-content: center; margin: 0 0 0.4rem; }
.inspector.q41112-wide .i-text-fallback { grid-column: 2; grid-row: 1 / span 2; }
.inspector.q41112-wide .i-desc { max-height: 210px; }
.inspector.q41112-wide .q41112-notes { grid-column: 1 / -1; grid-row: 3; }
.inspector.q41112-wide .i-actions { grid-column: 1 / -1; grid-row: 4; }
.inspector.q41112-wide .i-hint { grid-column: 1 / -1; grid-row: 5; }
/* ug1114 (Discord "[DESKTOP] Context Menu"): pinned Card Info on desktop (app.js ug14InfoModal) is a centred window over a dimmed board, like
   the deck builder's card window - big art beside the printed text, the state / tracking notes under the text, < > to the zone's next card.
   Esc or a click on the dimmed area (.ug14-info-backdrop) closes it. Hovering a card still peeks in the corner (unchanged). */
.ug14-info-backdrop { display: none; position: fixed; inset: 0; z-index: 89; background: color-mix(in srgb, var(--scrim, #000) 62%, transparent); }
body:has(.inspector.ug14-modal.visible) .ug14-info-backdrop { display: block; }
.inspector.ug14-modal.visible {
  top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); transition: none; z-index: 90;
  width: min(900px, calc(100vw - 48px)); max-height: calc(100vh - 48px); padding: 1.4rem 3.2rem; border-radius: 14px;
  box-shadow: 0 24px 70px color-mix(in srgb, var(--shade, #000) 70%, transparent);
}
.inspector.ug14-modal .i-content { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); column-gap: 1.5rem; align-items: start; }
.inspector.ug14-modal .i-art { grid-column: 1; grid-row: 1 / span 3; margin-bottom: 0.5rem; border-radius: 12px; }
.inspector.ug14-modal .q41112-flipbar { grid-column: 1; grid-row: 4; justify-content: center; margin: 0 0 0.4rem; }
.inspector.ug14-modal .i-text-fallback { grid-column: 2; grid-row: 1; display: block !important; }
.inspector.ug14-modal .q41112-notes { grid-column: 2; grid-row: 2; margin-top: 0.7rem; }
.inspector.ug14-modal .i-actions { grid-column: 1 / -1; grid-row: 5; }
.inspector.ug14-modal .i-hint { grid-column: 1 / -1; grid-row: 6; font-size: 0.7rem; }
.inspector.ug14-modal .i-name { font-size: 1.45rem; margin: 0.1rem 2rem 0.15rem 0; }
.inspector.ug14-modal .i-type { font-size: 0.78rem; }
.inspector.ug14-modal .i-keywords { font-size: 0.92rem; }
.inspector.ug14-modal .i-stats { font-size: 0.82rem; }
.inspector.ug14-modal .i-desc { font-size: 0.92rem; line-height: 1.5; max-height: none; }
.inspector.ug14-modal .q41112-note { font-size: 0.84rem; }
.inspector.ug14-modal .i-close { width: 30px; height: 30px; font-size: 1rem; top: 0.8rem; right: 0.8rem; border: 1px solid var(--line); }
.inspector.ug14-modal .ug14-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 1.4rem; line-height: 1; padding: 0 0 2px;
  display: flex; align-items: center; justify-content: center;
}
.inspector.ug14-modal .ug14-nav:hover { border-color: var(--hero); background: var(--panel-3, var(--panel-2)); }
.inspector.ug14-modal .ug14-nav-prev { left: 0.6rem; }
.inspector.ug14-modal .ug14-nav-next { right: 0.6rem; }
.inspector:not(.ug14-modal) .ug14-nav { display: none; }
/* ug1114 (Discord "Cycling"): Goldfish - the deck's Mill X window (app.js ug14OpenMill); the deck hints it has a menu. */
.ug14-mill-deck { cursor: context-menu; }
.ug14-mill-panel .ug14-mill-note { font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; margin: 0.2rem 0 0.6rem; }
.ug14-mill-panel .ug14-mill-row { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.3rem 0 0.5rem; }
.ug14-mill-panel .ug14-mill-step { min-width: 40px; min-height: 40px; font-size: 1.2rem; }
.ug14-mill-panel .ug14-mill-n { width: 5.5rem; min-height: 40px; text-align: center; font: inherit; font-size: 1.1rem; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.ug14-mill-panel .ug14-mill-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin-bottom: 0.6rem; }
.ug14-mill-panel .ug14-mill-quick button { min-height: 36px; min-width: 44px; }
.ug14-mill-panel .ug14-mill-acts { display: flex; gap: 0.4rem; justify-content: flex-end; }
.ug14-mill-panel .ug14-mill-acts button { min-height: 40px; min-width: 88px; }
/* agF-1105 (Discord "Damage Glow"): app.js flashDamageGlow lays this over the board frame (.table) for ~0.5 s whenever a player's
   health goes down. Fixed + pointer-events:none, under the inspector (80) / pickers (70) / card-focus view (60). */
.damage-glow {
  position: fixed; z-index: 45; pointer-events: none; opacity: 0; border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 92, 92, 0.75), 0 0 14px 2px rgba(255, 60, 60, 0.38), inset 0 0 22px 1px rgba(255, 60, 60, 0.2);
}
.damage-glow.on { animation: damage-glow 0.55s ease-out; }
@keyframes damage-glow { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }

/* Card-focus action view (replaces the old anchored .ability-popover): clicking an eligible source
   zooms it to center-stage over the dimmed board, with its ability controls in an attached rail. The
   dim is translucent, so the HUD strip, log, and rival board stay glanceable while you decide - a
   deliberate "spotlight, not full takeover". */
.ability-focus {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.ability-focus-backdrop {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--fog, #060912) 66%, transparent);
  backdrop-filter: blur(1.5px); animation: focus-fade 0.16s ease;
}
@keyframes focus-fade { from { opacity: 0; } to { opacity: 1; } }
.ability-focus-stage {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 0;
  max-width: 96vw; animation: focus-zoom 0.2s cubic-bezier(0.2,0.7,0.3,1);
}
@keyframes focus-zoom {
  from { opacity: 0; transform: scale(0.7) translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ability-focus-backdrop, .ability-focus-stage { animation: none; }
}
.focus-card {
  flex: 0 0 auto; width: 168px; align-self: center;
  border-radius: 10px 0 0 10px; overflow: hidden;
  box-shadow: -2px 0 0 0 color-mix(in srgb, var(--shade, #000) 25%, transparent), 0 12px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent);
}
.focus-card img { display: block; width: 100%; height: auto; }
/* r63vx (Discord "Roman Cancel"): a re-render of an open action window doesn't replay its open animation (app.js r63vxFocusSettle) - no flicker. */
.ability-focus.r63vx-still .ability-focus-backdrop, .ability-focus.r63vx-still .ability-focus-stage { animation: none; }
.focus-card .card-face.no-art {
  width: 168px; height: 235px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0.5rem; font-weight: 700;
}
/* x11109 (Discord "Tekken Ball"): a definite width, not just a 320px flex-basis - Firefox sized the stage from the rail's UNWRAPPED text
   (max-content), up to 96vw, so the card + rail sat at the stage's left edge instead of the screen's center. */
.ability-focus-rail {
  flex: 0 1 auto; width: 320px; min-width: 250px; align-self: stretch;
  max-height: min(80vh, 480px); max-height: min(80dvh, 480px); overflow-y: auto;
  background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent); border: 1px solid var(--hero);
  border-radius: 0 10px 10px 0; padding: 0.65rem 0.75rem;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent); font-size: 0.78rem;
  /* Same fixed-size override the old popover needed - a nested momentum/foundation cost picker
     (multiPickerRow/singlePickerRow, e.g. Powerful/EX's "click momentum to spend") would otherwise
     inherit :root's viewport-scaled --card-w/--card-h, far too big for the rail. */
  --card-w: 92px;
  --card-h: 128.8px;
}
.ability-focus-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line);
  position: sticky; top: -0.65rem; background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent); z-index: 1;
}
.ability-focus-head span {
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--hero); font-weight: 700;
}
.ability-focus-close {
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0.15rem 0.3rem;
}
.ability-focus-close:hover { color: var(--text); }
/* "‹ back" from an in-rail target pick to the ability list (see openCardPickerInRail). */
.ability-focus-back {
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.72rem; padding: 0.15rem 0.2rem; flex: 0 0 auto;
}
.ability-focus-back:hover { color: var(--hero); }
/* Narrow screens: stack the rail under the card so neither is crushed. */
@media (max-width: 620px) {
  .ability-focus-stage { flex-direction: column; max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
  .focus-card { border-radius: 10px 10px 0 0; width: 150px; }
  .focus-card .card-face.no-art { width: 150px; height: 210px; }
  .ability-focus-rail { border-radius: 0 0 10px 10px; align-self: stretch; width: 100%; flex-basis: auto; }
  /* A big Play button so a thumb doesn't land on the card art above it (Discord). */
  .ability-focus-rail button.primary { min-height: 3.4rem; font-size: 1.15rem; width: 100%; margin-top: 0.4rem; }
}

/* agP4-1108 (Discord "Play buttom"): on desktop too, the action window's Play buttons span the card-text box above them, like on phones
   (keeps the desktop height/font - only the width changes). */
@media (min-width: 621px) {
  .ability-focus-rail button.primary { width: 100%; }
}
/* r63kw: the keyword-name window (Don't Use That Word / Time for Rest) - the chosen keyword wears the primary button colours (keeps its size). */
.r63kw-keywords button[aria-pressed="true"] { background: var(--hero-deep); border-color: var(--hero); color: var(--on-hero-deep, white); }
/* agP4-1108: a Power token you can use right now glows in your stage (tap it for its action window). */
.token-chip.p41108-eligible { outline: 3px solid var(--hero); outline-offset: -3px; animation: eligible-pulse 1.4s ease-in-out infinite; cursor: pointer; }
.token-chip.p41108-eligible.selected { animation: none; outline: 3px solid var(--good); outline-offset: -3px; }
.token-chip.r31111-committed { transform: rotate(90deg); } /* agR3-1111: a committed stage token is turned sideways like a card */
/* z51110 (Discord "Keywords Text"): the keyword's reminder text, small and quiet, under its "Play Stun: 1" button. */
.z51110-kw-reminder { margin: 0.35rem 0.1rem 0; font-size: 0.72rem; line-height: 1.35; font-style: italic; color: var(--text-dim); }
@media (max-width: 620px) { .z51110-kw-reminder { font-size: 0.82rem; } }

/* ---- click-driven ability picker (Blitz/Enhance): source chips -> per-source detail ---- */
.card-text {
  background: var(--panel-2); border-radius: 6px; padding: 0.55rem 0.65rem; font-size: 0.78rem;
  margin: 0.4rem 0; white-space: pre-wrap; line-height: 1.4;
}
.keyword-action {
  border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem;
  background: color-mix(in srgb, var(--hi, #fff) 2%, transparent);
}
.keyword-action p { margin: 0 0 0.35rem; font-size: 0.76rem; }
.keyword-action button { margin-top: 0.3rem; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 0.4rem; }

/* ---- pile viewer: browse an entire discard pile (or any other card list) ---- */
.pile-backdrop {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--scrim, #000) 65%, transparent); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
/* Goldfish Edit mode (testing tool) */
.edit-mode-btn.active { border-color: var(--hero); color: var(--hero); }
.edit-panel {
  position: fixed; left: 12px; bottom: 12px; z-index: 65; width: 340px; max-width: calc(100vw - 24px); max-height: 72vh; overflow-y: auto;
  background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent); border: 1px solid var(--hero); border-radius: 10px; padding: 0.6rem 0.7rem; box-shadow: 0 10px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent);
  font-size: 0.78rem;
}
.edit-panel .edit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; color: var(--hero); }
.edit-panel .edit-help { color: var(--text-dim); line-height: 1.4; margin: 0 0 0.5rem; }
/* agX4-1106 (Discord "Edit Mode Text"): the help text opens from a small ❓ next to the title. */
.edit-panel .edit-title { display: inline-flex; align-items: center; gap: 0.35rem; }
.edit-panel .edit-help-btn {
  background: none; border: 1px solid transparent; border-radius: 50%; width: 1.6rem; height: 1.6rem; padding: 0; line-height: 1;
  font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.edit-panel .edit-help-btn:hover, .edit-panel .edit-help-btn.open { border-color: var(--hero); background: var(--panel-2); }
.edit-panel .edit-sub { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.68rem; color: var(--text-dim); }
.edit-panel .edit-row { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; margin: 0.3rem 0; }
.edit-panel select, .edit-panel input { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.35rem; font-size: 0.76rem; }
.edit-panel input[type="search"] { width: 100%; box-sizing: border-box; }
.edit-panel input[type="number"] { width: 3.6rem; }
.edit-panel .edit-results { display: flex; flex-direction: column; gap: 0.2rem; max-height: 26vh; overflow-y: auto; margin-top: 0.35rem; }
.edit-panel .edit-results button { text-align: left; font-size: 0.74rem; padding: 0.25rem 0.45rem; }
.edit-panel .edit-health { margin-top: 0.5rem; }
.edit-panel .edit-hp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-dest-panel { max-width: 420px; }
.edit-dest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; margin: 0.5rem 0; }
/* agE-1103: Edit mode action buttons (flip / ready-commit / replace), Find a card thumbnails, the collection filter; the decklist printing
   picker and the "edit the list as text" box on the setup screen. */
.edit-dest-actions { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.5rem 0; }
.edit-dest-actions button { text-align: left; }
/* z61110 (Discord "Shortcuts" / "Tokens & Counters in Editor Mode"): the counters window, the shortcut list, the Space Full Pass pill. */
.z61110-counters { min-width: min(340px, 90vw); }
.z61110-crow { display: flex; align-items: center; gap: 0.4rem; margin: 0.3rem 0; }
.z61110-crow button { min-width: 2rem; padding: 0.2rem 0.45rem; }
.z61110-cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z61110-cval { min-width: 1.6rem; text-align: center; }
.z61110-cadd { margin-top: 0.6rem; }
.z61110-counters input { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.4rem; font-size: 0.8rem; }
.z61110-cin { flex: 1; min-width: 0; }
.z61110-cnum { width: 3.6rem; }
.z61110-help { max-width: min(640px, 94vw); }
.z61110-help h4 { margin: 0.8rem 0 0.3rem; font-size: 0.85rem; }
.z61110-keys { border-collapse: collapse; font-size: 0.8rem; width: 100%; }
.z61110-keys td { padding: 0.18rem 0.4rem; vertical-align: top; border-bottom: 1px solid var(--line); }
.z61110-keys td:first-child { white-space: nowrap; width: 1%; }
.z61110-keys kbd { display: inline-block; padding: 0.05rem 0.4rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font: 600 0.75rem/1.3 ui-monospace, monospace; background: var(--panel-2, transparent); }
.z61110-keys-btn { display: block; width: 100%; margin-top: 0.4rem; text-align: left; }
.z61110-fp-pill { position: fixed; left: 50%; top: 4.2rem; transform: translateX(-50%); z-index: 10040; pointer-events: none; padding: 0.3rem 0.8rem;
  border-radius: 999px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; background: #b8860b; color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.edit-panel .edit-results button.edit-hit { display: flex; align-items: center; gap: 0.45rem; }
.edit-panel .edit-thumb { flex: 0 0 auto; width: 26px; height: 36px; border-radius: 3px; overflow: hidden; background: var(--panel-2); }
.edit-panel .edit-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.edit-panel .edit-hit-name { flex: 1; min-width: 0; }
.edit-panel select.edit-set { width: 100%; box-sizing: border-box; }
/* r53c (Discord "Filter for Goldfish Panel"): Find a card - a card name + a card text search bar, card type chips, the deck builder's
   Filter menu (beside the panel; over it on a phone) and the results as a gallery of small cards (hover = the full art). */
.edit-panel .r53c-qrow { flex-wrap: nowrap; }
.edit-panel .r53c-qrow input[type="search"] { flex: 1 1 0; min-width: 0; width: auto; }
.edit-panel .r53c-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; margin: 0.3rem 0; }
.edit-panel .r53c-chip { font-size: 0.68rem; padding: 0.12rem 0.45rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; line-height: 1.35; display: inline-flex; align-items: center; gap: 0.25rem; }
.edit-panel .r53c-chip.on { border-color: var(--hero); background: color-mix(in srgb, var(--hero) 24%, var(--panel-2)); }
.edit-panel .r53c-fltbtn.open { border-color: var(--hero); }
.edit-panel .r53c-fltbtn b { background: var(--hero); color: #111; border-radius: 999px; padding: 0 0.32rem; font-size: 0.62rem; }
.edit-panel .r53c-clear { border-style: dashed; color: var(--text-dim); }
.edit-panel .r53c-count { color: var(--text-dim); font-size: 0.68rem; margin-top: 0.25rem; }
.edit-panel .edit-results.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 0.3rem; max-height: 34vh; align-content: start; }
/* r59e (Discord "Goldfish Card Panel"): a FIXED height - 4 rows of tiles (--r59e-row = the measured tile height, set by r59eGridRow) - so the
   panel stops jumping up and down as the results change; fewer results leave the space empty, more scroll. */
.edit-panel .edit-results.edit-grid { height: calc(4 * var(--r59e-row, 96px) + 3 * 0.3rem); max-height: 60vh; overflow-y: auto; }
@media (max-width: 820px) { .edit-panel .edit-results.edit-grid { height: min(calc(4 * var(--r59e-row, 96px) + 3 * 0.3rem), 24vh); } } /* r59e: phone - still a fixed height, sized to the docked panel */
.edit-panel .edit-results.edit-grid > .empty-note { grid-column: 1 / -1; margin: 0.2rem 0; }
.edit-panel .edit-results.edit-grid button.edit-hit { position: relative; flex-direction: column; align-items: stretch; gap: 0.1rem; padding: 2px; min-width: 0; text-align: center; }
.edit-panel .edit-results.edit-grid .edit-thumb { width: 100%; height: auto; aspect-ratio: 5 / 7; }
.edit-panel .edit-results.edit-grid .edit-hit-name { font-size: 0.56rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-panel .edit-results.edit-grid .edit-hit[data-r53c-n]::after { content: "×" attr(data-r53c-n); position: absolute; top: 3px; right: 3px; padding: 0 0.25rem; border-radius: 6px; font-size: 0.6rem; font-weight: 700; background: color-mix(in srgb, var(--shade, #000) 75%, transparent); color: #fff; }
/* r56 (Discord "Favorites"): a deck builder favorite shows a star on its Find a card tile (top left - the copies badge is top right) */
.edit-panel .edit-results .r56-favmark { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 999px; font-size: 0.62rem; line-height: 1; background: color-mix(in srgb, var(--shade, #000) 70%, transparent); color: #f2c76b; pointer-events: none; }
.edit-panel .edit-results:not(.edit-grid) .r56-favmark { position: static; display: inline-grid; margin-left: 0.3rem; }
.edit-panel .r56-favchip.on { border-color: #f2c76b; color: #f2c76b; }
.edit-panel .r53c-fltmenu { position: fixed; left: 360px; bottom: 12px; z-index: 66; width: 320px; max-width: calc(100vw - 372px); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--glass, #0a0d11); border: 1px solid var(--hero); border-radius: 10px; box-shadow: 0 10px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
.edit-panel .r53c-flt-head, .edit-panel .r53c-flt-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; padding: 0.4rem 0.6rem; }
.edit-panel .r53c-flt-head { border-bottom: 1px solid var(--line); color: var(--hero); }
.edit-panel .r53c-flt-head button { padding: 0.1rem 0.45rem; }
.edit-panel .r53c-flt-foot { border-top: 1px solid var(--line); }
.edit-panel .r53c-flt-body { overflow-y: auto; padding: 0 0.6rem; flex: 1 1 auto; min-height: 0; }
.edit-panel .r53c-sec { border-bottom: 1px solid var(--line); padding: 0.35rem 0; }
.edit-panel .r53c-sec:last-child { border-bottom: 0; }
.edit-panel .r53c-sec h4 { margin: 0 0 0.15rem; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.edit-panel .r53c-sec h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.edit-panel .r53c-lbl { min-width: 4.4rem; font-size: 0.7rem; color: var(--text-dim); }
.edit-panel .r53c-range { display: flex; align-items: center; gap: 0.3rem; margin: 0.2rem 0; }
.edit-panel .r53c-kwadd { display: flex; gap: 0.3rem; margin: 0.2rem 0; }
.edit-panel .r53c-kwadd input { flex: 1 1 auto; min-width: 0; }
.edit-panel .r53c-show { background: var(--hero-deep); border-color: var(--hero); color: var(--on-hero-deep, #fff); }
@media (max-width: 820px) { .edit-panel .r53c-fltmenu { left: 8px; right: 8px; width: auto; max-width: none; bottom: 8px; max-height: 70vh; } }
.deck-import-details .resolve-results .printing-pick { margin-left: 0.35rem; font-size: 0.7rem; padding: 0.1rem 0.2rem; background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright); }
.deck-import-details .deck-text-toggle, .deck-import-details .deck-text-check { margin: 0 0.4rem 0.55rem 0; }
@media (max-width: 820px) { .edit-panel { left: 8px; right: 8px; width: auto; bottom: 8px; max-height: 55vh; } }
/* The in-match top bar folds behind a gear button and opens as a pop-up panel; the win-chance bar and Coach are hidden to give the
   board the room (suggested on Discord for phones, then made the same on desktop). A puzzle's goal strip stays visible. */
@media all {
  #matchTopbar { justify-content: flex-end; }
  #matchTopbar > *:not(.topbar-gear):not(.puzzle-strip) { display: none !important; }
  #matchTopbar .topbar-gear { display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; padding: 0.2rem 0.6rem;
    position: fixed; top: 0.5rem; right: 0.5rem; z-index: 96; } /* pinned, so a long puzzle goal can never push it off-screen */
  #matchTopbar .puzzle-strip { max-width: calc(100vw - 10rem); }
  #matchTopbar.open { position: fixed; top: 0.5rem; right: 0.5rem; z-index: 95; flex-direction: column; align-items: stretch; gap: 0.5rem;
    width: min(300px, 92vw); max-height: 85vh; overflow-y: auto; padding: 0.7rem; background: color-mix(in srgb, var(--glass, #0a0d11) 98%, transparent);
    border: 1px solid var(--hero); border-radius: 12px; box-shadow: 0 12px 32px color-mix(in srgb, var(--shade, #000) 60%, transparent); }
  #matchTopbar.open > *:not(.topbar-gear) { display: flex !important; flex-wrap: wrap; }
  #matchTopbar.open { padding-top: 3rem; }
  /* s51108: inside the gear pop-up the Settings list was position:absolute, so the pop-up's own scroll box clipped it after ~3 options
     (and covered Copy Debug Info / Feedback / Exit Match) - it now opens in the pop-up's flow and pushes the rest down. */
  #matchTopbar.open .autoskip-menu { position: static; min-width: 0; flex-basis: 100%; box-shadow: none; margin-top: 0.45rem; }
  .winprob, .coach-btn { display: none !important; }
}
/* Phones: the attack stat badges were ~12px text (a 9px label) - unreadable without pinch-zoom (suggested on Discord). Sized off the
   card width there instead, so they grow with the card-size slider and stay legible at the default zoom. */
@media (max-width: 820px) {
  .stat-badge { font-size: max(0.95rem, calc(var(--card-w) * 0.17)); padding: 3px 9px; min-width: 2.6rem; }
  /* Top-aligned with the card, not centred: the rival's card-pool row can run past the bottom of its half at small sizes. */
  .stat-badges { top: 0; transform: none; }
  .stat-badge .sb-lab { font-size: max(0.66rem, calc(var(--card-w) * 0.11)); }
  .stat-history { font-size: 0.85rem; }
}
/* Phones: the action bar drops its helper text ("As the second player, you may mulligan any subset...") - the step chip, title and
   buttons say what to do, and the space matters more (suggested on Discord). Desktop keeps it. */
@media (max-width: 820px) { .action-panel.flow-bar > p.empty-note, .action-panel.flow-bar .empty-note { display: none; } }
.pile-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.2rem; max-width: 90vw; max-height: 85vh; max-height: 85dvh; overflow-y: auto;
}
.pile-header { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 0.8rem; }
.pile-header h3 { margin: 0; font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 1rem; }
.pile-grid { display: flex; flex-wrap: wrap; gap: 0.7rem; max-width: 900px; }
/* r75mu (round 75, owner request "Mulligan window"): app.js r75muRender - the opening mulligan in its own window, built on the selection
   window (pile-panel ysel-panel): header + "View board", who goes first and what differs (yours highlighted), the hand at a readable size,
   the footer with the instruction and the buttons. Phones: yours only, 4 cards a row, tighter spacing. */
.pile-backdrop.r75mu-backdrop { z-index: 70; }
.pile-panel.ysel-panel.r75mu-panel { width: min(980px, calc(100vw - 32px)); max-width: none; box-sizing: border-box; padding: 0.9rem 1.2rem 1rem; }
.r75mu-panel > .pile-header { margin-bottom: 0.35rem; }
.r75mu-panel > .pile-header h3 { font-size: 1.1rem; }
/* r80mc (Discord "Mull window"): the title and the "You go first / second" line are centred in the window - a 3-column header (empty | title |
   View board) keeps the title on the window's centre line with the button still at the right edge */
.r75mu-panel > .pile-header { display: grid; grid-template-columns: 1fr auto 1fr; }
.r75mu-panel > .pile-header h3 { grid-column: 2; text-align: center; }
.r75mu-panel > .pile-header .r75mu-hide { grid-column: 3; justify-self: end; }
.r75mu-panel .r75mu-order { text-align: center; }
.r75mu-panel .r75mu-order { margin: 0 0 0.45rem; font-size: 0.92rem; color: var(--text); }
.r75mu-panel .r75mu-facts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.6rem; margin: 0 0 0.6rem; }
.r75mu-panel .r75mu-col { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.65rem; background: var(--panel-2); opacity: 0.62; }
.r75mu-panel .r75mu-col.r75mu-mine { opacity: 1; border-color: var(--hero); }
.r75mu-panel .r75mu-col-h { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 0.15rem; }
.r75mu-panel .r75mu-mine .r75mu-col-h { color: var(--hero); }
.r75mu-panel .r75mu-col ul { margin: 0; padding-left: 1.05rem; font-size: 0.8rem; line-height: 1.4; color: var(--text); }
.r75mu-panel .r75mu-bonus { margin: 0 0 0.55rem; font-size: 0.82rem; color: var(--hero); }
.r75mu-panel .r75mu-hand { --card-w: clamp(96px, calc((min(980px, 100vw - 32px) - 2.4rem) / 7 - 0.7rem), 124px); --card-h: calc(var(--card-w) * 7 / 5);
  justify-content: center; max-width: none; gap: 0.7rem; padding: 2px 0 4px; }
.r75mu-panel .r75mu-hand > .card-slot { width: var(--card-w); height: var(--card-h); }
.r75mu-panel .ysel-foot.r75mu-foot { gap: 0.45rem; }
.r75mu-panel .r75mu-acts { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.r75mu-panel .r75mu-acts button { min-height: 40px; min-width: 10rem; }
.action-panel.flow-bar.r75mu-under .aw-chip { margin-bottom: 0; }
@media (max-width: 820px) {
  .pile-backdrop.ysel-backdrop.r75mu-backdrop { padding: 12px 8px; }
  .pile-panel.ysel-panel.r75mu-panel { width: calc(100vw - 16px); padding: 0.65rem 0.75rem 0.8rem; }
  .r75mu-panel > .pile-header { gap: 0.6rem; margin-bottom: 0.2rem; }
  .r75mu-panel > .pile-header h3 { font-size: 1rem; }
  .r75mu-panel > .pile-header .r75mu-hide { min-height: 36px; padding: 0 0.7rem; font-size: 0.8rem; }
  .r75mu-panel .r75mu-order { margin-bottom: 0.3rem; font-size: 0.86rem; }
  .r75mu-panel .r75mu-facts { margin-bottom: 0.45rem; }
  .r75mu-panel .r75mu-col { padding: 0.3rem 0.55rem; }
  .r75mu-panel .r75mu-col-h { display: none; }
  .r75mu-panel .r75mu-col ul { font-size: 0.76rem; line-height: 1.35; }
  .r75mu-panel .r75mu-hand { --card-w: min(100px, calc((100vw - 16px - 1.5rem - 24px - 6px) / 4)); gap: 8px; }
  .r75mu-panel .ysel-instr { font-size: 0.78rem; }
  .pile-panel.ysel-panel.r75mu-panel .ysel-foot { bottom: -0.8rem; margin-bottom: -0.8rem; padding-bottom: 0.8rem; align-items: stretch; }
  .r75mu-panel .r75mu-acts button { flex: 1 1 0; min-width: 0; min-height: 44px; }
}
/* landscape phones: one sideways row of cards, the window using the whole height */
@media (max-height: 520px) {
  .pile-backdrop.ysel-backdrop.r75mu-backdrop { padding: 8px; }
  .pile-panel.ysel-panel.r75mu-panel { max-height: calc(100dvh - 16px); }
  .r75mu-panel .r75mu-hand { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; --card-w: 70px; }
}
/* agY1-1106 (Discord "[Mobile] Target Window" + the Stun window): the one selection window (app.js y1SelWindow) - header, optional
   "whose effect" line, the cards, and a footer pinned to the window's bottom edge with the instruction, a live count and Select, so
   the button is always on screen. Phones: the cards are ONE horizontal row (~4 visible, swipe for more, snap). */
.ysel-source { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--text-dim); }
.ysel-strip { gap: 0.6rem; padding: 2px 2px 4px; }
.ysel-foot { position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem;
  margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.ability-focus-rail .ysel-foot { bottom: -0.65rem; margin-bottom: -0.65rem; padding-bottom: 0.65rem; background: color-mix(in srgb, var(--glass, #0a0d11) 97%, transparent); }
.pile-panel .ysel-foot { bottom: -1rem; margin-bottom: -1rem; padding-bottom: 1rem; background: var(--panel); align-items: center; }
/* z51110 (Discord "[Desktop] Target Window"): on desktop the action window's selection (the cards in its rail) is 3 or 4 cards wide when
   there are that many to choose from, instead of 2 (card-wide slots, like phones) - phones (and landscape phones) keep their own layout. */
@media (min-width: 821px) and (min-height: 521px) {
  .ability-focus-rail.ysel .ysel-strip > .card-slot:not(.rotated) { width: var(--card-w); } /* card-wide slots (a committed card keeps its square) */
  .ability-focus-rail.ysel:has(.ysel-strip > .card-slot:nth-of-type(3)) { width: 348px; }
  .ability-focus-rail.ysel:has(.ysel-strip > .card-slot:nth-of-type(4)) { width: 452px; max-height: min(84vh, 600px); max-height: min(84dvh, 600px); }
}
.pile-panel .ysel-select { min-width: 10rem; }
.ysel-instr { margin: 0; text-align: center; font-size: 0.85rem; color: var(--text); display: flex; flex-wrap: wrap; justify-content: center; gap: 0.15rem 0.6rem; }
.ysel-count { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ysel-count:empty { display: none; }
.action-panel .ysel-reason { margin: 0.1rem 0 0.4rem; }
/* A centered dialog opened over the card-focus view (number / options / card window) hides the focus's ability text + Play button. */
body:has(#pileRoot > .pile-backdrop) .ability-focus-rail { visibility: hidden; }
@media (max-width: 820px) {
  .ysel-strip { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    --card-w: min(92px, calc((100vw - 64px) / 4.6)); --card-h: calc(var(--card-w) * 7 / 5); max-width: none; gap: 8px; padding-bottom: 6px; }
  .ysel-strip > .card-slot { scroll-snap-align: start; }
  .ysel-strip > .card-slot:not(.rotated) { width: var(--card-w); }
  .ysel-strip > .card-slot.has-pick-tag { margin-bottom: 0.95rem; }
  /* agAA1-1106 (Discord "[Mobile] Target Window" follow-up, "two lines instead of one"): 2 cards per row, 2 rows (4 visible), the rest
     to the right (swipe); the cards are sized so both rows + the pinned footer fit the screen. */
  .ysel-strip.aa1-two-rows { display: grid; grid-auto-flow: row; grid-template-rows: repeat(var(--aa1-rows, 2), auto);
    grid-template-columns: repeat(var(--aa1-cols, 2), calc((100% - 10px) / 2)); column-gap: 10px; row-gap: 12px;
    justify-items: center; align-items: start; padding: 4px 2px 6px;
    --card-w: min(128px, calc((100vw - 96px) / 2), calc((100dvh - 330px) / 2 * 5 / 7 - 6px)); --card-h: calc(var(--card-w) * 7 / 5); }
  .ysel-strip.aa1-two-rows > .card-slot { scroll-snap-align: start; }
  .ysel-strip.aa1-two-rows > .empty-note { grid-column: 1 / -1; }
  .pile-backdrop.ysel-backdrop { padding: 12px 8px; }
  .pile-panel.ysel-panel { width: calc(100vw - 16px); max-width: none; box-sizing: border-box; padding: 0.8rem 0.9rem; }
  .pile-panel.ysel-panel .ysel-foot { bottom: -0.8rem; margin-bottom: -0.8rem; padding-bottom: 0.8rem; align-items: stretch; }
  .pile-panel.ysel-panel .ysel-select { width: 100%; min-height: 3rem; font-size: 1.05rem; }
  .action-panel.flow-bar .empty-note.ysel-reason { display: block; text-align: center; }
}
/* agY1-1106 (Discord, Liquid Sentinel / Wielding One For All / Boiling-Hot Jealousy): every stepper is "[-] label [+]". */
.y1-step-wrap { margin: 0.35rem 0; }
.y1-step, .action-panel .row.y1-step, .ability-focus-rail .row.y1-step, .keyword-action .row.y1-step {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 2.6rem; align-items: center; gap: 0.5rem; flex-wrap: nowrap; }
.y1-step-btn { min-height: 2.4rem; min-width: 0; padding: 0; font-size: 1.25rem; line-height: 1; }
.y1-step-label { text-align: center; font-variant-numeric: tabular-nums; }
.y1-step-explain { margin: 0.2rem 0 0; text-align: center; font-size: 0.8rem; font-style: italic; color: var(--text-dim); }
.y1-step.y1-step-number { grid-template-columns: 3rem 6.5rem 3rem; justify-content: center; margin: 0.6rem 0; }
.y1-number-input { width: 100%; box-sizing: border-box; text-align: center; font-size: 1.5rem; font-weight: 700; padding: 0.3rem;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; -moz-appearance: textfield; appearance: textfield; }
.y1-number-input::-webkit-outer-spin-button, .y1-number-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.y1-dialog-title { margin: 0 0 0.6rem; font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 1rem; }
.y1-counts .ysel-instr { margin-top: 0.4rem; }
.y1-xseries { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; width: min(26rem, 100%); margin: 0 auto 0.4rem; }
.y1-xseries .y1-step-label { font-weight: 600; }
/* agII-1107: the Echo window fits short phones (ii2FitPickerRow shrinks its cards by the overflow). The cards take only their own width,
   and on a short landscape screen this one window may take half the height, with "Play Echo" / "Pass" beside the cards. */
@media (max-width: 820px), (max-height: 520px) {
  .action-panel.flow-bar.ii-echo-fit .row.ff-echo-row .card-slot:not(.rotated) { width: var(--card-w); height: var(--card-h); }
}
/* short screens: tighter text lines leave the cards more room */
@media (max-width: 820px) and (max-height: 640px), (max-height: 520px) {
  .action-panel.flow-bar.ii-echo-fit, .action-panel.flow-bar.ii-echo-fit > h3, .action-panel.flow-bar.ii-echo-fit > p { line-height: 1.25; }
}
@media (max-height: 520px) {
  .action-panel.flow-bar.ii-echo-fit { max-height: 50vh; max-height: 50dvh; }
  .action-panel.flow-bar.ii-echo-fit > p.ii-echo-note::after { content: "\A"; white-space: pre; }
  .action-panel.flow-bar.ii-echo-fit > .row.ff-echo-row { display: inline-flex; width: calc(100% - 11.5rem); vertical-align: middle; }
  .action-panel.flow-bar.ii-echo-fit > button.ff-echo-btn, .action-panel.flow-bar.ii-echo-fit > button.ff-echo-pass { position: static; vertical-align: middle; margin-top: 0; }
}
/* agCC-1107 (Discord "[Mobile] Target Window" follow-up, the Momentum window): the End Phase "→ Momentum / → Discard / → Shift" picker
   is part of the flow bar, not a dedicated window, so on phones it stays ONE row: the cards keep their size, extra cards sit to the right
   (swipe, snap), a short text replaces the long one, and "Clear pools & end turn" is pinned to the bar's bottom edge, always on screen. */
.cc-short { display: none; }
/* agFF-1107 (Discord "[Mobile] Target Window", the Echo window): "Play Echo" and "Pass" side by side. On phones the momentum cards are
   one sideways-scrolling row (the .cc-end-dest-row rules below + the card rules here, since these cards are plain chips). */
.action-panel > button.ff-echo-btn, .action-panel > button.ff-echo-pass { display: inline-block; vertical-align: top; margin: 0.3rem 0.2rem 0; }
@media (max-width: 820px), (max-height: 520px) {
  .action-panel .row.cc-end-dest-row.ff-echo-row { padding: 0 2px; margin-top: 0; }
  .action-panel .row.ff-echo-row > * { flex: 0 0 auto; scroll-snap-align: start; }
  .action-panel .row.ff-echo-row > :first-child { margin-left: auto; }
  .action-panel .row.ff-echo-row > :last-child { margin-right: auto; }
  /* pinned to the bar's bottom edge like the End Phase button: always on screen even when the text runs to three lines */
  .action-panel.flow-bar > button.ff-echo-btn, .action-panel.flow-bar > button.ff-echo-pass { position: sticky; bottom: 0; z-index: 3; margin-top: 0; }
}
/* agFF-1107 (Discord "Swipe Navegation"): Card Info swipes sideways to the next card in the zone - the sheet keeps vertical scrolling
   (and pinch zoom) but owns horizontal strokes; the new card slides in from the side it came from. */
@media (pointer: coarse) { .inspector { touch-action: pan-y pinch-zoom; } }
.inspector .i-content.ff-slide-l { animation: ff-slide-l 0.18s ease-out; }
.inspector .i-content.ff-slide-r { animation: ff-slide-r 0.18s ease-out; }
@keyframes ff-slide-l { from { transform: translateX(-28px); opacity: 0.35; } to { transform: none; opacity: 1; } }
@keyframes ff-slide-r { from { transform: translateX(28px); opacity: 0.35; } to { transform: none; opacity: 1; } }
@media (max-width: 820px), (max-height: 520px), (min-width: 821px) and (min-height: 521px) and (max-height: 860px) {
  .action-panel .cc-long { display: none; }
  .action-panel .cc-short { display: inline; }
  .action-panel .row.cc-end-dest-row { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; max-width: 100%;
    scroll-snap-type: x proximity; overscroll-behavior-x: contain; gap: 10px; padding: 2px 2px 6px; margin: 0.2rem 0 0; }
  .action-panel .row.cc-end-dest-row > [data-end-dest] { flex: 0 0 auto; scroll-snap-align: start; }
  /* centred while it fits, left-aligned (nothing cut off) once it scrolls */
  .action-panel .row.cc-end-dest-row > [data-end-dest]:first-child { margin-left: auto; }
  .action-panel .row.cc-end-dest-row > [data-end-dest]:last-child { margin-right: auto; }
  .action-panel.flow-bar > button.cc-end-btn { position: sticky; bottom: 0; z-index: 3; margin-top: 0.25rem; box-shadow: 0 0 0 6px var(--aw-bg, var(--panel)); }
}
/* agII-1107: the End Phase Momentum / Discard window FITS on every phone - no vertical scroll inside it, the button always on screen. The
   window is a grid capped at the flow bar's height (40dvh portrait; on a short landscape screen this one window may take half the height
   and the button sits beside the cards): text on top, the card row, the button in its own track. The card row is as tall as a full-size
   card when that fits and shrinks (with its cards) when the cap is reached - normal phones keep full-size cards, short screens shrink them. */
@media (max-width: 820px), (max-height: 520px), (min-width: 821px) and (min-height: 521px) and (max-height: 860px) {
  .action-panel.flow-bar.ii-end-fit { --ii-row-max: calc(128.8px + 1.25rem + 6px); display: grid; grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, var(--ii-row-max)) auto; align-content: start; align-items: center; column-gap: 0.45rem; row-gap: 0.1rem;
    height: auto; max-height: 40vh; max-height: 40dvh; overflow-y: auto; }
  .action-panel.flow-bar.ii-end-fit > * { grid-column: 1 / -1; }
  .action-panel.flow-bar.ii-end-fit > .aw-chip { grid-row: 1; grid-column: 1; margin: 0; }
  .action-panel.flow-bar.ii-end-fit > h3 { display: none; }
  .action-panel.flow-bar.ii-end-fit > p { grid-row: 1; grid-column: 2; margin: 0; text-align: left; line-height: 1.3; }
  .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row { grid-row: 2; align-self: stretch; min-height: 0; height: var(--ii-row-max); margin: 0; padding: 2px 2px 0;
    align-items: flex-start; --card-h: clamp(46px, calc(40dvh - 8.4rem), 128.8px); --card-w: calc(var(--card-h) * 5 / 7); }
  .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row .card-slot:not(.rotated) { width: var(--card-w); height: var(--card-h); }
  .action-panel.flow-bar.ii-end-fit > button.cc-end-btn { grid-row: 3; position: static; justify-self: center; margin: 0.1rem 0 0; box-shadow: none; }
}
/* the row is a size container, so each card takes exactly the row's height minus its "→ Momentum" label */
@supports (height: 1cqh) {
  @media (max-width: 820px), (max-height: 520px), (min-width: 821px) and (min-height: 521px) and (max-height: 860px) {
    .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row { container-type: size; height: auto; }
    .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row > [data-end-dest] { --card-h: clamp(40px, calc(100cqh - 1.25rem - 4px), 128.8px); --card-w: calc(var(--card-h) * 5 / 7); }
  }
}
@media (max-height: 520px) {
  .action-panel.flow-bar.ii-end-fit { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, var(--ii-row-max)); max-height: 50vh; max-height: 50dvh; }
  .action-panel.flow-bar.ii-end-fit > p { grid-column: 2 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row { grid-row: 2; grid-column: 1 / 3; --card-h: clamp(46px, calc(50dvh - 4.6rem), 128.8px); }
  .action-panel.flow-bar.ii-end-fit > button.cc-end-btn { grid-row: 2; grid-column: 3; align-self: center; margin: 0; }
}
/* r80ef: short DESKTOP windows (up to 860px tall) get the same End Phase Momentum / Discard window as phones - one sideways row, the short
   text, the button beside the cards like a landscape phone - capped at a quarter of the height (the cards shrink with it), so the
   board keeps its bottom stage on screen instead of losing ~120px to a 245px-tall bar at 1280x720. Taller desktops are unchanged. */
@media (min-width: 821px) and (min-height: 521px) and (max-height: 860px) {
  .action-panel.flow-bar.ii-end-fit { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, var(--ii-row-max)); max-height: 25vh; max-height: 25dvh; }
  .action-panel.flow-bar.ii-end-fit > p { grid-column: 2 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .action-panel.flow-bar.ii-end-fit > .row.cc-end-dest-row { grid-row: 2; grid-column: 1 / 3; --card-h: clamp(60px, calc(25dvh - 4.6rem), 128.8px); }
  .action-panel.flow-bar.ii-end-fit > button.cc-end-btn { grid-row: 2; grid-column: 3; align-self: center; margin: 0; }
}

/* agOO-1107: no picker card under ~80px wide on very short phones (360x560 / 360x640 portrait) or landscape phones.
   - The Echo and End Phase Momentum / Discard windows may take 60% of a short portrait screen (40% before), so their sideways card row
     keeps (nearly) full-size cards; ii2FitPickerRow never shrinks the Echo cards under 112px tall there (a long attack name made them 49px).
   - The selection window (y1SelWindow) may use (nearly) the whole screen height on a phone - below the settings gear in portrait, its
     header clear of the gear in landscape - its two rows of cards never go under 80px wide, and
     where two rows of 80px cards don't fit (a landscape phone, a 360x560 window with a long header) it becomes ONE sideways row of
     bigger cards (app.js oo1107SelOneRow). A single card is at least 80px wide too. */
@media (max-width: 820px) and (min-height: 521px) and (max-height: 640px) {
  .action-panel.flow-bar.ii-echo-fit, .action-panel.flow-bar.ii-end-fit { max-height: 60vh; max-height: 60dvh; }
}
/* landscape: the Echo window (its text runs to 3 lines with a long attack name) 55% of the height instead of 50% - its cards stay >= 80px wide */
@media (max-height: 520px) { .action-panel.flow-bar.ii-echo-fit { max-height: 55vh; max-height: 55dvh; } }
@media (max-width: 820px) {
  .ysel-strip { --card-w: min(110px, max(80px, calc((100vw - 64px) / 4.6))); }
  .ysel-strip.aa1-two-rows { --card-w: min(128px, calc((100vw - 96px) / 2), max(80px, calc((100dvh - 330px) / 2 * 5 / 7 - 6px))); }
  .ysel-strip.aa1-two-rows.oo-one-row { display: flex; align-items: flex-start; }
}
@media (max-width: 820px) and (min-height: 521px) {
  .pile-backdrop.ysel-backdrop { padding: 52px 8px 12px; }
  .pile-panel.ysel-panel { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
}
@media (max-height: 520px) {
  .pile-panel.ysel-panel { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .pile-panel.ysel-panel > .pile-header { padding-right: 2.8rem; }
}
/* a landscape phone wider than 820px (844x390, 915x412) got the board's tiny card size (41px) in the selection window: one sideways row of
   80-128px cards there too, the window using the whole screen height */
@media (max-height: 520px) and (min-width: 821px) {
  .pile-backdrop.ysel-backdrop { padding: 12px 8px; }
  .pile-panel.ysel-panel { max-width: calc(100vw - 16px); padding: 0.8rem 0.9rem; }
  .pile-panel.ysel-panel .ysel-foot { bottom: -0.8rem; margin-bottom: -0.8rem; padding-bottom: 0.8rem; }
  .ysel-strip { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; max-width: none;
    --card-w: 80px; --card-h: calc(var(--card-w) * 7 / 5); gap: 8px; padding-bottom: 6px; }
  .ysel-strip > .card-slot { flex: 0 0 auto; scroll-snap-align: start; }
  .ysel-strip > .card-slot:not(.rotated) { width: var(--card-w); height: var(--card-h); }
  .ysel-strip > .card-slot.has-pick-tag { margin-bottom: 0.95rem; }
}
/* agOO-1107 (Tranquility of Death browser check): a phone's stage / card pool rows scroll sideways and so clip vertically - the seal badge,
   centered ABOVE the card (top: -11px), lost its top 11px and read as a sliver. On phones it sits just inside the card's top edge. */
@media (max-width: 820px), (max-height: 520px) { .zone-row .card-slot .sealed-badge { top: 2px; } }
/* agZ2-1110 (Discord "Abyss Damnation"): on the RIVAL's half (the top of the board) the seal badge centered above the card sat right under the
   "Rival hand" tab and was hidden by it. The rival's side is drawn mirrored, so their badge sits centered BELOW the card instead (inside the
   card's bottom edge on phones, where the rows clip vertically). */
.half.opp .card-slot .sealed-badge { top: auto; bottom: -11px; }
@media (max-width: 820px), (max-height: 520px) { .half.opp .zone-row .card-slot .sealed-badge { top: auto; bottom: 2px; } }
/* agQ5-1112d (Discord "Icons on grouped cards"): a card's status icons (Freeze, Seal, a backup's stamina - app.js q51112StatusRow) sit in one
   row centred on the card's top edge - the rival's half is drawn mirrored, so theirs sit on the card's bottom edge (agZ2-1110) - clear of the
   Difficulty (top-left) and Block Modifier (top-right). A grouped stage card is covered on its right by the next one (each slot is a card-h
   square with the card centred in it; the next slot starts half a card-h on), so its icons move over the part of it you can SEE:
   --q51112-gx / --q51112-gw = centre / width of that visible strip (counters, centred tags), --q51112-cx / --q51112-cw = centre / width
   of the strip clear of the corners (the icon row - it wraps rather than reach a corner). --q51112-top = where the card's top edge is in its slot (a committed card is turned sideways in the
   middle band). Counters drop below the top corners, centred the same way. Card w = 5h/7, its left edge h/7 into the slot. */
.card-slot { --q51112-is: clamp(14px, calc(var(--card-w) * 0.22), 18px); --q51112-cw: calc(var(--card-w) * 0.68); }
.card-slot:is(.rotated, .r31111-tok-committed) { --q51112-top: calc((var(--card-h) - var(--card-w)) / 2); --q51112-cw: calc(var(--card-h) * 0.72); }
.stage-stack:not(.r31111-tok-pile) > .card-slot:has(+ .card-slot) { --q51112-cx: calc(var(--card-h) * 0.45); --q51112-cw: calc(var(--card-h) * 0.385); --q51112-gx: calc(var(--card-h) * 11 / 28); --q51112-gw: calc(var(--card-h) / 2); }
.stage-stack:not(.r31111-tok-pile) > .card-slot:has(+ .card-slot:is(.rotated, .r31111-tok-committed)) { --q51112-cx: calc(var(--card-h) * 0.3786); --q51112-cw: calc(var(--card-h) * 0.243); --q51112-gx: calc(var(--card-h) * 9 / 28); --q51112-gw: calc(var(--card-h) * 5 / 14); }
.stage-stack:not(.r31111-tok-pile) > .card-slot:is(.rotated, .r31111-tok-committed):has(+ .card-slot) { --q51112-cx: calc(var(--card-h) * 9 / 28); --q51112-cw: calc(var(--card-h) * 9 / 14); --q51112-gx: calc(var(--card-h) * 9 / 28); --q51112-gw: calc(var(--card-h) * 9 / 14); }
.stage-stack:not(.r31111-tok-pile) > .card-slot:is(.rotated, .r31111-tok-committed):has(+ .card-slot:is(.rotated, .r31111-tok-committed)) { --q51112-cx: calc(var(--card-h) / 4); --q51112-cw: calc(var(--card-h) / 2); --q51112-gx: calc(var(--card-h) / 4); --q51112-gw: calc(var(--card-h) / 2); }
.card-slot > .q51112-stat {
  position: absolute; z-index: 8; left: var(--q51112-cx, 50%); top: calc(var(--q51112-top, 0px) - 7px); transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; pointer-events: none;
  width: max-content; max-width: max(var(--q51112-is), var(--q51112-cw)); /* wider than the free strip: wraps instead of reaching a corner */
}
.half.opp .card-slot > .q51112-stat { top: auto; bottom: calc(var(--q51112-top, 0px) - 7px); left: var(--q51112-gx, 50%); }
.card-slot.q51112-has-stat.frozen::after, .card-slot.q51112-has-stat.has-stamina::before { content: none; display: none; }
.card-slot .q51112-stat > .sealed-badge { position: static; transform: none; flex: 0 0 auto; width: var(--q51112-is); height: var(--q51112-is); }
.card-slot .q51112-stat > .q51112-ic {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; height: var(--q51112-is); color: white; font-size: 0.65rem; white-space: nowrap;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 40%, transparent);
}
.card-slot .q51112-stat > .q51112-frz { width: var(--q51112-is); border-radius: 50%; background: var(--tide-deep); color: var(--on-tide-deep, white); }
.card-slot .q51112-stat > .q51112-sta { height: calc(var(--q51112-is) - 2px); padding: 0 0.35rem; border-radius: 999px; background: var(--bad); font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-slot > .counter-gems { top: calc(var(--q51112-top, 0px) + var(--card-h) * 0.18); left: var(--q51112-gx, 50%); width: auto; max-width: calc(var(--q51112-gw, var(--card-w)) - 8px); justify-content: center; }
.card-slot:is(.rotated, .r31111-tok-committed) > .counter-gems { top: calc(var(--q51112-top, 0px) + 5px); max-width: calc(var(--q51112-gw, var(--card-h)) - 8px); }
.card-slot.mini > .counter-gems { top: 3px; }
.stage-stack:not(.r31111-tok-pile) > .card-slot:has(+ .card-slot) > :is(.p51108-kind-tag, .facedown-badge, .attack-target-badge, .attack-stack-badge) { left: var(--q51112-gx); }
.stage-stack.r31111-tok-pile > .card-slot.r31111-tok-under > .q51112-stat { display: none; } /* a token pile: only the top token's icons */
/* Desktop: your Stage label sat right on the cards' top edge, under the icons - it moves up into the gap above it (layout unchanged). */
@media (min-width: 821px) and (min-height: 521px) { .half:not(.opp) .stage-block > .stage-header { position: relative; top: -6px; } }
/* Phones: the stage / pool rows scroll sideways and clip vertically (agOO-1107), so the row sits just inside the card's top (rival: bottom) edge. */
@media (max-width: 820px), (max-height: 520px) {
  .card-slot { --q51112-is: clamp(11px, calc(var(--card-w) * 0.3), 15px); }
  .card-slot > .q51112-stat { top: calc(var(--q51112-top, 0px) + 2px); gap: 2px; }
  .half.opp .card-slot > .q51112-stat { top: auto; bottom: calc(var(--q51112-top, 0px) + 2px); }
  .half.opp .stage-stack > .card-slot:first-child > .q51112-stat { bottom: max(calc(var(--q51112-top, 0px) + 2px), 11px); } /* clears the stack's xN badge */
  .card-slot .q51112-stat > .q51112-ic, .card-slot .q51112-stat > .sealed-badge { font-size: 0.5rem; }
  .card-slot .q51112-stat > .q51112-sta { padding: 0 0.22rem; font-size: 0.5rem; }
}

/* TEKKEN 8 shared Arena zone (rendered in the center of the table when arenas are in play). Arenas
   are landscape-oriented cards; the active one sits face-up with per-player break progress shown. */
.arena-zone { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; margin: 0.4rem auto; padding: 0.4rem 0.6rem; border: 1px solid var(--line-bright, #3d4a80); border-radius: 6px; background: color-mix(in srgb, var(--shade, #000) 25%, transparent); max-width: 220px; }
.arena-zone-label { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hero, #e0a23f); font-weight: 700; }
.arena-card { width: 180px; height: 128px; border: 1px solid var(--line-bright, #3d4a80); border-radius: 4px; overflow: hidden; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.arena-card img { width: 100%; height: 100%; object-fit: contain; }
.arena-card-name { font-size: 0.75rem; text-align: center; padding: 0.4rem; color: var(--text); }
.arena-break-progress { font-size: 0.6rem; color: var(--text-dim, #8d96c2); font-variant-numeric: tabular-nums; }
/* Discord r21 (ARENA): the arena deck sits ON the table's center line (the empty band between the halves, left of the centered
   Stage / Card Pool column so it never covers a pool) as just the card - no container box - with each player's damage toward the
   break floating beside it (arena cards are printed portrait - the card is card-sized). The "ARENA (+N queued)" tag sits on its top edge. */
.arena-zone { position: absolute; top: 50%; left: 24%; transform: translate(-50%, -50%); z-index: 6; flex-direction: row; align-items: center; gap: 0.4rem;
  margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; max-width: none; }
.arena-zone .arena-card { width: 84px; height: 117px; box-shadow: 0 4px 14px color-mix(in srgb, var(--shade, #000) 45%, transparent); }
/* agSS-1107 (Discord "ARENA" layout): arena cards are printed LANDSCAPE - the arena deck is a horizontal card centred where the "VS"
   watermark is, a bit larger than a board card on desktop (1.8 x a card's width; app.js ss1107PlaceArena fits it into the free band between the card pools and
   only slides it sideways when a full board leaves no room). Art stored portrait (the card turned 90 degrees) is turned back (.ss-rot). */
.arena-zone { left: 50%; }
.arena-zone .arena-card { --ss-ah: calc(var(--card-w) * 1.8); --ss-aw: calc(var(--ss-ah) * 7 / 5); width: var(--ss-aw); height: var(--ss-ah); position: relative; }
.arena-zone .arena-card.ss-rot img { position: absolute; left: 50%; top: 50%; width: var(--ss-ah); height: var(--ss-aw); max-width: none; max-height: none;
  object-fit: fill; transform: translate(-50%, -50%) rotate(-90deg); }
.table:has(> .arena-zone) > .watermark { opacity: 0; }
.arena-zone .arena-zone-label { position: absolute; top: -0.55rem; left: 0.3rem; z-index: 2; pointer-events: none; padding: 0 0.35rem; border-radius: 999px;
  background: var(--panel, #11162b); border: 1px solid var(--line-bright, #3d4a80); font-size: 0.56rem; line-height: 1.1rem; white-space: nowrap; }
.arena-dmg { display: flex; flex-direction: column; gap: 0.3rem; }
.arena-dmg-chip { display: flex; align-items: baseline; gap: 0.2rem; padding: 0.1rem 0.45rem; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--glass-2, #0a0d1a) 78%, transparent); border: 1px solid var(--line-bright, #3d4a80); font-size: 0.62rem; color: var(--text-dim, #8d96c2); font-variant-numeric: tabular-nums; }
.arena-dmg-chip b { color: var(--text); font-size: 0.78rem; }
.arena-dmg-chip.me { border-color: var(--tide, #4fb3c9); }
.arena-dmg-chip.hot b { color: var(--hero, #e0a23f); }
.arena-dmg-who { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.54rem; }

/* ============================================================================
   MOBILE PASS — Phase 1 + 2 (shared foundation, layout-concept agnostic)

   Everything below is ADDITIVE and gated on either a narrow viewport or a coarse
   pointer, so a desktop mouse on a normal window matches none of it. It is kept in
   one block (rather than scattered beside each component) purely so this whole pass
   can be reviewed - or reverted - as a unit.

   Gating vocabulary used here:
     (pointer: coarse)  -> finger/stylus. True on phones AND touchscreen laptops.
     (max-width: 820px) -> narrow viewport, regardless of what's pointing at it.
   The two are deliberately NOT conflated: a touchscreen laptop wants bigger tap
   targets but not a phone layout, and a narrow desktop window wants the reverse.
   ============================================================================ */

/* ---- fixed corner chrome ----
   .auth-widget (top-right) and .rules-details (top-left) are position:fixed and were
   free to overlap .title-bar's centered heading the moment the viewport reported its
   real width. Shrink both, drop the display name (the avatar still identifies you),
   and push the title bar down clear of them. */
@media (max-width: 820px) {
  .auth-widget { top: 0.5rem; right: 0.5rem; }
  .auth-widget button { padding: 0.35rem 0.5rem; font-size: 0.64rem; }
  .signed-in-as #authName { display: none; }
  .rules-details { top: 0.5rem; left: 0.5rem; }
  .rules-details > summary { padding: 0.35rem 0.55rem; font-size: 0.7rem; }
  /* Clears the two fixed corners above. Without this the eyebrow + H1 render underneath them. */
  .char-select .title-bar { padding-top: 3rem; }
  .rules-details[open] { padding: 0.75rem 0.5rem; }
  .overlay-panel { padding: 0.75rem; }
}

/* ---- touch targets ----
   Sub-24px controls against a 44px guideline. Deliberately scoped to the specific
   offenders rather than a blanket `button { min-height }`, which would inflate every
   dense row in the app (deck import, sideboard editor, puzzle list) for no reason. */
@media (pointer: coarse) {
  .side-controls button,
  .hud-util button,
  .sidebar-tabs button,
  .puzzle-btn,
  .log-toggle,
  .rules-toc button,
  .tutorial-nav-btn,
  .bug-report-type-btn {
    min-height: 44px;
    padding-inline: 0.75rem;
  }
  /* Round buttons stay round - min-height alone would turn these into capsules. */
  .hand-hide-btn { width: 44px; height: 44px; font-size: 1rem; }
  .overlay-close,
  .rules-drawer-close,
  .drawer-close {
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
  }
  /* The card-size slider's thumb is the one control that genuinely needs the extra room. */
  .card-size-control input[type="range"] { height: 44px; }
}

/* r75mu (round 75, owner request "no text selection"): clicking, dragging and long-pressing around the game no longer selects / highlights
   text, on desktop and phones (board, cards, buttons, menus, log, lobby, deck builder) - and no phone callout bubble on a long press (the
   game's own long-press handlers are pointer timers, unchanged). Typing and copying stay: text fields, text areas, editable text, links'
   own press menu, chat messages, the room code (one tap selects it all), the deck builder's export list and the copy-debug-info box (a text area). */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]), textarea, [contenteditable]:not([contenteditable="false"]) { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
a[href] { -webkit-touch-callout: default; }
.chat-msgs .bubble, .db-export pre { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.pvp-room-code { -webkit-user-select: all; user-select: all; -webkit-touch-callout: default; cursor: text; }
/* ---- card taps ----
   touch-action:manipulation opts these out of double-tap-to-zoom, which otherwise both
   eats the gesture and imposes the classic ~300ms click delay on every card tap. The
   callout/user-select suppression stops iOS from raising its own text-selection bubble
   on the long-press that now opens the inspector (see wireInspect in app.js). */
@media (pointer: coarse) {
  .card-chip, .token-chip, .card-slot, .arena-card {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  /* The card art itself never takes the press: a long-press whose target is an <img> is what
     raises Android Chrome's image menu (see the contextmenu guard in app.js). Taps fall through to
     the card element, which is where every card handler lives. */
  .card-chip img, .token-chip img, .card-slot img, .arena-card img, .inspector img {
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
  }
  /* Hover-lift is meaningless on touch and leaves a card stuck raised after a tap on
     browsers that emulate :hover. The long-press inspector replaces what it was for. */
  .hand.my-hand .card-slot:hover { transform: none; }
  /* Feedback for the long-press that is about to open the inspector. */
  .card-chip.longpress-armed .card-face.front,
  .card-chip.longpress-armed .card-face.back { outline: 2px solid var(--hero); outline-offset: 1px; }
}

/* ---- inspector as a bottom sheet ----
   The desktop inspector slides in from the right edge as a 300px column. On a 390px
   phone its own `max-width: calc(100vw - 20px)` expands it to 370px, i.e. it blankets
   the board. In portrait it becomes a bottom sheet instead: art and text side by side
   so neither has to be scrolled to, anchored to the thumb end of the screen. */
@media (max-width: 820px) and (orientation: portrait) {
  .inspector {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto; max-width: none;
    max-height: 62vh; max-height: 62dvh;
    border-radius: 12px 12px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .inspector.visible { transform: translateY(0); }
  /* Art beside text rather than above it. At ~150px wide the printed card text is too
     small to read off the scan, so showInspectorFor() also force-shows the HTML text
     block on coarse pointers - that block, not the image, is what you read here. */
  .inspector .i-content { display: flex; gap: 0.7rem; align-items: flex-start; }
  .inspector .i-art { flex: 0 0 40%; max-width: 150px; margin-bottom: 0; }
  .inspector .i-text-fallback { flex: 1 1 auto; min-width: 0; }
  .inspector .i-desc { max-height: none; }
  /* agF-1105: the text column scrolls on its own (the art stays put) once one-ability-per-line makes it taller than the sheet. */
  .inspector .i-text-fallback { max-height: calc(62dvh - 2.4rem); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .inspector .i-hint { flex-basis: 100%; }
}


/* Inspector action buttons - the touch stand-ins for desktop's drag-only moves (see
   inspectorActions in app.js). Hidden by default; showInspectorFor only fills and shows
   this row on a coarse pointer, so a mouse user never sees them. */
.inspector .i-actions { display: none; flex-direction: column; gap: 0.35rem; margin-top: 0.55rem; }
.inspector .i-action-btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--hero);
  border-radius: 6px; padding: 0.6rem 0.7rem; font-size: 0.78rem; font-family: inherit;
  cursor: pointer; min-height: 44px; width: 100%;
}
.inspector .i-action-btn:hover { background: var(--panel-3); }
/* In the bottom-sheet layout .i-content is a flex row, so this row has to be told to span it
   rather than becoming a third column beside the art and text. */
@media (max-width: 820px) and (orientation: portrait) {
  .inspector .i-actions { flex-basis: 100%; }
}
/* Tokens have no .card-face, so they need their own armed treatment. */
@media (pointer: coarse) {
  .token-chip.longpress-armed { outline: 2px solid var(--hero); outline-offset: 1px; }
  /* agC-1103: the full-art view's image never takes the press either - tap-and-hold flips a double-sided card (wireDsHold) instead of
     raising the browser's image menu / iOS callout. */
  .art-zoom img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
}

/* ============================================================================
   MOBILE PASS — Phase 3 (the landscape stopgap)

   Makes the EXISTING landscape board usable on a phone, without yet reflowing it
   for portrait. Same gating discipline as the Phase 1+2 block above: the width
   clause catches portrait phones, the height clause catches the same phone turned
   sideways (844x390 sails past a width-only gate while having LESS room), and
   neither matches a normal desktop window.
   ============================================================================ */

@media (max-width: 820px), (max-height: 520px) {
  /* The log rail is a 176px flow column, i.e. ~45% of a 390px screen before the board
     draws anything. Lift it out of flow into an overlay over the board's left edge so
     .board-col gets the full width; collapsed (the useful default here) it's just the
     toggle button sitting on the edge. No JS - .sidebar/.collapsed already exist and
     the existing toggle already drives them. */
  .board-layout { position: relative; }
  .sidebar {
    position: absolute; top: 0; left: 0; bottom: 0; z-index: 32;
    flex-basis: min(280px, 82vw); margin-top: 0; padding: 0.4rem;
    background: color-mix(in srgb, var(--glass-2, #0a0d1a) 97%, transparent); border-right: 1px solid var(--line-bright);
    border-radius: 0 10px 10px 0;
  }
  .sidebar.collapsed {
    bottom: auto; background: none; border-right: none; padding: 0;
  }
  .board-col { flex: 1 1 100%; min-width: 0; }

  /* .table's 480px floor is taller than a landscape phone's entire viewport, which
     forces the board to overflow rather than fit. */
  .table { min-height: 0; }

  /* The flow bar is the one thing that must always be reachable - cap it harder so it
     can't eat a short landscape viewport, and let it scroll internally instead. */
  .action-panel.flow-bar { max-height: 40vh; max-height: 40dvh; }

  /* Dossier controls and zone rows both get tight; reclaim what the gaps were using. */
  .half-grid { gap: 0.4rem; padding: 0 0.25rem; }
  .zone-row { gap: 0.3rem; }
  .hud-status { font-size: 0.72rem; }
}

/* The portrait "rotate your phone" nudge was removed - see the comment in index.html. Measuring
   both orientations showed portrait gives the board MORE height than landscape on a real phone. */


/* ---- match topbar on a phone ----
   The topbar is a flex row of six-ish controls (Goldfish toggle, card-size slider, Copy Debug Info,
   Feedback, Exit Match, auth widget). At desktop width they sit on one line; at 390px they wrapped
   into a 250px-TALL stack. On a 342px landscape viewport that left .table two pixels high - the
   board was effectively gone. Measured by scripts/mobile-check.mjs, not guessed.

   Fix: one non-wrapping row that scrolls sideways, with the long labels reduced to their icons.
   Everything stays reachable; nothing is removed. */
@media (max-width: 820px), (max-height: 520px) {
  #matchTopbar {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    justify-content: flex-start; gap: 0.4rem;
    padding-bottom: 0.15rem;
    scrollbar-width: none;                    /* the row is short; a scrollbar would cost more than it's worth */
  }
  #matchTopbar::-webkit-scrollbar { display: none; }
  #matchTopbar > * { flex: 0 0 auto; }
  /* Clears the fixed Rules button in the top-left corner, which otherwise sits on top of whatever
     is first in the topbar (in a puzzle, the goal banner). */
  #matchTopbar { padding-left: 5.6rem; }
  /* The puzzle goal is the most important text on the screen during a puzzle; in a content-sized
     scrolling row it ran 60px past the viewport. Cap it so it wraps inside the strip instead. */
  .puzzle-strip { max-width: calc(100vw - 7rem); margin-right: 0.35rem; }
  .puzzle-goal { font-size: 0.72rem; }
  #matchTopbar .debug-info-btn { font-size: 0.68rem; padding: 0.3rem 0.45rem; white-space: nowrap; }
  /* Emoji-only buttons: the leading glyph carries the meaning and the title attribute still spells
     it out. font-size:0 on the button hides the text node, then the ::first-letter trick is not
     reliable across engines - so instead the label text is clipped by a fixed width. */
  #matchTopbar .card-size-control .cs-label { display: none; }
  #matchTopbar .card-size-control input[type="range"] { width: 84px; }
  #matchTopbar .testing-toggle { font-size: 0.66rem; white-space: nowrap; }
  #matchTopbar .signed-in-as #authName { display: none; }
  #matchTopbar .auth-widget button { font-size: 0.62rem; padding: 0.3rem 0.4rem; }
}

/* In landscape the vertical budget is the scarce one - claw back everything that is chrome rather
   than board. */
@media (max-height: 520px) {
  body.in-match { padding-top: 0.25rem; gap: 0.25rem; }
  #matchTopbar .debug-info-btn { font-size: 0.62rem; padding: 0.25rem 0.4rem; }
  #matchTopbar .card-size-control input[type="range"] { height: 32px; }
  /* The flow bar is the one control that must stay reachable, but at 40dvh it was taking a third
     of a 342px screen. It scrolls internally, so a harder cap costs nothing but a scroll. */
  .action-panel.flow-bar { max-height: 30vh; max-height: 30dvh; padding: 0.25rem 0.6rem; }
  .hud-status { font-size: 0.66rem; padding-block: 0.15rem; }
  /* Both halves and the hands have to share what's left; the desktop offsets assume far more room.
     A fixed percentage does not work here: at 46% of a 178px table the two halves came out 81px
     each, which with a 2.2rem top offset and a 0.8rem bottom offset OVERLAPPED by ~34px (measured:
     .half.opp ended at y=163 while .half.me started at y=129, so the opponent's Card Pool sat on top
     of your Stage). Deriving the height from what's actually left after both offsets keeps them
     apart at any viewport height instead of at one. The 3.4rem is the two offsets (2.2 + 0.8) plus
     a 0.4rem gap between the halves. */
  .half { height: calc((100% - 3.4rem) / 2); }
  .half.opp { top: 2.2rem; }
  .half.me { bottom: 0.8rem; }
  .half.me .half-grid { padding-bottom: 0.6rem; }
  .half.opp .half-grid { padding-top: 0.6rem; }
}

/* A 750x342 landscape phone leaves ~178px of table for TWO halves, each needing a Stage row and a
   Card Pool row (~115px). It genuinely does not fit, and no card scale fixes it - at the size that
   would fit, a card is 22px wide and unreadable. So the half's content scrolls instead of being
   clipped by .table's overflow:hidden, which is what was silently swallowing the bottom of the
   Stage row. align-items:start stops the grid centring content half-out of the scrollport.
   This is the honest degradation for the landscape stopgap; the portrait branch (Concept B) is what
   actually solves it.

   Applies to NARROW as well as short viewports, not just landscape: on a 390x664 portrait phone the
   half-grid was carrying 470px of content in 198px of box with overflow-y:visible, so .table's
   overflow:hidden ate the difference and there was no way to scroll it back. Same failure, quieter -
   it only showed up once the check asked "is overflowing content still reachable?" rather than
   "is the first card clipped?". */
@media (max-width: 820px), (max-height: 520px) {
  .half-grid { overflow-y: auto; overflow-x: hidden; align-items: start; }
  .center-stack { justify-content: flex-start; }
}

/* ============================================================================
   MOBILE PASS — Phase 4: the portrait board (Concept B)

   Deliberately CSS-ONLY. render() already appends the table's children in exactly
   the order portrait wants - HUD strip, opponent half, arena, your half - so the
   reflow needs no second render path, no `portrait` branch through the sixteen
   action contexts, and no duplicated zone builders. That shared-builder property
   is the whole reason Concept B was picked over Concept C; this is it being paid
   out. Desktop keeps the absolutely-positioned arena untouched.

   The transform: .table becomes a vertical flex stack, the two .half elements stop
   being absolutely-positioned 44%-tall arenas and become flow children that scroll
   internally, each half's 3-column grid collapses to a single column, the dossier
   becomes a horizontal status strip, and every zone row scrolls sideways instead
   of wrapping into a pile.
   ============================================================================ */

@media (max-width: 820px), (max-height: 520px) {
  /* ---- the HUD breadcrumb ----
     Was position:absolute + white-space:nowrap, which put 807px of "Turn 6 · X's
     Turn · Combat Phase -> Block Step · Progressive Difficulty +0" into a 369px box.
     Static and wrapping instead; .spacer only exists to shove the chips to the far
     right, which is meaningless once the row wraps. */
  .hud-status {
    position: static; flex: 0 0 auto;
    white-space: normal; flex-wrap: wrap;
    gap: 0.2rem 0.55rem; font-size: 0.68rem; line-height: 1.35;
    /* Left padding clears the collapsed log toggle, which is an absolute overlay pinned to the
       table's top-left corner (Phase 3) and otherwise sits on top of the first two lines of text.
       The strip is deliberately NOT height-capped: it wraps to whatever the current window needs,
       and render() publishes the measured height as --hud-h so the rival hand peek below can offset
       itself exactly. An earlier fixed cap sliced the last line in half in any window with extra
       content - a Combat Phase adds a win-probability bar and a coach button. */
    padding: 0.35rem 0.5rem 0.35rem 2.5rem;
  }
  .hud-status .spacer { display: none; }
  .hud-status .sub { font-size: 0.64rem; }
  .hud-status .winprob-label { display: none; }

  /* The rival's hand peek is absolutely positioned to the table's top edge, which is now where the
     HUD strip lives. Two changes are needed together, and neither works alone:
       - push the peek down past the strip, so a RAISED rival hand starts below it;
       - raise the strip above it in the stacking order, because at REST the peek is translated up
         by (100% - 32px) and its cards still reach back over the strip's rows. Both were z-index 30
         and the peek is later in the DOM, so the peek was winning and the breadcrumb was invisible.
     The result is the intended "sliver + tab" at rest, and a clean start below the strip when up. */
  .hand-peek.opp { top: var(--hud-h, 3.6rem); }
  /* position:relative, NOT static - z-index is ignored on a static element, so the z-index alone
     did nothing and the peek kept painting over the breadcrumb. relative participates in flow
     exactly as static does here, so the layout is unchanged; it just gains a stacking position. */
  .hud-status { position: relative; z-index: 40; }

  /* A raised hand (the Block/Review/mulligan force-up) covered roughly two thirds of a 664px screen
     at the desktop peek size, hiding the very board the prompt asks you to click. Smaller cards and
     a sideways scroll keep the raised hand to a band rather than a takeover. */
  .hand-peek-cards { overflow-x: auto; max-width: 100%; }
  .hand-peek-cards .hand { justify-content: flex-start; }
  .hand-peek-cards { justify-content: flex-start; }
  /* The hide-hand eye sat in the scrolling hand row and ate a card's worth of width; the peek tab already collapses the hand here. */
  .hand-peek-cards .hand-hide-btn { display: none; }
  .hand-peek-cards .hand .card-slot { --card-w: 52px; --card-h: 72.8px; }

  /* ---- the table becomes a vertical stack ---- */
  .table { display: flex; flex-direction: column; min-height: 0; }

  /* ---- halves become flow children that scroll internally ----
     Each takes an equal share of what's left and scrolls its own content, so a
     deep stage never pushes the other player off screen. */
  .half {
    position: static; height: auto; top: auto; bottom: auto;
    flex: 1 1 0; min-height: 0; gap: 0.15rem;
  }
  .half-grid {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 0.3rem; overflow-y: auto; overflow-x: hidden; min-height: 0;
    padding: 0.3rem 0.4rem;
  }
  /* Clearance for the hand peek tabs, which sit on the table's top and bottom edges
     (~32px of each is visible at rest) and would otherwise cover the first/last row. */
  .half.opp .half-grid { padding-top: 1.9rem; }
  .half.me  .half-grid { padding-bottom: 1.9rem; }
  /* renderSide appends an empty <div> as the grid's balance column; in a single
     column that is just an extra gap. */
  .half-grid > div:empty { display: none; }

  /* ---- dossier becomes a status strip ----
     Character, momentum, deck/discard/removed and the side controls read as one
     compact row above that player's zones instead of a column pinned to an edge. */
  /* nowrap + scroll, NOT wrap: allowed to wrap, the character card, momentum fan,
     the three pile minis and the side controls rearranged themselves into a messy
     two-dimensional block several rows deep, and the momentum count ran off the
     right edge. One scrolling line keeps it a strip at any content size. */
  .dossier-edge {
    flex-direction: row; align-items: center; justify-content: flex-start;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    gap: 0.5rem; width: 100%; padding-bottom: 0.1rem;
    scrollbar-width: thin;
  }
  .dossier-edge > * { flex: 0 0 auto; }
  .dossier-edge.at-start, .dossier-edge.at-end { justify-self: auto; }
  /* Cards inside the status strip are identity markers, not things you read - keep
     them small so the strip stays a strip. Both vars must be set together: --card-h
     is declared once at :root against :root's --card-w and won't recompute here. */
  .dossier-edge .card-slot { --card-w: 34px; --card-h: 47.6px; }
  .dossier-edge .card-slot.lib-stack { width: 40px; height: 40px; }
  .dossier-edge .lib-face { width: 30px; height: 42px; }
  /* Margins that existed to clear the HP badge above and the name badge below when
     the dossier was a vertical column; a row needs far less. */
  .dossier-edge .char-wrap { margin-top: 0.5rem; margin-bottom: 0.8rem; }
  .dossier-edge .char-wrap .hp-badge { font-size: 0.6rem; padding: 0.12rem 0.35rem; top: -0.5rem; right: -0.5rem; }
  /* The character's name under its card is hidden on phones (suggested on Discord) - the card art already says who it is,
     and tapping the card still zooms it. The bottom margin that cleared the badge goes with it. */
  .dossier-edge .char-wrap .name-badge, .char-wrap .name-badge { display: none; }
  .dossier-edge .char-wrap { margin-bottom: 0.3rem; }
  .dossier-edge .zone-label { font-size: 0.52rem; }
  .side-controls { width: auto; }

  /* ---- zone rows scroll sideways ----
     flex-wrap made a 7-card stage wrap into a block several cards tall, which is
     what pushed content out of the table entirely. One scrolling line instead. */
  .center-stack { width: 100%; align-items: stretch; }
  .zone-row {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    justify-content: flex-start; gap: 0.3rem; padding-bottom: 0.1rem;
    scrollbar-width: thin;
  }
  .zone-label { padding-left: 0.1rem; }
  .stage-header { margin-top: 0; }

  /* Arena sits between the two halves as its own band rather than a floating box. */
  .arena-zone { flex: 0 0 auto; margin: 0.2rem auto; }
  /* Discord r21: on phones the arena is a slim band - just a small card with the two damage counters floating beside it. */
  .arena-zone { position: relative; top: auto; left: auto; transform: none; margin: 0.45rem auto 0.1rem; align-self: center; gap: 0.3rem; }
  .arena-zone .arena-card { --ss-ah: 64px; } /* agSS-1107: landscape, as tall as the old portrait band - the board doesn't move */
  .arena-zone .arena-zone-label { top: -0.5rem; font-size: 0.5rem; line-height: 0.95rem; }
}

/* The HUD overflow is not portrait-specific - a 750px-wide landscape phone clips it
   too (795px of text in a 729px box). Same fix, wider gate. */
@media (max-height: 520px) {
  .hud-status {
    white-space: normal; flex-wrap: wrap;
    gap: 0.15rem 0.5rem; font-size: 0.64rem; padding: 0.25rem 0.5rem;
  }
  .hud-status .spacer { display: none; }
  .hud-status .winprob-label { display: none; }
}

/* Landscape runs the same reflow as portrait (the gate above covers both), but its vertical budget
   is a fraction of portrait's, so the two values that must stay in step - the HUD height cap and the
   rival peek's offset below it - are both much smaller here. At portrait's 5.4rem the peek offset
   alone would have eaten half of a 178px table. */
@media (max-height: 520px) {
  .hud-status { padding-left: 2.5rem; }

  /* Both peeks are pinned to the table's opposite edges with ~178px of table between them. Each
     costs card-height + padding + tab, so for the two never to meet, that total has to stay under
     ~62px - which means trimming the padding and the tab too, not just the cards. At portrait's peek
     size they collided in the middle of the board. */
  .hand-peek-cards .hand .card-slot { --card-w: 30px; --card-h: 42px; }
  .hand-peek-cards { padding: 2px 6px 3px; }
  .hand-peek-tab { padding: 1px 10px; font-size: 0.58rem; }
  .dossier-edge .card-slot { --card-w: 30px; --card-h: 42px; }
}

/* ---- hand peek tab: a real touch target ----
   Measured at 19px tall, with an 8px sliver of card exposed directly below it (the table clips the
   rest). Aiming for the tab and landing a few pixels low hit the card instead - which PLAYED it.
   Reported from real use. Phase 1's touch-target pass raised the other small controls but missed
   this one, and it is the one sitting right on top of live cards.

   The reveal distance has to move with the tab height: the resting transform shows exactly the
   bottom/top N pixels of the peek, so a 44px tab behind a 32px reveal would still be clipped. 46px
   shows the whole tab and pushes the card sliver off the edge, which is what removes the misfire. */
@media (pointer: coarse) {
  .hand-peek-tab { min-height: 44px; padding-inline: 18px; }
  .hand-peek.you { transform: translateY(calc(100% - 46px)); }
  .hand-peek.opp { transform: translateY(calc(-100% + 46px)); }
}

/* Landscape has ~178px of table for BOTH peeks, so it trades a little of that target back. */
@media (max-height: 520px) {
  .hand-peek-tab { min-height: 34px; }
  .hand-peek.you { transform: translateY(calc(100% - 36px)); }
  .hand-peek.opp { transform: translateY(calc(-100% + 36px)); }
}

/* "Just shuffled" badge on a deck pile. The engine already shuffles wherever the rules require it
   and logs each one, but the log is a side rail (collapsed by default on a phone), so a shuffle was
   invisible on the board. Display-only - see recentShuffleFor() in app.js. */
.shuffle-flash {
  display: inline-block; margin-top: 0.2rem;
  background: var(--hero-deep); color: var(--on-hero-deep, #fff);
  border-radius: 999px; padding: 0.1rem 0.4rem;
  font-size: 0.55rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 45%, transparent);
  animation: shuffle-flash-in 0.28s ease-out;
}
@keyframes shuffle-flash-in {
  from { opacity: 0; transform: translateY(-3px) scale(0.9); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shuffle-flash { animation: none; }
}

/* ---- "The CPU's read" (opponent column): the offline deck read from /api/decklist/resolve (src/opponent/deckRead.js).
   A <details> so players who'd rather not see it can collapse it; the choice is remembered. ---- */
.cpu-read { width: 100%; margin-top: 0.7rem; border: 1px solid var(--cs-line); background: rgba(0,0,0,0.28); text-align: left; }
.cpu-read > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; padding: 0.45rem 0.6rem; background: var(--cs-panel-2); border-bottom: 1px solid var(--cs-line); }
.cpu-read > summary::-webkit-details-marker { display: none; }
.cpu-read .cr-kick { font-family: Impact, sans-serif; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.68rem; color: var(--cs-gold); }
.cpu-read .cr-plan { font-weight: 700; font-size: 0.86rem; color: var(--cs-text); }
.cpu-read .cr-toggle { margin-left: auto; font-size: 0.7rem; color: var(--cs-text-dim); }
.cpu-read .cr-toggle::after { content: "Hide"; }
.cpu-read:not([open]) .cr-toggle::after { content: "Show"; }
.cpu-read .cr-body { padding: 0.55rem 0.6rem 0.65rem; display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.74rem; line-height: 1.45; color: var(--cs-text-dim); }
.cpu-read .cr-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cpu-read .cr-chip { font-size: 0.66rem; padding: 0.12rem 0.45rem; border-radius: 999px; border: 1px solid var(--cs-line-bright); color: var(--cs-text); background: rgba(127,199,232,0.08); }
.cpu-read .cr-chip.style { border-color: var(--cs-gold-dim); color: var(--cs-gold); text-transform: capitalize; }
.cpu-read .cr-summary { color: var(--cs-text); font-size: 0.78rem; }
.cpu-read .cr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.4rem; }
.cpu-read .cr-box { padding: 0.4rem 0.5rem; border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.03); display: flex; flex-direction: column; gap: 0.15rem; }
.cpu-read .cr-label { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cs-text-dim); }
.cpu-read .cr-box b { color: var(--cs-text); font-weight: 700; }
.cpu-read .cr-sub { font-size: 0.68rem; }
.cpu-read .cr-warn { padding: 0.4rem 0.5rem; border: 1px solid #6b5220; background: #241a0c; color: #f3e2b3; }
.cpu-read .cr-warn b { color: #ffe6a8; }
.cpu-read ul { margin: 0; padding-left: 1rem; }

/* Gained keywords on a card (app.js chip -> gainedKeywordsFor): pills on the top-right corner, coloured like the card-text
   highlight for that keyword's ability timing (sampled from the printed cards). Pool cards are never frozen, so the
   frozen corner badge doesn't collide here. */
.card-slot .gained-kw-wrap { position: absolute; top: -8px; right: calc((var(--card-h) - var(--card-w)) / 2 - 8px); z-index: 6; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: auto; }
.card-slot .gained-kw { display: inline-block; padding: 2px 7px; border-radius: 999px; font-family: "Chakra Petch", Impact, sans-serif; font-weight: 700; font-size: 0.66rem; letter-spacing: 0.02em; line-height: 1.25; color: #14170a; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: default; }
.card-slot .gained-kw.kw-response { background: #b5d865; }
.card-slot .gained-kw.kw-enhance { background: #f2e420; }
.card-slot .gained-kw.kw-blitz { background: #e6aec9; }
.card-slot .gained-kw.kw-form { background: #b4dcea; }
.card-slot .gained-kw.kw-static { background: #f5c542; }
/* agZ4-1110 (Discord "White Angel Of Death"): the gained-keyword pills sat over the centred seal icon - on a sealed card they start below it,
   and the seal stays on top. */
.card-slot.z41110-sealed > .sealed-badge { z-index: 8; }
.card-slot.z41110-sealed > .gained-kw-wrap { top: 12px; }
@media (max-width: 820px), (max-height: 520px) { .zone-row .card-slot.z41110-sealed > .gained-kw-wrap { top: 24px; } }

/* Post-game review: Grandmaster's take on the biggest swings (app.js renderGameReview -> /api/match/:id/review). */
.gameover-review .review-moments { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.45rem; text-align: left; }
.gameover-review .review-loading, .gameover-review .review-good { font-size: 0.8rem; color: var(--text-dim); padding: 0.4rem 0; }
.gameover-review .review-good { color: color-mix(in srgb, #8fe3b4, var(--text) var(--ink-mix, 0%)); }
.gameover-review .review-moment { padding: 0.5rem 0.65rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; font-size: 0.8rem; line-height: 1.45; display: flex; flex-direction: column; gap: 0.2rem; }
.gameover-review .rm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.gameover-review .rm-turn { font-weight: 700; color: var(--text); }
.gameover-review .rm-swing { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.74rem; color: color-mix(in srgb, #ffb089, var(--text) var(--ink-mix, 0%)); }
.gameover-review .rm-you b, .gameover-review .rm-gm b { display: inline-block; min-width: 6.2rem; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.gameover-review .rm-gm { color: color-mix(in srgb, #bdf3d6, var(--text) var(--ink-mix, 0%)); }
.gameover-review .rm-gm b { color: color-mix(in srgb, #5ccf92, var(--text) var(--ink-mix, 0%)); }
.gameover-review .rm-note { color: var(--text-dim); font-size: 0.76rem; }
.gameover-review .rm-summary { font-size: 0.74rem; color: var(--text-dim); }
/* Today's puzzle pinned at the top of the training list (openTrainingPanel). */
.puzzle-row.puzzle-daily { border-color: #6b5220; background: linear-gradient(100deg, rgba(230,193,90,0.12), transparent 70%); }

/* Phones (portrait): the hand-peek tab shrinks to an arrow-only pill and the hand size moves beside the character as "Hand ×N", next to
   Mom (suggested on Discord - the "Your hand (6)" tab took a lot of room). The resting reveal shrinks with the tab, so still no card
   sliver shows below it (the misfire the 44px tab above was guarding against). Last in the file so it wins over the coarse-pointer block. */
@media (max-width: 820px) and (min-height: 521px) {
  .hand-count { display: inline; }
  .hand-peek-tab { min-height: 26px; padding: 0 22px; font-size: 0; gap: 0; }
  .hand-peek-tab .hp-chev { font-size: 0.8rem; }
  .hand-peek.you { transform: translateY(calc(100% - 26px)); }
  .hand-peek.opp { transform: translateY(calc(-100% + 26px)); }
}

/* Momentum pile + stacked counts (app.js renderSide): desktop keeps the momentum fan; phones stack it like the discard pile and put
   "Hand ×N" under "Mom ×N" (suggested on Discord - the fan kept widening the row). */
/* r55 (Discord "Momentum"): momentum is one face-down tile like the deck (app.js libraryStack + .mom-tile); it glows when a card in it can be played. */
.mom-pile { display: block; }
.mom-pile > .card-slot { position: relative; cursor: pointer; }
.mom-tile:hover .lib-face, .mom-tile:focus-visible .lib-face { border-color: var(--hero); }
.mom-tile.mom-live .lib-face { outline: 3px solid var(--hero); outline-offset: -3px; animation: eligible-pulse 1.4s ease-in-out infinite; }
/* r59bhz (Discord "highlight the Removed Pile and Discard Pile"): your discard / removed pile glows like the momentum tile when a card in it can be
   used right now (app.js r59bhzLivePile); click it for the pile viewer with those cards first and marked. */
.card-slot.r59bhz-live { cursor: pointer; }
.card-slot.r59bhz-live .card-chip .card-face { outline: 3px solid var(--hero); outline-offset: -3px; animation: eligible-pulse 1.4s ease-in-out infinite; }
.mom-stack .mom-pile { margin-right: 0.5rem; position: relative; }
.r55-mom-toggle { cursor: pointer; }
/* r55: the fanned-out momentum floats over the board toward the center of the table, so it never pushes anything aside. */
.mom-fan { position: absolute; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; align-items: center; padding: 6px;
  background: color-mix(in srgb, var(--bg, #0b1020) 88%, transparent); border: 1px solid var(--line, #2b3660); border-radius: 10px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
.dossier-edge.at-end .mom-fan { right: calc(100% + 8px); }
.dossier-edge.at-start .mom-fan { left: calc(100% + 8px); }
.mom-fan > .card-slot + .card-slot { margin-left: calc(var(--card-h) * -0.5); }
.mom-fan > .card-slot { position: relative; transition: transform 0.12s ease; }
.mom-fan > .card-slot:hover { transform: translateY(-6px); z-index: 2; }
.zone-counts { display: contents; }
.log-modal-head { display: none; }
@media (max-width: 820px), (max-height: 520px) {
  .zone-counts { display: flex; flex-direction: column; gap: 0.15rem; margin-left: 0.35rem; }
  .zone-counts .mom-count, .zone-counts .hand-count { margin-left: 0; }

  /* The phase/step line is dropped from the turn strip - the action bar's chip already names the step, and the strip covered
     the Log button (Discord). The Log button sits above the strip, in its left padding, as a small horizontal pill. */
  .hud-status .sub { display: none; }
  .hud-status { padding-left: 3.6rem; min-height: 2.4rem; align-items: center; }
  .sidebar.collapsed { z-index: 41; top: 0.3rem; left: 0.3rem; }
  .sidebar.collapsed .log-toggle { flex-direction: row; min-height: 1.9rem; padding: 0.2rem 0.5rem; gap: 0.25rem; }
  .sidebar.collapsed .log-toggle-text { writing-mode: horizontal-tb; }
  .sidebar.collapsed .log-toggle-icon { display: none; }

  /* The open log is a window over the whole screen with its own ✕ (Discord); the dimmed area around it closes it too. */
  .sidebar:not(.collapsed) {
    position: fixed; inset: 0; z-index: 120; flex-basis: auto; gap: 0;
    padding: max(3rem, env(safe-area-inset-top)) 0.6rem max(0.8rem, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--scrim, #000) 70%, transparent); border: none; border-radius: 0;
  }
  .sidebar:not(.collapsed) > .log-toggle { display: none; }
  .log-modal-head {
    display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto;
    background: var(--panel-2); border: 1px solid var(--line-bright); border-bottom: none; border-radius: 10px 10px 0 0;
    padding: 0.3rem 0.4rem 0.3rem 0.8rem; font-weight: 700; color: var(--text);
  }
  .log-modal-head button { min-width: 44px; min-height: 40px; font-size: 1.1rem; }
  .sidebar:not(.collapsed) > .log, .sidebar:not(.collapsed) > .chat-tab-box {
    flex: 1 1 auto; min-height: 0; max-height: none; clip-path: none; border: 1px solid var(--line-bright); border-radius: 0 0 10px 10px;
  }
  .sidebar:not(.collapsed) .log ul { font-size: 0.82rem; }
  /* agK-1105: Card Info opened from a log card name shows above the phone log window (z-index 120). */
  body:has(.sidebar:not(.collapsed)) .inspector { z-index: 130; }

  /* Attack stat history window (buildStatHistoryModal). */
  .stat-modal .pile-panel { min-width: min(280px, 86vw); }
  .stat-modal .stat-history { margin: 0; border: none; background: none; padding: 0; font-size: 0.95rem; line-height: 1.6; position: static; }
  .stat-modal .pile-header button { min-width: 44px; min-height: 40px; font-size: 1.1rem; }
}
/* The attack's stat badges hang off the card's edge; with the attacker at the end of a full card pool they reach over the OTHER half's
   dossier, which painted above them and swallowed the click. The half holding the attack paints on top instead. */
.half-grid:has(.stat-badges) { z-index: 3; }
/* ...but the raised rival half's centre-column box then reached over YOUR deck/discard/removed piles. Clicks pass through the empty
   box (its rows, cards and badges still take them); your own centre column keeps its box - it's the hand drag-and-drop target. */
.half.opp .half-grid:has(.stat-badges) .center-stack { pointer-events: none; }
.half.opp .half-grid:has(.stat-badges) .center-stack > * { pointer-events: auto; }
/* Card zoom sheet: the keywords line, and the full-size art view opened by tapping the art (touch, Discord). */
.inspector .i-keywords { font-size: 0.78rem; font-weight: 700; color: var(--hero); margin: 0.1rem 0 0.2rem; }
.art-zoom { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center;
  padding: max(0.8rem, env(safe-area-inset-top)) 0.8rem max(0.8rem, env(safe-area-inset-bottom)); }
.art-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.7); }

/* HP badge vs the start of the turn (Discord): red below, green above; tap for the turn's changes. */
.char-wrap .hp-badge.hp-clickable { cursor: pointer; }
/* agL-1102g: the level / Skill Tree badge (leveling characters - Sung Jinwoo). Its own spot on the character's left edge (it used to sit
   exactly under the HP badge), clickable for the Skill Tree panel; gold for a few seconds after a level-up. */
.char-wrap .lvl-badge {
  position: absolute; top: 1.3rem; left: -0.8rem; z-index: 4; cursor: pointer; white-space: nowrap;
  background: color-mix(in srgb, var(--glass, #0a0d11) 92%, transparent); border-radius: 999px; padding: 0.14rem 0.45rem;
  font-weight: 700; font-size: 0.64rem; font-variant-numeric: tabular-nums; max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis;
}
.char-wrap .lvl-badge.lvl-up { background: #f2c14e; color: #1b1400; border-color: #f2c14e; box-shadow: 0 0 10px rgba(242,193,78,0.85); }
.skill-modal .skill-tree-list > div { border-bottom: 1px solid color-mix(in srgb, var(--hi, #fff) 6%, transparent); padding: 4px 0; font-weight: 400; }
.skill-modal .skill-tree-list > div:last-child { font-weight: 400; }
.skill-modal .skill-row .skill-name { font-weight: 700; }
.skill-modal .skill-row .skill-text { font-size: 0.8rem; opacity: 0.9; }
.skill-modal .skill-row.locked { opacity: 0.55; }
.skill-modal .skill-row.next .skill-name { color: color-mix(in srgb, #f2c14e, var(--text) var(--ink-mix, 0%)); }
.skill-modal .skill-tree-note { font-size: 0.78rem; opacity: 0.8; font-style: italic; }
.char-wrap .hp-badge.hp-down { color: var(--bad); background: var(--hp-down-bg, rgba(70,12,16,0.95)); }
.char-wrap .hp-badge.hp-up { color: var(--good); background: var(--hp-up-bg, rgba(10,52,28,0.95)); }
.hp-modal .pile-panel { min-width: min(320px, 90vw); max-width: min(560px, 94vw); }
.hp-modal .stat-history { margin: 0; border: none; background: none; padding: 0; position: static; white-space: normal; font-size: 0.85rem; line-height: 1.55; }
.hp-modal .stat-history > div { padding: 2px 0; border-bottom: 1px solid color-mix(in srgb, var(--hi, #fff) 6%, transparent); }
.hp-modal .stat-history > div:last-child { border-bottom: none; font-weight: 700; }
/* "⏭️ Passed" on the character of the player who just passed the Enhance Step (Discord). */
.char-wrap .pass-flash {
  position: absolute; top: -0.7rem; left: -0.8rem; z-index: 4;
  background: var(--hero-deep); color: var(--on-hero-deep, #fff); border-radius: 999px; padding: 0.12rem 0.45rem;
  font-size: 0.62rem; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 6px color-mix(in srgb, var(--shade, #000) 45%, transparent);
  animation: shuffle-flash-in 0.28s ease-out;
}
@media (prefers-reduced-motion: reduce) { .char-wrap .pass-flash { animation: none; } }
/* Picker cards from mixed zones: "Stage" / "Momentum" / "Committed" tag along the top (Discord). */
.card-slot .pick-loc-badge {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  background: color-mix(in srgb, var(--glass, #0a0e1e) 90%, transparent); color: var(--good); border: 1px solid currentColor; border-radius: 999px; padding: 0.1rem 0.5rem;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; pointer-events: none;
}
/* Reorder top of deck (Psycho Mine): the revealed cards themselves, clicked top first (Discord). */
.reorder-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 0.4rem 0; }
.card-slot .pick-loc-badge.reorder-pos { color: var(--on-hero-deep, #fff); background: var(--hero-deep); border-color: var(--hero); font-size: 0.68rem; }
/* Cards playable from OUTSIDE the hand (Departure's [Discard Pile] Form, All For One's momentum grant, Tomura's removed-pile grant):
   set apart from the hand, with a purple glow and a zone tag (Discord). */
.hand .card-slot.out-of-zone { margin-left: 14px; position: relative; }
.hand .card-slot.out-of-zone + .card-slot.out-of-zone { margin-left: 4px; }
.card-slot.out-of-zone .card-chip.eligible .card-face.front { outline-color: #a970ff; animation-name: eligible-pulse-arcane; }
@keyframes eligible-pulse-arcane { 0%, 100% { outline-color: #a970ff; } 50% { outline-color: transparent; } }
.card-slot.out-of-zone::after {
  content: attr(data-zone); position: absolute; top: -0.55rem; left: 50%; transform: translateX(-50%); z-index: 6;
  font-size: 0.55rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  background: #6b3fc4; color: #fff; padding: 0 .35rem; border-radius: 999px; pointer-events: none;
}

/* The card that played the last Enhance (and its zone, once it has left the board) glows yellow until the other player answers or
   passes - only during the Enhance Step (Discord). */
.card-slot.last-enhance > .card-chip { box-shadow: 0 0 0 3px #ffd84a, 0 0 16px 5px rgba(255, 216, 74, 0.75); border-radius: 8px; }
.last-enhance-zone { box-shadow: 0 0 0 2px #ffd84a, 0 0 14px 4px rgba(255, 216, 74, 0.6); border-radius: 8px; }
/* ---- p51108 (Discord round 26) ---- */
/* Log: ability activations highlighted by kind - Enhance yellow, Response green, Blitz red (was pink), Form blue (new) - a tinted row
   with a coloured edge, the same on desktop and phone (app.js p51108LogIcon). */
:root { --evt-blitz: #ff6b6b; --evt-form: #6cb6ff; }
.log li.evt-form .log-icon, .log li.evt-form .log-msg,
.log-scroll li.evt-form .log-icon, .log-scroll li.evt-form .log-msg { color: var(--evt-form); }
.log li.evt-abil, .log-scroll li.evt-abil {
  border-left: 3px solid var(--p51108-lc, transparent); border-radius: 3px; padding-left: 3px; margin: 1px 0;
  background: color-mix(in srgb, var(--p51108-lc, transparent) 14%, transparent);
}
.log li.evt-abil.evt-keyword, .log-scroll li.evt-abil.evt-keyword { --p51108-lc: var(--evt-keyword); }
.log li.evt-abil.evt-response, .log-scroll li.evt-abil.evt-response { --p51108-lc: var(--evt-response); }
.log li.evt-abil.evt-blitz, .log-scroll li.evt-abil.evt-blitz { --p51108-lc: var(--evt-blitz); }
.log li.evt-abil.evt-form, .log-scroll li.evt-abil.evt-form { --p51108-lc: var(--evt-form); }
/* Highlight: Form blue / Blitz red / Response green - a ~1.2s glow + a small tag on the card that played it (app.js p51108DecorateSlot);
   on its pile / zone when the card already left the board. --p51108-delay (negative) keeps re-renders in step. */
.p51108-k-form { --p51108-c: #4da3ff; }
.p51108-k-blitz { --p51108-c: #ff4a4a; }
.p51108-k-response { --p51108-c: #3ddc84; }
.card-slot.p51108-flash > .card-chip { position: relative; }
.card-slot.p51108-flash > .card-chip::after {
  content: ""; position: absolute; inset: -2px; border-radius: 9px; pointer-events: none; z-index: 8;
  animation: p51108-ring 1.2s ease-out var(--p51108-delay, 0ms) 1 both;
}
@keyframes p51108-ring {
  0% { opacity: 0; box-shadow: 0 0 0 0 var(--p51108-c); }
  12%, 70% { opacity: 1; box-shadow: 0 0 0 3px var(--p51108-c), 0 0 18px 6px var(--p51108-c); background: color-mix(in srgb, var(--p51108-c) 18%, transparent); }
  100% { opacity: 0; box-shadow: 0 0 0 3px var(--p51108-c), 0 0 18px 6px var(--p51108-c); }
}
.card-slot .p51108-kind-tag {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 9; pointer-events: none; white-space: nowrap;
  background: var(--p51108-c); color: #08101a; border-radius: 999px; padding: 0.08rem 0.45rem; box-shadow: 0 1px 5px rgba(0,0,0,0.55);
  font-size: max(9px, calc(var(--card-w, 80px) * 0.13)); font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
  animation: p51108-tag 1.2s ease-out var(--p51108-delay, 0ms) 1 both;
}
@keyframes p51108-tag { 0% { opacity: 0; } 10%, 75% { opacity: 1; } 100% { opacity: 0; } }
/* r21109 (Discord round 28 "Highlight"): the rival's last-Enhance glow carries an ENHANCE tag in the same design - it stays with the glow
   (no fade); a Form / Blitz / Response flash on the same card shows its own tag on top for its second. */
.card-slot .p51108-kind-tag.r21109-enh-tag { --p51108-c: #ffd84a; animation: none; opacity: 1; }
.card-slot.p51108-flash .p51108-kind-tag.r21109-enh-tag { visibility: hidden; }
.p51108-zflash { border-radius: 8px; animation: p51108-zring 1.2s ease-out var(--p51108-delay, 0ms) 1 both; }
@keyframes p51108-zring { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 12%, 70% { box-shadow: 0 0 0 2px var(--p51108-c), 0 0 14px 4px var(--p51108-c); } }
/* Block Icon: a shield over the block icon of a card played as a block (app.js p51108ShieldEl) - zone colour, the total block difficulty
   inside, cracked for a partial block. */
.card-slot .p51108-shield {
  position: absolute; z-index: 6; top: 0; right: calc((var(--card-h) - var(--card-w)) / 2 - 1px);
  width: max(20px, calc(var(--card-w) * 0.3)); aspect-ratio: 24 / 28; display: grid; place-items: center; pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
}
.card-slot .p51108-shield svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.card-slot .p51108-shield .p51108-sh-body { fill: var(--p51108-zc); stroke: rgba(0,0,0,0.6); stroke-width: 1.4; stroke-linejoin: round; }
.card-slot .p51108-shield .p51108-sh-n {
  position: relative; margin-top: -10%; color: #fff; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  font-size: max(9px, calc(var(--card-w) * 0.15)); text-shadow: 0 1px 1px rgba(0,0,0,0.65);
}
.card-slot .p51108-z-H { --p51108-zc: #d32f2f; }
.card-slot .p51108-z-M { --p51108-zc: #ef7d00; }
.card-slot .p51108-z-L { --p51108-zc: #f5c400; }
.card-slot .p51108-z-L .p51108-sh-n { color: #1d1a00; text-shadow: none; }
.card-slot.rotated .p51108-shield { top: calc((var(--card-h) - var(--card-w)) / 2); right: 0; }
/* A failed block: a ❌ ghost of the card in the card pool, fading into its pile, where the ❌ stays about a second. */
.card-slot.p51108-ghost { pointer-events: none; animation: p51108-ghost 0.8s ease-in var(--p51108-delay, 0ms) 1 both; }
@keyframes p51108-ghost { 0%, 55% { opacity: 1; transform: none; filter: grayscale(0.55); } 100% { opacity: 0; transform: scale(0.72); filter: grayscale(1); } }
.p51108-fail {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9; pointer-events: none; line-height: 1;
  font-size: max(20px, calc(var(--card-w, 80px) * 0.42)); filter: drop-shadow(0 1px 3px rgba(0,0,0,0.85));
}
.p51108-failpile { position: relative; }
.p51108-fail.p51108-fail-pile { font-size: 1.6rem; animation: p51108-failpile 1.6s ease-out var(--p51108-delay, 0ms) 1 both; }
@keyframes p51108-failpile {
  0%, 30% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  38% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  46%, 88% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
/* r57 (Discord "Pass Animation"): the rival passed the Enhance Step - "PASS" over their stage, fully visible ~1s, then fades. */
.stage-block.r57-pass-host { position: relative; }
.r57-pass-stamp {
  position: absolute; left: 50%; top: 50%; z-index: 9; pointer-events: none; line-height: 1;
  font-weight: 900; letter-spacing: 0.12em; font-size: clamp(1.6rem, 4.2vw, 3rem); color: #fff;
  padding: 0.15em 0.45em; border: 3px solid currentColor; border-radius: 10px;
  background: rgba(20, 24, 40, 0.55); text-shadow: 0 2px 6px rgba(0,0,0,0.85); box-shadow: 0 2px 14px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%) rotate(-8deg);
  animation: r57-pass 1.8s ease-out var(--r57-pass-delay, 0ms) 1 both;
}
@keyframes r57-pass {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(1.5); }
  8% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  62% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
}
@keyframes r57-pass-rm { 0%, 62% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .r57-pass-stamp { animation-name: r57-pass-rm; transform: translate(-50%, -50%) rotate(-8deg); } }
/* ---- agD-1103 (Discord round 7) ---- */
/* Look at the top card (Mill it / Leave it on top): the outcome buttons size to their text instead of stretching to the thumbnail's
   height (and, on phones, a 7rem minimum width) - "too much space for too little text". */
.choice-options.look-top-row .choice-opt { align-self: center; }
@media (max-width: 820px) { .choice-options.look-top-row .choice-opt { min-width: 0; min-height: 2.4rem; font-size: 0.95rem; padding: 0.35rem 0.9rem; } }
/* Level (Skill Tree) badge: desktop - right under the character's name instead of over the art; the wrap's bottom margin grows to
   keep the next dossier row clear. Phones - a short "Lv N/M" in the Mom / Hand column (below). */
.char-wrap.has-lvl { margin-bottom: 2.05rem; }
.char-wrap .lvl-badge { top: auto; bottom: -2.35rem; left: 50%; transform: translateX(-50%); }
.zone-counts .lvl-count, .zone-counts .pass-count { display: none; }
@media (max-width: 820px), (max-height: 520px) {
  .char-wrap .lvl-badge, .char-wrap .pass-flash { display: none; }
  .dossier-edge .char-wrap.has-lvl, .char-wrap.has-lvl { margin-bottom: 0.3rem; }
  .zone-counts .lvl-count {
    display: inline-block; align-self: flex-start; cursor: pointer; white-space: nowrap; order: 3;
    border-width: 1px; border-radius: 999px; padding: 0 0.35rem; font-size: 0.6rem; font-weight: 700; line-height: 1.35;
    background: color-mix(in srgb, var(--glass, #0a0d11) 92%, transparent); font-variant-numeric: tabular-nums;
  }
  .zone-counts .lvl-count.lvl-up { background: #f2c14e; color: #1b1400; border-color: #f2c14e; }
  /* "Passed" (Enhance Step): small, no emoji, under the counts - it covered the rival's HP badge on the tiny character. */
  .zone-counts .pass-count {
    display: inline-block; align-self: flex-start; white-space: nowrap; order: 4;
    background: var(--hero-deep); color: var(--on-hero-deep, #fff); border-radius: 999px; padding: 0 0.35rem; font-size: 0.55rem; font-weight: 700; line-height: 1.4;
    animation: shuffle-flash-in 0.28s ease-out;
  }
}
@media (prefers-reduced-motion: reduce) { .zone-counts .pass-count { animation: none; } }
/* Card pickers: a face-down card is its card BACK laid over the art, see-through enough to tell which card it is (the zoom still
   shows the full art). */
.card-slot.pick-facedown .card-face.back { transform: scaleX(1); opacity: 0.55; }
.card-slot.pick-facedown .card-face.back .glyph { width: 45%; font-size: 1rem; }
/* Phones: the zone tags ("Stage" / "Hand" / "Your momentum") sit smaller and BELOW the card, not over its art; the card reserves the
   room so the next row doesn't run into them. */
@media (max-width: 820px) {
  .pile-grid > .card-slot.has-pick-tag { margin-bottom: 0.95rem; }
  /* k31112 (Discord "Echo"): a one-row picker inside the flow bar (the Echo window's momentum / card pool / hand cards) clips anything below
     its cards - the zone tag stays ON the card's top edge there. */
  .row > .card-slot.has-pick-tag .pick-loc-badge:not(.reorder-pos) { top: 4px; bottom: auto; }
  .card-slot .pick-loc-badge:not(.reorder-pos) {
    top: auto; bottom: -0.9rem; font-size: 0.5rem; padding: 0 0.3rem; letter-spacing: 0.02em; line-height: 1.4;
    max-width: calc(var(--card-h) + 0.4rem); overflow: hidden; text-overflow: ellipsis;
  }
}
/* An attack aimed at a BACKUP: the backup gets a red ring and a "Target" tag; the attack's stat badges add "-> Backup: <name>". */
.card-slot.attack-targeted > .card-chip { box-shadow: 0 0 0 3px #ff4d4d, 0 0 16px 5px rgba(255, 77, 77, 0.7); border-radius: 8px; }
.card-slot .attack-target-badge {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); z-index: 6; white-space: nowrap; pointer-events: none;
  background: #c0262d; color: #fff; border-radius: 999px; padding: 0.08rem 0.45rem; font-size: 0.62rem; font-weight: 800;
  letter-spacing: 0.03em; text-transform: uppercase; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
/* Desktop: hangs under the DMG badge out of the column's flow, so its width doesn't stretch the zone / SPD / DMG badges. */
.stat-badge.target-badge { border-color: #ff4d4d; color: color-mix(in srgb, #ff8b80, var(--text) var(--ink-mix, 0%)); max-width: 12rem; white-space: nowrap; position: absolute; top: calc(100% + 4px); left: 0; }
.stat-badge.target-badge .sb-lab { color: color-mix(in srgb, #ff8b80, var(--text) var(--ink-mix, 0%)); }
.stat-badge.target-badge .sb-val { font-size: 0.68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* v21109 Gravity Well: "No flip" while cards cannot be flipped during this attack. */
.stat-badge.v21109-noflip { border-color: #9a7bff; white-space: nowrap; }
.stat-badge.v21109-noflip .sb-lab { color: color-mix(in srgb, #c2b0ff, var(--text) var(--ink-mix, 0%)); }
@media (max-width: 820px) {
  .card-slot .attack-target-badge { font-size: 0.5rem; padding: 0 0.3rem; bottom: 13px; } /* clears the backup's stamina badge */
  .stat-badge.target-badge { position: static; }
  .stat-badge.target-badge .sb-val { display: none; } /* phones: "-> Backup" only - the ringed card says which */
}

/* Phones (portrait): the gear sat half above the turn strip - it now sits inside the strip's right end, which the strip's right
   padding keeps clear (Discord). */
@media (max-width: 820px) and (min-height: 521px) {
  #matchTopbar .topbar-gear { top: 1.6rem; right: 0.95rem; padding: 0.05rem 0.45rem; font-size: 1rem; }
  #matchTopbar.open .topbar-gear { top: 0.5rem; right: 0.5rem; }
}

/* Alt. Hand on a phone (portrait): your hand is a plain rounded zone docked under your half (app.js relocateHandToPeek) - no "Your
   hand" tab, always shown, and it no longer covers the board's bottom row; the rival's tab goes too (its size reads "Hand ×N"), so
   both halves drop their clearance for the tabs (suggested on Discord). */
@media (max-width: 820px) and (min-height: 521px) {
  .hand-dock {
    flex: 0 0 auto; display: flex; justify-content: safe center; overflow-x: auto; overflow-y: hidden;
    margin: 0.15rem 0.35rem 0.35rem; padding: 4px 6px; border-radius: 10px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--glass-3, #131a30) 72%, transparent), color-mix(in srgb, var(--glass-2, #0a0d1a) 96%, transparent)); border: 1px solid var(--line-bright);
    scrollbar-width: thin;
  }
  .hand-dock .hand { position: static; transform: none; left: auto; top: auto; bottom: auto; justify-content: flex-start; }
  .hand-dock .hand .card-slot { --card-w: 52px; --card-h: 72.8px; }
  .hand-dock .hand.my-hand .card-slot:hover { transform: none; }
  .hand-dock .hand-hide-btn { display: none; }
  .table.has-hand-dock .half.me .half-grid { padding-bottom: 0.3rem; }
  .table.no-opp-peek .half.opp .half-grid { padding-top: 0.3rem; }
}
/* With Alt. Hand there are no hand tabs on desktop either, so each side shows its hand size beside Mom, as on phones. */
body.alt-hand .hand-count { display: inline; }
/* o51108 (phones): while your hand is raised (Block / Review / mulligan, or pinned) your half gets room below its stage row for the hand, and
   app.js o51108KeepStageVisible scrolls it so the stage row sits just above the hand (it used to be covered). */
@media (max-width: 820px), (max-height: 520px) {
  .table.o51108-hand-up .half.me .half-grid { padding-bottom: calc(var(--o51108-peek-h, 114px) + 0.3rem); }
}
/* A landscape phone has ~96px per half - not enough for a stage row above an ~82px hand - so your half takes the larger share meanwhile. */
@media (max-height: 520px) {
  .table.o51108-hand-up .half.me { flex-grow: 2.6; }
}

/* Alt. Hand (experimental, desktop; app.js mountAltHand): your hand as a floating window - drag it by the ☰ grip, resize it from
   the bottom-right corner (CSS resize needs overflow other than visible), and the cards scale to fit (--hf-w / --hf-h, set by
   fitAltHandCards). Above the board and its peeks, below the card-focus view (60), pickers (70) and the inspector/hover zoom. */
.hand-float {
  position: fixed; z-index: 45; box-sizing: border-box;
  min-width: 160px; min-height: 70px; max-width: 100vw; max-height: 90vh;
  resize: both; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 34px 8px 10px; border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--glass-3, #131a30) 88%, transparent), color-mix(in srgb, var(--glass-2, #0a0d1a) 97%, transparent)); border: 1px solid var(--line-bright);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--shade, #000) 50%, transparent);
}
.hand-float.dragging { opacity: 0.85; box-shadow: 0 12px 36px color-mix(in srgb, var(--shade, #000) 65%, transparent); user-select: none; }
.hand-float-grip {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--line-bright); border-radius: 6px; color: var(--text);
  cursor: grab; touch-action: none;
}
.hand-float-grip:hover { border-color: var(--hero); color: var(--hero); }
.hand-float.dragging .hand-float-grip { cursor: grabbing; }
.hand-float .hand {
  position: static; transform: none; left: auto; top: auto; bottom: auto;
  flex-wrap: wrap; justify-content: center; align-content: center; gap: 6px; max-width: 100%;
}
/* A slot is normally a card-height square (room for a rotated card); hand cards never rotate, so here it is just the card. */
.hand-float .hand .card-slot, .hand-float .hand .card-slot:first-child { --card-w: var(--hf-w, 84px); --card-h: var(--hf-h, 117.6px); width: var(--card-w); margin-left: 0; }
.hand-float .hand.my-hand .card-slot:hover { transform: none; }
.hand-float .hand-hide-btn { display: none; }
/* In-page OK/Cancel dialog (uiConfirm) - a native confirm() drops a phone out of fullscreen. */
.ui-confirm.pile-panel { min-width: min(320px, 90vw); max-width: min(480px, 94vw); }
.ui-confirm-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
/* agU3-1106: in-page notices (uiNotice) - replace native alert(), which drops a phone out of fullscreen. */
.ui-notice-stack { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10050;
  display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.ui-notice { pointer-events: auto; background: var(--panel-2, #1b2440); color: var(--text, #eef1fb); border: 1px solid var(--line, #3a3a44);
  border-left: 4px solid var(--accent, #f0b429); border-radius: 8px; padding: 10px 14px; font-size: 0.92rem; line-height: 1.35;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--shade, #000) 45%, transparent); cursor: pointer; white-space: pre-line; }
/* u31109 Tekken Ball: every check of the check-off, in the check window (chips) and in the result summary (list) */
.u31109-duel { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; margin: 4px 0; font-size: 0.8rem; } /* centered under the centered check header (Discord "Tekken Ball": prompt looked off to the side) */
.u31109-duel-lead { opacity: 0.8; }
.u31109-duel-step { padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line, #3a3a44); white-space: nowrap; }
.u31109-duel-step.ok { border-color: color-mix(in srgb, #3fb950 70%, transparent); }
.u31109-duel-step.fail { border-color: color-mix(in srgb, #f85149 75%, transparent); }
.u31109-duel-step.now { border-color: var(--accent, #f0b429); font-weight: 600; }
.u31109-duel-result { max-width: min(560px, calc(100vw - 32px)); }
.u31109-duel-list { margin: 6px 0 8px; padding-left: 1.4em; line-height: 1.5; }
.u31109-duel-list li.ok::marker { color: #3fb950; }
.u31109-duel-list li.fail { font-weight: 600; }
.u31109-duel-outcome { font-weight: 600; margin: 4px 0 10px; }

/* r46 (Discord "Invade From Space"): the dedicated reorder window - the top N cards, left = top of the deck, each with < > */
.r46-reorder { max-width: min(760px, 94vw); }
.r46-strip { --card-w: clamp(96px, 11vw, 150px); --card-h: calc(var(--card-w) * 7 / 5); display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; padding: 0.4rem 0 0.8rem; }
.r46-slot { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.r46-pos { font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.r46-slot:first-child .r46-pos { color: var(--accent, #c9a2ff); }
.r46-arrows { display: flex; gap: 0.4rem; }
.r46-arrows button { width: 40px; height: 36px; font-size: 1.3rem; line-height: 1; padding: 0; }
.r46-arrows button:disabled { opacity: .3; }
.r46-foot { flex-direction: row !important; justify-content: center; flex-wrap: wrap; }
@media (max-width: 640px) { .r46-strip { gap: 0.5rem; --card-w: min(104px, calc((100vw - 72px) / 3)); } .r46-arrows button { width: 44px; height: 40px; } }
/* r61sv (round 61, owner request "card sleeves"): the sleeve looks (approved mockup, logo-free: the pattern edge to edge + a thin inner frame).
   Each .r61sv-s-<id> sets the back (--r61sv-bg), its frame colour (--r61sv-trim) and the face-up edge (--r61sv-edge); .r61sv-back paints a
   card back with them (app.js r61svBackCls: chip back faces, the deck / momentum tile, the rival's hidden hand, a face-down Card Info, the
   lobby's shuffle cards). Classic (no class) = the striped back, unchanged. CSS only - the only animation is the Prism foil. */
.r61sv-s-obsidian { --r61sv-trim: #9fb2d6; --r61sv-bg: repeating-linear-gradient(60deg, rgba(159,178,214,.06) 0 1px, transparent 1px 12px), repeating-linear-gradient(-60deg, rgba(159,178,214,.06) 0 1px, transparent 1px 12px), radial-gradient(ellipse at 30% 18%, #2a3552 0%, #0d1220 62%); --r61sv-edge: linear-gradient(150deg, #c3d0ea, #4a5878); }
.r61sv-s-ember { --r61sv-trim: #ffb36b; --r61sv-bg: repeating-linear-gradient(168deg, rgba(255,180,80,.12) 0 2px, transparent 2px 15px), radial-gradient(ellipse at 50% 112%, #ff7a2f 0%, #b3261e 36%, #3a0b0d 78%); --r61sv-edge: linear-gradient(150deg, #ffc58a, #b8461f); }
.r61sv-s-tide { --r61sv-trim: #7fe3ff; --r61sv-bg: repeating-radial-gradient(circle at 50% 135%, rgba(127,227,255,.16) 0 2px, transparent 2px 15px), linear-gradient(180deg, #0b3a57, #05172a); --r61sv-edge: linear-gradient(150deg, #9be9ff, #2f8fb4); }
.r61sv-s-verdant { --r61sv-trim: #b9e88f; --r61sv-bg: repeating-radial-gradient(ellipse at 28% 38%, rgba(185,232,143,.14) 0 1.5px, transparent 1.5px 11px), linear-gradient(160deg, #21502d, #0a1d11); --r61sv-edge: linear-gradient(150deg, #cdf0a8, #3f7a2c); }
.r61sv-s-storm { --r61sv-trim: #e3ebf7; --r61sv-bg: repeating-linear-gradient(115deg, rgba(227,235,247,.11) 0 1px, transparent 1px 9px), linear-gradient(200deg, #61738f, #202839); --r61sv-edge: linear-gradient(150deg, #f1f5fb, #6f7f99); }
.r61sv-s-void { --r61sv-trim: #cda8ff; --r61sv-bg: radial-gradient(1.2px 1.2px at 20% 28%, #fff 50%, transparent 52%), radial-gradient(1.6px 1.6px at 72% 62%, #efe2ff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 40% 82%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 86% 18%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 12% 70%, #fff 50%, transparent 52%), radial-gradient(1.4px 1.4px at 58% 12%, #fff 50%, transparent 52%), radial-gradient(ellipse at 50% 50%, #40206b 0%, #0a0414 72%); --r61sv-edge: linear-gradient(150deg, #e2c9ff, #6b3fb0); }
.r61sv-s-circuit { --r61sv-trim: #f2c76b; --r61sv-bg: linear-gradient(90deg, rgba(242,199,107,.15) 1px, transparent 1px) 0 0 / 14px 14px, linear-gradient(0deg, rgba(242,199,107,.15) 1px, transparent 1px) 0 0 / 14px 14px, linear-gradient(180deg, #152442, #0a1222); --r61sv-edge: linear-gradient(150deg, #ffe2a0, #a8792a); }
.r61sv-s-prism { --r61sv-trim: #ffffff; --r61sv-bg: linear-gradient(135deg, #1b2140, #2c1842); --r61sv-edge: linear-gradient(135deg, #ff7ac6, #7fe3ff, #ffe36b, #c9a2ff); }
.r61sv-s-mwhite { --r61sv-trim: #9aa3b2; --r61sv-bg: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px) 0 0 / 4px 4px, linear-gradient(160deg, #f4f5f7, #d6dae1); --r61sv-edge: linear-gradient(150deg, #f7f8fa, #c3c8d0); }
.r61sv-s-mblack { --r61sv-trim: #454b57; --r61sv-bg: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 4px 4px, linear-gradient(160deg, #1c1e23, #0a0b0e); --r61sv-edge: linear-gradient(150deg, #4a505c, #0b0c0f); }
.r61sv-s-silver { --r61sv-trim: #ffffff; --r61sv-bg: repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 1px, transparent 1px 3px), linear-gradient(135deg, #dfe4ec 0%, #9ba5b4 34%, #f1f4f8 54%, #8b95a4 78%, #cdd3dc 100%); --r61sv-edge: linear-gradient(135deg, #f4f7fb, #8d97a6 50%, #e3e8ef); }
.r61sv-s-brown { --r61sv-trim: #d1a575; --r61sv-bg: radial-gradient(rgba(0,0,0,.08) 1px, transparent 1px) 0 0 / 4px 4px, linear-gradient(160deg, #70482b, #3a2313); --r61sv-edge: linear-gradient(150deg, #c99a6c, #4f321c); }
.r61sv-s-lime { --r61sv-trim: #efffc2; --r61sv-bg: radial-gradient(rgba(0,0,0,.06) 1px, transparent 1px) 0 0 / 4px 4px, linear-gradient(160deg, #b4ec3a, #5e9b10); --r61sv-edge: linear-gradient(150deg, #d8ff7c, #5e9b10); }
/* r64ss (round 64): the 13 symbol sleeves - the approved Symbols mockup's colours ported as-is (--trim / --edge / the face-down background),
   colours + texture only, no symbol art; same frame / gloss as every sleeve (.r61sv-back ::before / ::after), none is matte, no foil. */
.r61sv-s-sym-air { --r61sv-trim: #ffffff; --r61sv-bg: repeating-radial-gradient(ellipse 140% 60% at 15% 115%,rgba(255,255,255,.2) 0 1.5px,transparent 1.5px 13px),linear-gradient(170deg,#d6f1fc 0%,#7fc7e8 45%,#3a80b2 100%); --r61sv-edge: linear-gradient(150deg,#e6f6fd,#5fb0dc); }
.r61sv-s-sym-all { --r61sv-trim: #ffffff; --r61sv-bg: repeating-radial-gradient(ellipse 60% 40% at 50% 50%,rgba(110,125,185,.24) 0 1px,transparent 1px 9px),linear-gradient(160deg,#f2f5ff 0%,#d6def5 45%,#97a3cf 100%); --r61sv-edge: linear-gradient(150deg,#f4f6ff,#8f9bc9); } /* r67: owner swapped the All / Infinity looks */
.r61sv-s-sym-chaos { --r61sv-trim: #ffc2e0; --r61sv-bg: repeating-linear-gradient(72deg,rgba(255,170,210,.15) 0 1px,transparent 1px 17px),repeating-linear-gradient(-28deg,rgba(255,150,70,.13) 0 2px,transparent 2px 23px),linear-gradient(135deg,#e06aa0 0%,#7a1f5c 52%,#2a0a26 100%); --r61sv-edge: linear-gradient(150deg,#ff9cc8,#a12a72); }
.r61sv-s-sym-death { --r61sv-trim: #cfc8dc; --r61sv-bg: repeating-linear-gradient(90deg,rgba(207,200,220,.05) 0 1px,transparent 1px 7px),radial-gradient(ellipse at 50% 0%,#5a5266 0%,#26222d 48%,#0b0a0e 100%); --r61sv-edge: linear-gradient(150deg,#9b93aa,#2c2833); }
.r61sv-s-sym-earth { --r61sv-trim: #ffffff; --r61sv-bg: linear-gradient(135deg,rgba(0,0,0,.22) 25%,transparent 25%) 0 0/24px 24px,linear-gradient(225deg,rgba(0,0,0,.22) 25%,transparent 25%) 0 0/24px 24px,radial-gradient(ellipse 120% 45% at 50% -6%,rgba(255,255,255,.42) 0%,rgba(255,255,255,0) 62%),linear-gradient(180deg,#5cc254 0%,#2f8f36 52%,#0e2e12 100%); --r61sv-edge: linear-gradient(150deg,#7ad46a,#1e6b28 55%,#0b120c); } /* r69: official symbol colours (tester) */
.r61sv-s-sym-evil { --r61sv-trim: #ff7a9e; --r61sv-bg: radial-gradient(ellipse at 50% 125%,rgba(255,60,100,.38) 0%,transparent 55%),repeating-conic-gradient(from 0deg at 50% 125%,rgba(0,0,0,.28) 0 6deg,transparent 6deg 14deg),linear-gradient(180deg,#1a050c 0%,#5c1230 60%,#b23a6a 100%); --r61sv-edge: linear-gradient(150deg,#d2466f,#3a0a1a); }
.r61sv-s-sym-fire { --r61sv-trim: #fff0b0; --r61sv-bg: repeating-linear-gradient(82deg,rgba(255,240,170,.13) 0 2px,transparent 2px 11px),radial-gradient(ellipse 120% 80% at 50% 118%,#ffe27a 0%,#ffa23a 32%,#e8552a 60%,#7a1e0c 100%); --r61sv-edge: linear-gradient(150deg,#ffd36a,#e0501f); }
.r61sv-s-sym-good { --r61sv-trim: #fffaf0; --r61sv-bg: repeating-conic-gradient(from 0deg at 50% -10%,rgba(255,255,255,.2) 0 3deg,transparent 3deg 12deg),linear-gradient(180deg,#fff3cc 0%,#e6c15a 48%,#a8802a 100%); --r61sv-edge: linear-gradient(150deg,#fff1c4,#c99a35); }
.r61sv-s-sym-infinity { --r61sv-trim: #ffffff; --r61sv-bg: linear-gradient(rgba(10,14,30,.38),rgba(10,14,30,.38)),repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 1px,transparent 1px 10px),conic-gradient(from 210deg at 50% 50%,#7fc7e8,#5ccf92,#e6c15a,#e87a45,#e06aa0,#a481d6,#4aa8e0,#7fc7e8); --r61sv-edge: linear-gradient(150deg,#7fc7e8,#e6c15a,#e06aa0); }
.r61sv-s-sym-life { --r61sv-trim: #ffffff; --r61sv-bg: radial-gradient(circle at 30% 30%,rgba(255,255,255,.18) 0 3px,transparent 4px) 0 0/16px 16px,radial-gradient(circle at 75% 72%,rgba(255,255,255,.11) 0 2px,transparent 3px) 0 0/16px 16px,linear-gradient(165deg,#6fe0cc 0%,#2fae9c 45%,#17786d 75%,#0a2e2a 100%); --r61sv-edge: linear-gradient(150deg,#8ff0df,#1f9a8b 52%,#0b2b28); } /* r70: official teal (owner) */
.r61sv-s-sym-order { --r61sv-trim: #1c1c1c; --r61sv-bg: repeating-linear-gradient(45deg,rgba(20,20,20,.2) 0 1px,transparent 1px 16px),repeating-linear-gradient(-45deg,rgba(20,20,20,.2) 0 1px,transparent 1px 16px),radial-gradient(ellipse at 50% 0%,#ffffff 0%,rgba(255,255,255,0) 62%),linear-gradient(180deg,#fffaea 0%,#fff5cc 50%,#e6d7a0 100%); --r61sv-edge: linear-gradient(150deg,#ffffff,#fff5cc 52%,#1c1c1c); } /* r69: official symbol colours (tester) */
.r61sv-s-sym-void { --r61sv-trim: #c9a6ff; --r61sv-bg: radial-gradient(circle at 50% 50%,#020104 0 16%,rgba(150,90,240,.5) 21%,transparent 47%),repeating-radial-gradient(circle at 50% 50%,rgba(170,120,255,.1) 0 1px,transparent 1px 8px),linear-gradient(180deg,#1c0d33,#050208); --r61sv-edge: linear-gradient(150deg,#9b6cf0,#16082c); }
.r61sv-s-sym-water { --r61sv-trim: #c8f4ff; --r61sv-bg: repeating-linear-gradient(160deg,rgba(200,244,255,.15) 0 1px,transparent 1px 8px),repeating-linear-gradient(20deg,rgba(200,244,255,.08) 0 1px,transparent 1px 13px),linear-gradient(180deg,#3fc6d6 0%,#1a7fa8 45%,#0a3a5c 100%); --r61sv-edge: linear-gradient(150deg,#7fe6f0,#0f5f86); }
/* the back: replaces the striped background (the stripes' own rules are more specific, hence !important on the background only) */
.r61sv-back { background: var(--r61sv-bg) !important; overflow: hidden; }
.lib-face.r61sv-back, .i-fd-back.r61sv-back, .deck-shuffle .card.r61sv-back, .r61sv-card { position: relative; }
.r61sv-back > .glyph { display: none !important; }
.r61sv-back > :not(.r61sv-foil):not(.glyph) { position: relative; z-index: 1; }
.r61sv-back::before { content: ""; position: absolute; inset: 7%; border-radius: 5px; border: 1.5px solid var(--r61sv-trim); opacity: .5; pointer-events: none; }
.r61sv-back::after { content: ""; position: absolute; inset: 0; background: linear-gradient(118deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0) 72%, rgba(255,255,255,.07) 100%); pointer-events: none; }
.r61sv-back.r61sv-matte::after, .r61sv-matte > .card-flip-outer .r61sv-back::after { background: linear-gradient(118deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 40%); }
.card-slot.lib-stack.mini .lib-face.r61sv-back::before, .card-slot.mini .r61sv-back::before { inset: 6%; border-width: 1px; border-radius: 3px; }
/* Prism: the animated foil (paused by Settings > Foil shimmer: Still and under reduced motion) */
.r61sv-foil { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; background: linear-gradient(115deg, transparent 18%, rgba(255,60,170,.38) 34%, rgba(60,220,255,.38) 50%, rgba(255,230,60,.32) 66%, transparent 82%); background-size: 260% 260%; animation: r61sv-holo 5s linear infinite; }
@keyframes r61sv-holo { 0% { background-position: 0% 50%; } 100% { background-position: 260% 50%; } }
body.r61sv-still .r61sv-foil, .r61sv-foil.r61sv-foil-still { animation: none; background-position: 40% 50%; }
/* face up: the edge is the card face's own 2px border (no size change, never over the art) in the sleeve's gradient + a soft gloss.
   Hover / glow / target / pick rings are outlines or more specific border colours, so they still win. */
.card-chip.r61sv-edge .card-face.front { border-color: transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--r61sv-edge) border-box; }
.card-chip.r61sv-edge .card-face.front::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(118deg, rgba(255,255,255,.13) 0%, rgba(255,255,255,0) 20%, rgba(255,255,255,0) 80%, rgba(255,255,255,.05) 100%); }
/* "2 sides" (a double-faced card - owner's view, face up only) */
.card-slot.r61sv-has-2s { position: relative; }
.r61sv-2s { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); z-index: 6; display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 999px; background: #0b1226; border: 1px solid #7fe3ff; color: #dff6ff; font-size: 0.46rem; line-height: 1.3; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.card-slot.rotated > .r61sv-2s { bottom: auto; top: calc(50% + 1.2em); }
.r61sv-2s svg { flex: none; }
@media (max-width: 820px) { .r61sv-2s { font-size: 0; gap: 0; padding: 2px; bottom: 2px; } .r61sv-2s svg { width: 9px; height: 9px; } }
/* transform flip: the old face turns over onto the new one, once (app.js r61svComputeFlips) */
.card-chip.r61sv-flipping > .card-flip-outer { animation: r61sv-hide 0.7s linear var(--r61sv-d, 0ms) both; }
.r61sv-flip { position: absolute; inset: 0; perspective: 900px; z-index: 3; pointer-events: none; animation: r61sv-gone 0.7s linear var(--r61sv-d, 0ms) both; }
.r61sv-flip-in { position: absolute; inset: 0; transform-style: preserve-3d; animation: r61sv-turn 0.7s ease-in-out var(--r61sv-d, 0ms) both; }
.r61sv-ff { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid var(--line); background: var(--panel-2); }
.r61sv-ff img { width: 100%; height: 100%; object-fit: cover; display: block; }
.r61sv-ff-b { transform: rotateY(180deg); }
.card-chip.r61sv-edge .r61sv-ff { border-color: transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--r61sv-edge) border-box; }
@keyframes r61sv-turn { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }
@keyframes r61sv-hide { 0%, 99.9% { opacity: 0; } 100% { opacity: 1; } }
@keyframes r61sv-gone { 0%, 99.9% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .r61sv-foil { animation: none; background-position: 40% 50%; }
  .r61sv-flip { display: none; }
  .card-chip.r61sv-flipping > .card-flip-outer { animation: none; }
}
/* the picker sheet (deck library ⋯ -> Sleeve): the cs2 sheet / seg / buttons + a tile grid and a preview */
#setup.cs2 .r61sv-panel { width: min(1080px, 100%); }
#setup.cs2 .r61sv-body { display: flex; min-height: 0; overflow-y: auto; }
#setup.cs2 .r61sv-pickcol { width: 46%; flex: none; padding: 20px 28px; border-right: 1px solid var(--fo-line); display: flex; flex-direction: column; gap: 12px; }
#setup.cs2 .r61sv-sidecol { flex: 1; min-width: 0; padding: 20px 28px; display: flex; flex-direction: column; gap: 16px; }
#setup.cs2 .r61sv-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
#setup.cs2 .r61sv-tile { background: transparent; border: 0; padding: 4px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; color: var(--fo-text); text-align: left; cursor: pointer; outline: 2px solid transparent; outline-offset: -1px; font: inherit; }
#setup.cs2 .r61sv-tile:hover { outline-color: var(--fo-line); }
#setup.cs2 .r61sv-tile.on { outline-color: var(--fo-accent); }
#setup.cs2 .r61sv-tile:focus-visible { outline-color: var(--fo-accent); outline-style: dashed; }
#setup.cs2 .r61sv-tile-name { font-size: 12px; font-weight: 600; padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* r64ss: the picker's two groups (Sleeves / Symbols), each a cs2-cap heading over the existing tile grid */
#setup.cs2 .r64ss-groups { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#setup.cs2 .r64ss-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#setup.cs2 .r61sv-pickcol { overflow-y: auto; min-height: 0; } /* 27 tiles: the grid scrolls on its own so the preview stays in view */
.r61sv-card { display: block; width: 100%; aspect-ratio: 5 / 7; border-radius: 8px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.09); }
.r61sv-card.r61sv-classic { background: repeating-linear-gradient(135deg, var(--fo-surf, var(--panel-2)) 0 6px, var(--fo-surf2, var(--panel)) 6px 12px); border: 2px solid var(--fo-line, var(--line)); box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.r61sv-card.r61sv-classic .glyph { width: 52%; aspect-ratio: 1; border: 2px solid var(--tide, #6dd3ff); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--tide, #6dd3ff); font-family: "Rockwell", "Roboto Slab", Georgia, serif; font-size: 0.8rem; }
#setup.cs2 .r61sv-prev { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; }
#setup.cs2 .r61sv-pv { display: flex; flex-direction: column; gap: 8px; width: 132px; flex: none; }
#setup.cs2 .r61sv-pv-big .r61sv-card .glyph { font-size: 1.4rem; }
#setup.cs2 .r61sv-pv-lab { font-size: 12px; color: var(--fo-muted); }
#setup.cs2 .r61sv-pv-fan { flex: 1 1 auto; min-width: 0; width: auto; align-items: center; }
#setup.cs2 .r61sv-fan { display: flex; height: 112px; align-items: flex-start; justify-content: center; }
#setup.cs2 .r61sv-fan-c { width: 46px; margin: 0 -7px; transform-origin: 50% 160%; display: block; }
#setup.cs2 .r61sv-fu { display: block; position: relative; border-radius: 10px; aspect-ratio: 5 / 7; box-shadow: 0 10px 26px rgba(0,0,0,.5); background: var(--fo-surf2); overflow: hidden; }
#setup.cs2 .r61sv-fu img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
#setup.cs2 .r61sv-fu.r61sv-fu-edge { padding: 3px; background: var(--r61sv-edge); box-sizing: border-box; }
#setup.cs2 .r61sv-fu.r61sv-fu-edge::after { content: ""; position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(118deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,0) 28%, rgba(255,255,255,0) 74%, rgba(255,255,255,.06) 100%); pointer-events: none; }
#setup.cs2 .r61sv-fu-none { display: flex; align-items: center; justify-content: center; font-family: var(--fo-display); font-size: 28px; color: var(--fo-muted); }
#setup.cs2 .r61sv-opts { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--fo-line); padding-top: 16px; }
#setup.cs2 .r61sv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
#setup.cs2 .r61sv-row-lab { font-size: 14px; font-weight: 600; color: var(--fo-text); }
#setup.cs2 .r61sv-foot { align-items: center; }
#setup.cs2 .r61sv-foot-btns { display: flex; gap: 10px; margin-left: auto; }
@media (max-width: 820px) {
  #setup.cs2 .r61sv-body { flex-direction: column; }
  #setup.cs2 .r61sv-pickcol { width: auto; border-right: 0; border-bottom: 1px solid var(--fo-line); padding: 14px 16px; }
  #setup.cs2 .r61sv-sidecol { padding: 14px 16px; }
  #setup.cs2 .r61sv-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 6px; }
  #setup.cs2 .r61sv-tile .r61sv-card { width: 74%; margin: 0 auto; }
  #setup.cs2 .r61sv-tile-name { text-align: center; }
  #setup.cs2 .r61sv-prev { gap: 12px; flex-wrap: nowrap; }
  #setup.cs2 .r61sv-tile { padding: 2px; }
  #setup.cs2 .r61sv-tile-name { font-size: 10px; }
  #setup.cs2 .r61sv-pv { width: 72px; }
  #setup.cs2 .r61sv-pv-fan { min-width: 0; }
  #setup.cs2 .r61sv-fan { height: 76px; }
  #setup.cs2 .r61sv-fan-c { width: 34px; margin: 0 -6px; }
  #setup.cs2 .r61sv-pv-lab { font-size: 11px; }
  #setup.cs2 .r61sv-pv-big .r61sv-card .glyph { font-size: 0.9rem; }
  #setup.cs2 .r64ss-groups { gap: 12px; }
  #setup.cs2 .r64ss-group { gap: 6px; }
  #setup.cs2 .r61sv-pickcol { overflow-y: visible; } /* stacked: the whole sheet body scrolls, as before */
  #setup.cs2 .r61sv-foot-note { display: none; }
}

/* sc1121 (owner request: friends online / invite / watch / shared decks / messages) - app.js sc1121*. The Friends window gets a status dot,
   a status line and actions per friend (Watch while they're in a match, Invite while they're online, Message always, More: Send a deck /
   Remove friend); a badge on Friends + the account button counts what's waiting; toasts (bottom right) carry invites and new messages; the
   message window floats bottom right (a bottom sheet on phones); a watched match shows a "Watching <name>" bar at the top. */
.sc-friends-card { max-width: 520px; }
#friendsPanel { z-index: 75; } /* above an open pick window mid-match (.pile-backdrop 70); Settings (140) and the social windows sit higher */
.sc-confirm-backdrop { z-index: 165; }
.sc-confirm p { margin: 0.2rem 0 0.4rem; line-height: 1.45; }
.sc-confirm-row { display: flex; justify-content: flex-end; gap: 0.5rem; }
.sc-confirm-row button { min-height: 40px; min-width: 6rem; border-radius: 8px; }
.sc-offline-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.45rem; margin: 0.6rem 0 0.2rem; font-size: 0.8rem; cursor: pointer; }
.sc-offline-toggle input { width: 16px; height: 16px; margin: 0; }
.sc-offline-toggle .key-hint { flex-basis: 100%; margin: 0; padding-left: calc(16px + 0.45rem); font-size: 0.7rem; }
.friend-row.sc-friend { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.3rem 0.55rem; padding: 0.5rem 0; }
.sc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); opacity: 0.55; }
.sc-online > .sc-dot { background: var(--good, #4ade80); opacity: 1; box-shadow: 0 0 6px color-mix(in srgb, var(--good, #4ade80) 60%, transparent); }
.sc-match > .sc-dot { background: var(--hero); opacity: 1; box-shadow: 0 0 6px color-mix(in srgb, var(--hero) 60%, transparent); }
.sc-who { display: flex; flex-direction: column; min-width: 0; gap: 0.05rem; }
.sc-name { font-weight: 700; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.sc-status { font-size: 0.7rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-online .sc-status { color: var(--good, #4ade80); }
.sc-match .sc-status { color: var(--hero); }
.sc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.3rem; }
.sc-actions button, .sc-extra button, .friend-row.sc-req button, .friend-row.sc-inv button, .friend-row.sc-share button {
  min-height: 32px; padding: 0.25rem 0.55rem; font-size: 0.74rem; border-radius: 6px; cursor: pointer; white-space: nowrap; position: relative; }
.sc-actions .sc-more { min-width: 32px; padding: 0.25rem 0.4rem; }
.sc-extra { display: none; grid-column: 2 / -1; justify-content: flex-end; flex-wrap: wrap; gap: 0.3rem; }
.sc-friend.sc-open > .sc-extra { display: flex; }
.sc-extra .sc-remove { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.friend-row.sc-req, .friend-row.sc-inv, .friend-row.sc-share { flex-wrap: wrap; }
.friend-row.sc-req .sc-who, .friend-row.sc-inv .sc-who, .friend-row.sc-share .sc-who { flex: 1 1 12rem; }
.sc-badge { display: inline-block; margin-left: 0.35rem; min-width: 1.1rem; padding: 0 0.3rem; border-radius: 999px; background: var(--bad); color: #fff;
  font-size: 0.66rem; font-weight: 700; line-height: 1.1rem; text-align: center; vertical-align: middle; }
.w21110-acct-btn { position: relative; }
.sc-acct-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff;
  font-size: 0.64rem; font-weight: 700; line-height: 18px; text-align: center; pointer-events: none; box-shadow: 0 0 0 2px var(--ink); }
#setup .sc-pvp-note, .sc-pvp-note { white-space: normal; overflow: visible; text-overflow: clip; text-align: left; line-height: 1.4; }
.sc-pvp-note { margin: 0.2rem 0 0.5rem; padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--hero) 55%, var(--line));
  background: color-mix(in srgb, var(--hero) 10%, var(--panel)); color: var(--text); font-size: 0.8rem; }

/* toasts */
.sc-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 160; display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.sc-toast { pointer-events: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.5rem; padding: 0.6rem 0.7rem; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line-bright); color: var(--text); font-size: 0.82rem; max-width: 100%;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--shade, #000) 50%, transparent); animation: sc-toast-in 180ms ease-out; }
.sc-toast.sc-invite { border-color: var(--hero); }
.sc-toast-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.sc-toast button { min-height: 34px; padding: 0.3rem 0.7rem; border-radius: 7px; font-size: 0.78rem; cursor: pointer; }
.sc-toast .sc-toast-x { min-width: 34px; padding: 0.3rem; background: none; border: 0; color: var(--text-dim); }
@keyframes sc-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sc-toast { animation: none; } }

/* send-a-deck picker */
.sc-modal-backdrop { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--shade, #000) 55%, transparent); }
.sc-modal { width: min(460px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--panel); border: 1px solid var(--hero); border-radius: 12px; padding: 0.7rem 0.9rem 0.9rem; overflow: hidden; }
.sc-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.sc-modal-head h3 { margin: 0; font-size: 1rem; }
.sc-modal-x { min-width: 36px; min-height: 36px; border-radius: 8px; }
.sc-modal-q { width: 100%; min-height: 36px; padding: 0.3rem 0.6rem; border-radius: 8px; border: 1px solid var(--line-bright); background: var(--panel-2); color: var(--text); font: inherit; }
.sc-modal-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; }
.sc-deck-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left; min-height: 44px; padding: 0.4rem 0.6rem;
  border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.sc-deck-pick:hover { border-color: var(--hero); }

/* message window */
.sc-chat { position: fixed; right: 16px; bottom: 16px; z-index: 155; width: min(360px, calc(100vw - 32px)); height: min(460px, calc(100dvh - 32px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--hero); border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 40px color-mix(in srgb, var(--shade, #000) 60%, transparent); }
.sc-chat-head { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.45rem 0.8rem; border-bottom: 1px solid var(--line); }
.sc-chat-title { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-chat-head .sc-status { grid-row: 2; }
.sc-chat-x { grid-row: 1 / 3; grid-column: 2; align-self: center; min-width: 36px; min-height: 36px; border-radius: 8px; }
.sc-chat-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.sc-chat-empty { margin: auto; color: var(--text-dim); font-size: 0.8rem; }
.sc-msg { max-width: 82%; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.35rem 0.6rem; border-radius: 12px; font-size: 0.84rem; line-height: 1.3; }
.sc-msg.theirs { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.sc-msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--hero) 22%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--hero) 50%, var(--line)); border-bottom-right-radius: 4px; }
.sc-msg.pending { opacity: 0.65; }
.sc-msg.failed { border-color: var(--bad); }
.sc-msg-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.sc-msg-time { font-size: 0.62rem; color: var(--text-dim); align-self: flex-end; }
.sc-chat-note { flex: 0 0 auto; margin: 0; padding: 0.25rem 0.8rem; font-size: 0.68rem; color: var(--text-dim); border-top: 1px solid var(--line); }
.sc-chat-form { flex: 0 0 auto; display: flex; gap: 0.4rem; padding: 0.5rem 0.6rem 0.6rem; }
.sc-chat-form input { flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 0.3rem 0.6rem; border-radius: 8px; border: 1px solid var(--line-bright);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 16px; }
.sc-chat-form button { min-height: 40px; padding: 0.3rem 0.9rem; border-radius: 8px; }
@media (max-width: 820px) {
  .sc-chat { left: 8px; right: 8px; bottom: 8px; width: auto; height: min(460px, 62dvh); }
  .sc-toasts { right: 8px; left: 8px; bottom: 8px; max-width: none; align-items: stretch; }
  .friend-row.sc-friend { grid-template-columns: auto minmax(0, 1fr); }
  .friend-row.sc-friend > .sc-actions { grid-column: 2; justify-content: flex-start; }
  .sc-actions button, .sc-extra button { min-height: 40px; }
  .sc-extra { justify-content: flex-start; }
}

/* watching a friend's match */
.sc-watch-bar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 0.6rem;
  max-width: calc(100vw - 120px); padding: 0.3rem 0.35rem 0.3rem 0.8rem; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--hero); color: var(--text); font-size: 0.8rem; box-shadow: 0 6px 18px color-mix(in srgb, var(--shade, #000) 45%, transparent); }
.sc-watch-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-watch-stop { flex: 0 0 auto; min-height: 30px; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.74rem; cursor: pointer; }
body.sc-watching .action-panel.flow-bar button:not(.sc-watch-stop-bar) { display: none; }
.action-panel.flow-bar .sc-watch-stop-bar { margin-left: 0.6rem; }
@media (min-width: 821px) { .action-panel.flow-bar .sc-watch-stop-bar { display: none; } }
@media (max-width: 820px) {
  .sc-watch-bar { display: none; }
}
