* { margin: 0; padding: 0; box-sizing: border-box; }
/* Global readability bump: nearly all text is sized in rem, so raising the
   root size scales every font up uniformly (~+25% over the 16px default)
   while px/vw layout dimensions stay fixed. Lifts all body/UI text. */
html { font-size: 20px; }
:root {
    --bg-dark: #0a0a0f;
    --bg-card: #1a1a24;
    --bg-hover: #252532;
    --gold: #d4af37;
    --gold-dim: #8b7355;
    --red: #8b0000;
    --red-bright: #dc143c;
    --blue: #1e3a5f;
    --blue-bright: #4169e1;
    --green: #228b22;
    --orange: #ff8400;
    --purple: #9c27b0;
    --text: #e8e6e3;
    --text-dim: #888;
    --border: #333;
}
body { font-family: 'Crimson Text', serif; background: var(--bg-dark); color: var(--text); min-height: 100vh; }
.screen { display: none; min-height: 100vh; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; }
.screen.active { display: flex; }
.title { font-family: 'Cinzel', serif; font-size: 3rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 30px rgba(212, 175, 55, 0.3); margin-bottom: 0.5rem; }
.subtitle { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 1rem; font-style: italic; }
/* Logo variants of .title. Text-shadow would draw a gold halo around the
   image box, so it is switched off here. */
.title-logo { line-height: 0; text-shadow: none; margin-bottom: 1rem; }
.title-logo img { width: min(420px, 74vw); height: auto; display: block; margin: 0 auto; }
.title-wordmark img { width: min(300px, 62vw); }
/* How to Play page */
.htp-screen { justify-content: flex-start; padding: 1.5rem 1rem; }
.htp-panel { width: min(820px, 96vw); max-height: 92vh; display: flex; flex-direction: column; background: var(--bg-card); border: 2px solid var(--gold); border-radius: 8px; box-shadow: 0 0 40px rgba(212,175,55,0.2); padding: 1.4rem 1.6rem; }
.htp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.8rem; margin-bottom: 0.5rem; }
.htp-title { font-size: 2.1rem; margin: 0; }
.htp-videos { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.htp-videos .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.htp-body { flex: 1 1 auto; overflow-y: auto; padding: 0.4rem 0.5rem 0.8rem 0; margin-bottom: 0.9rem; text-align: left; color: var(--text); line-height: 1.5; font-size: 0.92rem; }
.htp-body h2 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.15rem; margin: 1.3rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
.htp-body p { margin: 0.5rem 0; }
.htp-body ul { margin: 0.4rem 0 0.7rem; padding-left: 1.3rem; }
.htp-body li { margin: 0.3rem 0; }
.htp-body b { color: var(--text-bright, #f0e6d0); }
.btn { font-family: 'Cinzel', serif; font-size: 1rem; padding: 0.6rem 1.5rem; border: 2px solid var(--gold); background: transparent; color: var(--gold); cursor: pointer; transition: all 0.2s; margin: 0.3rem; }
.btn:hover:not(:disabled) { background: var(--gold); color: var(--bg-dark); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: var(--bg-dark); }
.btn.small { font-size: 0.8rem; padding: 0.3rem 0.8rem; }
/* The main menu's settings gear; the panel itself comes from src/feel/settingsPanel.ts. */
.settings-gear { position: fixed; top: 0.6rem; right: 0.6rem; z-index: 90; width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; line-height: 1; background: rgba(10,10,15,0.7); border: 2px solid var(--gold); border-radius: 50%; color: var(--gold); cursor: pointer; }
.settings-gear:hover { background: var(--gold); color: var(--bg-dark); }
.lobby-code { font-family: 'Cinzel', serif; font-size: 3rem; color: var(--gold); letter-spacing: 0.3em; margin: 1.5rem 0; padding: 1rem 2rem; border: 2px solid var(--gold); background: rgba(212, 175, 55, 0.1); cursor: pointer; }
.lobby-input { font-family: 'Cinzel', serif; font-size: 1.5rem; padding: 0.75rem 1.5rem; border: 2px solid var(--border); background: var(--bg-card); color: var(--gold); text-align: center; letter-spacing: 0.2em; text-transform: uppercase; width: 200px; }
.error-msg { color: var(--red-bright); margin: 1rem 0; }

/* Character Select */
.char-grid { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; margin: 1.5rem 0; }
.char-card { background: var(--bg-card); border: 2px solid var(--border); padding: 1rem; width: 260px; cursor: pointer; transition: all 0.2s; position: relative; }
.char-card:hover:not(.locked):not(.coming-soon) { border-color: var(--gold); transform: translateY(-4px); }
.char-card.selected { border-color: var(--gold); box-shadow: 0 0 20px rgba(212, 175, 55, 0.3); }
.char-card.locked { border-color: var(--green); cursor: default; }
.char-card.locked::after { content: '✓ LOCKED'; position: absolute; top: 8px; right: 8px; background: var(--green); color: white; padding: 0.15rem 0.4rem; font-size: 0.65rem; }
.char-card.coming-soon { cursor: default; opacity: 0.8; }
.char-portrait-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 0.8rem; }
.char-portrait { width: 100%; height: 100%; background: var(--bg-dark); border: 1px solid var(--border); background-size: cover; background-position: center; }
.coming-soon-banner { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(90deg, var(--purple), #7b1fa2); color: white; text-align: center; padding: 0.4rem; font-family: 'Cinzel', serif; font-size: 0.75rem; font-weight: bold; letter-spacing: 0.1em; }
.char-card h3 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.1rem; }
/* Difficulty tags (Beginner → Expert), color-coded by tier. */
.diff-badge, .char-diff { display: inline-block; font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; padding: 0.12rem 0.5rem; border-radius: 10px; border: 1px solid; text-transform: uppercase; white-space: nowrap; }
.char-diff { position: absolute; top: 8px; left: 8px; z-index: 2; }
.diff-beginner { color: #86e88f; border-color: #4caf50; background: rgba(0,0,0,0.8); }
.diff-easy     { color: #7fd6e0; border-color: #26a0b8; background: rgba(0,0,0,0.8); }
.diff-medium   { color: #e8cf6a; border-color: #d4af37; background: rgba(0,0,0,0.8); }
.diff-hard     { color: #f0a860; border-color: #e07b2a; background: rgba(0,0,0,0.8); }
.diff-expert   { color: #ff8a8a; border-color: #dc143c; background: rgba(0,0,0,0.8); }
.char-info { color: var(--text-dim); font-size: 0.85rem; margin: 0.3rem 0; }
.char-passive { font-size: 0.7rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 0.4rem; margin-top: 0.4rem; white-space: pre-line; }
.char-blurb { font-size: 0.7rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 0.4rem; margin-top: 0.4rem; font-style: italic; line-height: 1.3; }
/* Character Sheet modal */
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.82); display: none; align-items: center; justify-content: center; z-index: 500; }
.sheet-overlay.show { display: flex; }
.sheet-panel { position: relative; display: flex; gap: 1.5rem; background: var(--bg-card); border: 2px solid var(--gold); box-shadow: 0 0 40px rgba(212,175,55,0.25); border-radius: 8px; padding: 1.5rem; width: min(1000px, 94vw); max-height: 90vh; max-height: 90dvh; overflow: hidden; }
/* min-height USED to be a flat 420px, which is taller than the panel's
   own 90vh cap on any screen under ~470px — so on a phone in landscape
   the portrait pushed straight out through the bottom of its own panel.
   A floor relative to the viewport keeps the art large where there is
   room and lets it shrink where there is not. */
.sheet-img { flex: 0 0 46%; align-self: stretch; display: block; width: 46%; height: auto; min-height: min(420px, 60vh); object-fit: cover; object-position: center top; background-color: var(--bg-dark); border: 1px solid var(--border); border-radius: 6px; }
.sheet-body { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.sheet-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.7rem; line-height: 1.1; }
.sheet-sub { font-family: 'Cinzel', serif; color: var(--text); font-size: 1rem; margin-top: 0.25rem; letter-spacing: 0.04em; }
.sheet-sub .sub-hp { color: var(--red-bright); }
.sheet-sub .sub-dice { color: var(--blue-bright); }
.sheet-blurb { font-style: italic; color: var(--text-dim); font-size: 1.05rem; margin: 0.6rem 0; line-height: 1.4; }
.sheet-mechanics { flex: 1 1 auto; overflow-y: auto; white-space: pre-wrap; font-size: 1rem; line-height: 1.5; color: var(--text); border-top: 1px solid var(--border); padding: 0.7rem 0.4rem 0.7rem 0; margin-bottom: 0.8rem; }
/* Row 1: Choose (full). Row 2: How to Play (full). Row 3: Card List + Back.
   Small padding/font so the 4 buttons stay a slim block and the description
   keeps its room. */
.sheet-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; flex-shrink: 0; }
.sheet-btns > .btn:nth-child(1), .sheet-btns > .btn:nth-child(2) { grid-column: 1 / -1; }
.sheet-btns .btn { font-size: 0.72rem; padding: 0.32rem 0.6rem; margin: 0; }
.sheet-btns .btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* In-game Character Info button row (Cards / Character Guide / Close). */
.info-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }
.info-btns .btn { flex: 1; font-size: 0.82rem; padding: 0.45rem 0.6rem; }
.info-btns .btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* The right arrow becomes a labeled "Opponent Info" / "Your Info" toggle in info mode. */
.sheet-arrow.info-arrow { width: auto; height: auto; right: 10px !important; left: auto !important; top: 10px !important; transform: none !important; padding: 0.4rem 0.9rem; border-radius: 20px; font-family: 'Cinzel', serif; font-size: 0.72rem; white-space: nowrap; }
/* Card List overlay (character-select) — cards laid out as they appear in game,
   grouped by rarity in rows of 3. */
.cardlist-panel { position: relative; display: flex; flex-direction: column; background: var(--bg-card); border: 2px solid var(--gold); box-shadow: 0 0 40px rgba(212,175,55,0.25); border-radius: 8px; padding: 1.2rem 1.4rem; width: min(720px, 94vw); max-height: 90vh; }
.cardlist-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.cardlist-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.4rem; line-height: 1.1; }
.cardlist-body { flex: 1 1 auto; overflow-y: auto; padding-right: 0.4rem; }
.cl-section-head { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1rem; border-bottom: 1px solid var(--border); padding: 0.5rem 0 0.3rem; margin: 0.6rem 0 0.7rem; }
.cl-section-head:first-child { margin-top: 0; }
.cl-section-head .cl-copies { color: var(--text-dim); font-size: 0.72rem; font-family: 'Arial', sans-serif; letter-spacing: 0.02em; }
.cl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.cl-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: 4px; padding: 0.5rem; display: flex; flex-direction: column; min-height: 150px; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
.cl-card:hover { transform: translateY(-3px); box-shadow: 0 4px 14px rgba(0,0,0,0.45); border-color: var(--gold); }
.cl-card.signature { border-color: var(--gold); }
.cl-card-name { font-family: 'Cinzel', serif; font-size: 0.88rem; color: var(--gold); margin-bottom: 0.25rem; line-height: 1.1; }
.cl-card-timing { font-size: 0.6rem; text-transform: uppercase; padding: 0.1rem 0.35rem; border-radius: 2px; align-self: flex-start; margin-bottom: 0.3rem; }
.cl-card-timing.before { background: rgba(65, 105, 225, 0.2); color: var(--blue-bright); border: 1px solid var(--blue-bright); }
.cl-card-timing.after { background: rgba(255, 132, 0, 0.2); color: var(--orange); border: 1px solid var(--orange); }
.cl-card-desc { font-size: 0.74rem; color: var(--text); line-height: 1.35; white-space: pre-line; flex: 1; }
/* Card zoom — single enlarged, readable card with side arrows to page through. */
#cardzoom-overlay { z-index: 520; }
.cz-card { position: relative; background: var(--bg-card); border: 3px solid var(--gold); border-radius: 10px; box-shadow: 0 0 50px rgba(0,0,0,0.6); padding: 2rem 2.2rem; width: min(560px, 88vw); max-height: 84vh; overflow-y: auto; display: flex; flex-direction: column; }
.cz-card .cl-card-name { font-size: 1.9rem; margin-bottom: 0.7rem; line-height: 1.15; }
.cz-card .cl-card-timing { font-size: 0.95rem; padding: 0.2rem 0.6rem; margin-bottom: 0.9rem; }
.cz-card .cl-card-desc { font-size: 1.15rem; line-height: 1.55; }
.cz-card .cl-minion-stats { margin-bottom: 0.8rem; }
.cz-card .cl-minion-ss { font-size: 1.05rem; padding: 0.2rem 0.6rem; }
.cz-card .cl-minion-type { font-size: 0.9rem; }
.cz-rarity { font-family: 'Cinzel', serif; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.5rem; }
.cz-arrow { background: var(--bg-dark); border: 2px solid var(--gold); color: var(--gold); width: 60px; height: 60px; border-radius: 50%; font-size: 2rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; margin: 0 1.2rem; transition: all 0.15s; }
.cz-arrow:hover { background: var(--gold); color: var(--bg-dark); }
.cz-cardwrap { position: relative; display: flex; }
.cz-close { position: absolute; top: -14px; right: -14px; z-index: 5; background: var(--bg-dark); border: 2px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 50%; font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.cz-close:hover { border-color: var(--gold); color: var(--gold); }
.cz-counter { font-family: 'Cinzel', serif; color: var(--text-dim); font-size: 0.9rem; letter-spacing: 0.05em; text-align: center; }
.cz-counter:empty { display: none; }
.cz-side { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.cz-card.cl-minion { border-color: #8b5fbf; }
.cz-card.cl-minion .cl-card-name { color: #c9a3ff; }
.cz-card.cl-part { border-color: #b48c64; }
.cz-card.cl-part .cl-card-name { color: #e0b988; }
@media (max-width: 620px) { .cz-arrow { width: 46px; height: 46px; font-size: 1.5rem; margin: 0 0.4rem; } }
/* Card-zoom stack (enlarged card + Play/Close footer). */
.cz-stack { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.cz-foot { display: flex; gap: 0.6rem; }
.cz-foot:empty { display: none; }
/* The card zoom wears the same ink: its arrows, its close button and its Play and Close buttons are the dialogs' ink on paper (they were gold rings
   and gold-outlined buttons); the counter sits above the buttons, and on a phone the card fills the screen's height with its buttons beside it. */
#cardzoom-overlay .cz-arrow, #cardzoom-overlay .cz-close { background: #1b1620; border: 2px solid #ddd0b3; color: #f7f0e0; box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.5); }
#cardzoom-overlay .cz-arrow:hover, #cardzoom-overlay .cz-close:hover { background: #2b2431; border-color: #e2b13c; color: #fff; }
#cardzoom-overlay .cz-counter { color: #ddd0b3; }
#cardzoom-overlay .cz-foot .btn { margin: 0; min-width: 7.5rem; border: 2.5px solid #1b1620; border-radius: 5px 8px 6px 7px / 7px 5px 8px 6px; background: #ece3cf; color: #1b1620; box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.5); letter-spacing: 0.04em; }
#cardzoom-overlay .cz-foot .btn:hover:not(:disabled) { background: #fff7e6; color: #1b1620; }
#cardzoom-overlay .cz-foot .btn.primary { background: #1b1620; color: #f7f0e0; border-color: #ddd0b3; }
#cardzoom-overlay .cz-foot .btn.primary:hover:not(:disabled) { background: #2b2431; color: #f7f0e0; }
@media (max-height: 500px) {
    #cardzoom-overlay .cz-stack { flex-direction: row; align-items: center; gap: 0.8rem; }
    #cardzoom-overlay .cz-foot { flex-direction: column; }
    #cardzoom-overlay .cz-foot .btn { min-height: 48px; min-width: 6.2rem; }
    #cardzoom-overlay .cz-arrow { margin: 0 0.3rem; }
}

/* Magnifier button in the corner of every card. */
/* Keyword highlight in the zoom — a soft marker, NO border, hover for definition. */
.kw-hl { background: rgba(212,175,55,0.22); border-radius: 3px; padding: 0 2px; cursor: help; }
.kw-hl:hover { background: rgba(212,175,55,0.42); }
#kw-tip { position: fixed; display: none; max-width: min(420px, 90vw); background: #191921; color: var(--text); border: 1px solid var(--gold-dim); border-radius: 8px; padding: 0.8rem 1rem; font-size: 1.15rem; line-height: 1.5; z-index: 600; box-shadow: 0 6px 22px rgba(0,0,0,0.7); pointer-events: none; }
.cl-card.cl-minion { border-color: #8b5fbf; }
.cl-card.cl-minion .cl-card-name { color: #c9a3ff; }
.cl-minion-stats { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.3rem; }
.cl-minion-ss { font-family: 'Cinzel', serif; font-size: 0.62rem; color: #c9a3ff; border: 1px solid #8b5fbf; border-radius: 2px; padding: 0.05rem 0.3rem; }
.cl-minion-type { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.cl-card.cl-part { border-color: #b48c64; }
.cl-card.cl-part .cl-card-name { color: #e0b988; }
.cl-part-bonus { font-family: 'Cinzel', serif; font-size: 0.62rem; color: #e0b988; border: 1px solid #b48c64; border-radius: 2px; padding: 0.05rem 0.3rem; align-self: flex-start; margin-bottom: 0.3rem; }
@media (max-width: 620px) { .cl-grid { grid-template-columns: repeat(2, 1fr); } }
.sheet-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; background: var(--bg-dark); border: 2px solid var(--gold); color: var(--gold); font-size: 1.5rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; transition: all 0.15s; }
.sheet-arrow:hover { background: var(--gold); color: var(--bg-dark); }
.sheet-arrow.left { left: -24px; }
.sheet-arrow.right { right: -24px; }
.selections { display: flex; gap: 2rem; font-family: 'Cinzel', serif; font-size: 0.85rem; margin-top: 1rem; }
.selection { padding: 0.3rem 0.6rem; border-radius: 4px; }
.selection.you { background: rgba(65, 105, 225, 0.2); color: var(--blue-bright); }
.selection.opp { background: rgba(139, 0, 0, 0.2); color: var(--red-bright); }

/* Game Layout */
#game-screen { padding: 0; justify-content: flex-start; }
/* The game screen is a row: the tutorial coach, the table (client/src/board/board.css: the board drawn on a
   stage scaled to fit it) and the battle log. The coach and the log are siblings of the table, never over it. */
#game-screen.active { display: flex; flex-direction: row; align-items: stretch; height: 100vh; overflow: hidden; }
.game-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
/* Key Words quick-reference (in-game) */
.kw-panel { position: relative; display: flex; flex-direction: column; width: min(640px, 94vw); max-height: 88vh; background: var(--bg-card); border: 2px solid var(--gold); border-radius: 8px; box-shadow: 0 0 40px rgba(212,175,55,0.2); padding: 1.1rem 1.3rem; }
.kw-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 0.6rem; margin-bottom: 0.6rem; }
.kw-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.3rem; }
.kw-body { flex: 1 1 auto; overflow-y: auto; padding-right: 0.4rem; text-align: left; }
.kw-section { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.95rem; margin: 0.9rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.2rem; }
.kw-section:first-child { margin-top: 0; }
.kw-item { display: grid; grid-template-columns: 150px 1fr; gap: 0.6rem; padding: 0.3rem 0; align-items: baseline; }
.kw-term { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.72rem; font-weight: bold; letter-spacing: 0.02em; }
.kw-def { color: var(--text); font-size: 0.8rem; line-height: 1.4; }
@media (max-width: 560px) { .kw-item { grid-template-columns: 1fr; gap: 0.1rem; } }
.cond-elide { color: var(--text-dim); opacity: 0.7; letter-spacing: 0.1em; font-size: 0.9em; }
.cond-active { color: #ffd700; text-shadow: 0 0 6px rgba(255, 215, 0, 0.9); font-weight: bold; }
.rage-active { color: #ff4444; text-shadow: 0 0 6px rgba(255, 68, 68, 0.95); font-weight: bold; }
.marked-active { color: #ff4444; text-shadow: 0 0 6px rgba(255, 68, 68, 0.95); font-weight: bold; }
.form-active { color: #66cc66; text-shadow: 0 0 6px rgba(102, 204, 102, 0.95); font-weight: bold; }
.mana-active { color: #c084fc; text-shadow: 0 0 6px rgba(192, 132, 252, 0.95); font-weight: bold; }
.table-card-result { margin-top: 0.3rem; padding: 0.25rem 0.4rem; font-size: 0.62rem; font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(255, 132, 0, 0.2); color: var(--orange); border: 1px solid var(--orange); border-radius: 3px; text-align: center; }
.clock-area { background: var(--bg-card); border-top: 1px solid var(--border); padding: 0.5rem 0.8rem; }
.clock-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.clock-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.85rem; }
.clock-subtitle { color: var(--text-dim); font-size: 0.7rem; }
.clock-grid { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 170px; gap: 0.5rem; }  /* fixed, not minmax(...,auto): a long card name must not re-height the row */
.clock-slot { background: var(--bg-dark); border: 2px solid var(--border); border-radius: 5px; padding: 0.4rem; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; position: relative; min-height: 170px; }
.clock-slot:hover:not(.disabled):not(.empty) { border-color: var(--gold); transform: translateY(-2px); }
.clock-slot.selected { border-color: var(--gold); box-shadow: 0 0 12px rgba(212, 175, 55, 0.6); transform: translateY(-2px); }
.clock-slot.disabled { opacity: 0.5; cursor: not-allowed; }
.clock-slot.empty { background: transparent; border-style: dashed; opacity: 0.4; cursor: default; }
.clock-slot.empty.pending-pick { opacity: 1; background: rgba(65,105,225,0.1); }
.clock-refill-label { font-family: 'Cinzel', serif; color: var(--blue-bright); font-size: 0.7rem; text-align: center; margin-top: 2.5rem; }
.clock-slot.on-time { border-color: #ffd700; box-shadow: 0 0 10px rgba(255,215,0,0.6); }
.clock-slot.dice-here::before { content: ''; position: absolute; top: -10px; right: -8px; width: 22px; height: 22px; background: #f7f0e0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b1620' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='3'/%3E%3Ccircle cx='9' cy='9' r='1.1' fill='%231b1620'/%3E%3Ccircle cx='15' cy='9' r='1.1' fill='%231b1620'/%3E%3Ccircle cx='9' cy='15' r='1.1' fill='%231b1620'/%3E%3Ccircle cx='15' cy='15' r='1.1' fill='%231b1620'/%3E%3C/svg%3E") center / 80% no-repeat; border: 1.5px solid #1b1620; border-radius: 50%; z-index: 2; }
.clock-slot.pending-pick { border-color: var(--blue-bright); box-shadow: 0 0 12px rgba(65,105,225,0.8); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 10px rgba(65,105,225,0.7); } 50% { box-shadow: 0 0 20px rgba(65,105,225,1); } }
@keyframes recapGlow { 0%,100% { box-shadow: 0 0 5px rgba(212,175,55,0.45); transform: scale(1); } 50% { box-shadow: 0 0 18px rgba(212,175,55,0.95); transform: scale(1.04); } }
/* The round-result bar's Continue gently glows/pulses while it's actionable; stops once disabled ("Waiting..."). */
#recap-continue-btn:not(:disabled) { animation: recapGlow 1.8s ease-in-out infinite; }
/* Harlow Pocket Dice swap modal — dice boxes + the ⇄ swap symbol */
#harlow-pocket-dice { align-items: center; }
.pd-die { border: 2px solid #b48c64; background: rgba(180,140,100,0.15); padding: 0.5rem 0.75rem; border-radius: 6px; font-family: 'Cinzel', serif; font-size: 1.35rem; color: #d4a574; min-width: 2.1rem; text-align: center; transition: border-color 0.15s; }
.pd-die.pd-click { cursor: pointer; }
.pd-die.pd-click:hover { border-color: var(--gold); }
.pd-die.pd-pocket { border-color: var(--gold); color: var(--gold); background: rgba(212,175,55,0.15); box-shadow: 0 0 9px rgba(212,175,55,0.45); }
.pd-swap-arrow { font-size: 1.9rem; line-height: 1; color: var(--gold); margin: 0 0.35rem; user-select: none; }
/* Schmeem Free Attach modal */
.sa-section { font-family: 'Cinzel', serif; font-size: 0.9rem; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 0.25rem; }
.sa-rowlabel { font-size: 0.8rem; color: var(--text-dim); margin: 0.2rem 0 0.1rem; }
.sa-row { display: flex; flex-wrap: wrap; gap: 0.3rem; min-height: 1.4rem; }
.sa-build { display: flex; flex-direction: column; gap: 0.3rem; align-items: center; }
.sa-divider { border-top: 2px solid #fff; margin: 0.4rem 0; }
.sa-tile { border: 2px solid #b48c64; border-radius: 5px; background: rgba(180,140,100,0.14); padding: 0.25rem 0.4rem; min-width: 88px; text-align: center; font-family: 'Cinzel', serif; transition: border-color 0.12s; }
.sa-tile.sa-click { cursor: pointer; }
.sa-tile.sa-click:hover { border-color: var(--gold); }
.sa-tile.sa-sel { border-color: #66cc66; background: rgba(100,200,100,0.22); box-shadow: 0 0 8px rgba(100,200,100,0.5); }
.sa-tile.sa-rep { border-color: #ff4444; background: rgba(220,40,40,0.22); box-shadow: 0 0 8px rgba(255,68,68,0.5); }
.sa-tile.sa-grey { opacity: 0.4; }
.sa-tile.sa-empty { border-style: dashed; color: var(--text-dim); background: transparent; font-size: 0.74rem; padding: 0.4rem; min-width: 88px; }
.sa-tile-name { font-size: 0.8rem; font-weight: bold; line-height: 1.1; }
.sa-tile-bonus { font-size: 0.74rem; color: #d4a574; }
.sa-tile-rep { font-size: 0.66rem; color: #ff6b6b; margin-top: 0.1rem; }
/* Schmeem mech display (reuses the traps-area slot) — centered arm/leg stack.
   max-height + scroll keeps a tall (extra-part) stack from bleeding UP past the
   top bar / After-Rolls button and DOWN into the hand; the box stays centered on
   the card row and scrolls internally only when maxed out. */
.break-active { color: #ff8c3a; text-shadow: 0 0 6px rgba(255,140,58,0.95); font-weight: bold; }
/* Gyro reroll dice — labeled with die size (d4/d10/...) */
.gyro-die { border: 2px solid #b48c64; border-radius: 6px; background: rgba(180,140,100,0.15); padding: 0.25rem 0.5rem; min-width: 3rem; text-align: center; font-family: 'Cinzel', serif; }
.gyro-die.pd-click { cursor: pointer; }
.gyro-die.pd-click:hover { border-color: var(--gold); box-shadow: 0 0 8px rgba(212,175,55,0.4); }
.gyro-die.gyro-die-broken { border-color: #ff4444; background: rgba(220,40,40,0.14); }
.gyro-die.gyro-die-broken:hover { border-color: #ff8c3a; box-shadow: 0 0 8px rgba(255,120,60,0.5); }
.sa-tile-kind { font-size: 0.55rem; color: var(--text-dim); letter-spacing: 0.08em; }
.gyro-die-label { font-size: 0.6rem; color: var(--text-dim); }
.gyro-die-val { font-size: 1.3rem; color: #d4a574; line-height: 1.1; }
.clock-pos { position: absolute; top: 4px; left: 6px; font-family: 'Cinzel', serif; font-size: 0.75rem; color: var(--gold); opacity: 0.85; font-weight: bold; }
.clock-card-name { font-family: 'Cinzel', serif; font-size: 0.8rem; color: var(--gold); margin-top: 18px; line-height: 1.15; }
.clock-card-timing { font-size: 0.6rem; text-transform: uppercase; margin-top: 0.2rem; padding: 0.08rem 0.3rem; border-radius: 2px; align-self: flex-start; }
.clock-card-timing.before { background: rgba(65, 105, 225, 0.2); color: var(--blue-bright); border: 1px solid var(--blue-bright); }
.clock-card-timing.after { background: rgba(255, 132, 0, 0.2); color: var(--orange); border: 1px solid var(--orange); }
.clock-card-timing.anytime { background: rgba(212, 175, 55, 0.2); color: var(--gold); border: 1px solid var(--gold); }
.clock-card-desc { font-size: 0.65rem; color: var(--text); flex: 1; margin-top: 0.3rem; overflow: hidden; white-space: pre-line; line-height: 1.3; }
.clock-on-badge { position: absolute; top: 4px; right: 6px; font-family: 'Cinzel', serif; font-size: 0.7rem; color: #ffd700; font-weight: bold; text-shadow: 0 0 6px rgba(255,215,0,0.8); }
.hand-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200; justify-content: center; align-items: center; padding: 2rem; }
.hand-modal-overlay.active { display: flex; }
.hand-modal { background: var(--bg-card); border: 2px solid var(--gold); border-radius: 8px; padding: 1rem; max-width: 1000px; width: 100%; max-height: 80vh; overflow-y: auto; }
.hand-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.hand-modal-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.1rem; }
.pending-banner { background: rgba(65,105,225,0.18); border: 1px solid var(--blue-bright); color: var(--blue-bright); padding: 0.4rem 0.8rem; margin-bottom: 0.4rem; font-family: 'Cinzel', serif; font-size: 0.8rem; display: flex; gap: 0.6rem; align-items: center; }
/* Kaelo Karmic Flow bar: -6..0..+6 tier track with marker on current. */
/* Adrenaline actions live in their own bar above the hand (not the bottom action
   bar). Empty when there's nothing to spend, so it takes no space. */
/* Connection status. Deliberately a BANNER, not a modal: the player can
   still read the board and see what is happening while it reconnects.
   A blocking dialog here is what made a locked phone screen feel like a
   crash. Pinned top-centre, above the board but below real modals. */
.conn-banner {
    position: fixed; top: 0; left: 50%; transform: translate(-50%, -120%);
    z-index: 150; padding: 0.45rem 1.1rem; border-radius: 0 0 8px 8px;
    font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.03em;
    border: 1px solid; border-top: none; pointer-events: none;
    transition: transform 0.25s ease; white-space: nowrap; max-width: 92vw;
    overflow: hidden; text-overflow: ellipsis;
}
.conn-banner.show { transform: translate(-50%, 0); }
.conn-banner.warn { background: #2a1f08; border-color: var(--orange); color: var(--orange); }
.conn-banner.ok   { background: #0d2010; border-color: var(--green); color: #86e88f; }
.conn-banner.bad  { background: #2a0d13; border-color: var(--red-bright); color: #ff8a8a; }
@media (prefers-reduced-motion: reduce) { .conn-banner { transition: none; } }
.battle-log { width: 260px; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.log-header { padding: 0.5rem 0.6rem; background: var(--bg-dark); border-bottom: 1px solid var(--border); font-family: 'Cinzel', serif; color: var(--gold); display: flex; align-items: center; justify-content: space-between; }
.log-header > span { flex: 1; text-align: center; }
.log-min-btn { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 3px; width: 22px; height: 22px; line-height: 1; font-size: 0.8rem; cursor: pointer; flex-shrink: 0; }
.log-min-btn:hover { border-color: var(--gold); color: var(--gold); }
.log-entries { flex: 1; overflow-y: auto; padding: 0.5rem; font-size: 0.7rem; }
.log-entry { padding: 0.15rem 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.log-entry.round { color: var(--gold); font-weight: bold; margin-top: 0.4rem; }
.log-entry.debug { color: #ff9a5c; font-style: italic; }
.log-entry.phase { color: var(--blue-bright); font-style: italic; }
.log-entry.roll { color: var(--orange); }
.log-entry.damage { color: var(--red-bright); }
.log-entry.heal { color: var(--green); }
.log-entry.buff { color: #4fc3f7; }
.log-entry.debuff { color: #ff7043; }
.log-entry.ability { color: var(--purple); }
.log-entry.passive { color: #ab47bc; }
.log-entry.counter { color: #e91e63; }
.log-entry.salvage { color: #00bcd4; }
.log-entry.overcharge { color: #ffc107; }
.log-entry.mana { color: #ce93d8; }
.log-entry.resource { color: var(--gold-dim); }
.log-entry.clash { color: var(--gold); font-weight: bold; }
.log-entry.crit { color: #ff5722; font-weight: bold; }
.log-entry.victory { color: var(--gold); font-size: 0.9rem; font-weight: bold; }

/* Modals */

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 100; padding: 0.5rem; }
.modal-overlay.active { display: flex; }
/* A dialog may never be taller than the screen it is on.
   ---------------------------------------------------------------
   39 modals share this class, including every mid-match decision. With
   no cap and no scroll, a centered box taller than the viewport spills
   equally off the TOP and the BOTTOM, and neither end can be scrolled
   to — the classic flex-centering overflow trap. Measured on a phone in
   landscape (800x360): the Infernal Reinforcements pick is 508px tall,
   and its Confirm button sits at y=345-396, entirely off-screen. The
   choice could be read and not made.
   Capping at the viewport keeps the box inside the centering container,
   so `overflow-y: auto` on the box itself is genuinely reachable.
   dvh follows the phone's shrinking URL bar; vh is the fallback. */
.modal { position: relative; background: var(--bg-card); border: 2px solid var(--gold); padding: 1.5rem; max-width: 500px; text-align: center;
    max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem);
    overflow-y: auto; overscroll-behavior: contain; }
/* ── Minimize ──────────────────────────────────────────────────────────
   EVERY modal gets a [– Minimize] control: collapse it to a title bar at the
   bottom so the whole board is readable, then click the bar to expand and make
   an informed choice. !important is deliberate — it has to beat the per-modal
   id rules (side panels set their own align/padding/width). */
.modal-min-btn { position: absolute; top: 6px; right: 8px; font-family: 'Inter', sans-serif; font-size: 0.62rem; letter-spacing: 0.04em; padding: 0.16rem 0.5rem; background: rgba(0,0,0,0.45); border: 1px solid var(--border); color: var(--text-dim); border-radius: 4px; cursor: pointer; z-index: 6; white-space: nowrap; user-select: none; }
.modal-min-btn:hover { border-color: var(--gold); color: var(--gold); }
.modal-overlay.minimized { background: transparent !important; pointer-events: none !important; align-items: flex-end !important; justify-content: center !important; padding: 0 0 0.6rem 0 !important; }
.modal-overlay.minimized > .modal { pointer-events: auto; cursor: pointer; width: auto !important; max-width: 92vw !important; min-width: 0 !important; padding: 0.35rem 0.85rem !important; display: flex !important; align-items: center; gap: 0.6rem; box-shadow: 0 4px 18px rgba(0,0,0,0.65);
    /* A title bar is one line — it needs neither the height cap nor the
       scroller, and a scrollbar on a 1-line bar looks broken. */
    max-height: none !important; overflow: visible !important; }
.modal-overlay.minimized > .modal > * { display: none !important; }
.modal-overlay.minimized > .modal > .modal-title { display: block !important; margin: 0 !important; font-size: 0.85rem; white-space: nowrap; }
.modal-overlay.minimized > .modal > .modal-min-btn { display: block !important; position: static !important; }
/* Flash the minimized bar so it's obvious where it parked. */
@keyframes modalMinFlash {
    0%, 100% { box-shadow: 0 4px 18px rgba(0,0,0,0.65); border-color: var(--border); }
    50% { box-shadow: 0 0 20px 5px rgba(212,175,55,0.85), 0 4px 18px rgba(0,0,0,0.65); border-color: var(--gold); }
}
.modal-overlay.minimized > .modal { animation: modalMinFlash 1.2s ease-in-out infinite; }
/* Schmeem Ball Kicker is an INFORMED choice — you pick which of the opponent's
   dice to force a REGEN on, so the board (both rolls + Strike Scores) has to stay
   readable. Same non-blocking side treatment as the Adrenaline Window. */
#schmeem-ballkicker-modal { background: rgba(0,0,0,0.15); align-items: center; justify-content: flex-end; padding-right: 2rem; pointer-events: none; }
#schmeem-ballkicker-modal > .modal { max-width: 360px; width: 360px; pointer-events: auto; box-shadow: 0 0 24px rgba(0,0,0,0.7); }
/* Keep the side panels on-screen on phones (they'd otherwise overflow at 360px). */
@media (max-width: 620px) {
    #schmeem-ballkicker-modal { padding-right: 0.5rem; }
    #schmeem-ballkicker-modal > .modal { width: auto; max-width: 94vw; }
}
/* Kalamus Blood for Power — non-blocking side modal so the board (and the
   opponent's roll) stays visible while deciding Keep / Redraw. */
#blood-for-power-modal { background: rgba(0,0,0,0.15); align-items: center; justify-content: flex-end; padding-right: 2rem; pointer-events: none; }
#blood-for-power-modal > .modal { max-width: 340px; width: 340px; pointer-events: auto; box-shadow: 0 0 24px rgba(0,0,0,0.7); border-color: #c0392b; }
/* Kael'ris Wild Shift — the same non-blocking pattern. */
#shift-modal { background: rgba(0,0,0,0.15); align-items: center; justify-content: flex-end; padding-right: 2rem; pointer-events: none; }
#shift-modal > .modal { max-width: 400px; width: 400px; pointer-events: auto; box-shadow: 0 0 24px rgba(0,0,0,0.7); }
/* Kael'ris Keen Eyesight — same right-side non-blocking placement. */
#keen-eyesight-select-modal,
#keen-eyesight-keep-modal { background: rgba(0,0,0,0.15); align-items: center; justify-content: flex-end; padding-right: 2rem; pointer-events: none; }
#keen-eyesight-select-modal > .modal,
#keen-eyesight-keep-modal > .modal { max-width: 380px; width: 380px; pointer-events: auto; box-shadow: 0 0 24px rgba(0,0,0,0.7); }
.die-btn { font-family: 'Cinzel', serif; min-width: 60px; padding: 0.5rem 0.7rem; font-size: 1.1rem; font-weight: bold; border: 2px solid #66cc66; background: rgba(100, 200, 100, 0.12); color: #88dd88; border-radius: 5px; cursor: pointer; transition: all 0.15s; }
.die-btn:hover { background: rgba(100, 200, 100, 0.25); box-shadow: 0 0 8px rgba(102, 204, 102, 0.6); }
.die-btn.selected { background: rgba(100, 200, 100, 0.35); box-shadow: 0 0 12px rgba(102, 204, 102, 0.85); transform: scale(1.05); }
.die-btn .die-sides { display: block; font-size: 0.55rem; color: var(--text-dim); margin-top: 0.1rem; font-weight: normal; }
.modal-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.2rem; margin-bottom: 1rem; }
.modal-text { margin-bottom: 1rem; font-size: 0.9rem; }
.modal-options { display: flex; flex-direction: column; gap: 0.5rem; }
.modal-option { padding: 0.6rem; background: var(--bg-dark); border: 1px solid var(--border); cursor: pointer; }
.modal-option:hover:not(.disabled) { border-color: var(--gold); }
.modal-option.disabled { opacity: 0.3; cursor: not-allowed; }
.modal-option-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.9rem; }
.modal-option-desc { font-size: 0.75rem; color: var(--text-dim); }
.choice-row { display: flex; gap: 2rem; justify-content: center; margin: 1rem 0; }
.choice-box { padding: 1rem 2rem; background: var(--bg-dark); border: 2px solid var(--border); cursor: pointer; text-align: center; position: relative; transition: background 0.12s, border-color 0.12s, opacity 0.12s; }
.choice-box:hover { border-color: var(--gold); }
/* A picked minion has to read as picked with the pointer somewhere else.
   `.choice-box.selected` previously had NO rule at all — toggleMinionPick
   put the class on and took it off correctly, but nothing styled it, so
   the only feedback was :hover's gold border, which vanishes the instant
   you move the mouse. Same failure as the difficulty buttons, and the
   same fix: FILL it, don't glow it. */
.choice-box.selected {
    border-color: var(--gold); background: var(--gold);
    box-shadow: 0 0 14px rgba(212,175,55,0.5); transform: translateY(-2px);
}
.choice-box.selected .choice-value,
.choice-box.selected .choice-label { color: var(--bg-dark); font-weight: 700; }
.choice-box.selected::after {
    content: '✓'; position: absolute; top: -10px; right: -10px;
    width: 22px; height: 22px; line-height: 19px; border-radius: 11px;
    background: var(--bg-dark); color: var(--gold); border: 2px solid var(--gold);
    font-size: 0.75rem; font-weight: 700; text-align: center;
}
/* Once you have picked as many as the card allows, the rest are inert.
   Saying so beats a click that silently does nothing. */
.choice-box.pick-full { opacity: 0.35; cursor: not-allowed; }
.choice-box.pick-full:hover { border-color: var(--border); }
.choice-value { font-family: 'Cinzel', serif; font-size: 2rem; color: var(--gold); }
.choice-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.5rem; }
/* Minion options are laid out on a fixed grid rather than by text width,
   so four of them form a tidy block instead of a ragged one, and the ✓
   badge has room to sit in the corner without touching its neighbour. */
#minion-pick-options { gap: 1rem !important; }
#minion-pick-modal .modal { max-width: min(760px, 96vw); }
#minion-pick-options { flex-wrap: nowrap !important; }
.minion-opt { width: 148px; padding: 0.7rem 0.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.minion-opt .card { margin-bottom: 4px; }
.minion-opt .choice-label { line-height: 1.2; }
/* Running total for a multi-pick that COMBINES what you chose (Infernal
   Reinforcements sums the two Strike Scores into Kalamus's base). */
.pick-total { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.95rem; text-align: center; margin: 0.2rem 0 0.6rem; min-height: 1.2rem; }
/* Short screens: the cap above stops a dialog running off the edge, but a
   dialog you have to scroll to answer is still a bad dialog — and a dark
   box gives no hint that it scrolls. Tightening the padding and the
   option boxes gets the common decisions back to fitting outright.
   Phone landscape is the case that matters; a short desktop window gets
   the same treatment and is no worse for it. */
@media (max-height: 460px) {
    .modal { padding: 0.7rem 0.9rem; }
    .modal-title { font-size: 0.98rem; margin-bottom: 0.4rem; }
    .modal-text { font-size: 0.8rem; margin-bottom: 0.5rem; }
    .choice-row { gap: 0.5rem; margin: 0.5rem 0; }
    .choice-box { padding: 0.5rem 0.8rem; }
    .minion-opt { width: 84px; padding: 0.3rem 0.25rem; }
    .minion-opt .card { margin-bottom: 0; }
    #minion-pick-modal .modal-text { margin-bottom: 0.2rem; }
    #minion-pick-options { margin: 0.4rem 0 !important; }
    #minion-pick-options { gap: 0.5rem !important; }
    .pick-total { font-size: 0.85rem; margin: 0.1rem 0 1.2rem; }
    /* The way to answer must be visible without hunting for it. Where a
       dialog still has to scroll, its primary button becomes a footer
       bar riding the bottom edge — the standard phone pattern, and a
       much bigger tap target than a centred pill. The shadow paints a
       card-coloured shelf so content cannot scroll under it. */
    .modal > .btn.primary { position: sticky; bottom: -0.7rem; z-index: 3;
        display: block; width: 100%; margin: 0.6rem 0 0;
        padding: 0.55rem 0.8rem; font-size: 0.92rem;
        box-shadow: 0 0 0 0.3rem var(--bg-card); }
    /* A translucent shelf is not a shelf. The usual disabled style is
       opacity: 0.3, which would let the options show straight through
       it, so mute with colour instead and stay opaque. */
    .modal > .btn.primary:disabled { opacity: 1; background: #423d31; color: #8d8577; border-color: #635c49; }
}
.pick-total .pt-dim { color: var(--text-dim); font-family: 'Crimson Text', serif; font-size: 0.85rem; }
.scry-cards, .discard-cards { display: flex; gap: 0.5rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.scry-card { width: 100px; padding: 0.5rem; background: var(--bg-dark); border: 2px solid var(--border); cursor: pointer; }
.scry-card:hover { border-color: var(--gold); }
.scry-card.selected { border-color: var(--gold); background: var(--bg-hover); }
.scry-card-name { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.7rem; }
.scry-card-desc { font-size: 0.55rem; color: var(--text-dim); }

.place-card-preview { position: fixed; top: 0.6rem; left: 0.6rem; z-index: 250; width: 180px; background: var(--bg-card); border: 2px solid var(--blue-bright); border-radius: 6px; padding: 0.5rem; box-shadow: 0 0 16px rgba(65,105,225,0.6); animation: pulse 1.4s infinite; }
.place-card-preview-label { font-family: 'Cinzel', serif; font-size: 0.7rem; color: var(--blue-bright); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Responsive scaling — shrink card sizes on shorter / narrower viewports
   so playtesters don't have to zoom out. */
@media (max-height: 900px) {
    .clock-slot { min-height: 142px; }
    .clock-grid { grid-auto-rows: 142px; }
    .clock-area { padding: 0.35rem 0.6rem; }
}
@media (max-height: 760px) {
    .clock-slot { min-height: 122px; }
    .clock-grid { grid-auto-rows: 122px; }
    .clock-card-name { font-size: 0.7rem; margin-top: 14px; }
    .clock-card-desc { font-size: 0.58rem; }
}

/* ── Play vs AI setup ─────────────────────────────────────────── */
.ai-setup { display: flex; flex-direction: column; gap: 0.9rem; margin: 0.5rem 0 1.2rem; min-width: 320px; }
.ai-row { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; }
.ai-label { color: var(--text-dim); font-size: 0.9rem; letter-spacing: 0.03em; }
.ai-choices { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.ai-slot { min-width: 9.5rem; }
/* The selected difficulty has to read as chosen at a glance. The old
   rule set border-color and color to gold, which is exactly what .btn
   already is, so the only difference between picked and not picked was
   a faint glow. Fill it instead, the same way .btn.primary does. */
.ai-diff { position: relative; opacity: 0.55; }
.ai-diff:hover:not(.selected) { opacity: 0.85; }
.ai-diff.selected {
    opacity: 1; background: var(--gold); color: var(--bg-dark);
    font-weight: 700; box-shadow: 0 0 14px rgba(212,175,55,0.55);
    transform: translateY(-1px);
}
/* Hover fills an unselected button too, so the tick is what separates
   "I am pointing at this" from "this is the one I picked". */
.ai-diff.selected::after {
    content: '✓'; margin-left: 0.45rem; font-weight: 700;
}
.ai-diff-note {
    color: var(--text-dim); font-size: 0.78rem; line-height: 1.35;
    text-align: right; margin: -0.35rem 0 0; min-height: 1.1rem;
}
.ai-diff-note b { color: var(--gold); font-weight: 600; }
@media (max-width: 520px) { .ai-diff-note { text-align: left; } }
/* Champions the AI can't pilot yet — shown but not selectable as the opponent. */
.char-card.ai-locked { opacity: 0.32; filter: grayscale(0.85); cursor: not-allowed; }
.ai-locked-banner {
    position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
    background: rgba(0,0,0,0.72); color: var(--text-dim);
    font-size: 0.62rem; letter-spacing: 0.06em; padding: 0.22rem 0;
}
@media (max-width: 520px) {
    .ai-row { flex-direction: column; align-items: stretch; gap: 0.35rem; }
    .ai-choices { justify-content: stretch; }
}

/* ── Tutorial coach ────────────────────────────────────────────────
   A fixed panel bottom-left, clear of the hand strip and the log. It
   never moves or resizes with content — the body scrolls inside it —
   because a panel that jumps around while you read it is worse than no
   panel at all. */
#coach-panel { flex: 0 0 clamp(240px, 22vw, 320px); height: 100vh; min-height: 0;
    background: linear-gradient(180deg, #1e1b13 0%, var(--bg-card) 55%);
    border-right: 2px solid var(--gold); display: none; flex-direction: column;
    font-size: 0.82rem; overflow: hidden;
    transition: flex-basis 0.2s ease; }
#coach-panel.active { display: flex; }

/* ── Collapsing the coach ───────────────────────────────────────────
   On a phone this panel was eating the board alive: clamp()'s 240px
   FLOOR means the smaller the screen the bigger its share — 28% of an
   844px iPhone, 32% of a 740px Android. Backwards.
   It stays a flex SIBLING rather than becoming an overlay, because the
   comment on the markup records what happened last time it was taken
   out of flow: it sat on top of the Play/Pass buttons and the player
   bar and made the tutorial literally unplayable. Collapsing keeps it
   in the layout — it just reserves 34px instead of 240. fitBoard()
   sums visible siblings live, so the board reclaims the width by
   itself as long as we ask it to re-fit. */
#coach-panel.collapsed { flex-basis: 34px; }
#coach-panel.collapsed .coach-body,
#coach-panel.collapsed .coach-foot,
#coach-panel.collapsed .coach-reviewing-note,
#coach-panel.collapsed .coach-head-title,
#coach-panel.collapsed .coach-progress { display: none; }
#coach-panel.collapsed .coach-head { flex-direction: column; padding: 0.5rem 0; height: 100%;
    justify-content: flex-start; gap: 0.75rem; border-bottom: none; }
/* The vertical "COACH" spine you tap to get it back. */
.coach-spine { display: none; writing-mode: vertical-rl; text-orientation: mixed;
    font-family: 'Cinzel', serif; font-size: 0.7rem; letter-spacing: 0.18em;
    color: var(--gold); text-transform: uppercase; white-space: nowrap;
    cursor: pointer; user-select: none; }
#coach-panel.collapsed .coach-spine { display: block; }
.coach-toggle { flex: 0 0 auto; background: none; border: 1px solid var(--gold-dim);
    color: var(--gold); border-radius: 4px; cursor: pointer; font-size: 0.72rem;
    line-height: 1; padding: 0.25rem 0.4rem; min-width: 24px; min-height: 24px; }
.coach-toggle:hover { border-color: var(--gold); background: rgba(212,175,55,0.14); }
/* A new instruction arriving while collapsed must not go unnoticed. */
@keyframes coachWaiting { 0%,100% { border-right-color: var(--gold); }
                          50% { border-right-color: #fff3c4; } }
#coach-panel.collapsed.has-unread { animation: coachWaiting 1.1s ease-in-out infinite; }
#coach-panel.collapsed.has-unread .coach-spine::after { content: ' •'; color: #fff3c4; }
@media (prefers-reduced-motion: reduce) {
    #coach-panel { transition: none; }
    #coach-panel.collapsed.has-unread { animation: none; }
}
/* Phone-class: short viewport AND a touch pointer, so a narrow desktop
   window is never caught. Expanded is narrower here, and the tutorial
   opens collapsed — the board matters more than the text on 390px. */
@media (max-height: 460px) and (pointer: coarse) {
    #coach-panel { flex-basis: min(52vw, 230px); font-size: 0.78rem; }
    #coach-panel.collapsed { flex-basis: 30px; }
    .coach-body { padding: 0.5rem 0.55rem; line-height: 1.4; }
    .coach-foot { padding: 0.4rem 0.5rem; gap: 0.35rem; flex-wrap: wrap; }
    .coach-head { padding: 0.4rem 0.5rem; }
}
.coach-head { flex: 0 0 auto; display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem;
    background: rgba(212,175,55,0.12); border-bottom: 1px solid rgba(212,175,55,0.35); }
.coach-head-title { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.9rem; flex: 1 1 auto; }
.coach-progress { font-size: 0.62rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.coach-body { flex: 1 1 auto; padding: 0.75rem; line-height: 1.55; color: #ddd; overflow-y: auto; min-height: 0; }
.coach-body b { color: var(--gold); }
.coach-foot { flex: 0 0 auto; padding: 0.6rem 0.7rem; display: flex; gap: 0.5rem; align-items: center;
    flex-wrap: wrap; border-top: 1px solid rgba(212,175,55,0.25); background: rgba(0,0,0,0.25); }
.coach-foot .btn { margin: 0; padding: 0.4rem 0.9rem; font-size: 0.78rem; }
.coach-wait { font-size: 0.72rem; color: var(--blue-bright); font-style: italic; }
#coach-toast { position: fixed; left: 50%; top: 12%; transform: translateX(-50%) translateY(-8px);
    background: var(--bg-card); border: 2px solid var(--gold); border-radius: 6px;
    padding: 0.6rem 1rem; color: #eee; font-size: 0.85rem; z-index: 2000;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6); opacity: 0; pointer-events: none;
    transition: opacity 0.18s, transform 0.18s; max-width: min(560px, 90vw); text-align: center; }
#coach-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.coach-back-btn { padding: 0.4rem 0.6rem !important; min-width: 0; }
.coach-back-btn[disabled] { opacity: 0.3; cursor: default; }
/* Reading back through earlier steps: tint the panel so it's obvious you
   are looking at history and not at the instruction you owe an action to. */
#coach-panel.reviewing { border-right-color: var(--blue-bright); }
#coach-panel.reviewing .coach-head { background: rgba(65,105,225,0.16); border-bottom-color: rgba(65,105,225,0.45); }
#coach-panel.reviewing .coach-head-title { color: var(--blue-bright); }
.coach-reviewing-note { font-size: 0.68rem; color: var(--blue-bright); font-style: italic; padding: 0 0.75rem 0.4rem; display: none; }
#coach-panel.reviewing .coach-reviewing-note { display: block; }
#coach-skip { margin-left: auto; background: none; border: none; color: var(--text-dim);
    font-size: 0.68rem; cursor: pointer; text-decoration: underline; padding: 0; }
#coach-skip:hover { color: var(--gold); }
@keyframes coachNudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#coach-panel.nudge { animation: coachNudge 0.32s ease; }

/* The card the coach is pointing at. Everything else in hand is dimmed
   and unclickable, so there is exactly one legal move at any moment. */
.tut-target-btn { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(212,175,55,0.6) !important; }

/* Intro / outro */
#tutorial-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.82); z-index: 1400;
    display: none; align-items: center; justify-content: center; padding: 1rem; }
#tutorial-modal-overlay.active { display: flex; }
/* The intro/outro card. Same overflow trap as .modal, and worse placed:
   this is the FIRST thing a new player sees. At 800x360 it measured
   589px tall — the title scrolled off the top, and "Let's duel" sat at
   y=387, below the screen. The tutorial could not be started in
   landscape on a phone.
   Here the structure is known and fixed (title / body / one button), so
   rather than scrolling the whole card, the BODY scrolls and the title
   and button stay put. The way out is always on screen. */
.tutorial-modal { background: var(--bg-card); border: 2px solid var(--gold); border-radius: 6px;
    max-width: 560px; padding: 1.4rem; text-align: center;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); }
.tutorial-modal h2 { font-family: 'Cinzel', serif; color: var(--gold); margin: 0 0 0.8rem; flex: 0 0 auto; }
.tutorial-modal .tut-body { color: var(--text); line-height: 1.6; text-align: left; font-size: 0.88rem;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#tutorial-modal-cta { flex: 0 0 auto; }
/* Landscape on a phone is ~310-360px tall with the URL bar showing.
   Buy the body back some of that rather than making it scroll sooner. */
@media (max-height: 460px) {
    .tutorial-modal { padding: 0.8rem 1rem; }
    .tutorial-modal h2 { font-size: 1.05rem; margin: 0 0 0.45rem; }
    .tutorial-modal .tut-body { font-size: 0.82rem; line-height: 1.45; }
    #tutorial-modal-cta { margin-top: 0.6rem !important; }
}
.tutorial-modal .tut-body b { color: var(--gold); }

/* ── The dialog shell: ink on parchment, the board's look (the dialogs used to be navy and gold) ──────────────────
   Every dialog panel reads its colours through the page's custom properties (--gold for its title, border and buttons,
   --text, --text-dim, --bg-dark for its option boxes ...). Inside a dialog those are re-pointed at ink and paper, so
   one place restyles the choice dialogs, the character sheet, the card list, the keywords, the settings and the
   tutorial's intro; the rules below add the paper, the inked edge and the title. A dialog's icon is an inline ink
   icon (board/icons.ts) before its title, never an emoji. */
.modal, .sheet-panel, .cardlist-panel, .kw-panel, .hand-modal, .tutorial-modal, .settings-panel, .go-panel {
    --gold: #1b1620; --gold-dim: #5a5060; --text: #1b1620; --text-dim: #5a5060;
    --bg-dark: #f7f0e0; --bg-card: #ece3cf; --bg-hover: #e1d5b8; --border: rgba(27, 22, 32, 0.42);
    --blue-bright: #1d58b8; --red-bright: #b3241c; --green: #2c7a32; --orange: #9a5a00; --purple: #6a3d96;
    --paper: #ece3cf; --paper-2: #ddd0b3; --ink: #1b1620;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .18 0 0 0 0 .08 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    color: var(--text);
    background: radial-gradient(120% 90% at 50% 50%, transparent 58%, rgba(80, 55, 20, 0.2) 100%), var(--grain), linear-gradient(170deg, #efe6d2, #d9cbab);
    border: 3px solid var(--ink); border-radius: 8px 12px 9px 11px / 11px 8px 12px 9px;
    box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--ink), 5px 8px 0 4px rgba(0, 0, 0, 0.45), 0 14px 40px rgba(0, 0, 0, 0.55);
}
.modal-title svg.i, .kw-title svg.i, .cardlist-title svg.i { width: 1.05em; height: 1.05em; margin-right: 0.4em; vertical-align: -0.14em; color: var(--ink); }
.modal .btn, .sheet-panel .btn, .cardlist-panel .btn, .kw-panel .btn, .hand-modal .btn, .tutorial-modal .btn, .go-panel .btn {
    border: 2.5px solid var(--ink); border-radius: 5px 8px 6px 7px / 7px 5px 8px 6px; background: var(--paper); color: var(--ink); box-shadow: 2px 3px 0 rgba(27, 22, 32, 0.4); letter-spacing: 0.04em;
}
.modal .btn:hover:not(:disabled), .sheet-panel .btn:hover:not(:disabled), .cardlist-panel .btn:hover:not(:disabled), .kw-panel .btn:hover:not(:disabled), .hand-modal .btn:hover:not(:disabled), .tutorial-modal .btn:hover:not(:disabled), .go-panel .btn:hover:not(:disabled) { background: #fff7e6; color: var(--ink); }
.modal .btn.primary, .sheet-panel .btn.primary, .cardlist-panel .btn.primary, .kw-panel .btn.primary, .hand-modal .btn.primary, .tutorial-modal .btn.primary, .go-panel .btn.primary { background: var(--ink); color: #f7f0e0; border-color: var(--ink); }
.modal .btn.primary:hover:not(:disabled), .tutorial-modal .btn.primary:hover:not(:disabled), .sheet-panel .btn.primary:hover:not(:disabled), .go-panel .btn.primary:hover:not(:disabled) { background: #2b2431; color: #f7f0e0; }
.modal-option, .choice-box, .scry-card, .pd-die, .gyro-die, .sa-tile { border-color: var(--ink); box-shadow: 2px 3px 0 rgba(27, 22, 32, 0.3); }
.modal-option:hover:not(.disabled), .choice-box:hover, .pd-die.pd-click:hover, .gyro-die.pd-click:hover, .sa-tile.sa-click:hover { background: #fff7e6; border-color: var(--ink); box-shadow: 2px 3px 0 rgba(27, 22, 32, 0.3), 0 0 0 2px #e2b13c; }
.sa-tile, .gyro-die, .pd-die { background: var(--bg-dark); }
.sa-tile.sa-sel { border-color: var(--green); background: rgba(44, 122, 50, 0.18); box-shadow: 0 0 0 2px var(--green); }
.sa-tile.sa-rep, .gyro-die.gyro-die-broken { border-color: var(--red-bright); background: rgba(179, 36, 28, 0.14); }
.pd-die.pd-pocket { border-color: #a87508; color: #6e4c04; background: rgba(226, 177, 60, 0.3); box-shadow: 0 0 0 2px #e2b13c; }
.pd-die, .gyro-die-val, .sa-tile-bonus { color: var(--ink); }
.sa-tile-bonus { color: #6e4c04; } .sa-tile-rep { color: var(--red-bright); } .sa-tile-kind { color: var(--text-dim); }
.pd-swap-arrow { color: var(--ink); display: inline-flex; align-items: center; } .pd-swap-arrow svg.i { width: 1.5rem; height: 1.5rem; }
.die-btn { border-color: var(--green); background: rgba(44, 122, 50, 0.1); color: #1b4d20; }
.die-btn:hover { background: rgba(44, 122, 50, 0.22); box-shadow: 0 0 0 2px var(--green); } .die-btn.selected { background: rgba(44, 122, 50, 0.35); box-shadow: 0 0 0 3px var(--green); }
.break-active { color: var(--red-bright); text-shadow: none; }
.modal-min-btn { background: transparent; border: 1.5px solid var(--border); color: var(--text-dim); font-family: 'Cinzel', serif; }
.modal-min-btn:hover { border-color: var(--ink); color: var(--ink); }
.choice-box.selected::after { background: var(--paper); color: var(--ink); border-color: var(--ink); }
/* a picked box is filled gold (the ink-on-paper boxes around it are not), so it reads as picked with the pointer elsewhere */
.choice-box.selected { background: #d4af37; border-color: var(--ink); box-shadow: 0 0 0 3px #e2b13c, 2px 3px 0 3px rgba(27, 22, 32, 0.35); }
.choice-box.selected .choice-value, .choice-box.selected .choice-label { color: var(--ink); }
.choice-value svg.i { width: 1em; height: 1em; }
.choice-box .choice-value.good, .choice-value.good { color: #8a5a06; } .choice-value.bad { color: var(--red-bright); }
.cl-card, .scry-card { background: var(--bg-dark); }
.cl-card:hover { border-color: var(--ink); box-shadow: 3px 4px 0 rgba(27, 22, 32, 0.35); }
.cl-card.signature { border-color: #a87508; }
.cl-card.cl-minion, .cz-card.cl-minion { border-color: #6a3d96; } .cl-card.cl-minion .cl-card-name, .cz-card.cl-minion .cl-card-name { color: #6a3d96; }
.cl-minion-ss, .cl-part-bonus { color: #6a3d96; border-color: #6a3d96; } .cl-part-bonus { color: #6e4c04; border-color: #a87508; }
.cl-card.cl-part, .cz-card.cl-part { border-color: #a87508; } .cl-card.cl-part .cl-card-name, .cz-card.cl-part .cl-card-name { color: #6e4c04; }
.kw-hl { background: rgba(226, 177, 60, 0.38); } .kw-hl:hover { background: rgba(226, 177, 60, 0.6); }
.sheet-arrow { background: var(--ink); border: 2px solid var(--paper-2); color: #f7f0e0; }
.sheet-arrow:hover { background: #2b2431; color: #fff; }
.sheet-img { background-color: var(--paper-2); }
.sheet-overlay, .modal-overlay, .hand-modal-overlay { background: rgba(8, 6, 12, 0.78); }
.modal-overlay.minimized { background: transparent !important; }
/* what a zone tile's dialog shows: a card beside its words */
.zd-body { display: flex; gap: 0.9rem; align-items: flex-start; justify-content: center; text-align: left; }
.zd-card[hidden] { display: none; }
.zd-card { flex: none; padding: 0 6px 6px 0; }
.zd-text { margin: 0; max-width: 320px; white-space: pre-line; font-size: 0.9rem; line-height: 1.3; }
.zd-text p { margin: 0 0 0.45rem; } .zd-line { font-family: 'Cinzel', serif; color: var(--ink); } .zd-line b { font-size: 1.15em; color: #6a3d96; } .zd-dim { color: var(--text-dim); font-style: italic; }
.choice-box.good { border-color: #a87508; } .choice-box.good .choice-value, .choice-box.good .choice-label { color: #8a5a06; }
.choice-box.bad { border-color: var(--red-bright); } .choice-box.bad .choice-value, .choice-box.bad .choice-label { color: var(--red-bright); }
.good-text { color: #8a5a06 !important; } .bad-text { color: var(--red-bright) !important; }
.replace-msg { color: var(--red-bright); font-size: 0.72rem; min-height: 1.1rem; margin-top: 0.4rem; text-align: center; }
.down-note { color: var(--red-bright) !important; }
.modal.modal-alert { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--red-bright), 5px 8px 0 4px rgba(0, 0, 0, 0.45), 0 14px 40px rgba(0, 0, 0, 0.55); }
.modal-alert .modal-title svg.i { color: var(--red-bright); }
/* Trap Master's list: a row per trap, its card beside its words */
.tm-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: min(280px, 46vh); overflow-y: auto; padding: 0.35rem; border: 2px solid var(--ink); border-radius: 5px 8px 6px 7px / 7px 5px 8px 6px; background: rgba(247, 240, 224, 0.55); margin-bottom: 0.5rem; text-align: left; }
.tm-row { display: flex; gap: 0.6rem; align-items: center; padding: 0.3rem 0.45rem; border: 2px solid var(--border); border-radius: 5px; background: var(--bg-dark); cursor: pointer; }
.tm-row:hover { border-color: var(--ink); }
.tm-row.selected { border-color: var(--ink); background: #d4af37; box-shadow: 0 0 0 2px #e2b13c; }
.tm-row .card { flex: none; margin: 0 4px 4px 0; }
.tm-name { font-family: 'Cinzel', serif; font-size: 0.85rem; color: var(--ink); font-weight: 700; }
.tm-name svg.i { width: 1em; height: 1em; margin-right: 0.3em; vertical-align: -0.12em; }
.tm-desc { font-size: 0.7rem; line-height: 1.2; margin-top: 0.15rem; white-space: pre-line; color: var(--text); }
.tm-empty { color: var(--text-dim); padding: 0.5rem; text-align: center; }
.tm-count { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.4rem; }

@media (max-height: 460px) {
    /* a title keeps clear of the Minimize button, which sits beside it on a short screen */
    .modal > .modal-title { padding: 0 4.6rem; }
    /* Wild Shift's five options must fit a phone in landscape */
    .shift-opt { padding: 0.25rem 0.5rem !important; }
    #shift-modal-options { display: grid !important; grid-template-columns: 1fr 1fr; gap: 0.3rem !important; }
    #shift-modal > .modal { width: 600px; max-width: 96vw; }
    #shift-modal .modal-text { margin-bottom: 0.2rem; }
}

/* the connection banner and the coach's refusal toast, in the same ink on parchment (the banner sits above the stage, top centre) */
.conn-banner { background: #ece3cf; color: #1b1620; border-color: #1b1620; border-width: 2px; font-weight: 700; letter-spacing: 0.04em; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.5); }
.conn-banner.warn { box-shadow: inset 0 -5px 0 #c98a12, 3px 4px 0 rgba(0, 0, 0, 0.5); }
.conn-banner.ok { box-shadow: inset 0 -5px 0 #2c7a32, 3px 4px 0 rgba(0, 0, 0, 0.5); }
.conn-banner.bad { box-shadow: inset 0 -5px 0 #b3241c, 3px 4px 0 rgba(0, 0, 0, 0.5); }
.conn-banner.warn, .conn-banner.ok, .conn-banner.bad { background: #ece3cf; color: #1b1620; }
#coach-toast { background: #ece3cf; color: #1b1620; border: 2.5px solid #1b1620; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.5); font-weight: 600; }
@media (max-height: 460px) {
    /* Free Attach is the tallest dialog: smaller tiles, and Equip and Skip ride the bottom edge */
    #schmeem-attach-modal .modal { max-width: 96vw !important; width: min(760px, 96vw) !important; }
    #schmeem-attach-modal .sa-tile { min-width: 66px; padding: 0.12rem 0.3rem; }
    #schmeem-attach-modal .sa-tile-name { font-size: 0.6rem; } #schmeem-attach-modal .sa-tile-bonus { font-size: 0.55rem; }
    #schmeem-attach-modal .sa-section { font-size: 0.7rem; margin-bottom: 0; } #schmeem-attach-modal .sa-rowlabel { font-size: 0.58rem; margin: 0.05rem 0 0; }
    #schmeem-attach-sub { font-size: 0.75rem !important; margin-bottom: 0.2rem !important; }
    #schmeem-attach-modal .sa-actions { position: sticky; bottom: -0.7rem; z-index: 3; margin-top: 0.3rem !important; padding: 0.3rem 0; background: var(--bg-card); }
    #schmeem-attach-modal .sa-actions .btn { margin: 0 0.2rem; }
}
@media (max-height: 460px) {
    /* The character sheet on a phone in landscape: the portrait narrows, the type shrinks, and all four buttons are on screen
       (the mechanics text scrolls between the blurb and the buttons) */
    .sheet-panel { padding: 0.55rem 0.8rem; gap: 0.8rem; }
    .sheet-img { flex: 0 0 31%; width: 31%; min-height: 0; }
    .sheet-title { font-size: 1.05rem; }
    .sheet-sub { font-size: 0.78rem; margin-top: 0.05rem; }
    .sheet-blurb { font-size: 0.74rem; margin: 0.2rem 0; line-height: 1.22; }
    .sheet-mechanics { font-size: 0.74rem; line-height: 1.28; padding: 0.3rem 0.3rem 0.3rem 0; margin-bottom: 0.3rem; min-height: 2.6rem; }
    .sheet-btns { gap: 0.25rem; }
    .sheet-btns > .btn:nth-child(1), .sheet-btns > .btn:nth-child(2) { grid-column: auto; }
    .sheet-btns .btn, .info-btns .btn { min-height: 44px; padding: 0.15rem 0.4rem; font-size: 0.64rem; }
    .info-btns { gap: 0.3rem; }
}

/* ── The end of the match (play/endScreen.ts) ──────────────────────────────────────────────────────────────────────
   A parchment panel (the dialog shell's look) over the dimmed final board: the winner's portrait, the stamp in the board's
   stamp language (blue ink when you win, red when the opponent does), the facts the server sent, Rematch as the big button.
   Sizes are CSS pixels (the page's root is 20px). Motion keys off data-motion: with `reduced` nothing moves. */
#gameover-screen {
    --paper: #ece3cf; --paper-2: #ddd0b3; --paper-hi: #f7f0e0; --ink: #1b1620; --ink-soft: #5a5060;
    --you: #1d58b8; --opp: #b3241c; --gold-ink: #a87508; --gold-hi: #e2b13c; --tie: #5a5060;
    --display: 'Cinzel', Georgia, 'Times New Roman', serif; --serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
    position: fixed; inset: 0; z-index: 300; min-height: 0; padding: 16px; overflow: auto;
    justify-content: flex-start;   /* the panel centres itself with auto margins, so a panel taller than the window scrolls from its top */
    background: radial-gradient(85% 80% at 50% 46%, rgba(10, 8, 15, 0.58), rgba(6, 5, 9, 0.9) 100%);
    -webkit-backdrop-filter: blur(2px) saturate(0.55); backdrop-filter: blur(2px) saturate(0.55);
}
#gameover-screen[data-outcome="victory"] { background: radial-gradient(85% 80% at 50% 46%, rgba(40, 28, 8, 0.52), rgba(8, 6, 8, 0.9) 100%); }
#gameover-screen[data-outcome="defeat"] { background: radial-gradient(85% 80% at 50% 46%, rgba(38, 8, 10, 0.5), rgba(8, 4, 6, 0.92) 100%); }
/* the board behind the panel is inert (screens.js): its K.O. stamp has had its moment, and the panel's own VICTORY or DEFEAT takes over. The
   stamp lives in stage pixels and the panel in page pixels, so on some windows it would show beside the panel (two big stamps) or be cut by it.
   It fades out as the panel comes up; the loser's drained plate stays, so the dimmed board still shows who fell */
#game-screen[inert] .ko-stamp { opacity: 0; transition: opacity .3s ease-out; }
/* nothing behind it (the match was left before the result came): the table's own ink wash */
#gameover-screen.alone { background: radial-gradient(120% 90% at 50% 45%, #221d27, #16131b 70%), #16131b; -webkit-backdrop-filter: none; backdrop-filter: none; }
.go-panel { position: relative; width: min(820px, 100%); margin: auto; padding: 26px 34px 12px; text-align: left;
    display: grid; grid-template-columns: 218px minmax(0, 1fr); grid-template-areas: "hero main" "foot foot"; column-gap: 34px; row-gap: 10px; }
.go-panel.no-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "foot"; }
.go-hero { grid-area: hero; align-self: start; text-align: center; padding-top: 6px; }
.go-main { grid-area: main; min-width: 0; }

.go-portrait { position: relative; width: 218px; height: 209px; margin: 0 auto; border-radius: 5px 9px 6px 8px; transform: rotate(-1.4deg);
    background: var(--paper-hi) 50% 30% / cover no-repeat; filter: contrast(1.1) sepia(0.15);
    box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper-2), 0 0 0 8.5px var(--ink), 4px 6px 0 8.5px rgba(0, 0, 0, 0.45); }
#gameover-screen[data-outcome="victory"] .go-portrait { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper-2), 0 0 0 8.5px var(--ink), 4px 6px 0 8.5px rgba(0, 0, 0, 0.45), 0 0 34px 10px rgba(226, 177, 60, 0.5); }
.go-rib { position: relative; z-index: 1; display: inline-block; margin: -14px 0 0; transform: rotate(-3deg); padding: 6px 18px 6px 20px; white-space: nowrap;
    font: 900 13px/1 var(--display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-hi);
    clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%); }
.go-rib.you { background: var(--you); } .go-rib.opp { background: var(--opp); }
.go-who { margin-top: 10px; }
.go-kicker { font: 800 12px/1 var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft); }
.go-name { font: 900 24px/1.1 var(--display); letter-spacing: 0.02em; color: var(--ink); margin: 6px 0 0; }

/* the stamp, as the board's own result stamp is drawn: paper, a double rule and a side's ink, slammed down a little crooked */
.go-stamp { --sc: var(--tie); display: inline-block; text-align: center; margin: 2px 0 12px 4px; padding: 7px 26px 9px; transform: rotate(-3deg);
    background: var(--grain), var(--paper-hi); color: var(--sc); border: 4px double var(--sc); border-radius: 6px 9px 7px 8px; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.4); }
.go-stamp.you { --sc: var(--you); } .go-stamp.opp { --sc: var(--opp); }
.go-stamp small { display: block; font: 800 12px/1 var(--display); letter-spacing: 0.26em; text-transform: uppercase; }
.go-stamp b { display: block; font: 900 58px/1.04 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.go-flavor { font: italic 400 19px/1.25 var(--serif); color: var(--ink-soft); margin: 0 0 9px 4px; }

.go-facts { margin: 0; border-top: 2.5px solid var(--ink); }
.go-fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 7px 0 8px; border-bottom: 1.5px dashed rgba(27, 22, 32, 0.38); }
.go-fact dt { font: 800 12px/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.go-fact dd { margin: 0; font: 500 18px/1.25 var(--serif); color: var(--ink); min-width: 0; }
.go-fact b { font-family: var(--display); font-weight: 900; }
.go-note { font: italic 400 17px/1.25 var(--serif); color: var(--ink-soft); padding: 8px 0 0; }
.go-tag { display: inline-block; flex: none; font: 800 10.5px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 7px 3px; border-radius: 3px; color: var(--paper-hi); background: var(--tie); }
.you > .go-tag { background: var(--you); } .opp > .go-tag { background: var(--opp); }
.go-hp { display: grid; gap: 6px; }
.go-hpside { display: flex; align-items: center; gap: 9px; min-width: 0; }
.go-hpname { flex: none; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; color: var(--ink-soft); }
.go-bar { flex: 1 1 60px; min-width: 40px; height: 11px; border: 2.5px solid var(--ink); border-radius: 3px 5px 4px 4px; background: rgba(27, 22, 32, 0.12); overflow: hidden; }
.go-bar > i { display: block; height: 100%; background: var(--tie); }
.go-hpside.you .go-bar > i { background: var(--you); } .go-hpside.opp .go-bar > i { background: var(--opp); }
.go-hpside > b { flex: none; min-width: 3.4em; text-align: right; font-size: 20px; }
.go-hpside > b small { font: 600 14px var(--serif); color: var(--ink-soft); }
.go-blow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.go-amt { font-size: 19px; } .go-amt b { font-size: 26px; color: var(--tie); } .go-blow.you .go-amt b { color: var(--you); } .go-blow.opp .go-amt b { color: var(--opp); }
.go-src { font: italic 400 18px/1.2 var(--serif); color: var(--ink-soft); }
.go-eq { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 17px; }
.go-term em { font: 700 17px var(--serif); font-style: normal; color: var(--ink-soft); margin-right: 3px; }
.go-term b { font-size: 17px; } .go-term small { font: 500 15px var(--serif); color: var(--ink-soft); }
.go-clash { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.go-sc { display: inline-flex; align-items: center; gap: 6px; } .go-sc b { font-size: 23px; } .go-sc.won b { text-decoration: underline; text-decoration-thickness: 2.5px; text-underline-offset: 3px; }
.go-sc.you b { color: var(--you); } .go-sc.opp b { color: var(--opp); }
.go-vs, .go-margin { font: italic 400 17px var(--serif); color: var(--ink-soft); }
.go-crit { font: 800 11.5px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 8px; border: 2px solid var(--gold-ink); color: #6e4c04; background: rgba(226, 177, 60, 0.3); border-radius: 3px 5px 4px 4px; }

.go-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; padding-top: 12px; border-top: 2px dashed rgba(27, 22, 32, 0.32); }
.go-panel .btn { margin: 0; }
.go-big { min-width: 290px; min-height: 54px; padding: 8px 34px; font-size: 24px; letter-spacing: 0.06em; border-width: 3px; }
.go-menu { min-height: 46px; padding: 8px 20px; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; }
.go-menu.go-big { justify-content: center; font-size: 24px; } .go-menu.go-big svg.i { display: none; }
.go-data { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 12px; }
.go-link { appearance: none; background: none; border: 0; margin: 0; padding: 0 10px; min-height: 44px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    font: 600 16px var(--serif); color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.go-link:hover { color: var(--ink); } .go-link:focus-visible, .go-panel .btn:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }
.go-link svg.i { width: 1.05em; height: 1.05em; }
.go-data-note { font: italic 400 16px var(--serif); color: #2c7a32; }
.go-data-note:empty { display: none; }

/* motion: the overlay darkens, the panel rises, the portrait settles, the stamp slams (its landing is the thud, endScreen.ts), the facts follow */
@keyframes go-fade { from { opacity: 0; } }
@keyframes go-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes go-settle { from { opacity: 0; transform: translateY(10px) rotate(-1.4deg) scale(1.04); } }
@keyframes go-slam { 0% { opacity: 0; transform: rotate(-3deg) scale(2.6); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.55); }
    55% { opacity: 1; transform: rotate(-3deg) scale(0.93); animation-timing-function: ease-out; } 75% { transform: rotate(-3deg) scale(1.035); } 100% { opacity: 1; transform: rotate(-3deg) scale(1); } }
@keyframes go-row { from { opacity: 0; transform: translateX(10px); } }
#gameover-screen[data-motion="full"].active { animation: go-fade 0.3s ease-out; }
#gameover-screen[data-motion="full"] .go-panel { animation: go-rise 0.38s ease-out 0.1s backwards; }
#gameover-screen[data-motion="full"] .go-portrait { animation: go-settle 0.4s ease-out 0.2s backwards; }
#gameover-screen[data-motion="full"] .go-rib, #gameover-screen[data-motion="full"] .go-who { animation: go-fade 0.3s ease-out 0.45s backwards; }
#gameover-screen[data-motion="full"] .go-stamp { animation: go-slam 0.36s 0.36s backwards; }
#gameover-screen[data-motion="full"] .go-flavor { animation: go-fade 0.3s ease-out 0.7s backwards; }
#gameover-screen[data-motion="full"] .go-fact, #gameover-screen[data-motion="full"] .go-note { animation: go-row 0.28s ease-out backwards; }
#gameover-screen[data-motion="full"] .go-fact:nth-child(1) { animation-delay: 0.78s; } #gameover-screen[data-motion="full"] .go-fact:nth-child(2) { animation-delay: 0.88s; }
#gameover-screen[data-motion="full"] .go-fact:nth-child(3) { animation-delay: 0.98s; } #gameover-screen[data-motion="full"] .go-fact:nth-child(4) { animation-delay: 1.08s; }
#gameover-screen[data-motion="full"] .go-note { animation-delay: 1.18s; }
#gameover-screen[data-motion="full"] .go-foot { animation: go-fade 0.35s ease-out 1.2s backwards; }

/* a window too narrow for two columns (a desktop window dragged thin): the portrait above the facts, the overlay scrolls */
@media (max-width: 640px) and (min-height: 461px) {
    .go-panel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "main" "foot"; padding: 22px 20px 12px; row-gap: 14px; }
    .go-hero { display: flex; flex-direction: column; align-items: center; }
    .go-portrait { width: 170px; height: 163px; }
    .go-fact { grid-template-columns: minmax(0, 1fr); }
    .go-big { min-width: 0; width: 100%; } .go-menu { width: 100%; justify-content: center; }
}

/* a phone in landscape: the same panel, tighter; every touch target keeps 44px */
@media (max-height: 460px) {
    #gameover-screen { padding: 8px; }
    .go-panel { padding: 14px 20px 8px; grid-template-columns: 148px minmax(0, 1fr); column-gap: 22px; row-gap: 6px; }
    .go-hero { padding-top: 3px; }
    .go-portrait { width: 148px; height: 142px; box-shadow: 0 0 0 2.5px var(--ink), 0 0 0 5px var(--paper-2), 0 0 0 7px var(--ink), 3px 4px 0 7px rgba(0, 0, 0, 0.45); }
    #gameover-screen[data-outcome="victory"] .go-portrait { box-shadow: 0 0 0 2.5px var(--ink), 0 0 0 5px var(--paper-2), 0 0 0 7px var(--ink), 3px 4px 0 7px rgba(0, 0, 0, 0.45), 0 0 24px 7px rgba(226, 177, 60, 0.5); }
    .go-rib { font-size: 10px; padding: 4px 12px 4px 14px; margin-top: -11px; }
    .go-who { margin-top: 8px; } .go-kicker { font-size: 9.5px; } .go-name { font-size: 16px; margin-top: 3px; }
    .go-stamp { margin: 0 0 8px 2px; padding: 4px 18px 5px; border-width: 3px; }
    .go-stamp small { font-size: 9.5px; } .go-stamp b { font-size: 38px; }
    .go-flavor { font-size: 16px; margin: 0 0 5px 2px; }
    .go-fact { grid-template-columns: 74px minmax(0, 1fr); gap: 2px 10px; padding: 4px 0 5px; }
    .go-fact dt { font-size: 10px; } .go-fact dd { font-size: 15px; }
    .go-tag { font-size: 9px; padding: 2px 5px; }
    .go-hp { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
    .go-hpname { display: none; } .go-bar { height: 9px; min-width: 24px; }
    .go-hpside > b { font-size: 16px; min-width: 3em; } .go-hpside > b small { font-size: 12px; }
    .go-amt { font-size: 15px; } .go-amt b { font-size: 20px; } .go-src { font-size: 14px; }
    .go-eq { font-size: 14px; } .go-term em, .go-term b { font-size: 14px; } .go-term small { font-size: 12.5px; }
    .go-term.sum { display: none; }
    .go-sc b { font-size: 18px; } .go-vs, .go-margin { font-size: 14px; } .go-crit { font-size: 9.5px; padding: 3px 6px; }
    .go-note { font-size: 14px; padding-top: 4px; }
    .go-foot { gap: 6px 14px; padding-top: 8px; }
    .go-big { min-width: 230px; min-height: 48px; padding: 6px 24px; font-size: 20px; }
    .go-menu { min-height: 46px; padding: 6px 16px; font-size: 14px; } .go-menu.go-big { font-size: 20px; }
    .go-data { flex: 0 1 auto; flex-wrap: nowrap; gap: 0 4px; }
    .go-link { font-size: 14px; } .go-data-note { font-size: 13px; }
}
/*
 * The playing card: frame A (parchment and brush), slightly 3D without WebGL.
 * Drawn by client/src/cards/face.ts; the approved look is the mock in
 * .mockups/match-screen-redesign/ (shared/ink.css, frame "parch").
 *
 * A card is sized by --cw on .card (its width in CSS pixels). Everything inside is in container
 * units (cqw: 1 = 1% of the card's width), so one component serves the raised card, the hand, the
 * table, the zoom and the phone. Up to 122 px wide, a card draws its compact layout: art, name,
 * seal and marker (the rules, type line and rarity line stay in the markup and are hidden).
 *
 * Thickness is one edge layer behind the card (.card::before), not stacked shadows, which repaint on
 * a phone; the light on the face (.c-face::after) follows the pointer through --mx and --my.
 */

.card {
  --cw: 150px;
  --c-paper: #ece3cf; --c-paper-hi: #f7f0e0; --c-ink: #1b1620; --c-ink-soft: #5a5060; --c-ink-faint: rgba(27, 22, 32, .35);
  --c-gold: #a87508; --c-gold-hi: #e2b13c; --c-heal: #2c7a32; --c-steel: #3a3a46; --c-loss: #7d1410;
  --c-display: 'Cinzel', Georgia, 'Times New Roman', serif; --c-serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --c-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .18 0 0 0 0 .08 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  width: var(--cw); aspect-ratio: 5 / 7; position: relative; flex: none; isolation: isolate;
  container-type: inline-size; border-radius: calc(var(--cw) * .055);
  font: 400 16px/normal var(--c-serif); color: var(--c-ink); text-align: left;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* the card's thickness and its cast shadow: one layer, lit from the upper left */
.card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: #8a7c60;
  transform: translate(calc(var(--cw) * .014), calc(var(--cw) * .024));
  box-shadow: 0 calc(var(--cw) * .05) calc(var(--cw) * .08) rgba(0, 0, 0, .5);
}
.c-face {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 4.6cqw 6cqw 5cqw 6.4cqw / 6cqw 4.6cqw 6.2cqw 5cqw;
  background: radial-gradient(110% 80% at 25% 10%, var(--c-paper-hi), transparent 60%), var(--c-grain), linear-gradient(165deg, #efe6d2, #d9cbab);
  box-shadow: inset 0 0 0 1.3cqw var(--c-ink), inset 0 0 0 2.6cqw #e7dcc4, inset 0 0 0 3cqw rgba(27, 22, 32, .5);
}
.card.r-signature .c-face { box-shadow: inset 0 0 0 1.3cqw var(--c-ink), inset 0 0 0 2.4cqw #e7dcc4, inset 0 0 0 3.2cqw var(--c-gold); }
.c-face::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 9;
  background: radial-gradient(70% 55% at var(--mx, 28%) var(--my, 12%), rgba(255, 250, 235, .32), transparent 70%),
    linear-gradient(128deg, rgba(255, 255, 255, .14), transparent 40%, transparent 70%, rgba(20, 10, 0, .16));
}

/* the drawing: the character's one drawing, cropped. The crop is a focus point (--fx, --fy) and a zoom
   (--art-size, the drawing's width over the window's), kept covering the window (art.ts) */
.c-art {
  --aw: 86cqw; --ah: 50cqw;
  --iw: calc(var(--art-size, 1.2) * var(--aw)); --ih: calc(var(--iw) * var(--art-aspect, 1.4));
  position: absolute; left: 7cqw; right: 7cqw; top: 18cqw; height: 50cqw; width: auto;
  border: 1.1cqw solid var(--c-ink); border-radius: 1.5cqw 2.5cqw 1.8cqw 2.2cqw; background-color: var(--c-paper-hi);
  background-image: var(--art-url, none); background-repeat: no-repeat; background-blend-mode: multiply;
  background-size: var(--iw) var(--ih);
  background-position:
    clamp(calc(var(--aw) - var(--iw)), calc(var(--aw) * .5 - var(--fx, .5) * var(--iw)), 0px)
    clamp(calc(var(--ah) - var(--ih)), calc(var(--ah) * .5 - var(--fy, .5) * var(--ih)), 0px);
}
.c-art::after { content: ''; position: absolute; inset: 0; background: var(--c-grain); opacity: .8; }

.c-banner {
  position: absolute; left: 4.5cqw; right: 4.5cqw; top: 4.5cqw; min-height: 15cqw; z-index: 2;
  background: var(--c-ink); color: var(--c-paper-hi); display: flex; align-items: center; padding: 1.6cqw 6cqw 1.6cqw 21cqw;
  clip-path: polygon(0 0, 100% 3%, 97% 50%, 100% 97%, 1% 100%, 3% 50%);
}
.c-name {
  font: 800 8.4cqw/1.02 var(--c-display); letter-spacing: .01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.c-seal {
  position: absolute; left: 3cqw; top: 2.5cqw; width: 19cqw; height: 19cqw; z-index: 3; display: grid; place-items: center; border-radius: 50%;
  background: var(--c-paper-hi); color: var(--c-ink); border: 1.3cqw solid var(--c-ink); box-shadow: .6cqw .9cqw 0 rgba(27, 22, 32, .35);
}
.card.t-after .c-seal { background: var(--c-ink); color: var(--c-paper-hi); border-color: var(--c-paper-hi); outline: 1cqw solid var(--c-ink); }
.card.t-minion .c-seal { background: #6a3d96; color: var(--c-paper-hi); border-color: var(--c-paper-hi); outline: 1cqw solid var(--c-ink); }
.card.t-minion .c-gem { border-radius: 50%; transform: none; }
.card.t-minion .c-stat { --fx-color: #6a3d96; }
.card.t-anytime .c-seal { box-shadow: 0 0 0 1cqw var(--c-gold-hi), .6cqw .9cqw 0 rgba(27, 22, 32, .35); }
.c-seal svg.i { width: 62%; height: 62%; }

.c-stat {
  position: absolute; z-index: 4; display: inline-flex; align-items: center; justify-content: center; gap: 1cqw; white-space: nowrap;
  left: 3.5cqw; top: 59cqw; height: 15cqw; padding: 0 3.2cqw 0 2.4cqw; background: var(--c-paper-hi);
  border: 1.3cqw solid var(--c-ink); border-radius: 8cqw 6cqw 7cqw 6cqw; color: var(--fx-color, var(--c-ink)); box-shadow: .6cqw 1cqw 0 rgba(27, 22, 32, .35);
}
.c-stat b { font: 900 10.5cqw/1 var(--c-display); }
.c-stat svg.i { width: 8.5cqw; height: 8.5cqw; stroke-width: 2.6; }
.fx-true_damage, .fx-opp_strike { --fx-color: var(--c-loss); }
.fx-heal { --fx-color: var(--c-heal); }
.fx-shield, .fx-deflect { --fx-color: var(--c-steel); }

.c-type {
  position: absolute; left: 30cqw; right: 7cqw; top: 70.5cqw; display: flex; align-items: center; gap: 2cqw;
  font: 800 5.6cqw/1 var(--c-display); letter-spacing: .07em; white-space: nowrap; text-transform: uppercase; color: var(--c-ink-soft);
}
.c-gem { width: 5.4cqw; height: 5.4cqw; transform: rotate(45deg); border: .9cqw solid currentColor; display: inline-block; flex: none; }
.card.r-uncommon .c-gem { background: linear-gradient(135deg, currentColor 50%, transparent 50%); }
.card.r-signature .c-gem { background: var(--c-gold); border-color: var(--c-gold); box-shadow: 0 0 0 .5cqw rgba(168, 117, 8, .3); }
.c-rules {
  position: absolute; left: 7cqw; right: 7cqw; top: 79cqw; bottom: 8.5cqw; overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  border-top: .7cqw solid var(--c-ink-faint); padding-top: 2.2cqw; font: 400 var(--rules-fs, 7.7cqw)/1.13 var(--c-serif);
}
.c-rules::-webkit-scrollbar { display: none; }
/* the longest rules text, at the smallest type that fits, runs past the box: it fades and scrolls (the zoom has the most room) */
.card.c-more .c-rules { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 7cqw), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 7cqw), transparent); }
.c-rules p { margin: 0 0 .32em; color: inherit; font: inherit; max-width: none; }
.c-rules .kw { font: 700 .86em/1.1 var(--c-display); letter-spacing: .02em; display: block; margin-top: .1em; }
.c-rules .note { font-style: italic; font-size: .9em; opacity: .8; }
.c-rarity { position: absolute; left: 0; right: 0; bottom: 1.7cqw; text-align: center; font: italic 400 4.6cqw/1 var(--c-serif); color: var(--c-ink-soft); letter-spacing: .03em; z-index: 3; }
/* conditionals that are lit, set for parchment (the old board lit them gold on dark) */
.c-rules .cond-active, .c-rules .mana-active, .c-rules .rage-active, .c-rules .marked-active, .c-rules .form-active { font-weight: 700; border-radius: .6cqw; padding: 0 .5cqw; margin: 0 -.5cqw; }
.c-rules .cond-active, .c-rules .mana-active, .c-rules .rage-active, .c-rules .marked-active, .c-rules .form-active, .c-rules .cond-elide { color: inherit; text-shadow: none; }
.c-rules .cond-active { background: rgba(226, 177, 60, .5); }
.c-rules .mana-active { background: rgba(123, 88, 168, .32); }
.c-rules .rage-active, .c-rules .marked-active { background: rgba(179, 36, 28, .26); color: #6b100a; }
.c-rules .form-active { background: rgba(44, 122, 50, .26); color: #1b4d20; }
.c-rules .cond-elide { opacity: .55; }
/* how the card was paid for, on the table */
.c-paid {
  position: absolute; right: 8.5cqw; top: 19.5cqw; z-index: 4; padding: .8cqw 2cqw; border-radius: 1cqw; background: var(--c-ink); color: var(--c-gold-hi);
  font: 800 5.4cqw/1 var(--c-display); letter-spacing: .08em; white-space: nowrap;
}

/* Compact: a card up to 122 px wide (the phone's hand, cards on the table, mini cards) keeps art, name, seal and marker */
@container (max-width: 122.5px) {
  .c-rules, .c-type, .c-rarity { display: none; }
  .c-name { font-size: 11.5cqw; line-height: 1; }
  .c-banner { padding: 2cqw 3cqw; min-height: 26cqw; left: 3cqw; right: 3cqw; top: 3cqw; clip-path: none; border-radius: 2cqw; justify-content: center; text-align: center; }
  .c-art { --aw: 90cqw; --ah: 103cqw; top: 32cqw; bottom: 5cqw; height: auto; left: 5cqw; right: 5cqw; }
  .c-seal { left: auto; right: 4cqw; top: 33cqw; width: 22cqw; height: 22cqw; }
  .c-stat { left: 4cqw; right: auto; top: auto; bottom: 5cqw; height: 24cqw; padding: 0 4cqw 0 3cqw; }
  .c-stat svg.i { width: 12cqw; height: 12cqw; }
  .c-stat b { font-size: 17cqw; }
  .c-paid { right: 6cqw; top: auto; bottom: 6cqw; font-size: 8cqw; }
  /* a peeking hand hides the lower half, so the number moves up under the name */
  .peek .c-stat { top: 33cqw; bottom: auto; }
}

/* States */
.card.dim { filter: saturate(.35) brightness(.72); }
.card.countered { opacity: .6; }
.card.countered .c-face::before {
  content: ''; position: absolute; inset: 0; z-index: 8; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - .9cqw), var(--c-loss) calc(50% - .9cqw), var(--c-loss) calc(50% + .9cqw), transparent calc(50% + .9cqw));
}
.card.playable::after, .card.raised::after, .card.selected::after, .card.fx-lift:not(.dim)::after {
  content: ''; position: absolute; inset: calc(var(--cw) * -.025); border-radius: calc(var(--cw) * .08); pointer-events: none;
  box-shadow: 0 0 0 calc(var(--cw) * .012) var(--c-gold-hi), 0 0 calc(var(--cw) * .08) rgba(226, 177, 60, .55);
}
.card.raised::after, .card.selected::after { box-shadow: 0 0 0 calc(var(--cw) * .014) var(--c-gold-hi), 0 0 calc(var(--cw) * .1) rgba(226, 177, 60, .65); }
.card.dim.raised { filter: none; }
.card.tut-target::after { content: ''; position: absolute; inset: -3px; border-radius: calc(var(--cw) * .08); pointer-events: none; box-shadow: 0 0 0 2px var(--c-gold-hi), 0 0 18px rgba(226, 177, 60, .8); }
.card.tut-locked, .fan > .card.tut-locked { opacity: .28; cursor: not-allowed; pointer-events: none; }
.card.pick-target { cursor: pointer; }
.card.pick-target::after { content: ''; position: absolute; inset: -3px; border-radius: calc(var(--cw) * .08); pointer-events: none; box-shadow: 0 0 0 2px #4f86e8, 0 0 14px rgba(79, 134, 232, .7); }
.card.fx-flash::after { content: ''; position: absolute; inset: -3px; border-radius: calc(var(--cw) * .08); pointer-events: none; box-shadow: 0 0 0 3px #b3241c, 0 0 18px rgba(179, 36, 28, .9); }

/* The back of a card: tooled leather with an inked fulcrum mark (a placeholder until Carl designs the real back) */
.card.back .c-face {
  background: radial-gradient(80% 60% at 30% 20%, #6b2a22, transparent 70%), var(--c-grain), linear-gradient(160deg, #4a1d18, #210c0a);
  box-shadow: inset 0 0 0 1.2cqw #0f0605, inset 0 0 0 3cqw #4a1d18, inset 0 0 0 3.6cqw #9c7b52;
}
.card.back .c-mark { position: absolute; inset: 22% 18%; color: #d9b98a; opacity: .9; }
.card.back .c-mark svg { width: 100%; height: 100%; stroke-width: 1.3; }
.card.back .c-trap { position: absolute; left: 0; right: 0; bottom: 12cqw; text-align: center; font: 900 11cqw/1 var(--c-display); letter-spacing: .14em; color: #e8cf9c; text-shadow: 0 .6cqw 0 #0f0605; }
svg.i { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* A card on the table: it fills its slot and opens its zoom */
.table-card { cursor: zoom-in; }
.card-slot > .table-card { margin: auto; }
.card.back.table-card { cursor: default; }

/* A mini card (Aeon's clock): the drawing, the name and the number, centred in its tile */
.mini-card { cursor: pointer; margin: 4px auto 0; }

/* The zoom: the whole card, large, on the zoom overlay (cardZoom.js) */
.cz-card.cz-face { background: none; border: 0; box-shadow: none; padding: 0; width: auto; max-height: none; overflow: visible; display: block; }
.zoom-card .c-rules { scrollbar-width: thin; }
.zoom-card .c-rules::-webkit-scrollbar { display: block; width: 6px; }
.zoom-card .c-rules::-webkit-scrollbar-thumb { background: rgba(27, 22, 32, .4); border-radius: 3px; }
.cz-card.cz-face.with-account { display: flex; flex-direction: row; align-items: flex-start; gap: 22px; }
.cz-played { width: min(250px, 38vw); max-height: 80vh; overflow-y: auto; padding: 12px 14px; border-radius: 6px 10px 7px 9px; background: #ece3cf; color: #1b1620; border: 3px solid #1b1620; box-shadow: 3px 4px 0 rgba(0, 0, 0, .45); font: 400 15px/1.25 'Crimson Text', Georgia, serif; }
.cz-played-head { font: 800 11px/1 'Cinzel', Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #5a5060; margin-bottom: 8px; }
.cz-played p { margin: 0 0 .4em; }
.cz-played .kw { font: 700 .86em/1.1 'Cinzel', Georgia, serif; display: block; }
.cz-played .note { font-style: italic; opacity: .8; }
.cz-played .cond-active, .cz-played .mana-active, .cz-played .rage-active, .cz-played .marked-active, .cz-played .form-active { color: inherit; text-shadow: none; font-weight: 700; background: rgba(226, 177, 60, .45); border-radius: 3px; padding: 0 2px; }
.cz-played .cond-elide { color: inherit; opacity: .55; }
.cz-played .table-card-result { margin-top: .6rem; }
@media (max-width: 700px) { .cz-card.cz-face.with-account { flex-direction: column; align-items: center; } }

/* A grid of cards, in a dialog (discard, Aeon's hand): every card its own size, wrapping */
.card-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 4px 14px; }
.card-grid > .card { cursor: pointer; margin: 0 6px 6px 0; }
.card-grid > .card.selected::after { content: ''; position: absolute; inset: -4px; border-radius: calc(var(--cw) * .08); pointer-events: none; box-shadow: 0 0 0 3px #e2b13c, 0 0 18px rgba(226, 177, 60, .75); }
.card-grid.discarding > .card.selected { filter: saturate(.5); }
.card-grid.discarding > .card.selected::after { box-shadow: 0 0 0 3px #b3241c, 0 0 18px rgba(179, 36, 28, .8); }

/* The hand fan (positions come from fan.ts: each card is moved with translate, rotate and scale, which
   transition apart from the lean toward the pointer, set as a transform) */
.fan { position: relative; }
.fan > .card {
  position: absolute; left: 0; bottom: 0; transform-origin: 50% 50%; cursor: pointer; touch-action: none; pointer-events: auto;
  translate: var(--fan-x, 0px) var(--fan-y, 0px); rotate: var(--fan-rot, 0deg); scale: 1;
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: translate .24s cubic-bezier(.2, .9, .3, 1.2), rotate .24s cubic-bezier(.2, .9, .3, 1.2), scale .24s cubic-bezier(.2, .9, .3, 1.2), transform .09s linear, filter .2s;
}
.fan > .card.fan-snap { transition: none; }
.fan > .card.dim { cursor: default; }
.fan.locked > .card { pointer-events: none; }
.fan > .card.raised::before { box-shadow: 0 calc(var(--cw) * .12) calc(var(--cw) * .16) rgba(0, 0, 0, .65); }
:root.fx-calm .fan > .card { transition: translate .18s ease-out, rotate .18s ease-out, scale .18s ease-out, filter .2s; transform: none; }

/* What the raised card carries beside it: the zoom button and, for Thorgar, the free extend */
.c-tools { position: absolute; left: calc(100% + 8px); top: 8px; display: none; flex-direction: column; gap: 6px; z-index: 20; }
.card.raised > .c-tools { display: flex; }
.c-tool {
  appearance: none; border: 2.5px solid var(--c-ink); background: var(--c-paper); color: var(--c-ink); cursor: pointer; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; font: 800 11px/1 var(--c-display); box-shadow: 2px 3px 0 rgba(0, 0, 0, .45);
}
.c-tool:hover { background: #fff7e6; }
.c-tool svg.i { width: 20px; height: 20px; stroke-width: 2.3; }
.c-tool.wide { width: auto; height: auto; border-radius: 6px; padding: 7px 9px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; background: #b3541c; color: var(--c-paper-hi); }
@media (max-height: 500px) { .c-tool { width: 48px; height: 48px; } .c-tool svg.i { width: 26px; height: 26px; } }
/*
 * What the board's sequences draw: the caption line along the top of the throw area, the HP ledgers, the queued
 * chips' arrival, the round-result bar, and the replay's dimmed zones. Stage pixels, like board.css.
 */

/* ── The caption: one line along the top edge of the throw area ── */
.stage .throw-area > .caption { left: 150px; right: 6px; top: 0; height: 24px; z-index: 30; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity .18s; }
.stage .throw-area > .caption.on { opacity: 1; }
.caption-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 10px 3px; border-radius: 4px 7px 5px 6px;
  font: italic 600 14px/1.1 var(--serif); color: var(--paper-hi); background: rgba(14, 11, 20, .78); border: 1.5px solid rgba(236, 227, 207, .28);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, .35); }
.caption.you .caption-text { border-color: rgba(121, 173, 255, .7); }
.caption.opp .caption-text { border-color: rgba(255, 125, 112, .7); }
.caption.struck .caption-text { color: var(--paper-2); }
.stage[data-stage="phone"] .throw-area > .caption { left: 74px; right: 0; height: 18px; }
.stage[data-stage="phone"] .caption-text { font-size: 10.5px; padding: 2px 6px; }

/* ── The HP ledgers: what hit each gauge this round, above your plate and under the opponent's ── */
.stage .who > .ledger { position: absolute; left: 76px; width: 236px; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; z-index: 3; pointer-events: none; }
.stage .who > .ledger:empty { display: none; }
.stage .you-who > .ledger { bottom: calc(100% + 4px); }
.stage .opp-who > .ledger { left: calc(100% + 12px); top: 2px; width: 176px; }   /* beside the plate: under it lie the opponent's slots and zone */
.ledger .lr { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 1px 7px; font: 600 13px/1.25 var(--serif); color: var(--paper-hi);
  border-left: 2px solid rgba(236, 227, 207, .25); background: rgba(14, 11, 20, .55); }
/* one line: the cause, then its note ("17 − Deflect 5") when both fit; a note that does not fit wraps to a second line
   the row's height hides, and a cause longer than the row ends in an ellipsis */
.ledger .lr .lb { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; min-width: 0; height: 1.25em; overflow: hidden; white-space: nowrap; }
.ledger .lr .lb .nm { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ledger .lr .lb svg.i { width: 12px; height: 12px; align-self: center; flex: none; }
.ledger .lr em { flex: none; font-style: italic; font-size: .88em; opacity: .8; }
.ledger .lr .am { font: 900 14px/1.2 var(--display); }
.ledger .lr.base { color: var(--paper-2); } .ledger .lr.base .am { color: var(--paper-hi); }
.ledger .lr.neg { border-left-color: #ff8a7a; } .ledger .lr.neg .am { color: #ff8a7a; }
.ledger .lr.pos { border-left-color: #7fd17f; } .ledger .lr.pos .am { color: #7fd17f; }
/* your ledger starts right of the deck and discard chips that sit under your plate's left edge (they end about 106 px in) */
.stage[data-stage="phone"] .who > .ledger { left: 104px; width: 150px; }
/* the phone's opponent plate has no room beside it: its ledger sits under the opponent's slots, at that end of the clash zone */
.stage[data-stage="phone"] .opp-who > .ledger { left: 106px; top: 206px; width: 150px; }
.stage[data-stage="phone"] .ledger .lr { font-size: 11px; padding: 0 4px; gap: 4px; } .stage[data-stage="phone"] .ledger .lr .am { font-size: 11.5px; }

/* ── Queued chips: what waits to land at resolution, beside a gauge ── */
.qchip.heal { border-color: var(--heal); color: var(--heal); }
.qchip.shieldq { border-color: var(--steel); color: var(--steel); }

/* ── What a hit draws for a moment ── */
.stage .hp > .trail { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, rgba(255, 138, 122, .95) 0 3px, rgba(255, 210, 200, .9) 3px 6px); }
/* a coin between the sockets and what it paid for (drawn over the page, in the viewport) */
.sq-coin { position: absolute; left: 0; top: 0; z-index: 700; pointer-events: none; will-change: transform; }
.sq-coin .tok { display: block; }
.sq-coin .coin { margin: 0; }
/* an unmet condition: a grey tag naming it pops up at its card and gives out */
.sq-fizzle { position: absolute; z-index: 700; pointer-events: none; white-space: nowrap; padding: .23em .6em; border-radius: 4px 7px 5px 6px;
  font: 800 1em/1 'Cinzel', Georgia, serif; letter-spacing: .04em; text-transform: uppercase; color: #6f6759; background: #d4cbb6; border: 2px dashed #8d8573;
  text-decoration: line-through; text-decoration-color: rgba(163, 20, 15, .75); text-decoration-thickness: 2px; }

/* ── The strike (board/strike.ts): damage flies from the attacker along a streak and slams into what it hits ── */
.imp-chip.sq-strike { z-index: 704; border-color: #e8624f; box-shadow: .12em .2em 0 rgba(0, 0, 0, .45), 0 0 .7em rgba(232, 98, 79, .6); }
/* the streak is a tapered brush stroke: thin at its tail, thickest at the chip, its edge ragged, with dry-brush bristle lines along it. It is
   inked in the strike's hot red (a stroke of the table's own dark ink would vanish on the table) with a dark edge and a glow
   (the thickness is set per rung and stage in strike.ts) */
.sq-streak { position: absolute; z-index: 702; transform-origin: 0 50%; pointer-events: none;
  clip-path: polygon(0 47%, 8% 42%, 20% 34%, 34% 25%, 48% 17%, 62% 10%, 76% 5%, 90% 1%, 100% 0, 100% 100%, 92% 97%, 79% 92%, 65% 85%, 51% 79%, 37% 70%, 22% 62%, 10% 57%, 0 53%);
  background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(70, 10, 10, .32) 2px 3px), linear-gradient(90deg, rgba(179, 36, 28, 0) 0%, rgba(179, 36, 28, .85) 24%, #e8624f 62%, #ffeedc 100%);
  filter: drop-shadow(0 0 1px #1b1620) drop-shadow(0 0 4px rgba(232, 98, 79, .65)); }
/* ink spattered off the impact: hot red and cream blots, and a few of the dark ink with a pale ring so they show on the table */
.sq-dot { position: absolute; z-index: 703; pointer-events: none; border-radius: 52% 48% 55% 45% / 50% 55% 45% 50%; background: #ffeedc; box-shadow: 0 0 0 .5px #1b1620; }
.sq-dot.red { background: #e8624f; }
.sq-dot.ink { background: #1b1620; box-shadow: 0 0 0 1px rgba(255, 238, 220, .7); }
.sq-burst, .sq-crack { position: absolute; z-index: 703; pointer-events: none; }
.sq-burst svg, .sq-crack svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sq-burst polygon { fill: #fff4d6; stroke: #e8624f; stroke-width: 4; stroke-linejoin: round; }
.sq-burst.r3 polygon { fill: #ffe2d8; stroke: #c8342a; }
.sq-crack path { fill: none; stroke: #1b1620; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 1.5px #fff8e6); }
/* a defence the strike ignores: a dashed ring as it streaks through */
.sq-pass { position: absolute; z-index: 703; pointer-events: none; border-radius: 50%; border: 2px dashed rgba(255, 238, 220, .95); }
/* the damage as a figure that pops off the plate and holds: big, inked, in the strike's red */
.sq-figure { position: absolute; z-index: 706; pointer-events: none; white-space: nowrap; font: 900 1em/1 'Cinzel', Georgia, serif; letter-spacing: -.01em; color: #ff7a63; -webkit-text-stroke: .09em #1b1620; paint-order: stroke fill;
  text-shadow: 0 .06em 0 #1b1620, 0 0 .5em rgba(232, 98, 79, .75); }
.sq-figure.r3 { color: #ff5a46; text-shadow: 0 .06em 0 #1b1620, 0 0 .6em rgba(232, 60, 40, .95); }
/* what a defence absorbed, popping off it; a heal's amount rising from the gauge */
.sq-pop { position: absolute; z-index: 705; pointer-events: none; white-space: nowrap; font: 900 1em/1 'Cinzel', Georgia, serif; color: #f7f0e0;
  text-shadow: 0 0 2px #000, 0 0 4px #000, 0 1px 0 #000; }
.sq-pop.deflect { color: #a9cdff; } .sq-pop.shield { color: #ead98f; } .sq-pop.heal { color: #92f092; }
.sq-pop.pass { color: #d8d2c4; font: italic 700 .82em/1 Georgia, serif; letter-spacing: .02em; }
/* the HP bar's chunk breaking away, and the plate's red flash */
.sq-chunk { position: absolute; z-index: 701; pointer-events: none; border: 2px solid #1b1620; border-left-width: 0; box-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
.sq-red { position: absolute; z-index: 699; pointer-events: none; border-radius: 8px; background: #d8342a; mix-blend-mode: multiply; }
/* a heal's motes */
.sq-mote { position: absolute; left: 0; top: 0; z-index: 703; width: 12px; height: 12px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #f4ffec 0%, #7ee87e 45%, rgba(99, 216, 107, 0) 72%); }
.stage[data-stage="phone"] .sq-mote { width: 9px; height: 9px; }

/* ── The round-result bar: in place of Play and Pass once the resolution has played ── */
.stage .acts.round-over > .acts-main { display: none; }
.result-bar { display: flex; flex-direction: column; gap: 6px; }
.result-bar[hidden] { display: none; }
/* desktop: the action column's own width, standing a little taller than Play and Pass (the decks sit left of it). It hangs from
   the stage's bottom edge (like the phone's), so a bar with more to say grows upward and never off the stage */
.stage .acts.round-over { top: auto; bottom: 14px; }
.stage .acts .result-bar { position: relative; width: 100%; padding: 7px 8px 8px; border-radius: 7px 10px 8px 9px / 9px 7px 10px 8px; color: var(--ink);
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(80, 55, 20, .22) 100%), var(--grain), linear-gradient(180deg, var(--paper), var(--paper-2)); box-shadow: 3px 4px 0 rgba(0, 0, 0, .45); }
.rb-title { font: 800 13px/1.1 var(--display); letter-spacing: .08em; text-transform: uppercase; display: flex; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; align-items: baseline; }
.rb-title .rb-round, .rb-title b { white-space: nowrap; }
.rb-title b.victory { color: var(--gold-ink); } .rb-title b.defeat { color: var(--loss); }
/* desktop: about 100 px of room, so the outcome takes a line of its own, larger, and "Round 2" sits above it */
.stage[data-stage="desktop"] .rb-title b { flex: 0 0 100%; font-size: 17px; letter-spacing: .08em; }
/* a phrase of a side's line ("healed 6") never splits across two lines; on the desktop's narrow bar each takes a line of its own, with no dot between */
.rb-ph { white-space: nowrap; }
.stage[data-stage="desktop"] .rb-ph { display: block; }
.stage[data-stage="desktop"] .rb-sep { display: none; }
.rb-lines { display: flex; flex-direction: column; gap: 2px; }
.rb-line { display: flex; flex-direction: column; gap: 0; font: 600 13px/1.15 var(--serif); }
.rb-line b { font: 800 10px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.rb-line.you b { color: var(--you); } .rb-line.opp b { color: var(--opp); }
.rb-status { font: italic 400 12px/1.1 var(--serif); color: var(--ink-soft); }
.rb-status:empty { display: none; }
.rb-replay { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rb-replay[hidden] { display: none; }
.stage .acts .result-bar .btn { min-height: 38px; }
.stage .acts .result-bar .btn.rb-speed.on { background: var(--ink); color: var(--paper-hi); }

/* ── The replay: the zones and the plate's champion counters keep the end picture, dimmed ── */
.stage.replaying .zone, .stage.replaying .xrow { opacity: .42; filter: saturate(.6); transition: opacity .2s; }

/* phone: the bar sits at the bottom right, 48 px buttons */
.stage[data-stage="phone"] .acts.round-over { top: auto; }
.stage[data-stage="phone"] .acts .result-bar { margin-left: -84px; width: 196px; padding: 5px 7px 7px; gap: 4px; }
.stage[data-stage="phone"] .rb-title { font-size: 10.5px; }
.stage[data-stage="phone"] .rb-line { flex-direction: row; gap: 6px; font-size: 10.5px; } .stage[data-stage="phone"] .rb-line b { font-size: 9px; min-width: 24px; }
.stage[data-stage="phone"] .acts .result-bar { display: grid; grid-template-columns: 1fr 1fr; column-gap: 6px; row-gap: 3px; }
.stage[data-stage="phone"] .result-bar > .rb-title, .stage[data-stage="phone"] .result-bar > .rb-lines, .stage[data-stage="phone"] .result-bar > .rb-status { grid-column: 1 / -1; }
.stage[data-stage="phone"] .acts .result-bar .btn { min-height: 48px; font-size: 12px; padding: 0 .3em; }
.stage[data-stage="phone"] .result-bar > .rb-replay { grid-column: 2; }
/*
 * The match board: a dark ink-wash table with parchment plates, paper cards and ink-rimmed counters
 * (the approved look: .mockups/match-screen-redesign, frame A on the dark table). Everything on the
 * board is placed in the stage's own pixels (client/src/board/stage.ts): desktop 1280 x 720, phone
 * 844 x 390 (`data-stage="phone"`), and the whole stage is scaled to fit. Sizes below are stage pixels.
 *
 * Sides: blue ink for you, red ink for the opponent, always paired with position (you are at the
 * bottom) and a word. Ochre is for highlights and crits. The colours are the round recap's own, so
 * the board, the parchment dice tray and the recap read as one set of paper and ink.
 *
 * Scope: every rule is under `.stage` or `.table-host` so the board cannot touch the menus and dialogs.
 * The class names `card-slot`, `table-card`, `hand-card` and `card-zoom-btn` are the ones the card
 * code (client/src/cards, the hand and the zoom) draws into, so they are styled here but not owned.
 */

.stage, .table-host {
  --paper: #ece3cf; --paper-2: #ddd0b3; --paper-hi: #f7f0e0; --paper-lo: #cdbf9f;
  --ink: #1b1620; --ink-soft: #5a5060; --ink-faint: rgba(27, 22, 32, .35);
  --you: #1d58b8; --you-hi: #3f7fe0; --opp: #b3241c; --opp-hi: #e0483e;
  --gold-ink: #a87508; --gold-hi: #e2b13c; --heal: #2c7a32; --steel: #3a3a46; --loss: #7d1410;
  --table: #16131b; --table-2: #221d27; --brass: #9c7b52;
  --serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .18 0 0 0 0 .08 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .85 0 0 0 0 .75 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  --ease-lift: cubic-bezier(.2, .9, .3, 1.2);
}

/* ── The table: the area beside the coach and the battle log, that the stage is fitted into ── */
.table-host { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 50% 45%, var(--table-2), var(--table) 70%), var(--table); }
.table-host::before { content: ''; position: absolute; inset: 0; background: var(--grain-light); opacity: .9; pointer-events: none; }
.game-main.table-host { flex: 1 1 0; display: block; min-width: 0; height: 100%; overflow: hidden; }

.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; color: var(--paper); font-family: var(--serif); line-height: 1.2;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stage *, .stage *::before, .stage *::after { box-sizing: border-box; }
.stage > * { position: absolute; }
.stage [hidden] { display: none !important; }
.stage svg.i { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stage svg.i.fill { fill: currentColor; }
.stage button { font-family: inherit; }
.sheet { color: var(--ink); background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(80, 55, 20, .22) 100%), var(--grain), linear-gradient(180deg, var(--paper), var(--paper-2)); }

/* ── The top bar ── */
.stage .topbar { left: 0; right: 0; top: 0; height: 38px; display: flex; align-items: center; gap: 12px; padding: 0 14px; z-index: 40;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .15)); border-bottom: 1.5px solid rgba(236, 227, 207, .14); }
.round { font: 800 15px/1 var(--display); letter-spacing: .08em; color: var(--paper-hi); text-transform: uppercase; }
.pill { display: inline-flex; align-items: baseline; gap: 0; font: 800 11.5px/1 var(--display); letter-spacing: .1em; padding: 6px 10px; border-radius: 4px 7px 5px 6px; background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--paper-2); text-transform: uppercase; white-space: nowrap; }
.stage .phase-display { padding: 0; border-radius: 0; font: inherit; background: none; color: inherit; }
.pill .turn { font-style: normal; color: var(--you); }
.pill.mine { box-shadow: 0 0 0 1.5px var(--paper-2), 0 0 0 4px rgba(226, 177, 60, .8); }
.pill .turn:not(:empty)::before { content: '\00a0\00b7\00a0'; color: var(--ink); }
.hint { font: italic 400 15px/1 var(--serif); color: var(--paper-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tools { margin-left: auto; display: flex; gap: 6px; flex: none; }
.tool { appearance: none; border: 0; margin: 0; background: transparent; color: var(--paper-2); display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; height: 36px; border-radius: 6px;
  font: 700 12px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.tool:hover { background: rgba(236, 227, 207, .1); color: var(--paper-hi); }
.tool:focus-visible, .stage .btn:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }
.tool svg.i { width: 19px; height: 19px; }

.bandline { left: 0; right: 0; height: 0; border-top: 1.5px dashed rgba(236, 227, 207, .12); z-index: 1; }
.bandline.top { top: 132px; } .bandline.bottom { top: 486px; }

/* ── A player: portrait and plate ── */
.who { display: flex; align-items: center; gap: 10px; z-index: 20; }
.opp-who { left: 18px; top: 44px; align-items: flex-start; }
.you-who { left: 18px; top: 504px; align-items: flex-start; }
.portrait { position: relative; width: 66px; height: 66px; border-radius: 50%; flex: none; background-color: var(--paper-hi); background-size: cover; background-position: 50% 30%;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 5.5px var(--paper-2), 0 0 0 7.5px var(--ink), 3px 5px 0 7.5px rgba(0, 0, 0, .45); filter: contrast(1.1) sepia(.15); margin-top: 7px; }
.portrait .rib { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%) rotate(-3deg); font: 900 9.5px/1 var(--display); letter-spacing: .16em; color: var(--paper-hi); padding: 3px 7px 3px 8px;
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); white-space: nowrap; filter: none; }
.opp .rib { background: var(--opp); } .you .rib { background: var(--you); }
.plate { padding: 7px 11px 8px; border-radius: 7px 10px 8px 9px / 9px 7px 10px 8px; display: flex; flex-direction: column; gap: 5px; box-shadow: 3px 4px 0 rgba(0, 0, 0, .45); min-width: 0; }
.plate .nm { display: flex; align-items: center; gap: 8px; font: 800 14px/1 var(--display); letter-spacing: .03em; white-space: nowrap; min-height: 18px; }
.plate .nm small { font: italic 400 13px/1 var(--serif); color: var(--ink-soft); letter-spacing: 0; }
.plate .hprow { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.hold { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.hold:empty { display: none; }
.hold.gauge { width: 210px; }
.xrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; max-width: 400px; }

/* ── Action tokens: your Adrenaline and Mana actions, round ink tokens on your plate. Each wears its short name and
   its cost as coin pips; it glows while it can be spent, dims (still readable) while it cannot, and a tap spends it.
   Its full text is the small parchment card #aa-card (play/actionTokens.ts). The spend's motion flies from the token
   (`#you-aa .aa-token[data-res][data-act]`). ── */
.aa-row { display: flex; align-items: flex-start; gap: 6px; min-height: 0; padding-top: 3px; }
.aa-div { align-self: stretch; width: 0; margin: 2px 3px 14px; border-left: 2px dotted rgba(27, 22, 32, .4); }
.aa-token { appearance: none; margin: 0; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 66px; flex: none; font-family: var(--display); }
.aa-disc { --rim: #c98a12; position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 1px;
  background: radial-gradient(circle at 36% 28%, var(--paper-hi), var(--paper) 58%, var(--paper-2));
  border: 2.5px solid var(--ink); box-shadow: 0 0 0 2px var(--rim), 0 0 0 3.5px var(--ink), 2px 3px 0 3.5px rgba(27, 22, 32, .35); transition: box-shadow .2s, transform .12s; }
.aa-token.mana .aa-disc { --rim: #7b58a8; }
.aa-disc > svg.i { width: 17px; height: 17px; color: #b07a0e; margin-top: 3px; stroke-width: 2.3; }
.aa-token.mana .aa-disc > svg.i { color: #5b3f8a; }
.aa-pips { display: inline-flex; gap: 1.5px; justify-content: center; margin-bottom: 3px; }
.aa-pip { width: 6px; height: 6px; border-radius: 50%; background: #d79a1c; border: 1px solid var(--ink); display: block; }
.aa-token.mana .aa-pip { background: #8d6bc0; }
.aa-name { font: 800 8.3px/1.1 var(--display); letter-spacing: 0; text-transform: uppercase; text-align: center; color: var(--paper-hi); max-width: 76px; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.plate .aa-name { color: var(--ink); text-shadow: none; }
.aa-token:hover:not(.locked) .aa-disc { transform: translateY(-1px); }
.aa-token:active .aa-disc { transform: translateY(1px); }
.aa-token.ready .aa-disc { box-shadow: 0 0 0 2px var(--rim), 0 0 0 3.5px var(--ink), 0 0 0 6px rgba(226, 177, 60, .65), 0 0 14px 5px rgba(226, 177, 60, .5), 2px 3px 0 3.5px rgba(27, 22, 32, .35); animation: aaGlow 1.8s ease-in-out infinite; }
.aa-token.dim, .aa-token.blocked { cursor: default; }
.aa-token.dim .aa-disc, .aa-token.blocked .aa-disc { filter: saturate(.45) brightness(.9); }
.aa-token.dim, .aa-token.blocked { opacity: .62; }
.aa-token.blocked .aa-ban { position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; color: var(--opp); stroke-width: 2.6; background: var(--paper-hi); border-radius: 50%; filter: none; }
.aa-token.refused .aa-disc { animation: aaRefuse .32s ease; }
.aa-token.tut-locked { opacity: .4; cursor: not-allowed; }
.aa-token.tut-target-btn .aa-disc { box-shadow: 0 0 0 2px var(--rim), 0 0 0 3.5px var(--ink), 0 0 0 6px var(--gold-hi), 0 0 18px 6px rgba(226, 177, 60, .8); }
.aa-token:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; border-radius: 8px; }
.aa-row.window .aa-token.ready .aa-disc { animation-duration: 1.1s; }
@keyframes aaGlow { 50% { box-shadow: 0 0 0 2px var(--rim), 0 0 0 3.5px var(--ink), 0 0 0 6px rgba(226, 177, 60, .9), 0 0 20px 8px rgba(226, 177, 60, .7), 2px 3px 0 3.5px rgba(27, 22, 32, .35); } }
@keyframes aaRefuse { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .aa-token.ready .aa-disc, .aa-token.refused .aa-disc { animation: none; } }
.aa-compact, .aa-tray { display: none; }

/* The full text of an action: a small parchment card in frame A's style, above its token. */
.aa-card { z-index: 70; width: 218px; border-radius: 7px; border: 2.5px solid var(--ink); color: var(--ink); background: radial-gradient(110% 80% at 25% 10%, var(--paper-hi), transparent 60%), var(--grain), linear-gradient(165deg, #efe6d2, #d9cbab);
  box-shadow: 0 0 0 1.5px var(--paper-lo), 3px 5px 0 rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .55); overflow: hidden; pointer-events: none; }
.aa-card.touch { pointer-events: auto; }
.aa-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 8px; padding: 5px 9px; background: var(--ink); color: var(--paper-hi); font: 800 12px/1.1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.aa-card-cost { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--gold-hi); white-space: nowrap; }
.aa-card-cost .aa-pips { margin: 0; }
.aa-card-text { margin: 0; padding: 7px 10px 8px; font: 600 14px/1.25 var(--serif); }
.aa-card-note { margin: 0; padding: 5px 10px 7px; border-top: 1.5px dashed var(--ink-faint); font: italic 600 12.5px/1.2 var(--serif); color: var(--ink-soft); }
.aa-card-note.blocked { color: var(--loss); }
.aa-card-note.ready { color: var(--heal); }
.aa-spend { appearance: none; display: block; width: calc(100% - 16px); min-height: 40px; margin: 0 8px 8px; border: 2.5px solid var(--ink); border-radius: 5px 8px 6px 7px / 7px 5px 8px 6px; background: var(--ink); color: var(--paper-hi); font: 800 12px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }

/* ── Counters: coins, sockets, piles, plaques, the health gauge, Deflect ── */
.tok { --tc: #c98a12; --te: #7d5508; --tz: 24px; display: inline-flex; align-items: flex-end; gap: 3px; vertical-align: middle; }
.tok-row { display: inline-flex; align-items: flex-end; gap: 2px; }
.tok.two { flex-direction: column; align-items: flex-start; gap: 1px !important; }
.tok.capped { flex-direction: row; align-items: flex-end; gap: 5px; }
.tok-cap { font: 800 7.5px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; align-self: flex-end; margin-bottom: 3px; }
.tok.adr { --tc: #d79a1c; --te: #7d5508; } .tok.mana { --tc: #7b58a8; --te: #3f2a5c; } .tok.shield { --tc: #7c8a99; --te: #3e4752; } .tok.deflect { --tc: #4a4452; --te: #1d1a22; } .tok.charges { --tc: #3f9bb8; --te: #1f5468; }
.tok.scrap { --tc: #a8773a; --te: #5e3f16; } .tok.recycle { --tc: #6f8d76; --te: #36503c; } .tok.grave { --tc: #7a6a8c; --te: #3a2f48; } .tok.minions { --tc: #8a5cb0; --te: #43265f; }
.tok.scrap .coin svg.i, .tok.recycle .coin svg.i, .tok.grave .coin svg.i, .tok.minions .coin svg.i { color: #fbf3e0; }
.coin { width: var(--tz); height: var(--tz); border-radius: 50%; flex: none; display: grid; place-items: center; color: #fbf3e0; position: relative;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .55) 0 8%, transparent 11%), radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--tc) 75%, #fff), var(--tc) 70%);
  border: 2px solid var(--ink); box-shadow: 0 calc(var(--tz) * .14) 0 var(--te), 0 calc(var(--tz) * .14) 0 2px var(--ink); margin-bottom: calc(var(--tz) * .14); }
.coin svg.i { width: 58%; height: 58%; stroke-width: 2.4; }
.tok.adr .coin svg.i { color: var(--ink); }
.pile { position: relative; width: calc(var(--tz) + 4px); flex: none; }
.pile .coin { position: absolute; left: 0; margin-bottom: 0; }
.socket { width: var(--tz); height: var(--tz); border-radius: 50%; border: 2px dashed rgba(27, 22, 32, .45); flex: none; margin-bottom: calc(var(--tz) * .14); }
.badge { position: absolute; right: -9px; top: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; z-index: 5; background: var(--ink); color: var(--paper-hi); border: 1.5px solid var(--paper-hi);
  font: 800 12px/17px var(--display); text-align: center; }
.plaque { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 6px; background: var(--paper-hi); color: var(--ink); border: 2px solid var(--ink); font: 800 12px/1 var(--display); box-shadow: 2px 2px 0 rgba(0, 0, 0, .4); }
.plaque svg.i { width: 15px; height: 15px; }
.plaque b { font-weight: 800; }
.plate .pile .badge { top: auto; bottom: -3px; right: -13px; }
.plate .tok.capped, .plate .hprow .tok { margin-right: 8px; }
.plate .plaque { box-shadow: none; border-width: 1.5px; padding: 1px 6px 1px 4px; font-size: 11px; background: transparent; }

.hp { --side: var(--you); position: relative; height: 22px; width: 100%; border: 2.5px solid var(--ink); border-radius: 4px 7px 5px 6px / 6px 4px 7px 5px; background: rgba(255, 255, 255, .5); overflow: hidden; box-shadow: 1.5px 2px 0 rgba(27, 22, 32, .3); }
.hp.opp { --side: var(--opp); }
.hp > i { position: absolute; top: 0; bottom: 0; left: 0; display: block; }
.hp .fill { background: linear-gradient(180deg, color-mix(in srgb, var(--side) 80%, #fff), var(--side)); }
.hp .shld { background: repeating-linear-gradient(-45deg, #5d6b7a 0 4px, #a9b6c4 4px 7px); }
.hp b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 800 13px/1 var(--display); color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 1px #000; letter-spacing: .03em; }

.guard { --tz: 26px; display: inline-flex; align-items: center; gap: 4px; flex: none; transition: transform .22s var(--ease-lift), opacity .2s; transform-origin: 30% 50%; }
.guard.off { opacity: 0; transform: scale(.4); }
.guard .coin { margin-bottom: 3px; --tc: #55506a; --te: #1d1a22; }
.guard b { font: 900 18px/1 var(--display); color: var(--ink); min-width: 1ch; }

/* damage that waits to land at resolution: a dashed chip beside the gauge */
.qchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 5px; border: 2px dashed var(--loss); color: var(--loss); font: 900 13px/1 var(--display); background: rgba(255, 255, 255, .35); }
.qchip.holy { border-color: var(--gold-ink); color: var(--gold-ink); }
.qchip svg.i { width: 14px; height: 14px; stroke-width: 2.5; }

/* status tags and the champions' own counters */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--paper-hi); color: var(--ink); font: 800 10px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tag svg.i { width: 13px; height: 13px; stroke-width: 2.4; }
.tag.rage, .tag.mark { border-color: var(--opp); color: var(--opp); }
.tag.ban { border-color: var(--ink-soft); color: var(--ink-soft); }
.tag em { font: 900 11px/1 var(--display); font-style: normal; }
.pips { display: inline-flex; gap: 2px; } .pips i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: block; }
.pocket, .form { display: inline-flex; align-items: center; gap: 4px; font: 800 12px/1 var(--display); color: var(--ink); text-transform: uppercase; }
.pocket svg.i, .form svg.i { width: 16px; height: 16px; }
.ftiles { display: inline-flex; gap: 3px; }
.ft { width: 20px; height: 20px; border-radius: 3px; border: 1.5px solid var(--ink); display: grid; place-items: center; font: 800 8.5px/1 var(--display); font-style: normal; background: var(--paper-hi); color: var(--ink); }
.ft.down { background: repeating-linear-gradient(45deg, #4a3a2c 0 3px, #2c2019 3px 6px); border-style: dashed; }
.ft.now { box-shadow: 0 0 0 2px var(--gold-hi); } .ft.also { outline: 1.5px solid var(--gold-ink); outline-offset: 1px; }
.karma { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); }
.karma > svg.i { width: 15px; height: 15px; }
.kcells { display: inline-flex; gap: 1px; }
.kc { width: 20px; height: 20px; display: grid; place-items: center; font: 800 9px/1 var(--display); font-style: normal; border: 1px solid transparent; border-radius: 2px; color: var(--ink); }
.kc.bad { background: rgba(179, 36, 28, .25); } .kc.bad6 { background: rgba(179, 36, 28, .6); color: #fff; } .kc.bad5 { background: rgba(179, 36, 28, .52); } .kc.bad4 { background: rgba(179, 36, 28, .44); } .kc.bad3 { background: rgba(179, 36, 28, .36); } .kc.bad2 { background: rgba(179, 36, 28, .3); } .kc.bad1 { background: rgba(179, 36, 28, .22); }
.kc.good1 { background: rgba(226, 177, 60, .22); } .kc.good2 { background: rgba(226, 177, 60, .3); } .kc.good3 { background: rgba(226, 177, 60, .38); } .kc.good4 { background: rgba(226, 177, 60, .48); } .kc.good5 { background: rgba(226, 177, 60, .58); } .kc.good6 { background: rgba(226, 177, 60, .7); }
.kc.neutral { background: rgba(27, 22, 32, .1); border-color: var(--ink-faint); }
.kc.now { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--paper-hi), 0 0 0 3px var(--ink); transform: scale(1.18); position: relative; z-index: 2; background: var(--paper-hi); }

/* ── The other side's hand, and the decks and discards ── */
.opp-hand { left: 50%; top: 40px; width: 180px; height: 80px; margin-left: -90px; z-index: 5; }
.opp-hand .badge { right: 18px; top: -2px; }
.opp-hand .card { position: absolute; top: 0; }
.piles { display: flex; gap: 26px; z-index: 5; }
.opp-piles { right: 22px; top: 46px; }
.you-piles { right: 150px; top: 566px; gap: 28px; z-index: 6; }
.piles-wrap { position: relative; }
.deck > .card { position: absolute; left: 0; top: 0; z-index: 2; margin: 0; cursor: default; }
.deck.discard > .card { transform: rotate(2deg); }
.deck { position: relative; display: block; flex: none; width: var(--cw); height: calc(var(--cw) * 1.4); }
.deck:not(.empty):not(.discard) { transform: translate(calc(var(--layers) * -.45px), calc(var(--layers) * -.9px)); }
.deck-edge { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: calc(var(--cw) * .055); z-index: 1;
  transform: translate(calc(var(--layers) * .45px), calc(var(--layers) * .9px)); background: repeating-linear-gradient(135deg, #ddd1b6 0 1.2px, #aa9e84 1.2px 2.4px);
  box-shadow: 1px 2px 0 #5a4f3e, 4px 9px 14px rgba(0, 0, 0, .55); }
.deck-n { position: absolute; right: -10px; top: -10px; z-index: 6; width: 30px; height: 30px; border-radius: 50%; background: var(--paper-hi); color: var(--ink); border: 2.5px solid var(--ink); display: grid; place-items: center; font: 900 13px/1 var(--display); box-shadow: 1.5px 2px 0 rgba(0, 0, 0, .45); }
.deck.empty { border: 2px dashed rgba(236, 227, 207, .35); border-radius: 8px; display: grid; place-items: center; color: rgba(236, 227, 207, .5); font: 700 11px/1.2 var(--display); text-align: center; }
.loose { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: calc(var(--cw) * .055); background: var(--paper-2); border: 2px solid var(--ink); box-shadow: 1px 2px 0 rgba(0, 0, 0, .4); }
.loose.l1 { transform: rotate(-8deg); } .loose.l2 { transform: translate(3px, -2px) rotate(6deg); background: var(--paper-lo); }

/* ── The clash zone: slots, the two Strike Score circles, the stamp and the open middle ── */
.clash { left: 0; right: 0; top: 132px; height: 354px; z-index: 10; }
.stage .clash > * { position: absolute; }
#opp-before { left: 232px; top: 32px; } #opp-after { left: 336px; top: 32px; }
#you-before { left: 968px; top: 196px; } #you-after { left: 1072px; top: 196px; }
.stage .card-slot.slot { width: 96px; height: 134px; border: 2px dashed rgba(236, 227, 207, .32); border-radius: 7px; display: grid; place-items: center; text-align: center; color: rgba(236, 227, 207, .55);
  font: 700 10.5px/1.3 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.stage .card-slot:has(> .table-card) { border-color: transparent; }
.stage .card-slot.hidden { display: none; }
.stage .card-slot .pass-mark { color: rgba(236, 227, 207, .75); font-size: 12px; letter-spacing: .12em; }
.stage .card-slot > span { pointer-events: none; }

/* The throw area: the open middle of the clash zone. At rest it holds the two circles, their lists and the stamp; in
   clash mode (the dice are being thrown) it grows downward over the space the hand leaves, and its ground shows.
   Nothing else lies inside it in clash mode: slots, zones, plates, tools, piles and the action column are outside. */
.throw-area { --clash-h: 424px; --caption-h: 26px; left: 440px; top: 4px; width: 520px; height: 350px; z-index: 9; transition: height .26s var(--ease-lift); }
.throw-area > * { position: absolute; }
.throw-ground { --feather: 52px; left: 0; top: 0; right: 0; bottom: 0; opacity: 0; pointer-events: none; transition: opacity .26s;
  /* A pool of light on the ink table, not a panel: brightest at the middle, fading to nothing at every edge and corner (a soft-edged mask, no rim),
     with an uneven wash so it reads as lamplight on wet ink. The dice still stop at the area's invisible walls. */
  background: var(--grain-light),
    radial-gradient(ellipse 34% 40% at 28% 66%, rgba(236, 227, 207, .07), transparent),
    radial-gradient(ellipse 58% 62% at 50% 46%, rgba(236, 227, 207, .40), rgba(236, 227, 207, .31) 52%, rgba(236, 227, 207, .20) 82%, rgba(236, 227, 207, .12));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent), linear-gradient(to bottom, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent), radial-gradient(ellipse 80% 82% at 50% 50%, #000 58%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent), linear-gradient(to bottom, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent), radial-gradient(ellipse 80% 82% at 50% 50%, #000 58%, transparent 100%);
  mask-composite: intersect; }
.stage.clash-mode .throw-area { height: var(--clash-h); }
.stage.clash-mode .throw-ground { opacity: 1; }
.stage.clash-mode .opp-hand { opacity: 0; }
.opp-hand { transition: opacity .26s; }
.stage.instant, .stage.instant * { transition: none !important; }

.stage > .flight { left: 0; top: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; overflow: visible; }

/* the Strike Score circle: empty until the roll, then it holds the number the server worked out */
.score { width: 104px; height: 104px; z-index: 12; }
.score.opp { left: 64px; top: 26px; } .score.you { left: 344px; top: 192px; }
.medal { --side: var(--you); position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; flex: none; transition: box-shadow .25s;
  background: radial-gradient(circle at 40% 32%, var(--paper-hi), var(--paper) 55%, var(--paper-2));
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 7px var(--paper-2), 0 0 0 9.5px var(--ink), 4px 7px 0 9.5px rgba(0, 0, 0, .4); }
.medal.opp { --side: var(--opp); }
.medal.win { box-shadow: 0 0 0 4px var(--ink), 0 0 0 7px var(--paper-2), 0 0 0 9.5px var(--ink), 0 0 0 14px rgba(226, 177, 60, .45), 4px 7px 0 9.5px rgba(0, 0, 0, .4); }
.medal .mtag { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap; font: 800 9.5px/1 var(--display); letter-spacing: .16em; padding: 3px 7px; background: var(--paper); border: 2px solid var(--ink); border-radius: 3px; color: var(--ink-soft); }
.medal .role { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 800 10.5px/1 var(--display); letter-spacing: .12em; padding: 4px 7px; border-radius: 3px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); z-index: 3; }
.medal .role.agg { background: var(--ink); color: var(--paper-hi); border-color: var(--paper-2); }
.medal .mfx { position: absolute; right: -22px; top: 8px; z-index: 4; }
.medal .mfx:empty { display: none; }
.medal .mfx i { display: block; font: 800 9px/1 var(--display); font-style: normal; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; padding: 3px 6px; border-radius: 3px; background: var(--ink); color: var(--gold-hi); border: 1.5px solid var(--gold-hi); transform: rotate(6deg); }
.medal .dg { display: grid; place-items: center; }
.score .die20 { --d: 92px; }
.medal.s-empty .dg { visibility: hidden; }
.medal.s-empty::before { content: ''; position: absolute; inset: 9px; border: 2px dashed var(--ink-faint); border-radius: 50%; }
.die20 { --d: 46px; position: relative; width: var(--d); height: var(--d); display: grid; place-items: center; flex: none; }
.die20 svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.die20 b { position: relative; font: 900 calc(var(--d) * .39) / 1 var(--display); color: var(--nf, #f2c94c); margin-top: calc(var(--d) * .04); text-shadow: var(--nsh, 0 1px 0 #000); letter-spacing: -.01em; }
/* a d4's number sits low in its triangle; a d6's a touch smaller in its square */
.die20.s4 b { margin-top: calc(var(--d) * .2); font-size: calc(var(--d) * .34); }
.die20.s6 b { font-size: calc(var(--d) * .37); }
.medal.crit .die20 b { color: #ffd84a; text-shadow: 0 0 10px rgba(255, 215, 0, .9), 0 1px 0 #000; }

/* the lines beneath a circle: the dice that filled it, and each bonus or penalty the server kept */
ul.brk { list-style: none; margin: 0; padding: 0; position: absolute; left: -26px; top: 124px; width: 156px; display: flex; flex-direction: column; gap: 1px; color: var(--paper-hi); }
.brk .r { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 1px 7px; font: 600 13.5px/1.25 var(--serif); border-left: 2px solid transparent; }
/* the label takes the room the amount leaves and ends in an ellipsis; the amount is a column of its own, so it never prints over a label */
.brk .r .lb { display: block; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brk .r em { margin-left: 5px; font-style: italic; font-size: .9em; opacity: .85; }
.brk .r .am { flex: none; min-width: 2.2ch; text-align: right; font: 900 14px/1.2 var(--display); letter-spacing: .01em; }
.brk .r.base { color: var(--paper-2); }
.brk .r.opp { border-left-color: var(--opp-hi); } .brk .r.opp .am { color: var(--opp-hi); }
.brk .r.you { border-left-color: #79adff; } .brk .r.you .am { color: #79adff; }
.brk .r.base .am { color: var(--paper-hi); }
.brk .r.miss .lb { text-decoration: line-through; text-decoration-thickness: 1.5px; opacity: .62; }
.brk .r.miss .am { color: var(--paper-2); opacity: .7; }
.dt-broken { text-decoration: line-through; text-decoration-color: #ff4444; text-decoration-thickness: 2px; opacity: .8; }
.dt-crit { color: #ffd700; font-weight: 700; text-shadow: 0 0 8px rgba(255, 215, 0, .8); }
.dt-smite { color: #7da0ff; font-weight: 700; } .dt-holy { color: #ffd24a; font-weight: 700; } .dt-primal { color: #7bd77b; font-weight: 700; }
.dt-form_die { color: #d99a76; font-weight: 700; } .dt-elf_flat { color: #d4a574; font-weight: 700; } .dt-minion { color: #c58dff; font-weight: 700; }

/* the lethal blow's finisher: the loser's plate and portrait drain of colour, and the board's own stamp slams K.O. across its side (board/table.ts) */
.who .portrait, .who .plate { transition: filter .6s ease; }
.who.defeated .portrait, .who.defeated .plate { filter: grayscale(1) brightness(.76) contrast(1.05); }
.ko-stamp { position: absolute; left: 0; top: 0; z-index: 60; transform: translate(-50%, -50%) rotate(-8deg); padding: 0 26px 3px; text-align: center; background: var(--paper-hi); color: var(--opp); pointer-events: none;
  border: 5px double var(--opp); border-radius: 6px 10px 7px 9px; box-shadow: 4px 6px 0 rgba(0, 0, 0, .5); }
.ko-stamp.you { color: var(--you); border-color: var(--you); }
.ko-stamp[hidden] { display: none; }
.ko-stamp b { display: block; font: 900 72px/1.05 var(--display); letter-spacing: .08em; }
.stage[data-stage="phone"] .ko-stamp { padding: 0 14px 2px; border-width: 3.5px; }
.stage[data-stage="phone"] .ko-stamp b { font-size: 46px; }

/* the clash stamp: the margin of the two Strike Scores, inked between the circles */
.stamp { --sc: var(--opp); left: 254px; top: 172px; transform: translate(-50%, -50%) rotate(-3deg); z-index: 14; text-align: center; padding: 4px 12px 5px; background: var(--paper-hi); color: var(--sc);
  border: 3px double var(--sc); border-radius: 6px 9px 7px 8px; box-shadow: 3px 4px 0 rgba(0, 0, 0, .4); white-space: nowrap; }
.stamp.you { --sc: var(--you); } .stamp.tie { --sc: var(--ink-soft); }
.stamp small { display: block; font: 800 9.5px/1 var(--display); letter-spacing: .14em; }
.stamp b { display: block; font: 900 30px/1.05 var(--display); }
.stamp.off { visibility: hidden; }

/* ── The champions' zones (Elowyn's traps, Schmeem's mech, Kalamus's minions) ── */
.zone { z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.zone:empty { display: none; }
.opp-zone { left: 18px; top: 34px; width: 208px; height: 280px; }
.you-zone { right: 20px; top: 10px; width: 236px; height: 176px; justify-content: flex-end; }
.traps { display: grid; grid-template-columns: repeat(2, 84px); grid-auto-rows: 72px; gap: 8px; }
.trap { appearance: none; margin: 0; width: 84px; height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px; text-align: center; border-radius: 6px; border: 2px solid var(--ink);
  font: 800 10px/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--ink); }
.trap svg.i { width: 20px; height: 20px; }
.trap.up { cursor: pointer; background: radial-gradient(110% 80% at 25% 10%, var(--paper-hi), transparent 60%), var(--grain), linear-gradient(165deg, #efe6d2, #d9cbab); box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); }
.trap.up:hover { background: #fff7e6; }
.trap.up.fired { border-color: var(--opp); box-shadow: 0 0 0 2px var(--opp), 2px 3px 0 rgba(0, 0, 0, .45); }
.trap.down { background: radial-gradient(80% 60% at 30% 20%, #6b2a22, transparent 70%), var(--grain), linear-gradient(160deg, #4a1d18, #210c0a); color: #d9b98a; border-style: dashed; border-color: var(--brass); }

.mech { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; max-height: 100%; }
.mgrid { display: flex; flex-wrap: wrap; width: 184px; gap: 4px; justify-content: center; }
.mgrid.up { flex-wrap: wrap-reverse; }
.mdiv { display: block; width: 184px; border-top: 2px solid rgba(236, 227, 207, .55); }
.mt { appearance: none; margin: 0; position: relative; width: 90px; height: 64px; padding: 3px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-radius: 5px; border: 2px solid var(--ink); color: var(--ink);
  background: linear-gradient(165deg, #efe6d2, #d9cbab); box-shadow: 2px 2px 0 rgba(0, 0, 0, .45); font-family: var(--display); cursor: pointer; overflow: hidden; }
.mt:hover { background: #fff7e6; }
.mt .mn { font: 800 9.5px/1.05 var(--display); } .mt .mb { font: 600 9px/1.1 var(--serif); color: var(--ink-soft); } .mt .ml { font: 700 8.5px/1.1 var(--serif); color: var(--ink-soft); } .mt .burn { color: var(--opp); font-weight: 800; }
.mt.empty { cursor: default; background: transparent; border-style: dashed; border-color: rgba(236, 227, 207, .4); color: rgba(236, 227, 207, .55); box-shadow: none; font: 700 8.5px/1.15 var(--display); }
.mt.broken { border-color: var(--opp); background: linear-gradient(165deg, #e8c9c0, #cfa89c); }
.mt.burnt { border-color: #c4731a; background: linear-gradient(165deg, #ecd5a8, #d6b078); }
.mt .mx { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(179, 36, 28, .65); pointer-events: none; }
.mt .mx svg.i { width: 34px; height: 34px; stroke-width: 2.4; }
.mt.burnt .mx { color: rgba(196, 115, 26, .7); }
/* Kalamus's minions: the card of the one renderer (its Strike Score is the marker, its type the seal) with its ability beside it;
   the extra minion is a smaller card that adds its Strike Score only. A tap opens the minion's dialog. */
.minions { display: flex; align-items: flex-start; gap: 8px; }
.mn-tile { appearance: none; margin: 0; padding: 0; border: 0; background: none; cursor: zoom-in; display: block; flex: none; }
.mn-tile .card { margin: 0; }
.mn-tile.extra { margin-top: 2px; }
.mn-tile:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; border-radius: 6px; }
.mn-side { display: flex; flex-direction: column; gap: 6px; width: 104px; min-width: 0; }
.mn-ability { margin: 0; padding: 5px 7px; border-radius: 5px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); font: 600 11.5px/1.2 var(--serif); box-shadow: 2px 2px 0 rgba(0, 0, 0, .4); }
.mn-ability.vanilla, .mn-note { font-style: italic; color: var(--ink-soft); }
.mn-ability.vanilla { background: transparent; border-style: dashed; border-color: rgba(236, 227, 207, .4); color: rgba(236, 227, 207, .65); box-shadow: none; }
.mn-extra { display: flex; align-items: center; gap: 6px; }
.mn-note { margin: 0; font: italic 600 10px/1.15 var(--serif); color: rgba(236, 227, 207, .78); min-width: 0; }

/* ── Notices: pop-ups about what the other side's cards did (a milled minion, an Adrenaline or Mana action, Zombie Horde).
   They stack left of the throw area, below the opponent's slots: clear of both circles and of the caption along the throw
   area's top edge. They stay until dismissed. ── */
.toasts { left: 232px; top: 310px; width: 204px; max-height: 172px; overflow-y: auto; overflow-x: hidden; z-index: 65; display: flex; flex-direction: column; gap: 7px; padding: 6px 7px 4px 0; pointer-events: none; scrollbar-width: none; }
.toasts::-webkit-scrollbar { display: none; }
.mill-toast { position: relative; flex: none; pointer-events: auto; padding: 6px 26px 6px 10px; border-radius: 6px 9px 7px 8px; border: 2px solid var(--ink); border-left: 7px solid var(--toast, #6a3d96); color: var(--ink); text-align: left;
  background: radial-gradient(110% 90% at 20% 0%, var(--paper-hi), transparent 60%), var(--grain), linear-gradient(165deg, #efe6d2, #d9cbab); box-shadow: 2px 3px 0 rgba(0, 0, 0, .5);
  font: 600 12.5px/1.22 var(--serif); opacity: 0; transform: translateX(-8px); transition: opacity .25s, transform .25s; }
.mill-toast.show { opacity: 1; transform: none; }
.mill-toast.aa-toast { --toast: #c98a12; }
.mill-toast b { font-weight: 800; }
.mill-toast svg.i { width: 14px; height: 14px; color: var(--toast, #6a3d96); }
.zh-toast { font-size: 12.5px; }
.toast-close-x { position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); border: 1.5px solid var(--ink-faint); background: var(--paper-hi); }
.toast-close-x svg.i { width: 10px; height: 10px; stroke-width: 3; color: inherit; }
.toast-close-x:hover { color: var(--ink); border-color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .mill-toast { transition: none; transform: none; } }

/* ── The buttons beside the hand ── */
.acts { right: 16px; top: 548px; width: 118px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.acts-main { display: flex; flex-direction: column; gap: 10px; }
.stage .acts .btn { appearance: none; margin: 0; width: 100%; min-height: 44px; padding: 0 .6em; border: 2.5px solid var(--ink); border-radius: 5px 8px 6px 7px / 7px 5px 8px 6px; background: var(--paper); color: var(--ink); cursor: pointer;
  font: 800 13px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); transition: transform .12s, box-shadow .12s; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.stage .acts .btn:hover:not(:disabled) { background: #fff7e6; color: var(--ink); transform: translateY(-1px); }
.stage .acts .btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .45); }
.stage .acts .btn[data-action="playCard"], .stage .acts .btn.primary { background: var(--ink); color: var(--paper-hi); border-color: var(--paper-2); }
.stage .acts .btn[data-action="playCard"]:hover:not(:disabled), .stage .acts .btn.primary:hover:not(:disabled) { background: #2b2431; color: var(--paper-hi); }
.stage .acts .btn:disabled { opacity: .45; cursor: default; }
.stage .acts .btn.tut-target-btn { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 16px rgba(226, 177, 60, .6); }

/* ── The hand: the fan's box (the mock's): from the clash zone down to the stage's bottom edge, over everything else.
   The fan (cards/fan.ts, face.css) places its cards inside #hand-cards in this box's own coordinates; cards take the pointer, the box does not. ── */
.hand { left: 0; width: 1200px; top: 132px; bottom: 0; z-index: 50; pointer-events: none; }
#hand-cards { position: absolute; inset: 0; pointer-events: none; }

/* Aeon's clock takes the hand's place */
.clock-area { left: 440px; top: 514px; width: 516px; height: 198px; z-index: 50; padding: 6px 8px; border: 2px solid rgba(236, 227, 207, .25); border-radius: 8px; background: rgba(14, 11, 20, .78); display: flex; flex-direction: column; gap: 4px; }
.clock-header { display: flex; justify-content: space-between; align-items: center; }
.clock-right { display: flex; gap: 8px; align-items: center; }
.clock-title { font: 800 12px/1 var(--display); color: var(--gold-hi); text-transform: uppercase; letter-spacing: .08em; }
.clock-subtitle { font: italic 400 11px/1 var(--serif); color: var(--paper-2); }
.clock-area .clock-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 78px; gap: 5px; flex: 1; min-height: 0; }
.clock-area .clock-slot { min-height: 0; padding: 3px 4px; background: linear-gradient(165deg, #efe6d2, #d9cbab); color: var(--ink); border: 2px solid var(--ink); }
.clock-area .clock-slot.empty { background: transparent; border-style: dashed; border-color: rgba(236, 227, 207, .35); color: var(--paper-2); }
.clock-area .clock-pos, .clock-area .clock-on-badge { font-size: 9px; color: var(--ink); text-shadow: none; }
.clock-area .clock-card-name { margin-top: 12px; font-size: 9.5px; color: var(--ink); }
.clock-area .clock-card-desc { font-size: 8px; color: var(--ink); }
.clock-area .clock-slot.on-time { border-color: var(--gold-ink); box-shadow: 0 0 0 2px var(--gold-hi); }
.clock-area .btn.small { font-size: 10px; padding: .2em .7em; margin: 0; }

/* ── The battle log: a column beside the table on desktop ── */
#game-screen > .battle-log { width: 260px; background: #181420; border-left: 2px solid rgba(236, 227, 207, .2); color: var(--paper); height: 100%; }
#game-screen > .battle-log .log-header { background: #100d15; border-bottom: 1.5px solid rgba(236, 227, 207, .2); color: var(--paper-hi); font-family: 'Cinzel', Georgia, serif; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
#game-screen > .battle-log .log-min-btn { border-color: rgba(236, 227, 207, .35); color: var(--paper-2); }

/* ── Phone landscape: 844 x 390 ── */
.stage[data-stage="phone"] .topbar { height: 0; padding: 0; border: 0; background: none; z-index: 40; }
.stage[data-stage="phone"] .hint, .stage[data-stage="phone"] .tool span { display: none; }
.stage[data-stage="phone"] .tools { position: absolute; right: 4px; top: 4px; gap: 0; }
.stage[data-stage="phone"] .tool { width: 44px; height: 44px; padding: 0; justify-content: center; }
.stage[data-stage="phone"] .tool svg.i { width: 22px; height: 22px; }
.stage[data-stage="phone"] .round { position: absolute; left: 470px; top: 6px; font-size: 10.5px; }
.stage[data-stage="phone"] .pill { position: absolute; left: 470px; top: 22px; font-size: 10px; padding: 4px 7px; }
.stage[data-stage="phone"] .pill .turn { display: none; }
.stage[data-stage="phone"] .bandline.top { top: 52px; } .stage[data-stage="phone"] .bandline.bottom { top: 270px; }
.stage[data-stage="phone"] .portrait { width: 40px; height: 40px; margin-top: 3px; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--paper-2), 0 0 0 5.5px var(--ink); }
.stage[data-stage="phone"] .portrait .rib { font-size: 7px; padding: 2px 5px; bottom: -7px; }
.stage[data-stage="phone"] .plate { padding: 4px 8px 5px; gap: 3px; }
.stage[data-stage="phone"] .plate .nm { font-size: 10.5px; gap: 6px; min-height: 14px; }
.stage[data-stage="phone"] .plate .nm small { display: none; }
.stage[data-stage="phone"] .plate .hprow { gap: 4px 6px; min-height: 16px; flex-wrap: wrap; max-width: 150px; }
.stage[data-stage="phone"] .hold.gauge { width: 90px; }
.stage[data-stage="phone"] .who { gap: 6px; }
.stage[data-stage="phone"] .hp { height: 16px; } .stage[data-stage="phone"] .hp b { font-size: 11px; }
.stage[data-stage="phone"] .guard { --tz: 20px; } .stage[data-stage="phone"] .guard b { font-size: 14px; } .stage[data-stage="phone"] .guard.off { display: none; }
.stage[data-stage="phone"] .xrow { gap: 3px 6px; max-width: 196px; }
.stage[data-stage="phone"] .tag { font-size: 8.5px; padding: 1px 5px 1px 4px; }
.stage[data-stage="phone"] .kcells { gap: 0; } .stage[data-stage="phone"] .kc { width: 9px; height: 16px; font-size: 7px; } .stage[data-stage="phone"] .kc.now { width: 15px; }
.stage[data-stage="phone"] .karma { gap: 3px; } .stage[data-stage="phone"] .karma > svg.i { width: 13px; height: 13px; }
.stage[data-stage="phone"] .ft { width: 16px; height: 16px; font-size: 7px; }
/* Kael'ris's form name at its longest ("Honey Badger", "Dire Spider") shares a row with Marked on the opponent's phone plate, so the plate stays two chip rows tall. */
.stage[data-stage="phone"] .form { font-size: 10px; gap: 3px; } .stage[data-stage="phone"] .form svg.i { width: 13px; height: 13px; }
.stage[data-stage="phone"] .qchip { font-size: 11px; padding: 1px 5px 1px 4px; }
.stage[data-stage="phone"] .opp-who { left: 8px; top: 2px; }
.stage[data-stage="phone"] .you-who { left: 8px; top: auto; bottom: 6px; align-items: flex-end; }   /* anchored to the bottom, so a plate with a third row grows upward */
.stage[data-stage="phone"] .opp-hand { top: 2px; left: 330px; margin-left: 0; width: 120px; height: 46px; }
.stage[data-stage="phone"] .opp-piles { right: auto; left: 372px; top: 8px; gap: 8px; }
.stage[data-stage="phone"] .opp-hand { left: 270px; }
.stage[data-stage="phone"] .you-piles { right: auto; left: 8px; top: 270px; gap: 6px; }
.stage[data-stage="phone"] .tok-cap { display: none; }
.stage[data-stage="phone"] .plaque { padding: 2px 6px 2px 4px; font-size: 12px; }
.stage[data-stage="phone"] .plate .plaque { font-size: 10px; padding: 0 4px 0 3px; } .stage[data-stage="phone"] .plate .plaque svg.i { width: 12px; height: 12px; }
.stage[data-stage="phone"] .you-who { z-index: 52; }   /* above the hand, so the 48 px Actions token is never under a card */
.stage[data-stage="phone"] .you-who .plate { position: relative; }
/* The phone: one compact 48 px token beside the plate opens a tray of the tokens, anchored to the plate (never a dialog). */
.stage[data-stage="phone"] .aa-row { position: static; padding: 0; display: block; }
.stage[data-stage="phone"] .aa-compact { appearance: none; margin: 0; padding: 0; position: absolute; right: -56px; bottom: 0; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 2.5px solid var(--ink); color: #b07a0e; background: radial-gradient(circle at 36% 28%, var(--paper-hi), var(--paper) 58%, var(--paper-2)); box-shadow: 0 0 0 2px #c98a12, 0 0 0 3.5px var(--ink), 2px 3px 0 3.5px rgba(27, 22, 32, .35); }
.stage[data-stage="phone"] .aa-compact svg.i { width: 24px; height: 24px; }
.stage[data-stage="phone"] .aa-compact span { display: none; }
.stage[data-stage="phone"] .aa-compact.ready { box-shadow: 0 0 0 2px #c98a12, 0 0 0 3.5px var(--ink), 0 0 0 6px rgba(226, 177, 60, .65), 0 0 14px 5px rgba(226, 177, 60, .5), 2px 3px 0 3.5px rgba(27, 22, 32, .35); animation: aaGlow 1.8s ease-in-out infinite; }
.stage[data-stage="phone"] .aa-compact.tut-target-btn { box-shadow: 0 0 0 2px #c98a12, 0 0 0 3.5px var(--ink), 0 0 0 6px var(--gold-hi), 0 0 18px 6px rgba(226, 177, 60, .8); }
.stage[data-stage="phone"] .aa-tray { position: absolute; left: -4px; bottom: calc(100% + 10px); z-index: 60; display: none; gap: 6px; padding: 7px 8px 6px; border-radius: 8px; border: 2.5px solid var(--ink);
  background: var(--grain), linear-gradient(165deg, #efe6d2, #d9cbab); box-shadow: 3px 5px 0 rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .55); }
.stage[data-stage="phone"] .aa-row.tray-open .aa-tray { display: flex; }
.stage[data-stage="phone"] .aa-tray .aa-token { width: 72px; min-height: 44px; }
.stage[data-stage="phone"] .aa-tray .aa-name { color: var(--ink); text-shadow: none; font-size: 8px; max-width: 72px; }
.stage[data-stage="phone"] .aa-card { width: 176px; }
.stage[data-stage="phone"] .aa-card-text { font-size: 12.5px; }
.stage[data-stage="phone"] .aa-spend { min-height: 48px; }   /* a finger's target */
.stage[data-stage="phone"] .clash { top: 52px; height: 218px; }
.stage[data-stage="phone"] #opp-before { left: 116px; top: 64px; } .stage[data-stage="phone"] #opp-after { left: 182px; top: 64px; }
.stage[data-stage="phone"] #you-before { left: 776px; top: 2px; } .stage[data-stage="phone"] #you-after { left: 776px; top: 93px; }
.stage[data-stage="phone"] .card-slot.slot { width: 62px; height: 87px; font-size: 8px; }
.stage[data-stage="phone"] .score { width: 64px; height: 64px; }
.stage[data-stage="phone"] .throw-ground { --feather: 34px; }
.stage[data-stage="phone"] .throw-area { --clash-h: 320px; --caption-h: 22px; left: 266px; top: 0; width: 456px; height: 218px; }
.stage[data-stage="phone"].clash-mode .throw-area { height: var(--clash-h); }
.stage[data-stage="phone"] .score.opp { left: 4px; top: 18px; } .stage[data-stage="phone"] .score.you { left: 190px; top: 116px; }
.stage[data-stage="phone"] .medal { box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--paper-2), 0 0 0 7px var(--ink), 3px 5px 0 7px rgba(0, 0, 0, .4); }
.stage[data-stage="phone"] .medal.win { box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--paper-2), 0 0 0 7px var(--ink), 0 0 0 10px rgba(226, 177, 60, .45), 3px 5px 0 7px rgba(0, 0, 0, .4); }
.stage[data-stage="phone"] .medal .mtag { font-size: 7.5px; top: -11px; padding: 2px 5px; border-width: 1.5px; }
.stage[data-stage="phone"] .medal .role { font-size: 8.5px; bottom: -12px; padding: 3px 5px; }
.stage[data-stage="phone"] .medal.s-empty::before { inset: 6px; }
.stage[data-stage="phone"] .score .die20 { --d: 58px; }
.stage[data-stage="phone"] .medal .mfx { right: -14px; top: 0; } .stage[data-stage="phone"] .medal .mfx i { font-size: 7px; padding: 2px 4px; }
.stage[data-stage="phone"] ul.brk { left: -12px; top: 82px; width: 116px; }
.stage[data-stage="phone"] .score.opp ul.brk { left: 0; width: 100px; }   /* (the stamp lies just right of it) */
/* 12 px type: the phone reads these at arm's length. A card's condition is dropped (the amount says it applied); a row that did not
   apply keeps it as a small tag, because it is the reason. The merged "Earlier" row names its cards instead of saying "Earlier". */
.stage[data-stage="phone"] .brk .r { font-size: 12px; padding: 0 4px; gap: 4px; } .stage[data-stage="phone"] .brk .r .am { font-size: 12.5px; min-width: 2.4ch; }
.stage[data-stage="phone"] .brk .r .cond { display: none; }
.stage[data-stage="phone"] .brk .r.miss .cond { display: inline-block; margin-left: 4px; padding: 0 3px; border: 1px solid currentColor; border-radius: 3px; font-size: 8.5px; line-height: 1.25; vertical-align: 1px; text-decoration: none; }
.stage[data-stage="phone"] .brk .r.earlier .ew { display: none; }
.stage[data-stage="phone"] .brk .r.earlier em { margin-left: 0; font-style: normal; font-size: 1em; opacity: 1; }
.stage[data-stage="phone"] .stamp { left: 142px; top: 96px; padding: 2px 6px 3px; border-width: 2px; }
.stage[data-stage="phone"] .stamp small { font-size: 6.5px; letter-spacing: .1em; } .stage[data-stage="phone"] .stamp b { font-size: 17px; }
.stage[data-stage="phone"] .opp-zone { left: 6px; top: 62px; width: 104px; height: 152px; }
.stage[data-stage="phone"] .you-zone { left: 724px; right: auto; top: 2px; width: 50px; height: 180px; justify-content: flex-start; }
.stage[data-stage="phone"] .traps { grid-template-columns: repeat(2, 50px); grid-auto-rows: 44px; gap: 4px; }
.stage[data-stage="phone"] .trap { width: 50px; height: 44px; font-size: 7px; padding: 2px; gap: 1px; } .stage[data-stage="phone"] .trap svg.i { width: 13px; height: 13px; }
.stage[data-stage="phone"] .mgrid, .stage[data-stage="phone"] .mdiv { width: 104px; }
.stage[data-stage="phone"] .mt { width: 50px; height: 36px; } .stage[data-stage="phone"] .mt .mn { font-size: 7.5px; } .stage[data-stage="phone"] .mt .ml { font-size: 7px; }
.stage[data-stage="phone"] .mt .mx svg.i { width: 20px; height: 20px; }
.stage[data-stage="phone"] .mt.empty { font-size: 7px; }
.stage[data-stage="phone"] .minions { flex-direction: column; align-items: center; gap: 6px; }
.stage[data-stage="phone"] .mn-extra { display: block; } .stage[data-stage="phone"] .mn-tile.extra .card { opacity: .92; }
.stage[data-stage="phone"] .you-zone .traps { grid-template-columns: 50px; }
.stage[data-stage="phone"] .you-zone .mgrid, .stage[data-stage="phone"] .you-zone .mdiv { width: 50px; }
.stage[data-stage="phone"] .toasts { left: 112px; top: 196px; width: 150px; max-height: 72px; }
.stage[data-stage="phone"] .mill-toast, .stage[data-stage="phone"] .zh-toast { font-size: 11px; padding: 4px 24px 4px 8px; }
.stage[data-stage="phone"] .acts { right: 6px; top: auto; bottom: 6px; width: 112px; flex-direction: column-reverse; gap: 4px; }
.stage[data-stage="phone"] .acts-main { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.stage[data-stage="phone"] .acts .btn { min-height: 48px; font-size: 13px; padding: 0 .3em; }
.stage[data-stage="phone"] #hand-actions .btn[data-action="playCard"], .stage[data-stage="phone"] #hand-actions .btn[data-action="roll"] { grid-column: 1 / -1; order: 1; }
.stage[data-stage="phone"] #hand-actions .btn[data-action="pass"] { grid-column: 1 / -1; order: 2; }
.stage[data-stage="phone"] #hand-actions .btn:not([data-action="playCard"]):not([data-action="pass"]):not([data-action="roll"]) { font-size: 10.5px; line-height: 1.1; }
.stage[data-stage="phone"] .hand { width: 844px; top: 52px; }
.stage[data-stage="phone"] .clock-area { left: 250px; top: 292px; width: 460px; height: 96px; padding: 3px 5px; }
.stage[data-stage="phone"] .clock-area .clock-grid { grid-auto-rows: 36px; gap: 3px; }
.stage[data-stage="phone"] .clock-area .clock-card-desc, .stage[data-stage="phone"] .clock-area .clock-subtitle { display: none; }
.stage[data-stage="phone"] .clock-area .clock-card-name { font-size: 7.5px; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) { .stage .guard { transition: none; } }

/* On a phone the battle log is a drawer over the table, not a column beside it (the table never shrinks for it) */
@media (max-height: 500px) {
  #game-screen > .battle-log { position: fixed; right: 0; top: 0; bottom: 0; width: min(300px, 55vw); z-index: 120; box-shadow: -6px 0 18px rgba(0, 0, 0, .6); }
}
/* Printed possibilities sit still in gold ink; the real values keep their own colour and position. */
.g-preview { pointer-events: none; }
.stage .gauge, .stage [id$="-guard-slot"] { position: relative; }
.g-chip, .g-notes, .g-unavailable { position: absolute; z-index: 6; color: #e2c779; background: rgba(27,22,32,.93); border: 1.5px dashed #d6b65e; border-radius: 4px 7px 5px 6px; }
.g-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 2px 5px; top: -3px; left: 0; font: 800 13px/1.2 var(--display); }
.g-chip svg.i { width: 14px; height: 14px; }
.g-chip .coin { --tz: 22px; background: transparent; border: 1.5px dashed #d6b65e; box-shadow: none; color: #e2c779; }
.g-chip em { font: italic 12px/1.1 var(--serif); }
.g-true_damage { left: calc(100% + 8px); top: -2px; }
.g-shield { left: calc(100% + 8px); }
.g-segment { position: absolute; top: 0; bottom: 0; z-index: 1; border: 1px dashed #e2c779; background: repeating-linear-gradient(-45deg, rgba(226,199,121,.75) 0 2px, rgba(27,22,32,.35) 2px 5px); }
.hp b { z-index: 2; }
.g-notes { left: 0; bottom: calc(100% + 5px); width: max-content; max-width: 210px; padding: 3px 6px; display: flex; flex-direction: column; gap: 3px; font: italic 600 13px/1.2 var(--serif); }
.g-notes.g-note-row { position: static; }
.who > .g-notes { left: calc(100% + 12px); top: 22px; bottom: auto; }
.medal > .g-notes { bottom: auto; left: calc(100% + 18px); top: 40px; max-width: 180px; }
.g-unavailable { right: calc(100% + 8px); top: 8px; width: 150px; padding: 7px; font: italic 600 13px/1.25 var(--serif); }
.g-cost { opacity: .45; outline: 1.5px dashed #967432; outline-offset: 1px; }
.ledger .lr.g-row { color: #e2c779; border-left: 2px dashed #d6b65e; font-style: italic; }
.ledger .lr.g-row .am { color: #e2c779; }
.stage[data-stage="phone"] .g-chip { font-size: 11px; padding: 1px 4px; }
.stage[data-stage="phone"] .g-chip .coin { --tz: 17px; }
.stage[data-stage="phone"] .g-notes { font-size: 11px; max-width: 180px; }
.stage[data-stage="phone"] .medal > .g-notes { left: calc(100% + 28px); top: 28px; max-width: 126px; }
.stage[data-stage="phone"] .medal.opp > .g-notes { left: 0; top: calc(100% + 74px); max-width: 170px; }
.stage[data-stage="phone"] .who > .g-notes { left: 208px; top: 0; max-width: 140px; font-size: 10px; }
.stage[data-stage="phone"] .g-unavailable { right: auto; left: calc(100% + 8px); top: 66px; width: 86px; font-size: 11px; }
.stage[data-stage="phone"] .g-deflect { gap: 2px; padding: 1px 3px; font-size: 10px; }
.stage[data-stage="phone"] .g-deflect em { position: absolute; right: 0; bottom: calc(100% + 5px); font-size: 10px; padding: 1px 3px; color: #e2c779; background: rgba(27,22,32,.93); border: 1px dashed #d6b65e; border-radius: 3px; }
/* on the phone the raised card lies over the left of the opponent's ledger, which would cut a preview row at its start: its dashed chip beside the plate says the same */
.stage[data-stage="phone"] .opp-who > .ledger .lr.g-row { display: none; }
