/* Shared styles for the new-engine client (lobby + game). Dark, like /tools/. */
:root {
  --bg: #0d0f14;
  --panel: #161a23;
  --card: #1e2330;
  --hover: #252b3a;
  --border: #2a3147;
  --border-light: #3a4560;
  --text: #e8ecf5;
  --text-2: #8090b0;
  --muted: #4a5570;
  --gold: #f0c040;
  --light: #f0c040;
  --shadow: #a77bff;
  --move: #40c080;
  --target: #ff5050;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--gold); }
button {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--border-light); border-radius: 6px;
  padding: 7px 12px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--gold); background: var(--hover); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--gold); color: #1a1400; border-color: var(--gold); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #ffd760; }
button.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

header.bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
header.bar h1 { font-size: 15px; margin: 0; font-weight: 600; }
header.bar a { color: var(--text-2); text-decoration: none; font-size: 13px; }
header.bar .spacer { flex: 1; }

.team-light { color: var(--light); }
.team-shadow { color: var(--shadow); }
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  border: 1px solid currentColor; font-weight: 600;
}
.muted { color: var(--text-2); }
.error-toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: #4a1d1d; border: 1px solid var(--target); color: #ffd0d0;
  padding: 10px 16px; border-radius: var(--radius); z-index: 50; max-width: calc(100% - 32px);
}

/* ── Lobby ─────────────────────────────────────────────── */
.lobby { max-width: 900px; margin: 0 auto; padding: 24px 16px 64px; }
.lobby h2 {
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin: 28px 0 10px;
}
.box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 12px; }
.form-row label { display: flex; gap: 6px; align-items: center; }
select, textarea, input[type="text"], input[type="password"], input[type="email"], input:not([type]) { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border-light); border-radius: 6px; padding: 6px; }
.game-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.game-row:first-child { border-top: none; }
/* Profile (account.js) */
.profile-form { max-width: 440px; }
.profile-form label { display: flex; flex-direction: column; gap: 4px; }
.profile-form .field-help { margin-top: -4px; font-size: 12px; }
.profile-form .pw-change { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.nudge { margin-bottom: 12px; }

/* Admin: deleted games, collapsed until opened */
.deleted-games { margin-top: 12px; }
.deleted-games summary { cursor: pointer; color: var(--text-2); margin-bottom: 8px; }
.game-row .id { font-family: 'SF Mono', Menlo, monospace; color: var(--text-2); }
.seat-link { display: inline-flex; gap: 6px; align-items: center; }
.created { margin-top: 12px; }

/* ── Game layout ───────────────────────────────────────── */
.game {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px;
  padding: 16px; max-width: 1500px; margin: 0 auto;
}
@media (max-width: 960px) { .game { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.panel h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.panel h3.team-light { color: var(--light); }
.panel h3.team-shadow { color: var(--shadow); }
.decision.mine { border-color: var(--gold); }
.decision .title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.decision .hint { color: var(--text-2); margin-bottom: 10px; line-height: 1.45; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices + .choices { margin-top: 8px; }
.stat-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 4px 12px; align-items: center; }
.stat-grid .h { color: var(--text-2); font-size: 12px; }

/* ── Board ─────────────────────────────────────────────── */
.board-wrap { min-width: 0; }
.board {
  /* Fit the screen height so the hand below stays visible on a laptop. */
  position: relative; width: min(100%, calc((100vh - 230px) * 1395 / 1517)); min-width: min(100%, 420px);
  margin: 0 auto; background: 0 0 / 100% 100% no-repeat;
  border-radius: var(--radius); overflow: hidden;
}
.area { position: absolute; transition: background 0.15s; }
.units {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 3px;
  pointer-events: none; /* clicks fall through to the area for moving */
}
.area.movable { background: rgba(64, 192, 128, 0.35); cursor: pointer; }
.area.movable:hover { background: rgba(64, 192, 128, 0.55); }
.area.targetable { background: rgba(255, 80, 80, 0.25); }
/* A hovered choice ("Push mid", an area or unit option) shown on the board */
.area.hl { background: rgba(240, 192, 64, 0.45); box-shadow: inset 0 0 0 3px var(--gold); }
.hl-unit { outline: 3px solid var(--gold) !important; outline-offset: 2px; }
.token {
  position: relative; width: clamp(22px, 3.4vw, 40px); aspect-ratio: 1; border-radius: 50%;
  background: center / cover; border: 2px solid; box-shadow: 0 2px 5px rgba(0,0,0,0.6);
  flex: none;
}
.token.light { border-color: var(--light); }
.token.shadow { border-color: var(--shadow); }
.token.exhausted { filter: grayscale(0.7) brightness(0.75); }
.token.active { box-shadow: 0 0 0 3px #fff, 0 0 12px 4px var(--gold); }
.token .hp {
  position: absolute; right: -6px; bottom: -4px; min-width: 18px; padding: 0 3px;
  background: #000c; border-radius: 9px; font-size: 11px; font-weight: 700; text-align: center;
}
.token .lvl { position: absolute; left: -5px; top: -5px; font-size: 12px; }
.chip {
  flex: none; padding: 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #000b; border: 2px solid;
}
.chip.light { border-color: var(--light); color: var(--light); }
.chip.shadow { border-color: var(--shadow); color: var(--shadow); }
.monster {
  position: relative; flex: none; width: clamp(24px, 3.8vw, 38px); aspect-ratio: 1; border-radius: 50%;
  background: center / cover; border: 2px solid #7a4aa0;
}
.monster .n { position: absolute; right: -5px; bottom: -4px; background: #000c; border-radius: 9px; font-size: 11px; padding: 0 4px; font-weight: 700; }
.nexus-hp { flex: none; background: #000c; border-radius: 6px; padding: 2px 7px; font-weight: 700; border: 2px solid; }
.tower {
  position: absolute; transform: translate(-50%, -50%); width: clamp(18px, 2.6vw, 28px); aspect-ratio: 1;
  border-radius: 50%; background: center / cover; border: 2px solid; z-index: 5; pointer-events: none;
}
.tower.light { border-color: var(--light); }
.tower.shadow { border-color: var(--shadow); }
.tower.destroyed { opacity: 0.25; filter: grayscale(1); }
.targetable-unit { outline: 3px solid var(--target); outline-offset: 1px; cursor: crosshair; pointer-events: auto; }
.targetable-unit.picked { outline-color: var(--gold); }

/* ── Hand ──────────────────────────────────────────────── */
.hand { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.card-img {
  width: clamp(70px, 9vw, 110px); aspect-ratio: 558 / 780; border-radius: 6px;
  background: center / cover var(--card); border: 2px solid var(--border); cursor: default;
}
.card-img { position: relative; cursor: zoom-in; }
.card-img.clickable { cursor: pointer; }
.zoom-btn {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%); padding: 0; width: 26px; height: 26px; border-radius: 50%;
  font-size: 13px; line-height: 1; background: #000b; border: 1px solid #fff6; color: #fff; opacity: 0.8;
}
.zoom-btn:hover:not(:disabled) { opacity: 1; background: #000d; border-color: var(--gold); }
.card-img.clickable:hover { border-color: var(--gold); transform: translateY(-3px); }
.card-img.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

/* ── Heroes list + log ─────────────────────────────────── */
.hero-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.hero-row .token { width: 26px; }
.hero-row .name { flex: 1; }
.log { max-height: 280px; overflow-y: auto; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.log div { padding: 1px 0; }
.log .ev-important { color: var(--text); }
.log .log-time { color: var(--text-2); opacity: 0.6; font-variant-numeric: tabular-nums; margin-right: 6px; }

/* ── Draft ─────────────────────────────────────────────── */
.draft-pool { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .draft-pool { grid-template-columns: repeat(2, 1fr); } }
.draft-col h4 { margin: 0 0 8px; text-transform: capitalize; }
.draft-hero {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px;
  border: 1px solid transparent; margin-bottom: 4px;
}
.draft-hero.selectable { cursor: pointer; border-color: var(--border-light); background: var(--card); }
.draft-hero.selectable:hover { border-color: var(--gold); }
.draft-hero.unavailable { opacity: 0.4; }
.draft-hero .token { width: 32px; }
.draft-hero .why { font-size: 11px; color: var(--text-2); }
/* The pick/ban order: one slot per hero, done ones show the hero. */
.draft-order { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.draft-slot {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 7px; border-radius: 6px;
  border: 1px solid var(--border-light); background: var(--card); font-size: 12px; text-transform: capitalize;
}
.draft-slot .n { color: var(--text-2); font-size: 10.5px; }
.draft-slot b { color: var(--text); font-weight: 600; text-transform: none; }
.draft-slot.ban { border-style: dashed; }
.draft-slot.done { opacity: 0.55; }
.draft-slot.now.team-light { border-color: var(--light); box-shadow: 0 0 0 1px var(--light) inset; }
.draft-slot.now.team-shadow { border-color: var(--shadow); box-shadow: 0 0 0 1px var(--shadow) inset; }
.draft-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-red { color: #ff6b6b; } .color-blue { color: #5aa9ff; } .color-green { color: #5fd38a; } .color-yellow { color: #f0c040; }

/* Draft: compact pool on the left, sticky preview of the clicked hero on the right. */
.draft-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: start; }
@media (max-width: 1200px) { .draft-main { grid-template-columns: 1fr; } }
.draft-main .draft-pool { gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.draft-main .draft-hero { gap: 6px; padding: 3px 5px; margin-bottom: 3px; font-size: 13px; }
.draft-main .draft-hero .token { width: 26px; }
.draft-hero { cursor: pointer; }
.draft-hero.previewed { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.draft-preview { position: sticky; top: 12px; }
.preview-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.preview-head h3 { margin: 0; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text); }
.preview-sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-img { width: 100%; aspect-ratio: 1; border-radius: 6px; display: block; background: var(--card); cursor: zoom-in; }
.preview-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.card-full { width: 100%; aspect-ratio: 558 / 780; border-radius: 5px; display: block; background: var(--card); cursor: zoom-in; }
.draft-preview img:hover { outline: 2px solid var(--gold); }
.zoom {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px #000; }

/* Draft filters and range icons */
.draft-filters { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.filter-group .muted { font-size: 12px; margin-right: 2px; }
.chip-btn { padding: 3px 9px; font-size: 12.5px; border-radius: 999px; text-transform: capitalize; display: inline-flex; align-items: center; gap: 4px; }
.range-icon { width: 15px; height: 15px; flex: none; color: var(--text-2); }
.draft-hero .draft-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-hero .draft-name .why { overflow: hidden; text-overflow: ellipsis; }
.range-badge {
  position: absolute; right: -5px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: #000d; display: flex; align-items: center; justify-content: center;
}
.range-badge .range-icon { width: 12px; height: 12px; color: var(--text); }
.chip-btn .range-icon { width: 13px; height: 13px; color: inherit; }

/* Taken heroes: tinted by who took them (red = banned). Kept readable, not faded. */
.draft-hero.is-banned, .draft-hero.is-light, .draft-hero.is-shadow { opacity: 1; }
.draft-hero.is-banned { background: rgba(255, 80, 80, 0.22); border-color: rgba(255, 80, 80, 0.55); }
.draft-hero.is-light { background: rgba(240, 192, 64, 0.22); border-color: rgba(240, 192, 64, 0.6); }
.draft-hero.is-shadow { background: rgba(167, 123, 255, 0.25); border-color: rgba(167, 123, 255, 0.6); }
.draft-hero.is-banned .why { color: #ff9a9a; }
.draft-hero.is-light .why { color: var(--light); }
.draft-hero.is-shadow .why { color: var(--shadow); }
.draft-hero.is-banned .token { filter: grayscale(1); }

/* Light mode: darker color names (the bright ones are made for a dark page). The range
   badge sits on a dark disc in both modes, so its icon stays white. */
[data-theme="light"] .color-red { color: #c62828; }
[data-theme="light"] .color-blue { color: #1f62c4; }
[data-theme="light"] .color-green { color: #1d7f45; }
[data-theme="light"] .color-yellow { color: #9a6c00; }
.range-badge .range-icon { color: #fff; }
.hero-row.zoomable { cursor: zoom-in; border-radius: 6px; }
.hero-row.zoomable:hover { background: var(--hover); }

/* Melee / ranged label in the draft preview header */
.range-label { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; text-transform: capitalize; }
.range-label .range-icon { width: 18px; height: 18px; color: var(--text); }

/* Attack reveals: cards drawn + values = strength (side panel and a short pop-up) */
.atk-who { font-weight: 600; margin-bottom: 8px; }
.atk-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.atk-card { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.atk-img { width: 64px; aspect-ratio: 558 / 780; border-radius: 4px; display: block; cursor: zoom-in; }
.atk-img.big { width: 130px; cursor: default; }
.atk-val { font-weight: 700; font-size: 15px; }
.atk-val span { color: var(--gold); margin-left: 1px; }
.atk-op { font-size: 20px; font-weight: 700; color: var(--text-2); padding-bottom: 22px; }
.atk-total { display: flex; flex-direction: column; align-items: center; padding-bottom: 22px; }
.atk-total b { font-size: 30px; line-height: 1; color: var(--gold); }
.atk-total span { font-size: 11px; color: var(--text-2); }
.atk-by { margin-top: 6px; font-size: 12.5px; line-height: 1.4; }
.attack-popup {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--panel); border: 2px solid var(--gold); border-radius: 10px; padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); max-width: calc(100% - 32px); cursor: pointer;
  animation: atk-in 0.25s ease-out;
}
.attack-popup .atk-total b { font-size: 40px; }
@keyframes atk-in { from { opacity: 0; transform: translate(-50%, -10px); } }

/* M3: spells, statuses, effects */
.decision .hint { white-space: pre-line; }
.cast-btn {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); padding: 3px 9px; font-size: 12px;
  border-radius: 999px; background: var(--gold); color: #1a1400; border: none; font-weight: 700; white-space: nowrap;
}
.cast-btn:hover:not(:disabled) { background: #ffd760; }
[data-theme="light"] .cast-btn { color: #fff; }
.status-pill, .stat-pill {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; font-size: 10.5px; font-weight: 700;
  border: 1px solid currentColor; vertical-align: 1px; cursor: help;
}
.st-burn { color: #ff7a3c; } .st-disarm { color: #c9a227; } .st-freeze { color: #4cb6ff; }
.st-silence { color: #b78cff; } .st-stun { color: #ff5a8a; }
.stat-pill { color: var(--text-2); }
.effect-row { font-size: 12.5px; padding: 2px 0; color: var(--text-2); cursor: zoom-in; }
.effect-row b { color: var(--text); font-weight: 600; }

/* Hero details (click a hero in the Heroes list) */
.details-overlay { cursor: default; }
.details-card {
  position: relative; width: min(620px, 100%); max-height: 100%; overflow-y: auto; padding: 18px 20px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border-light); border-radius: 10px; cursor: default;
}
.details-close { position: absolute; top: 10px; right: 10px; padding: 2px 8px; }
.details-top { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start; }
.details-top img { width: 100%; border-radius: 6px; cursor: zoom-in; }
.details-top h2 { margin: 0 0 2px; font-size: 18px; }
.details-ability { margin: 10px 0 0; line-height: 1.45; font-size: 13.5px; }
.details-stats { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.details-stats th { text-align: left; font-weight: 600; color: var(--text-2); padding: 4px 10px 4px 0; white-space: nowrap; }
.details-stats td { padding: 4px 10px 4px 0; vertical-align: top; }
.details-card h3 { margin: 14px 0 6px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.details-card > div { font-size: 13.5px; line-height: 1.5; }
@media (max-width: 520px) { .details-top { grid-template-columns: 1fr; } .details-top img { max-width: 220px; } }
.details-stats td:nth-child(2) { width: 64px; }

/* Reaction window countdown */
.react-timer { font-variant-numeric: tabular-nums; color: var(--text-2); margin-bottom: 8px; font-size: 13px; }
.react-timer.urgent { color: var(--target); font-weight: 700; }

/* 3–4 players: one hand per teammate, and the hero split after the draft */
.hand-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hand-group + .hand-group { border-left: 1px solid var(--border); padding-left: 12px; }
.hand-label { font-size: 12px; color: var(--text-2); }
.hand-cards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.assign-grid { display: grid; grid-template-columns: auto repeat(2, minmax(90px, auto)); gap: 8px 12px; align-items: center; margin: 12px 0; }
.assign-grid .h { font-weight: 600; text-align: center; }
.assign-grid button.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
#clock .ticking { color: var(--gold); }

/* Lobby: game names, hero icons, rename */
.game-name { font-weight: 600; }
.lobby-team { display: inline-flex; gap: 4px; align-items: center; }
.lobby-hero { width: 32px; height: 32px; border-radius: 50%; border: 2px solid currentColor; object-fit: cover; }
.link-btn { background: none; border: none; padding: 0; color: var(--text-2); cursor: pointer; font-size: 13px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.unlock { max-width: 360px; margin: 40px auto; }
.unlock input { width: 100%; margin: 10px 0; }
.lobby-heroes { flex-basis: 100%; display: flex; align-items: center; gap: 10px; }
.lobby-vs { font-size: 12px; }
.admin-actions { display: inline-flex; gap: 8px; margin-left: auto; white-space: nowrap; }
.unlock .title { font-weight: 600; font-size: 15px; }
.unlock .hint { color: var(--text-2); margin: 4px 0 10px; }
.unlock label { display: block; margin-top: 8px; }
.unlock button { margin-top: 12px; }
.undo-btn { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; background: var(--panel); border: 2px solid var(--gold);
  box-shadow: 0 4px 16px rgba(0,0,0,.2); cursor: pointer; }

/* M5: items and the market */
.item-chip {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; font-size: 10.5px; font-weight: 600;
  border: 1px solid var(--item); border-left-width: 4px; color: var(--text); vertical-align: 1px; cursor: zoom-in; white-space: nowrap;
}
.item-chip.unique { box-shadow: inset 0 0 0 1px var(--gold); }
.details-item .item-chip { margin: 0 4px 0 0; font-size: 12.5px; padding: 1px 7px; }   /* hero details card */
.market-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.market-card {
  position: relative; width: 64px; height: 90px; padding: 0; border-radius: 5px; border: 1px solid var(--border-light);
  background: var(--card) center / cover no-repeat; cursor: pointer;
}
.market-row.small { gap: 4px; flex-wrap: nowrap; }
.market-row.small .market-card { flex: 1 1 0; min-width: 0; max-width: 44px; aspect-ratio: 259 / 389; height: auto; cursor: zoom-in; }
/* Keep the card image whole on hover (the generic button:hover background would reset its size). */
button.market-card:hover:not(:disabled) { background: var(--card) center / cover no-repeat; }
.market-card.selected { outline: 3px solid var(--gold); outline-offset: 1px; }
.market-card.empty { opacity: 0.3; cursor: default; }
.market-card > span {
  position: absolute; right: 2px; bottom: 2px; min-width: 16px; padding: 0 3px; border-radius: 8px;
  background: var(--gold); color: #1a1400; font-size: 11px; font-weight: 700; text-align: center;
}
.discard-items summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); margin: 6px 0; }

/* Leave-and-resume: pause and the lobby's "your move" */
.pause-btn { padding: 3px 10px; font-size: 13px; }
.paused-banner {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 10px; background: var(--panel); border: 2px solid var(--gold);
  box-shadow: 0 4px 16px rgba(0,0,0,.25); font-weight: 600; text-align: center;
}
.paused-banner button { margin-left: 8px; }
.lobby-flag { margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.lobby-flag.your-move { background: var(--gold); color: #1a1400; }
.lobby-flag.paused { border: 1px solid var(--text-2); color: var(--text-2); }

/* M6: the outsider */
.outsider {
  position: relative; flex: none; width: clamp(28px, 4.2vw, 42px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: clamp(14px, 2vw, 20px); color: #fff;
  background: center / cover #13534d; border: 2px solid #9ff0e4; box-shadow: 0 2px 5px rgba(0,0,0,0.6);
}
.units .outsider, .units .token { pointer-events: auto; }   /* hover shows their card; clicks pass to the area (game.js) */
.outsider-row img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; border: 1px solid #9ff0e4; }
.outsider .hp { position: absolute; left: -5px; top: -4px; background: #000c; border-radius: 9px; font-size: 11px; padding: 0 4px; }
.outsider .n { position: absolute; right: -6px; bottom: -4px; background: #000c; border-radius: 9px; font-size: 11px; padding: 0 4px; }

/* Draft only: the two teams side by side */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }

/* Notes after the game (game.js) and on the stats page */
#notes textarea { width: 100%; box-sizing: border-box; resize: vertical; margin-bottom: 6px; }
#notes .note { margin-top: 8px; white-space: pre-wrap; }
.stats-note { margin: 6px 0; white-space: pre-wrap; }

/* Hover preview of cards and items (game.js) */
.hover-preview {
  position: fixed; z-index: 80; width: 260px; height: auto; border-radius: 10px; pointer-events: none;
  box-shadow: 0 8px 28px rgba(0,0,0,.45); background: var(--card);
}
.hover-preview.large { width: min(500px, 90vw); }   /* outsider sheets: square, small print */
/* A hero's details card on hover (the same card as clicking it in the Heroes list) */
.hover-details { position: fixed; z-index: 80; width: min(520px, 92vw); pointer-events: none; }
.hover-details .details-card { width: 100%; max-height: 90vh; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.hover-details .details-close { display: none; }

/* Reaction window: the card being cast against you */
.react-card { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 8px; }
.react-card .atk-img { width: 90px; flex: none; }
.plans-row { flex-wrap: wrap; align-items: flex-start; }
.plans-row .atk-card { text-align: center; font-size: 12.5px; }

/* Stats page (stats.html) */
.stats-page { max-width: 1200px; }
.stats-controls { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 8px; font-size: 13.5px; }
.stats-wrap { overflow-x: auto; padding: 0; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
.stats-table td:first-child { display: flex; align-items: center; gap: 8px; }
.stats-table th { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.stats-table th[data-sort] { cursor: pointer; user-select: none; }
.stats-table th[data-sort]:hover, .stats-table th.sorted { color: var(--text); }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table .lobby-hero { width: 24px; height: 24px; vertical-align: middle; }
.stats-game { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.stats-game:last-child { border-bottom: none; }
.stats-game .stats-wrap { margin-top: 6px; border: 1px solid var(--border); border-radius: 6px; }
.stats-game-head { color: var(--text); font-size: 13.5px; }
.stats-notes { font-size: 12.5px; line-height: 1.5; margin-top: 24px; }
