/* Fonts bundled in fonts/ (SIL Open Font License): Lilita One for headings & numbers, Nunito for text. */
@font-face { font-family: "Lilita One"; src: url("../fonts/LilitaOne-latin.woff2") format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lilita One"; src: url("../fonts/LilitaOne-latin-ext.woff2") format("woff2"); font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito-latin.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito-latin-ext.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #111318;
  --felt: #181b22;
  --panel: #1e222b;
  --panel-2: #272c38;
  --line: #353b4b;
  --ink: #f2f2f0;
  --ink-2: #b9bcc6;
  --muted: #7d8291;
  --accent: #3987e5;
  --good: #1baf7a;
  --bad: #e34948;
  --gold: #eda100;
  --usa: #eb6834;
  --eu: #3987e5;
  --neutral: #8c8f9b;
  --target: #f2c14e;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 50% 45%, #1c2029 0%, var(--bg) 70%);
  color: var(--ink);
  font: 14px/1.35 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  user-select: none;
}
button {
  font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
b { color: var(--ink); }
b[title] { text-decoration: underline dotted var(--muted); cursor: help; }

/* ---------------------------------------------------------------- start screen */
.start { max-width: 900px; margin: 48px auto; padding: 0 16px; overflow: auto; max-height: 100vh; }
.start h1 { font-size: 52px; margin: 0; letter-spacing: -1px; }
.start .tagline { color: var(--ink-2); margin: 4px 0 30px; font-size: 16px; }
.leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.leader-pick { display: flex; gap: 14px; text-align: left; padding: 16px; border-radius: 14px; background: var(--panel);
  border: 2px solid var(--line); transition: transform 0.15s, border-color 0.15s; }
.leader-pick:hover { transform: translateY(-3px); }
.leader-pick.selected { border-color: var(--target); }
.leader-pick h2 { margin: 0 0 2px; font-size: 20px; }
.leader-pick .title { color: var(--ink-2); font-style: italic; margin-bottom: 10px; }
.leader-pick .faction { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.leader-pick .flavor { color: var(--muted); font-style: italic; margin-top: 10px; }
.start-row { display: flex; gap: 12px; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.seg button.on { border-color: var(--target); color: var(--target); }

.portrait {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: 18px; letter-spacing: 1px; color: #fff; border: 3px solid rgba(255, 255, 255, 0.15);
}
.portrait.big { width: 72px; height: 72px; font-size: 24px; }
.portrait.f-usa { background: linear-gradient(135deg, #f08a4b, #b5431b); }
.portrait.f-eu { background: linear-gradient(135deg, #5598e7, #1c4f95); }

/* ---------------------------------------------------------------- arena layout
 * Leaders face each other in the centre; log on the left; turn button, capital and decks on the right;
 * opponent's hand peeks in from the top, yours from the bottom.
 */
.arena {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 190px;
  grid-template-rows: 46px auto minmax(0, 1fr) 30px minmax(0, 1fr) auto 150px;
  grid-template-areas:
    "side ohand  ocap"
    "side ohero  odeck"
    "side oboard turn"
    "side mid    turn"
    "side mboard turn"
    "side mhero  mdeck"
    "side hand   mcap";
  column-gap: 10px; height: 100vh; padding: 0 8px;
}
.side { grid-area: side; display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 8px 0; }
.board {
  display: flex; gap: 10px; justify-content: center; align-items: center; min-height: 0;
  background: var(--felt); border: 1px solid #22262f; padding: 8px;
}
.board.opp { grid-area: oboard; border-radius: 120px 120px 14px 14px / 40px 40px 14px 14px; }
.board.me { grid-area: mboard; border-radius: 14px 14px 120px 120px / 14px 14px 40px 40px; }
.midline { grid-area: mid; align-self: center; border-top: 2px dashed var(--line); margin: 0 30px; }

/* opponent's hand: card backs peeking from the top edge */
.opp-hand { grid-area: ohand; display: flex; justify-content: center; align-items: flex-start; }
.opp-hand .back { width: 54px; height: 76px; margin: 0 -9px; border-radius: 7px; display: block;
  background: repeating-linear-gradient(45deg, #2f5a99 0 6px, #27497d 6px 12px); border: 2px solid #7fa6dc;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); transform: translateY(calc(-34px + var(--lift, 0px))) rotate(var(--tilt, 0deg)); }

/* leaders */
.hero-row { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 6px 0; }
.hero-row.opp { grid-area: ohero; }
.hero-row.me { grid-area: mhero; }
.hero { position: relative; display: flex; flex-direction: column; align-items: center; cursor: default; }
.hero .portrait { width: 92px; height: 92px; font-size: 32px; border: 4px solid #c9cfdc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6); transition: box-shadow 0.2s, transform 0.2s; }
.hero.active .portrait { border-color: var(--target); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.25), 0 6px 18px rgba(0, 0, 0, 0.6); }
.hero .hero-name { margin-top: 4px; font-size: 14px; background: rgba(17, 19, 24, 0.85); padding: 1px 10px; border-radius: 8px;
  border: 1px solid var(--line); white-space: nowrap; }
.approval-badge { position: absolute; right: -14px; top: 54px; min-width: 46px; height: 40px; padding: 0 6px;
  display: grid; place-items: center; grid-auto-flow: column; font-size: 21px; color: #fff; text-shadow: 0 1px 2px #000;
  background: radial-gradient(circle at 35% 30%, #6fe3b4, #12805a); border: 3px solid #0a4a33;
  border-radius: 50% 50% 46% 46%; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6); }
.approval-badge small { font-size: 12px; align-self: center; }
.approval-badge.low { background: radial-gradient(circle at 35% 30%, #ff8a8a, #b32121); border-color: #5a1010;
  animation: lowpulse 1.2s ease-in-out infinite; }
@keyframes lowpulse { 50% { transform: scale(1.12); } }
.hero.targetable { box-shadow: none !important; }
.hero.targetable .portrait { box-shadow: 0 0 0 4px var(--target), 0 0 26px rgba(242, 193, 78, 0.8) !important; cursor: crosshair; }
.hero.spot-target { box-shadow: none !important; }
.hero.spot-target .portrait { box-shadow: 0 0 0 4px var(--bad), 0 0 26px rgba(227, 73, 72, 0.8); }

.hero-power { position: relative; width: 68px; height: 68px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 30%, #3a4152, #1c2029); border: 3px solid #555d70; }
.hero-power .pcost { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px;
  display: grid; place-items: center; font-size: 15px; color: #fff; text-shadow: 0 1px 2px #000;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(160deg, #6cb3ff, #1d5fc4); }
.hero-power .pname { font-size: 11.5px; line-height: 1.05; text-align: center; padding: 8px 4px 0; }
.hero-power .ptip { display: none; position: absolute; left: 80px; top: 50%; transform: translateY(-50%); width: 200px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px;
  color: var(--ink-2); text-align: left; z-index: 20; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
.hero-power:hover .ptip { display: block; }
.hero-power.ready { border-color: var(--good); box-shadow: 0 0 0 2px var(--good), 0 0 16px rgba(27, 175, 122, 0.6); cursor: pointer; }
.hero-power.ready:hover { transform: scale(1.06); }
.hero-power.used { filter: grayscale(1) brightness(0.6); }
.hero-power:disabled { opacity: 1; }

/* Political Capital crystals and decks (right column) */
.capital { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; padding-right: 6px; }
.capital.opp { grid-area: ocap; justify-content: flex-start; padding-top: 8px; }
.capital.me { grid-area: mcap; justify-content: flex-end; padding-bottom: 14px; }
.capital .crystals { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; max-width: 170px; }
.capital i { width: 14px; height: 18px; clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%, 0 30%);
  background: #2a2f3b; display: inline-block; transition: background 0.3s; }
.capital i.spent { background: #5a4a1e; }
.capital i.full { background: var(--gold); }
.capnum { font-size: 22px; color: var(--gold); text-shadow: 0 2px 0 #000; }
.deck { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-right: 6px; color: var(--ink-2); font-size: 14px; }
.deck.opp { grid-area: odeck; }
.deck.me { grid-area: mdeck; }
.deck-stack { width: 30px; height: 42px; border-radius: 4px; background: repeating-linear-gradient(45deg, #2f5a99 0 4px, #27497d 4px 8px);
  border: 2px solid #7fa6dc; box-shadow: 2px 2px 0 #1b2f52, 4px 4px 0 #14233d; }

/* End turn (right edge, mid-height) */
.turn-panel { grid-area: turn; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.turn-panel .turn-no { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.turn-panel .status { font-size: 12.5px; color: var(--ink-2); text-align: center; min-height: 32px; max-width: 170px; }
.endturn { width: 170px; padding: 14px 10px; font-size: 20px; border-radius: 40px; color: #fff;
  background: linear-gradient(180deg, #2fd496, #12805a); border: 3px solid #0a4a33; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); }
.endturn:hover:not(:disabled) { transform: translateY(-2px); border-color: #0a4a33; }
.endturn.wait, .endturn:disabled { background: linear-gradient(180deg, #4a5061, #2c303b); border-color: #22252e; color: var(--ink-2); }
.endturn.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(27, 175, 122, 0.7); } 50% { box-shadow: 0 0 0 12px rgba(27, 175, 122, 0); } }

/* your hand: peeks up from the bottom edge, rises on hover */
.arena .hand { grid-area: hand; display: flex; justify-content: center; align-items: flex-start; padding: 0; min-width: 0; }
.arena .hand .card { margin: 0 var(--overlap, 0px); transform: translateY(var(--lift, 0px)) rotate(var(--tilt, 0deg));
  transform-origin: 50% 140%; }
.arena .hand .card:hover { transform: translateY(-104px) scale(1.12); z-index: 10; }
.arena .hand .card.selected { transform: translateY(-112px) scale(1.14); z-index: 11; }

.their-turn .board.me, .their-turn .hand { filter: saturate(0.85); }

/* ---------------------------------------------------------------- pawns on the board */
.pawn {
  width: 126px; height: 162px; border-radius: 12px; background: var(--panel-2); border: 2px solid var(--line);
  padding: 0 7px 24px; position: relative; display: flex; flex-direction: column; gap: 3px; overflow: visible;
  transition: box-shadow 0.15s, opacity 0.2s;
}
.pawn.f-usa { border-top: 4px solid var(--usa); }
.pawn.f-eu { border-top: 4px solid var(--eu); }
.pawn.f-neutral { border-top: 4px solid var(--neutral); }
.pawn .part { height: 52px; margin: 0 -7px 2px; border-radius: 9px 9px 0 0; overflow: hidden; background: #000; }
.pawn.filibuster .part { border-radius: 3px 3px 0 0; }
.pawn .pname { font-weight: 700; font-size: 12px; line-height: 1.15; }
.pawn .ptext { font-size: 10.5px; color: var(--ink-2); line-height: 1.25; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.pawn .badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.pawn .pw, .pawn .sp, .cstats .pw, .cstats .sp {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.pawn .pw, .pawn .sp { position: absolute; bottom: -8px; }
.pawn .pw { left: -8px; background: var(--gold); color: #1b1300; }
.pawn .sp { right: -8px; background: var(--good); color: #fff; }
.pw.zero { opacity: 0.6; }
.sp.hurt { background: var(--bad) !important; color: #fff; }
.pawn.filibuster { border-color: #8f99bf; border-width: 3px; border-radius: 6px 6px 22px 22px; background: #2b3142; }
/* Off the Record: blurred, smoky, dashed outline */
.pawn.stealth { border-style: dashed; border-color: #9aa3b8; }
.pawn.stealth .part { filter: blur(1.5px) grayscale(0.4) brightness(0.8); }
.pawn.stealth::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(10, 12, 20, 0.35) 0 6px, rgba(10, 12, 20, 0.12) 6px 12px);
  animation: stealthDrift 6s linear infinite; background-size: 34px 34px; }
@keyframes stealthDrift { to { background-position: 34px 0; } }
.badge.stl { background: #2a2f3d; color: #c9cfdd; border: 1px dashed #9aa3b8; }
.pawn.teflon { background-image: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%); }
.pawn.redtape { opacity: 0.75; }
.pawn.redtape::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(-45deg, rgba(227, 73, 72, 0.22) 0 6px, transparent 6px 14px); }
/* What you can use this turn: ready pawns glow and pulse green, new ones sleep (Zzz), used ones go grey. */
.pawn.ready { box-shadow: 0 0 0 2px var(--good), 0 0 14px rgba(27, 175, 122, 0.5); cursor: pointer; animation: readyPulse 1.6s ease-in-out infinite; }
.pawn.ready:hover { transform: translateY(-3px); }
@keyframes readyPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--good), 0 0 10px rgba(27, 175, 122, 0.4); }
  50% { box-shadow: 0 0 0 3px #3fe0a5, 0 0 22px rgba(27, 175, 122, 0.85); }
}
.pawn.asleep { border-color: #6f8fc9; }
.pawn.asleep .part { filter: saturate(0.35) brightness(0.55); }
.pawn .zzz { position: absolute; top: -14px; right: -10px; padding: 2px 8px 3px; border-radius: 12px;
  background: rgba(14, 22, 44, 0.92); border: 2px solid #6f8fc9; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); z-index: 3; pointer-events: none; display: flex; align-items: flex-end; gap: 1px;
  font-weight: 900; color: #cfe3ff; text-shadow: 0 1px 3px #000, 0 0 6px rgba(120, 170, 255, 0.7); }
.pawn .zzz b { display: block; animation: zFloat 2.4s ease-in-out infinite; }
.pawn .zzz b:nth-child(1) { font-size: 14px; }
.pawn .zzz b:nth-child(2) { font-size: 19px; animation-delay: 0.4s; }
.pawn .zzz b:nth-child(3) { font-size: 25px; animation-delay: 0.8s; }
@keyframes zFloat {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(-4px); opacity: 1; }
}
.pawn.spent { filter: grayscale(0.7) brightness(0.68); }
.pawn.selected { box-shadow: 0 0 0 3px var(--target), 0 0 18px rgba(242, 193, 78, 0.6); }
.badge { font-size: 10px; padding: 1px 5px; border-radius: 6px; background: var(--line); color: var(--ink-2); }
.badge.tef { background: #2f4f45; color: #fff; }
.badge.red { background: #6a2b2b; color: #fff; }

.targetable { box-shadow: 0 0 0 3px var(--target), 0 0 16px rgba(242, 193, 78, 0.55) !important; cursor: crosshair !important; }
.leader.targetable { border-color: var(--target); }
.spot-target { box-shadow: 0 0 0 3px var(--bad), 0 0 22px rgba(227, 73, 72, 0.7) !important; }
.their-turn .board.me, .their-turn .hand { filter: saturate(0.8); }

/* ---------------------------------------------------------------- cards */
.hand { grid-area: hand; display: flex; justify-content: center; align-items: flex-end; padding: 0 20px 12px; }
.card {
  --frame: #8c8f9b; --frame-2: #4a4e5a;
  width: 156px; height: 222px; border-radius: 12px; position: relative; padding: 5px;
  background: linear-gradient(160deg, var(--frame), var(--frame-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 16px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
}
.card.f-usa { --frame: #f08a4b; --frame-2: #7a2a10; }
.card.f-eu { --frame: #6aa8f0; --frame-2: #16386e; }
.card.f-neutral { --frame: #aab0bd; --frame-2: #3c404b; }
.card .art { height: 80px; border-radius: 8px 8px 3px 3px; overflow: hidden; background: #000; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6); }
.card.is-policy .art { border-radius: 40px 40px 3px 3px / 26px 26px 3px 3px; }
.art svg, .art img, .part svg, .part img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card .cost {
  position: absolute; left: -6px; top: -6px; width: 34px; height: 34px; display: grid; place-items: center; z-index: 2;
  font-weight: 900; font-size: 17px; color: #fff; text-shadow: 0 1px 2px #000;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, #6cb3ff, #1d5fc4);
}
.card .cost.up { background: linear-gradient(160deg, #ff8a8a, #b32121); }
.card .cost.down { background: linear-gradient(160deg, #6fe3b4, #12805a); }
.card .nameplate {
  margin: -9px 6px 0; position: relative; z-index: 1; text-align: center; padding: 3px 6px; border-radius: 6px;
  background: linear-gradient(180deg, #2c313d, #1b1f27); border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.card .cname { font-weight: 800; font-size: 12.5px; line-height: 1.1; }
.card .ctype { text-align: center; font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(255, 255, 255, 0.75);
  margin: 3px 0 2px; text-shadow: 0 1px 1px #000; }
.card .textbox { flex: 1; background: linear-gradient(180deg, #ece6d6, #d8cfb8); color: #2a241a; border-radius: 4px 4px 8px 8px;
  padding: 5px 7px 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 3px; overflow: hidden; }
.card .ctext { font-size: 11px; line-height: 1.25; text-align: center; color: #2a241a; }
.card .ctext b { color: #000; }
.card .cflavor { font-size: 9.5px; line-height: 1.2; color: #6b5f48; font-style: italic; text-align: center; }
.card .pw, .card .sp { position: absolute; bottom: -7px; width: 30px; height: 30px; display: grid; place-items: center;
  font-weight: 900; font-size: 16px; color: #fff; text-shadow: 0 1px 2px #000; z-index: 2; }
.card .pw { left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd166, #c27c00); border: 2px solid #5b3a00; }
.card .sp { right: -7px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 35% 30%, #6fe3b4, #12805a); border: 2px solid #0a4a33; }
.card .sp.hurt { background: radial-gradient(circle at 35% 30%, #ff8a8a, #b32121) !important; border-color: #5a1010; }

.hand .card { margin: 0 var(--overlap, -10px); transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 120%;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s; }
.hand .card:hover { transform: translateY(-30px) scale(1.08); z-index: 10; }
.hand .card.playable { box-shadow: 0 0 0 2px var(--good), 0 0 16px rgba(27, 175, 122, 0.55), 0 6px 16px rgba(0, 0, 0, 0.45); cursor: pointer; }
.hand .card.unplayable { filter: brightness(0.72) saturate(0.6); }
.hand .card.selected { transform: translateY(-38px) scale(1.1); z-index: 11; box-shadow: 0 0 0 3px var(--target), 0 0 22px rgba(242, 193, 78, 0.6); }

/* gallery */
.modal.gallery { max-width: min(1280px, 94vw); max-height: 90vh; overflow: auto; position: relative; }
.modal.gallery h3 { margin: 18px 0 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }
.gallery-grid { display: flex; flex-wrap: wrap; gap: 16px 14px; padding: 6px; }
.close-top { position: sticky; top: 0; float: right; z-index: 3; }

/* ---------------------------------------------------------------- side panel */
.logbox { background: var(--panel); border-radius: 14px; padding: 10px; flex: 1; overflow: auto; min-height: 0; }
.logbox h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.logbox div { font-size: 12px; color: var(--ink-2); padding: 1px 0; }
.logbox div.turn { color: var(--muted); margin-top: 8px; font-weight: 600; }
.logbox div.p1 { color: #f0b9a0; }
.side .actions { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- animation layer */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.fx .ghost { pointer-events: none; z-index: 31; }
.floater { position: fixed; font-weight: 900; font-size: 22px; white-space: nowrap; pointer-events: none;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.8); }
.floater.big { font-size: 30px; }
.floater.dmg { color: #ff6b6a; }
.floater.heal { color: #4fe0a8; }
.floater.info { color: #cfe3ff; font-size: 18px; }
.floater.tape { color: #ff9e9e; font-size: 18px; }
.banner { position: fixed; left: 50%; top: 50%; font-size: 46px; font-weight: 900; letter-spacing: 1px;
  padding: 14px 40px; border-radius: 16px; background: rgba(17, 19, 24, 0.85); border: 2px solid var(--target);
  color: var(--target); text-shadow: 0 2px 0 #000; }
.spotlight { position: fixed; left: 42%; top: 46%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.7)); }
.spotlight .card { width: 250px; height: 356px; padding: 7px; }
.spotlight .card .art { height: 132px; }
.spotlight .card .cname { font-size: 17px; }
.spotlight .card .ctext { font-size: 14px; }
.spotlight .card .cflavor { font-size: 12px; }
.spotlight .card .cost { width: 46px; height: 46px; font-size: 22px; }
.spotlight .card .pw, .spotlight .card .sp { width: 40px; height: 40px; font-size: 20px; }
.spotlight .card.spot-power { height: 290px; }
.spot-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--target);
  background: rgba(17, 19, 24, 0.9); padding: 3px 10px; border-radius: 8px; }

.arrow { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 25; }
.arrow.hidden { display: none; }
.arrow path#arrowPath { fill: none; stroke: var(--target); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 12;
  filter: drop-shadow(0 0 6px rgba(242, 193, 78, 0.7)); animation: dash 0.6s linear infinite; }
.arrow marker path { fill: var(--target); }
@keyframes dash { to { stroke-dashoffset: -14; } }

.zoom { position: fixed; z-index: 28; pointer-events: none; }
.zoom.hidden { display: none; }
.zoom .card { width: 210px; height: 300px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); }
.zoom .card .art { height: 110px; }
.zoom .card .ctext { font-size: 13px; }
.zoom .card .cflavor { font-size: 11px; }

/* ---------------------------------------------------------------- overlay */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; z-index: 40; }
.overlay.hidden { display: none; }
.modal { background: var(--panel); border-radius: 16px; padding: 24px; max-width: 580px; border: 1px solid var(--line); }
.modal h2 { margin-top: 0; }
.modal li { margin: 6px 0; color: var(--ink-2); }
.modal dl dt { font-weight: 700; margin-top: 8px; }
.modal dl dd { margin: 0; color: var(--ink-2); }
.modal.over { text-align: center; min-width: 380px; }
.modal.over h2 { font-size: 30px; }
.modal.won { border-color: var(--good); box-shadow: 0 0 40px rgba(27, 175, 122, 0.35); }
.modal.lost { border-color: var(--bad); box-shadow: 0 0 40px rgba(227, 73, 72, 0.3); }

@media (prefers-reduced-motion: reduce) {
  .endturn.pulse, .approval.low .num, .arrow path#arrowPath { animation: none; }
}
@media (max-width: 1100px) {
  .arena { grid-template-columns: 0 minmax(0, 1fr) 150px; column-gap: 6px; }
  /* the log is hidden; the buttons float in the top-left corner */
  .side { position: fixed; top: 6px; left: 6px; z-index: 20; padding: 0; width: auto; }
  .side .logbox { display: none; }
  .endturn { width: 140px; font-size: 17px; }
}

.side .actions { display: flex; gap: 6px; }
.side .actions button { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.side .actions button[data-act="menu"] { flex: 1; }

/* Title splash shown until the first click/key (browsers block sound before that) */
.enter-splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; cursor: pointer; text-align: center; padding: 16px;
  background: radial-gradient(ellipse at 30% 20%, rgba(178, 34, 52, 0.35), transparent 60%),
    radial-gradient(ellipse at 75% 80%, rgba(0, 51, 153, 0.4), transparent 60%), #0d1118;
  transition: opacity 0.5s ease, transform 0.5s ease; }
.enter-splash h1 { font-size: clamp(44px, 9vw, 96px); margin: 0; letter-spacing: -1px; }
.enter-splash .tagline { color: var(--ink-2); font-size: 18px; }
.enter-splash .enter-hint { margin-top: 36px; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; color: #f2c14e;
  animation: enterBlink 1.6s ease-in-out infinite; }
@keyframes enterBlink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.enter-splash.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }

/* ---------------------------------------------------------------- game font */
.start h1, .enter-splash h1, .enter-splash .enter-hint, .leader-pick h2, .start h3, .portrait, .hero .hero-name, .approval-badge, .capnum, .hero-power .pcost,
.hero-power .pname, .turn-panel .turn-no, .endturn, button.primary, .card .cost, .card .cname, .card .pw, .card .sp,
.pawn .pname, .pawn .pw, .pawn .sp, .pawn .zzz, .banner, .floater, .spot-label, .modal h2, .modal.gallery h3, .logbox h3,
.leader-pick .faction, .deck span {
  font-family: "Lilita One", "Nunito", system-ui, sans-serif; font-weight: 400; letter-spacing: 0.3px;
}
.start h1 { font-size: 64px; letter-spacing: 1px; text-shadow: 0 4px 0 #000, 0 0 30px rgba(242, 193, 78, 0.25); }
.card .cname { font-size: 14px; }
.pawn .pname { font-size: 13px; }
.banner { letter-spacing: 2px; }

/* ---------------------------------------------------------------- rarity & legendaries */
.card .rarity { display: inline-block; vertical-align: middle; margin: -2px 4px 0; transform: rotate(45deg); width: 9px; height: 9px;
  border: 1.5px solid rgba(0, 0, 0, 0.7); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.rarity.r-common { background: linear-gradient(135deg, #ffffff, #a9adb7); }
.rarity.r-rare { background: linear-gradient(135deg, #8fd0ff, #1f6fd6); }
.rarity.r-epic { background: linear-gradient(135deg, #e3a6ff, #8a2fc8); }
.rarity.r-legendary { background: linear-gradient(135deg, #ffe08a, #e08a00); box-shadow: 0 0 6px #ffb703; }
.spotlight .card .rarity { width: 12px; height: 12px; }

.card.legendary { --frame: #ffd36b; --frame-2: #8a5a00;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 14px rgba(255, 196, 64, 0.45), 0 6px 16px rgba(0, 0, 0, 0.45); }
.card.legendary::before { content: "♛"; position: absolute; top: -17px; left: 50%; transform: translateX(-50%); z-index: 3;
  font-size: 22px; color: #ffd36b; text-shadow: 0 2px 0 #5c3c00, 0 0 8px rgba(255, 196, 64, 0.7); }
.card.legendary .nameplate { background: linear-gradient(180deg, #4a3a14, #241a06); border-color: #ffd36b; }
.pawn.legendary { border-color: #ffd36b; border-width: 3px; box-shadow: 0 0 14px rgba(255, 196, 64, 0.4); }
.pawn .crown { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 20px; z-index: 2;
  color: #ffd36b; text-shadow: 0 2px 0 #5c3c00, 0 0 8px rgba(255, 196, 64, 0.7); pointer-events: none; }

/* Text fitting: ui.js raises data-fit until the text box no longer overflows. */
.card .textbox[data-fit="1"] > * { zoom: 0.93; }
.card .textbox[data-fit="2"] > * { zoom: 0.86; }
.card .textbox[data-fit="3"] > * { zoom: 0.8; }
.card .textbox[data-fit="4"] .cflavor, .card .textbox[data-fit="5"] .cflavor, .card .textbox[data-fit="6"] .cflavor { display: none; }
.card .textbox[data-fit="4"] .ctext { zoom: 0.93; }
.card .textbox[data-fit="5"] .ctext { zoom: 0.84; }
.card .textbox[data-fit="6"] .ctext { zoom: 0.76; }
.portrait { overflow: hidden; padding: 0; }
.portrait .emblem { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- battlefield */
.arena { --fc-usa: 235, 104, 52; --fc-eu: 57, 135, 229; --fc-neutral: 140, 143, 155;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(255, 255, 255, 0.035), transparent 70%); }
.arena.me-usa { --mine: var(--fc-usa); } .arena.me-eu { --mine: var(--fc-eu); }
.arena.opp-usa { --theirs: var(--fc-usa); } .arena.opp-eu { --theirs: var(--fc-eu); }
.board {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(var(--tint), 0.16), transparent 72%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 7px),
    #171a21;
  border: 1px solid rgba(var(--tint), 0.28);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.4s, border-color 0.4s;
}
.board.me { --tint: var(--mine); }
.board.opp { --tint: var(--theirs); }
.my-turn .board.me, .their-turn .board.opp {
  border-color: rgba(var(--tint), 0.6);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45), 0 0 26px rgba(var(--tint), 0.18);
}
.midline { border-top: 0; height: 2px; margin: 0 40px;
  background: linear-gradient(90deg, transparent, rgba(var(--theirs), 0.6) 25%, #c9cfdc 50%, rgba(var(--mine), 0.6) 75%, transparent); position: relative; }
.midline i { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(135deg, #f2c14e, #a86f00); border: 2px solid #1a1d24; box-shadow: 0 0 10px rgba(242, 193, 78, 0.6); }

/* ---------------------------------------------------------------- particles & legendary banner */
.particles { position: fixed; inset: 0; pointer-events: none; z-index: 32; }
.legend-banner { position: fixed; left: 50%; top: 46%; z-index: 33; pointer-events: none; text-align: center;
  padding: 10px 46px 14px; border-radius: 14px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(74, 58, 20, 0.95), rgba(36, 26, 6, 0.95)); border: 3px solid #ffd36b;
  box-shadow: 0 0 40px rgba(255, 196, 64, 0.55), 0 10px 30px rgba(0, 0, 0, 0.6); }
.legend-banner small { display: block; font-family: "Lilita One", sans-serif; font-size: 14px; letter-spacing: 6px;
  text-transform: uppercase; color: #ffd36b; }
.legend-banner span { display: block; font-family: "Lilita One", sans-serif; font-size: 42px; color: #fff;
  text-shadow: 0 3px 0 #5c3c00, 0 0 18px rgba(255, 196, 64, 0.7); }
.legend-banner.theirs { border-color: #ff8a6a; }
.side .actions button.off { opacity: 0.45; text-decoration: line-through; }

/* ---------------------------------------------------------------- log & attack preview */
.logbox div { display: flex; gap: 6px; align-items: baseline; }
.logbox div i { font-style: normal; width: 12px; flex: none; text-align: center; opacity: 0.85; }
.logbox div.lf-usa { color: #f6c3a8; }
.logbox div.lf-usa i { color: var(--usa); }
.logbox div.lf-eu { color: #bcd6f6; }
.logbox div.lf-eu i { color: var(--eu); }
.logbox div.turn { display: block; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 8px; }
.will-die { position: relative; }
.pawn.will-die::before, .hero.will-die .portrait::after {
  content: "☠"; position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; font-size: 46px;
  color: #fff; background: rgba(160, 20, 20, 0.45); border-radius: inherit; text-shadow: 0 2px 6px #000;
  animation: skull 0.6s ease-in-out infinite alternate; pointer-events: none; }
.hero .portrait { position: relative; }
@keyframes skull { to { transform: scale(1.04); background: rgba(190, 30, 30, 0.55); } }

/* ---------------------------------------------------------------- opening hand */
.modal.mulligan { max-width: 900px; text-align: center; }
.mull-cards { display: flex; gap: 18px; justify-content: center; margin: 22px 0 26px; flex-wrap: wrap; }
.mull-cards .card { cursor: pointer; transition: transform 0.15s, filter 0.15s; }
.mull-cards .card:hover { transform: translateY(-6px); }
.mull-cards .card.swap { filter: grayscale(0.8) brightness(0.6); transform: translateY(6px); }
.mull-cards .card.swap::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 90px;
  color: #ff6b6a; text-shadow: 0 4px 10px #000; font-family: "Lilita One", sans-serif; }
.endturn.wait { font-size: 15px; white-space: nowrap; }
.mull-cards .card.swap::after { font-size: 120px; color: #ff4d4d; -webkit-text-stroke: 3px #3a0000; z-index: 5; }

/* ---------------------------------------------------------------- start screen v2 */
.start { position: relative; max-width: 1060px; margin: 0 auto; padding: 34px 16px 70px; min-height: 100vh; max-height: 100vh;
  overflow: auto; display: flex; flex-direction: column; align-items: center; }
.start-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.start-bg i { position: absolute; width: 60vw; height: 60vw; border-radius: 50%; filter: blur(90px); opacity: 0.22; }
.start-bg i:first-child { background: var(--usa); left: -18vw; top: -10vw; animation: drift1 18s ease-in-out infinite alternate; }
.start-bg i:last-child { background: var(--eu); right: -18vw; bottom: -14vw; animation: drift2 21s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(8vw, 6vw) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-7vw, -5vw) scale(1.15); } }
.start header { text-align: center; }
.start .live, .enter-splash .live { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 2px; color: #fff; background: #d62828;
  padding: 2px 10px; border-radius: 4px; animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: 0.65; } }
.start h1 { margin: 6px 0 0; font-size: 76px; line-height: 1; }
.start .tagline { margin: 6px 0 18px; }
.start > h3 { margin: 6px 0 14px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 2px; font-size: 14px; }
.country-row { display: flex; align-items: stretch; gap: 18px; width: 100%; }
.country-row .vs { align-self: center; font-family: "Lilita One", sans-serif; font-size: 40px; color: var(--target);
  text-shadow: 0 3px 0 #000, 0 0 20px rgba(242, 193, 78, 0.4); }
.country-pick { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 20px;
  border-radius: 18px; border: 3px solid var(--line); background: linear-gradient(180deg, rgba(30, 34, 43, 0.95), rgba(20, 22, 28, 0.95));
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s; }
.country-pick:hover { transform: translateY(-4px); }
.country-pick.f-usa.selected { border-color: var(--usa); box-shadow: 0 0 30px rgba(235, 104, 52, 0.35); }
.country-pick.f-eu.selected { border-color: var(--eu); box-shadow: 0 0 30px rgba(57, 135, 229, 0.35); }
.country-pick:not(.selected) { opacity: 0.7; }
.cp-emblem { width: 112px; height: 112px; border-radius: 50%; overflow: hidden; border: 4px solid #c9cfdc; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6); }
.cp-emblem .emblem { width: 100%; height: 100%; display: block; }
.country-pick h2 { margin: 4px 0 0; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 30px; }
.cp-title { color: var(--ink-2); font-style: italic; margin-top: -4px; }
.cp-style { color: var(--ink); font-size: 14px; max-width: 360px; }
.cp-power { display: flex; gap: 10px; align-items: center; text-align: left; background: rgba(0, 0, 0, 0.25); padding: 8px 12px;
  border-radius: 10px; font-size: 13px; color: var(--ink-2); }
.cp-power .pcost { flex: none; width: 26px; height: 26px; display: grid; place-items: center; font-family: "Lilita One", sans-serif;
  color: #fff; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(160deg, #6cb3ff, #1d5fc4); }
.cp-leaders { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; }
.cp-leaders small { width: 100%; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.cp-leaders span { font-size: 12px; color: #ffd36b; border: 1px solid rgba(255, 211, 107, 0.5); background: rgba(74, 58, 20, 0.5);
  padding: 2px 8px; border-radius: 999px; }
.cp-flavor { color: var(--muted); font-style: italic; font-size: 12.5px; }
.start-row { justify-content: center; margin-top: 22px; }
.start-row.secondary { margin-top: 12px; }
.seg-label { color: var(--ink-2); text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.big-start { font-size: 20px; padding: 12px 34px; border-radius: 40px; box-shadow: 0 6px 18px rgba(57, 135, 229, 0.45); }
.ticker { position: fixed; left: 0; right: 0; bottom: 0; height: 34px; display: flex; align-items: center; z-index: 5;
  background: #0b0c10; border-top: 2px solid #d62828; overflow: hidden; }
.ticker b { flex: none; height: 100%; display: grid; place-items: center; padding: 0 14px; background: #d62828; color: #fff;
  font-family: "Lilita One", sans-serif; font-weight: 400; letter-spacing: 1.5px; }
.ticker-track { flex: 1; overflow: hidden; white-space: nowrap; }
.ticker-move { display: inline-block; animation: ticker 70s linear infinite; }
.ticker-move span { margin: 0 34px; color: #e9e9e9; font-size: 14px; }
.ticker-move span::before { content: "◆"; color: #d62828; margin-right: 34px; font-size: 10px; vertical-align: middle; }
@keyframes ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-move, .start-bg i, .start .live { animation: none; } }

/* ---------------------------------------------------------------- game over v2 */
.modal.over { min-width: 560px; }
.over-body { display: flex; gap: 28px; align-items: center; justify-content: center; margin: 10px 0 20px; }
.stats-table { border-collapse: collapse; font-size: 14px; }
.stats-table td, .stats-table th { padding: 5px 12px; }
.stats-table td { font-family: "Lilita One", sans-serif; font-size: 20px; text-align: center; min-width: 70px; }
.stats-table td.who { font-size: 14px; color: var(--ink-2); }
.stats-table th { font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.8px; }
.stats-table tr + tr { border-top: 1px solid var(--line); }
.over .rounds { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.mvp { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mvp small { color: var(--target); text-transform: uppercase; letter-spacing: 2px; font-weight: 800; }
.mvp span { color: var(--ink-2); font-size: 13px; }
.over-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------------- buffed stats & keyword glossary */
.pw.up, .sp.up { background: radial-gradient(circle at 35% 30%, #8dffb0, #1b9e4b) !important; border-color: #0a4a22 !important;
  color: #fff !important; box-shadow: 0 0 10px rgba(80, 230, 140, 0.6); }
.pw.down { filter: grayscale(0.6) brightness(0.85); }
.zoom { display: flex; gap: 10px; align-items: flex-start; }
.kw-box { width: 210px; display: flex; flex-direction: column; gap: 8px; }
.kw-box div { background: rgba(17, 19, 24, 0.95); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
.kw-box b { display: block; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 15px; color: var(--target); }
.kw-box span { font-size: 12.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- settings */
.modal.settings { min-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.modal.settings label { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--ink-2); }
.modal.settings input[type=range] { width: 170px; accent-color: var(--accent); }
.modal.settings label.check { justify-content: flex-start; gap: 10px; cursor: pointer; }
.modal.settings label.check input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.modal.settings .seg button.on { border-color: var(--target); color: var(--target); }
.modal.settings .primary { align-self: flex-end; margin-top: 6px; }
.side .actions button { padding: 6px 9px; }

/* ---------------------------------------------------------------- speech bubbles (voice-line subtitles) */
.speech { position: fixed; z-index: 34; pointer-events: none; max-width: 260px; padding: 9px 14px; border-radius: 16px;
  background: #fdfbf4; color: #1d1a14; font-weight: 700; font-size: 14.5px; line-height: 1.25; text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55); border: 2px solid #1d1a14; }
.speech::after { content: ""; position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: #1d1a14; border-bottom: 0; }

/* ---------------------------------------------------------------- gallery: click a card for a close-up */
.gallery .card[data-gal] { cursor: zoom-in; transition: transform 0.15s; }
.gallery .card[data-gal]:hover { transform: translateY(-5px) scale(1.04); z-index: 2; }
.gallery-hint { color: var(--muted); margin-top: -6px; }
.modal.card-detail { display: flex; align-items: center; gap: 34px; max-width: min(1100px, 94vw); padding: 30px 26px; position: relative; }
.dt-card .card { zoom: 2.15; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(255, 255, 255, 0.2); }
.dt-info { flex: 1; min-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.dt-info h2 { margin: 0; font-size: 34px; }
.dt-meta { color: var(--ink-2); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.dt-meta .rarity { display: inline-block; width: 11px; height: 11px; transform: rotate(45deg); margin-right: 4px; border: 1.5px solid rgba(0, 0, 0, 0.7); }
.dt-stats { display: flex; gap: 10px; }
.dt-stat { font-family: "Lilita One", sans-serif; font-size: 18px; padding: 4px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.dt-stat.cost { color: #8fd0ff; } .dt-stat.pw { color: var(--gold); } .dt-stat.sp { color: #4fe0a8; }
.dt-text { font-size: 19px; line-height: 1.4; color: var(--ink); background: rgba(236, 230, 214, 0.06); border-left: 3px solid var(--target); padding: 10px 14px; border-radius: 6px; }
.dt-keys { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.dt-keys b { font-family: "Lilita One", sans-serif; font-weight: 400; color: var(--target); margin-right: 4px; }
.dt-flavor { font-style: italic; color: var(--muted); font-size: 15px; }
.dt-sound { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dt-line { font-style: italic; color: var(--ink-2); font-size: 14px; }
.dt-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.dt-count { color: var(--muted); font-size: 13px; }
.dt-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 64px; font-size: 32px; padding: 0; border-radius: 12px; }
.dt-nav.prev { left: -52px; } .dt-nav.next { right: -52px; }
@media (max-width: 1100px) { .modal.card-detail { flex-direction: column; } .dt-card .card { zoom: 1.6; } .dt-nav.prev { left: 6px; } .dt-nav.next { right: 6px; } }

/* ================================================================ phones (portrait) */
.rotate-hint { display: none; }
@media (max-width: 640px) {
  /* start screen */
  .start { margin: 18px auto; padding: 0 12px 60px; }
  .start h1 { font-size: 44px; }
  .start .tagline { font-size: 14px; margin: 4px 0 14px; }
  .country-row { gap: 6px; }
  .country-row .vs { font-size: 22px; }
  .country-pick { padding: 12px 8px; gap: 4px; min-width: 0; }
  .cp-emblem { width: 70px; height: 70px; border-width: 3px; }
  .country-pick h2 { font-size: 19px; }
  .cp-title { font-size: 12px; }
  .cp-style, .cp-power, .cp-flavor { display: none; }
  .cp-leaders { font-size: 11px; }
  .start-row { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .start-row .big-start { width: 100%; }
  .start-row.secondary button { font-size: 13px; padding: 7px 10px; }
  .ticker { height: 28px; }
  .ticker-move span { font-size: 12px; }

  /* arena: one column, End turn beside the middle line */
  .arena {
    grid-template-columns: minmax(0, 1fr) 112px; /* fixed, so the turn button's text can't resize the boards */
    grid-template-rows: 24px auto minmax(0, 1fr) 46px minmax(0, 1fr) auto 132px;
    grid-template-areas:
      "ohand  ohand"
      "ohero  ocap"
      "oboard oboard"
      "mid    turn"
      "mboard mboard"
      "mhero  mcap"
      "hand   hand";
    height: 100vh; height: 100dvh; padding: 0 6px; column-gap: 6px;
  }
  .deck { display: none; }
  .side .actions button:not([data-act="settings"]):not([data-act="menu"]) { display: none; }
  .side .actions button { padding: 4px 9px; font-size: 12px; }
  .turn-panel { flex-direction: row; gap: 6px; position: relative; }
  .turn-panel .turn-no, .turn-panel .status { display: none; }
  .endturn { width: 112px; height: 40px; padding: 0 6px; font-size: 15px; line-height: 1.05; border-width: 2px; }
  .endturn.wait, .endturn:disabled { font-size: 13px; }
  /* Cancel floats under the button instead of pushing things aside */
  .turn-panel button[data-act="cancel"] { position: absolute; top: calc(100% + 2px); right: 0; z-index: 6; padding: 4px 10px; font-size: 12px; }
  .midline { margin: 0 6px; }

  .opp-hand .back { width: 28px; height: 40px; margin: 0 -5px; border-radius: 4px; border-width: 1px;
    transform: translateY(calc(-18px + var(--lift, 0px))) rotate(var(--tilt, 0deg)); }
  .hero-row { gap: 12px; padding: 2px 0; }
  .hero .portrait { width: 54px; height: 54px; font-size: 20px; border-width: 3px; }
  .hero .hero-name { font-size: 11px; padding: 0 6px; margin-top: 2px; }
  .approval-badge { right: -16px; top: 26px; min-width: 34px; height: 28px; font-size: 17px; border-width: 2px; }
  .hero-power { width: 46px; height: 46px; }
  .hero-power .pcost { width: 20px; height: 20px; top: -8px; font-size: 12px; }
  .hero-power .pname { font-size: 8.5px; padding: 6px 2px 0; }
  .capital { padding-right: 0; gap: 2px; }
  .capital.opp { padding-top: 4px; }
  .capital.me { padding-bottom: 6px; }
  .capital .crystals { max-width: 92px; gap: 2px; }
  .capital i { width: 8px; height: 11px; }
  .capnum { font-size: 16px; }

  /* officials: art + stats only (touch and hold to read the card) */
  .board { gap: 4px; padding: 4px; }
  .board.opp { border-radius: 40px 40px 10px 10px / 18px 18px 10px 10px; }
  .board.me { border-radius: 10px 10px 40px 40px / 10px 10px 18px 18px; }
  .pawn { width: min(58px, calc((100vw - 44px) / 6)); height: 82px; padding: 0 3px 12px; border-radius: 8px; gap: 1px; }
  .pawn .part { height: 46px; margin: 0 -3px 1px; border-radius: 6px 6px 0 0; }
  .pawn .pname { font-size: 8.5px; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pawn .ptext, .pawn .badges { display: none; }
  .pawn .pw, .pawn .sp { width: 20px; height: 20px; font-size: 12px; bottom: -6px; }
  .pawn .pw { left: -5px; }
  .pawn .sp { right: -5px; }
  .pawn .crown { font-size: 13px; top: -11px; }
  .pawn .zzz { top: -9px; right: -6px; padding: 0 4px 1px; border-width: 1px; border-radius: 8px; }
  .pawn .zzz b:nth-child(1) { font-size: 8px; }
  .pawn .zzz b:nth-child(2) { font-size: 10px; }
  .pawn .zzz b:nth-child(3) { font-size: 13px; }

  /* hand: smaller cards, spread to fit the width (js sets --overlap) */
  .arena .hand { align-items: flex-start; padding-top: 4px; }
  .arena .hand .card { zoom: 0.55; }
  .arena .hand .card:hover { transform: translateY(var(--lift, 0px)) rotate(var(--tilt, 0deg)); }
  .arena .hand .card.selected { transform: translateY(-60px) scale(1.15); }

  /* dialogs */
  .modal { padding: 16px 12px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; }
  .modal h2 { font-size: 22px; }
  .mull-cards { gap: 8px; margin: 12px 0 14px; }
  .mull-cards .card { zoom: 0.68; }
  .mull-cards .card.swap::after { font-size: 70px; }
  .gallery-grid { gap: 10px 6px; justify-content: center; }
  .gallery-grid .card { zoom: 0.72; }

  /* end screen */
  .modal.over { min-width: 0; width: calc(100vw - 16px); padding: 14px 10px; }
  .modal.over h2 { font-size: 21px; line-height: 1.15; margin: 4px 0 8px; }
  .over-body { flex-direction: column; gap: 8px; margin: 6px 0 12px; }
  .stats-table { width: 100%; }
  .stats-table td, .stats-table th { padding: 4px 4px; }
  .stats-table td { font-size: 17px; min-width: 0; }
  .stats-table td.who { font-size: 11.5px; line-height: 1.15; }
  .stats-table th { font-size: 10.5px; letter-spacing: 0.3px; }
  .over-body .rounds { margin: 6px 0 0; font-size: 13px; }
  .mvp { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 10px; align-items: center; }
  .mvp small { width: 100%; }
  .mvp span { max-width: 150px; text-align: left; }
  .mvp .card { zoom: 0.55; }
  .over-actions { flex-wrap: wrap; }
  .over-actions button { flex: 1; min-width: 140px; }

  /* touch-and-hold preview, centred */
  .zoom.touch { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); flex-direction: column; align-items: center; }
  .zoom.touch .card { zoom: 1.15; }
  .zoom.touch .kw-box { width: min(300px, 90vw); }
  .hero-power .ptip { display: none !important; }
}
/* phones held sideways: ask to turn upright */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .rotate-hint { display: flex; position: fixed; inset: 0; z-index: 2000; background: #0d1118; color: var(--ink);
    flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 16px; }
  .rotate-hint b { font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 26px; }
  .rotate-hint span { font-size: 54px; animation: rotateHint 2s ease-in-out infinite; }
  @keyframes rotateHint { 0%, 30% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }
}
