:root {
  --bg: #14161f;
  --panel: #1d2030;
  --panel2: #262a3d;
  --line: #343a55;
  --ink: #eef0f7;
  --muted: #9aa0b8;
  --accent: #f2b84b;
  --good: #5fd08a;
  --bad: #ff6b6b;
  --flame: #e8572a;
  --tide: #2f86e0;
  --grove: #3fa653;
  --forge: #b08a55;
  --shadow: #8a5cc7;
  --neutral: #8d93a5;
  --radius: 10px;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; }
#app { max-width: 820px; margin: 0 auto; padding: env(safe-area-inset-top) 10px calc(env(safe-area-inset-bottom) + 10px); }
h1, h2, h3 { margin: 0.4em 0; }
h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 18px; }
.muted { color: var(--muted); }
.warn { color: var(--accent); }

/* Buttons and inputs */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); color: #241a05; border-color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #2b0505; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.xs { padding: 2px 9px; font-size: 15px; border-radius: 7px; }
.btn.wide { width: 100%; margin-top: 14px; padding: 14px; font-size: 17px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.row { display: flex; }
.gap { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 320px; margin: 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); }
.chips.big .chip { font-size: 15px; padding: 9px 14px; }

/* Screens */
.screen { padding: 8px 0 30px; }
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 8px; }
.topbar h2 { text-align: center; font-size: 19px; }
.home { display: flex; flex-direction: column; justify-content: center; min-height: 90vh; text-align: center; }
.logo span { font-size: 64px; }
.logo h1 { font-size: 40px; letter-spacing: 0.02em; }
.logo p { color: var(--muted); margin-top: 0; margin-bottom: 36px; }
.rules p, .rules li { line-height: 1.5; font-size: 15px; }
.note { background: var(--panel); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; font-size: 14px; }

/* Deck list */
.deck-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.deck-name { font-weight: 700; font-size: 16px; }
.deck-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.deck-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Builder */
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.champ-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 10px 0; }
.champ { text-align: left; border: 2px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 8px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.champ small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.champ.sel { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 18%, var(--panel)); }
.summary { background: var(--panel); border-radius: var(--radius); padding: 10px; border: 1px solid var(--line); }
.counts { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.counts .ok b { color: var(--good); }
.curve { display: flex; gap: 6px; height: 60px; align-items: flex-end; margin: 10px 0 4px; padding-bottom: 16px; }
.bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }
.bar div { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: 0.85; }
.bar span { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
.bar em { position: absolute; top: -2px; left: 0; right: 0; text-align: center; font-size: 11px; font-style: normal; }
.errors { color: var(--accent); font-size: 13px; margin: 6px 0 0; padding-left: 18px; }
.ok-line { color: var(--good); font-size: 14px; margin-top: 6px; }
.decklist { margin: 10px 0; background: var(--panel); border-radius: var(--radius); padding: 8px 10px; border: 1px solid var(--line); }
.decklist summary { cursor: pointer; font-weight: 600; }
.dl-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dl-row .dl-name { flex: 1; }
.dl-row::before { content: ""; width: 4px; align-self: stretch; background: var(--fc); border-radius: 2px; }
.filters { position: sticky; top: 0; background: var(--bg); padding: 6px 10px; margin: 0 -10px; z-index: 5; }
.search { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: 10px; margin-top: 8px; }
.grid .card { width: 100%; }
.grid-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qty { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.player-setup { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin: 10px 0; }
.toggle { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; margin: 12px 0; flex-wrap: wrap; }
.toggle input { width: auto; transform: scale(1.3); }
.toggle small { color: var(--muted); width: 100%; padding-left: 28px; margin-top: -6px; }

/* Faction colors */
.f-flame { --fc: var(--flame); }
.f-tide { --fc: var(--tide); }
.f-grove { --fc: var(--grove); }
.f-forge { --fc: var(--forge); }
.f-shadow { --fc: var(--shadow); }
.f-neutral { --fc: var(--neutral); }

/* Card face */
/* Card frame. The card keeps a 5:7 shape; everything inside is sized in cqw (percent of the card's width),
   so a hand card and the big detail card look identical, just scaled. */
.card { --w: 116px; width: var(--w); aspect-ratio: 5 / 7; flex: 0 0 auto; position: relative; cursor: pointer; user-select: none; container-type: inline-size;
  border-radius: 5.5% / 3.9%; background: linear-gradient(160deg, #2b2d36, #0b0c11 55%, #1a1b22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.card.big { --w: min(300px, 82vw, calc((100dvh - 290px) / 1.4)); margin: 0 auto; cursor: default; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.card.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.card.glow { box-shadow: 0 0 0 2px var(--good), 0 0 12px color-mix(in srgb, var(--good) 60%, transparent); }
.card.dim { opacity: 0.5; }
.card.legend { background: linear-gradient(160deg, #6b5320, #1b1508 40%, #0b0c11 60%, #4a3a16); }
.card.legend.glow { box-shadow: 0 0 0 2px var(--good), 0 0 12px color-mix(in srgb, var(--good) 60%, transparent); }

.c-frame { --plate: color-mix(in srgb, var(--fc) 22%, #efe6d2); --edge: color-mix(in srgb, var(--fc) 65%, #000);
  position: absolute; inset: 3.2cqw; display: flex; flex-direction: column; gap: 1.8cqw; padding: 2.6cqw 2.6cqw 3cqw; border-radius: 3.5cqw;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1.2cqw, rgba(0, 0, 0, 0.035) 1.2cqw 2.4cqw),
    linear-gradient(170deg, color-mix(in srgb, var(--fc) 85%, #fff 5%), color-mix(in srgb, var(--fc) 55%, #000) 100%);
  box-shadow: inset 0 0 0 0.5cqw rgba(0, 0, 0, 0.35), inset 0 0.6cqw 0 rgba(255, 255, 255, 0.18); }
.f-neutral .c-frame { background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.2), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 1.2cqw, rgba(0, 0, 0, 0.04) 1.2cqw 2.4cqw),
    linear-gradient(170deg, #b9bfcc, #6a7184); }

/* Title and type bars: raised plates with a bevel */
.c-title, .c-type { display: flex; align-items: center; justify-content: space-between; gap: 1.5cqw; color: #1c1912;
  background: linear-gradient(180deg, color-mix(in srgb, var(--plate) 70%, #fff), var(--plate) 55%, color-mix(in srgb, var(--plate) 85%, #000));
  border: 0.6cqw solid var(--edge); box-shadow: 0 0.6cqw 0.9cqw rgba(0, 0, 0, 0.45), inset 0 0.5cqw 0 rgba(255, 255, 255, 0.55); }
.c-title { height: 12.5cqw; padding: 0 1.6cqw 0 2.8cqw; border-radius: 3cqw / 50%; }
.legend .c-title { border-color: #c8a24a; box-shadow: 0 0.6cqw 0.9cqw rgba(0, 0, 0, 0.45), inset 0 0.5cqw 0 rgba(255, 255, 255, 0.55), 0 0 0 0.5cqw #5c4612; }
.c-name { font-weight: 800; font-size: 8cqw; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-name.long { font-size: 7cqw; }
.c-name.xlong { font-size: 6.2cqw; letter-spacing: -0.02em; }
.c-title .cost { gap: 0.6cqw; flex: 0 0 auto; }
.c-title .pip { width: 8.4cqw; height: 8.4cqw; font-size: 5.2cqw; border-width: 0.35cqw;
  box-shadow: 0 0.4cqw 0.5cqw rgba(0, 0, 0, 0.45), inset 0 -0.7cqw 0 rgba(0, 0, 0, 0.2), inset 0 0.6cqw 0 rgba(255, 255, 255, 0.35); }

.c-art { margin: 0 1.2cqw; aspect-ratio: 120 / 72; overflow: hidden; border-radius: 0.8cqw; flex: 0 0 auto;
  border: 0.7cqw solid color-mix(in srgb, var(--fc) 35%, #000); box-shadow: 0 0 0 0.4cqw rgba(255, 255, 255, 0.2), 0 0.8cqw 1.4cqw rgba(0, 0, 0, 0.5); }
.c-art svg, .u-art svg, .champ-art svg { width: 100%; height: 100%; display: block; }

.c-type { height: 10cqw; padding: 0 1.6cqw 0 2.8cqw; border-radius: 2cqw; font-size: 5.8cqw; font-weight: 700; white-space: nowrap; }
.c-type.long { font-size: 4.9cqw; letter-spacing: -0.015em; }
.c-type span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-type .emblem { width: 7.2cqw; height: 7.2cqw; flex: 0 0 auto; filter: drop-shadow(0 0.3cqw 0.3cqw rgba(0, 0, 0, 0.45)); }

/* Rules box: parchment tinted with the faction color */
.c-text { flex: 1 1 auto; min-height: 0; overflow: hidden; margin: 0 1.2cqw; padding: 2.4cqw 3cqw; border-radius: 1.6cqw;
  position: relative; isolation: isolate; color: #201c15; font-size: 7.8cqw; line-height: 1.22;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fc) 10%, #f7f0e1), color-mix(in srgb, var(--fc) 16%, #e9dfc8));
  border: 0.5cqw solid color-mix(in srgb, var(--fc) 40%, #000); box-shadow: inset 0 0.5cqw 1.2cqw rgba(80, 60, 20, 0.25); }
.c-text.mid { font-size: 7cqw; }
.c-text.long { font-size: 6.4cqw; }
.c-text.xlong { font-size: 5.6cqw; line-height: 1.18; }
.big .c-text.big-norm { font-size: 7.8cqw; line-height: 1.22; }
.big .c-text.big-mid { font-size: 7cqw; line-height: 1.22; }
.big .c-text.big-long { font-size: 6.4cqw; line-height: 1.22; }
.c-text.xxlong { font-size: 5.1cqw; line-height: 1.16; }
.big .c-text.big-xlong { font-size: 5.6cqw; line-height: 1.18; }
.big .c-text.big-xxlong { font-size: 5.1cqw; line-height: 1.16; }
.c-text .watermark { position: absolute; z-index: -1; width: 34cqw; height: 34cqw; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0.14; filter: grayscale(0.3); }
.c-text b { font-weight: 800; }
.c-text i { opacity: 0.8; }
.c-flavor { font-style: italic; font-size: 0.86em; line-height: 1.2; opacity: 0.78; margin-top: 1.4cqw; padding-top: 1.4cqw; border-top: 0.35cqw solid color-mix(in srgb, var(--fc) 30%, transparent); }
.c-flavor.solo { margin-top: 0; padding-top: 0; border-top: 0; font-size: 0.92em; }
.card:not(.big) .c-flavor.big-only { display: none; }
.t-creature .c-text { padding-bottom: 7cqw; }
.t-resource .c-text { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: 7.4cqw; }
.t-resource .c-flavor { font-weight: 400; }

/* Attack / Health plaque */
.pt { position: absolute; right: 2.4cqw; bottom: 1.4cqw; display: flex; align-items: center; gap: 2.2cqw; padding: 0 2.6cqw; height: 11cqw; border-radius: 2.6cqw;
  font-weight: 900; font-size: 8.6cqw; color: #1c1912;
  background: linear-gradient(180deg, color-mix(in srgb, var(--plate) 70%, #fff), var(--plate) 55%, color-mix(in srgb, var(--plate) 85%, #000));
  border: 0.6cqw solid var(--edge); box-shadow: 0 0.8cqw 1.2cqw rgba(0, 0, 0, 0.5), inset 0 0.5cqw 0 rgba(255, 255, 255, 0.55); }
.legend .pt { border-color: #c8a24a; }
.pt span { display: inline-flex; align-items: center; gap: 0.6cqw; line-height: 1; }
.pt svg { width: 5.6cqw; height: 5.6cqw; }
.pt-atk svg { color: #b5561b; }
.pt-hp svg { color: #c8283c; }
.u-art { margin: 3px 0 1px; border-radius: 3px; overflow: hidden; aspect-ratio: 120 / 72; border: 1px solid color-mix(in srgb, var(--fc) 35%, #000); }
.champ-art { display: block; border-radius: 6px; overflow: hidden; aspect-ratio: 120 / 72; margin-bottom: 4px; }
.stats { position: absolute; bottom: 4px; left: 6px; right: 6px; display: flex; justify-content: space-between; }
.atk, .hp { min-width: 24px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; padding: 0 5px; border: 1px solid rgba(0, 0, 0, 0.45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.5); }
.atk { background: #e9a13b; color: #2a1700; }
.hp { background: #e94c5b; color: #2b0006; }
.hp.hurt { background: #7a1f2a; color: #ffd2d6; }
.atk.up, .hp.up { box-shadow: 0 0 0 2px var(--good), 0 1px 2px rgba(0, 0, 0, 0.5); }
.badge { position: absolute; top: -8px; right: -8px; background: var(--accent); color: #241a05; border-radius: 999px; padding: 2px 7px; font-weight: 800; font-size: 12px; }

/* Cost pips */
.cost { display: inline-flex; gap: 2px; }
.pip { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 50%; font-size: 10.5px; font-weight: 800; color: #fff; border: 1px solid rgba(0, 0, 0, 0.35); }
.pip-n { background: #d9dce6; color: #222; }
.pip-F { background: var(--flame); }
.pip-T { background: var(--tide); }
.pip-G { background: var(--grove); }
.pip-I { background: var(--forge); }
.pip-S { background: var(--shadow); }
.pip-W { background: #565c75; }
.pip-P { background: conic-gradient(var(--flame), var(--tide), var(--grove), var(--forge), var(--shadow), var(--flame)); }
.pip-spark { background: var(--accent); color: #241a05; }
.pip.tapped { opacity: 0.3; filter: grayscale(0.6); }
.res-row { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; }

/* Match layout */
.match { display: flex; flex-direction: column; gap: 6px; min-height: 100vh; padding-top: 6px; }
.pbar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; display: flex; flex-direction: column; gap: 5px; }
.pbar.target { outline: 3px dashed var(--bad); cursor: crosshair; }
.pinfo { display: flex; gap: 12px; align-items: center; }
.pinfo b { font-size: 16px; }
.core { font-weight: 800; color: #ff8a8a; font-size: 18px; }
.pres { font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.champ-line { display: flex; gap: 6px; flex-wrap: wrap; }
.champ-chip, .relic, .mini { font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--fc); background: color-mix(in srgb, var(--fc) 20%, var(--panel)); cursor: pointer; }
.opp-hand { display: flex; flex-wrap: wrap; gap: 4px; }
.mini { font-size: 11px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; min-height: 124px; padding: 6px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.025); border: 1px dashed var(--line); }
.board .empty { grid-column: 1 / -1; align-self: center; text-align: center; color: var(--muted); font-size: 13px; }
.unit { --plate: color-mix(in srgb, var(--fc) 22%, #efe6d2); --edge: color-mix(in srgb, var(--fc) 65%, #000);
  position: relative; border-radius: 8px; padding: 4px 4px 27px; min-height: 112px; cursor: pointer; border: 2px solid #0b0c11; transition: transform 0.15s;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 3px, rgba(0, 0, 0, 0.035) 3px 6px),
    linear-gradient(170deg, color-mix(in srgb, var(--fc) 85%, #fff 5%), color-mix(in srgb, var(--fc) 55%, #000));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.unit.f-neutral { background: linear-gradient(170deg, #b9bfcc, #6a7184); }
.unit.tapped { opacity: 0.55; transform: rotate(-5deg) scale(0.95); }
.unit.sel { outline: 3px solid var(--accent); }
.unit.glow { box-shadow: 0 0 0 2px var(--good), 0 0 12px color-mix(in srgb, var(--good) 60%, transparent); }
.unit.target { box-shadow: 0 0 0 3px var(--bad), 0 0 14px var(--bad); animation: pulse 1s infinite; }
.unit.attacking { border-color: var(--accent); opacity: 1; transform: translateY(6px); }
.opp-board .unit.attacking { transform: translateY(8px); }
.my-board .unit.attacking { transform: translateY(-8px); }
.u-name { font-weight: 800; font-size: 11px; line-height: 1.15; color: #1c1912; padding: 2px 4px; border-radius: 4px; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--plate) 70%, #fff), var(--plate) 55%, color-mix(in srgb, var(--plate) 85%, #000)); border: 1px solid var(--edge); }
.u-kw { font-size: 9.5px; font-weight: 700; color: #fff; margin-top: 2px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.u-tags { font-size: 12px; position: absolute; top: 20px; right: 4px; text-shadow: 0 1px 2px #000; }
.u-label { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #241a05; font-weight: 800; font-size: 11px; border-radius: 999px; padding: 1px 7px; white-space: nowrap; z-index: 2; }
.unit .stats { left: 4px; right: 4px; }
.unit .atk, .unit .hp { min-width: 20px; height: 20px; font-size: 13px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--bad), 0 0 4px var(--bad); } }
.center { display: flex; flex-direction: column; gap: 5px; padding: 4px 2px; }
.banner { font-weight: 700; text-align: center; font-size: 15px; color: var(--accent); min-height: 20px; }
.recent { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.35; cursor: pointer; }
.recent .log-turn { color: var(--ink); font-weight: 700; }
.log-hit { color: #ffb3a1; }
.log-good { color: #a6ecbf; }
.log-bad { color: #ff9b9b; }
.log-turn { color: var(--accent); font-weight: 700; }
.actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.champ-btn { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 25%, var(--panel2)); }
.hand { display: flex; gap: 8px; overflow-x: auto; padding: 8px 4px 12px; scroll-snap-type: x proximity; }
.hand .card { scroll-snap-align: start; }
.hand .empty { color: var(--muted); padding: 20px; }

/* Overlays */
.handoff { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; text-align: center; z-index: 50; padding: 20px; }
.handoff h2 { font-size: 30px; }
.modal-back { position: fixed; inset: 0; background: rgba(5, 6, 12, 0.72); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: var(--panel); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 14px calc(env(safe-area-inset-bottom) + 16px); border: 1px solid var(--line); }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 18px; } }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.why { color: var(--accent); font-size: 14px; text-align: center; }
.choose { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.full-log { font-size: 13px; line-height: 1.45; max-height: 60vh; overflow-y: auto; }
.over { text-align: center; }
.trophy { font-size: 60px; }
.code { min-height: 90px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; max-width: 90vw; text-align: center; }

@media (min-width: 700px) {
  .card { --w: 150px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 420px) {
  .board { gap: 4px; padding: 4px; }
  .unit { padding: 4px 3px 26px; }
  .u-name { font-size: 10px; padding: 1px 3px; }
  .u-name.long-word { font-size: 8.6px; letter-spacing: -0.03em; }
  .card { --w: 112px; }
}
