/* Lil: dark "night table" look. Fixed homes: top bar, status line, then the phase view. */
:root {
  color-scheme: dark;
  /* 1.3 palette "lantern and slate": deep blue-green slate, verdigris teal; 1.4 (zeynep): the amber accent
     became violet (amber stays only on gold numbers, warnings and legendary-orange) */
  --bg: #0f1619; --panel: #172126; --panel2: #1f2b31; --line: #2d3d44; --text: #ece6d6; --muted: #93a3a6;
  --mine: #5fa3dc; --mine-soft: #5fa3dc33; --foe: #e2705f; --foe-soft: #e2705f33;
  --accent: #a687f5; --accent-soft: #2a2245; --accent-line: #5d4a9c; --gold: #e8c46b;
  --teal: #5fb8a6; --teal-soft: #5fb8a622;
  --good: #7cc47f; --warn: #e8ae4c; --bad: #d9534a;
  --floor: #30353f; --floor2: #2c313a; --wall: #090a0d; --low: #6b5a43; --rubble: #3a3630;
  --zone: #c2412d; --conc: #8fb7d9;
  --r-common: #9aa0ab; --r-uncommon: #7cc47f; --r-rare: #5fa3dc; --r-epic: #b07ce0; --r-legendary: #f08a4b;
  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  /* simple textures: fine grain everywhere, a faint lantern glow at the top */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--grain), radial-gradient(1200px 500px at 50% -120px, #a687f514, transparent 70%), var(--bg); background-attachment: fixed; color: var(--text); font-family: var(--f-body); font-size: 15px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; min-width: 0; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--bad); }
.label { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.app { display: grid; grid-template-rows: auto auto 1fr; min-height: 100%; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); gap: 10px; max-width: 1400px; margin: 0 auto; }
.app > * { min-width: 0; }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 24px; letter-spacing: .04em; color: var(--text); text-decoration: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; text-decoration: none; color: var(--text); }
#phase-chip { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.codechip { font-family: var(--f-mono); }
.chip.offline { color: var(--muted); border-style: dashed; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.helpbtn, .iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); font-family: var(--f-display); font-weight: 700; font-size: 19px; display: grid; place-items: center; padding: 0; }
.iconbtn { font-size: 16px; }

/* status line */
.status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.status .now { font-weight: 600; }

/* cards and buttons */
.card { background: linear-gradient(180deg, #ffffff06, transparent 40%), var(--panel); box-shadow: inset 0 1px 0 #ffffff0a; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.card h2 { margin: 0; font-family: var(--f-display); font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.card p { margin: 0; }
.card.narrow { max-width: 560px; width: 100%; margin: 24px auto 0; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-weight: 600; text-decoration: none; color: var(--text); text-align: center; display: inline-block; }
.btn.primary { background: var(--accent); color: #1a1405; border-color: var(--accent); }
.btn.danger { border-color: #7a3a33; color: #f0a090; }

/* lobby */
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; align-items: start; }
.lobby .span2 { grid-column: 1 / -1; }
.codeinput { font-size: 20px; letter-spacing: .2em; text-transform: uppercase; width: 9.5ch; }
.recent { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.options { display: grid; gap: 10px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset { padding: 6px 14px; font-size: 14px; }
.optgroup { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; margin: 0; }
.optgroup legend { padding: 0 6px; }
details.optgroup summary { cursor: pointer; padding: 2px 0; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; margin-top: 6px; }
.opt { display: grid; gap: 4px; font-size: 14px; }
.opt.check { display: flex; align-items: center; gap: 8px; }
.opt input[type="number"] { width: 8ch; }
.sugg { display: inline-flex; gap: 4px; }
.sugg .chip { padding: 2px 7px; }
.optsummary { display: grid; gap: 10px; }
.optsummary dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 4px 0 0; font-size: 14px; }
.optsummary dt { color: var(--muted); }
.optsummary dd { margin: 0; text-align: right; }
.optsummary dd.changed { color: var(--accent); font-weight: 600; }
.waiting { justify-items: center; text-align: center; }
.bigcode { font-size: 44px; letter-spacing: .18em; font-weight: 600; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.finished { text-align: center; justify-items: center; }

/* help drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(440px, 100%); background: var(--panel); border-left: 1px solid var(--line); padding: calc(16px + env(safe-area-inset-top, 0px)) 18px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; z-index: 20; display: grid; gap: 12px; align-content: start; box-shadow: -20px 0 40px #0008; }
.drawer h3 { margin: 0; font-family: var(--f-display); font-size: 26px; }
.drawer .stline { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 8px; padding: 8px 10px; font-weight: 600; }
.drawer ul { margin: 0; padding-left: 18px; display: grid; gap: 5px; line-height: 1.45; }
.drawer p { margin: 0; }
.drawer details { border-top: 1px solid var(--line); padding-top: 8px; }
.drawer summary { cursor: pointer; font-family: var(--f-display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.drawer details[open] summary { margin-bottom: 6px; }
.drawer .close { justify-self: end; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; }
.gloss { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 0; font-size: 14px; }
.gloss dt { font-weight: 700; }
.gloss dd { margin: 0; }

/* overlays */
.overlay { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 40; }
.overlay .box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; display: grid; gap: 6px; text-align: center; }
.popover { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 25; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; min-width: 220px; box-shadow: 0 12px 30px #0008; }
.toggle { display: flex; gap: 8px; align-items: center; }
.toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 6px; z-index: 50; width: min(440px, calc(100% - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; box-shadow: 0 8px 24px #0009; }
.toast.error { border-color: var(--bad); }

@media (max-width: 760px) {
  .app { padding-inline: 12px; }
  .lobby { grid-template-columns: 1fr; }
  .bigcode { font-size: 36px; }
  .card h2 { font-size: 22px; }
}

/* language switch (frontend/i18n) */
.langbtn { font-size: 13px; letter-spacing: .04em; }
.homeprefs { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; }
.homeprefs > .opt:first-child { flex: 1 1 200px; }
.seg { display: flex; gap: 6px; }

/* Details on hover / long-press (components/tip.js) */
.tipbox { position: fixed; z-index: 60; max-width: min(320px, calc(100vw - 16px)); background: var(--panel); border: 1px solid var(--accent-line, var(--line)); border-radius: 10px; padding: 10px 12px; box-shadow: 0 12px 30px #000a; pointer-events: none; font-size: 14px; line-height: 1.4; }
.tipbox p { margin: 4px 0 0; }
.tipbox .tiphead { font-weight: 700; }
.tipbox .tiphead.r-common { color: var(--r-common); } .tipbox .tiphead.r-uncommon { color: var(--r-uncommon); }
.tipbox .tiphead.r-rare { color: var(--r-rare); } .tipbox .tiphead.r-epic { color: var(--r-epic); } .tipbox .tiphead.r-legendary { color: var(--r-legendary); }
.tipbox .tipmeta { color: var(--muted); font-size: 12.5px; }
.tipbox[data-rarity] { --rc: var(--r-common); border: 1px solid color-mix(in srgb, var(--rc) 45%, var(--line)); border-top: 4px solid var(--rc); min-width: 220px; }
.tipbox[data-rarity="uncommon"] { --rc: var(--r-uncommon); } .tipbox[data-rarity="rare"] { --rc: var(--r-rare); }
.tipbox[data-rarity="epic"] { --rc: var(--r-epic); } .tipbox[data-rarity="legendary"] { --rc: var(--r-legendary); }
.tipbox .tiptop { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.tipbox .tiptop .tiphead { font-family: var(--f-display); font-size: 16px; }
.tipbox .tipcost { font-family: var(--f-mono); color: var(--mine); font-weight: 700; white-space: nowrap; }
.cardmodal { position: fixed; inset: 0; z-index: 70; background: #000a; display: grid; place-items: center; padding: 16px; }
.cardmodal .cardbox { position: static; pointer-events: auto; max-width: min(380px, 100%); width: 100%; display: grid; gap: 6px; font-size: 15px; }
.cardmodal .cardbox .row { margin-top: 6px; }
.tipbox .tipup { color: var(--accent); font-size: 13px; }
[data-card], [data-status], [data-tip] { -webkit-touch-callout: none; cursor: help; }
button[data-card], button[data-tip], a[data-card] { cursor: pointer; }

/* card chips (draft sheet, combat sheet) */
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
/* a picked card as a small card: rarity colored name, frame and tint (components/cardchip.js) */
.tchip { --rc: var(--r-common); display: inline-flex; flex-direction: column; gap: 1px; min-width: 96px; max-width: 220px; padding: 5px 9px 6px;
  border-radius: 8px; background: color-mix(in srgb, var(--rc) 9%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent);
  border-top: 3px solid var(--rc); cursor: help; font-size: 12.5px; line-height: 1.25; }
.tchip:hover, .tchip:focus-visible { background: color-mix(in srgb, var(--rc) 18%, var(--panel2)); outline: none; }
.tchip .tn { font-weight: 650; color: color-mix(in srgb, var(--rc) 70%, var(--text)); }
.tchip .tm { font-size: 11px; color: var(--muted); }
.tchip small { color: var(--muted); }
.tchip.dormant { opacity: .6; border-style: dashed; }
.tchip.r-uncommon { --rc: var(--r-uncommon); }
.tchip.r-rare { --rc: var(--r-rare); }
.tchip.r-epic { --rc: var(--r-epic); }
.tchip.r-legendary { --rc: var(--r-legendary); }

/* Help button: glows until Help was opened once on this screen (help/help.js) */
.helpbtn { background: var(--accent, #a687f5); color: #1b1a17; border-color: transparent; }
.helpbtn.pulse { animation: helppulse 1.8s ease-out infinite; }
@keyframes helppulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #a687f5) 70%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@media (prefers-reduced-motion: reduce) { .helpbtn.pulse { animation: none; outline: 2px solid var(--accent, #a687f5); outline-offset: 3px; } }
.helpnudge { position: fixed; top: calc(60px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 26; max-width: min(300px, calc(100vw - 24px)); display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--accent, #a687f5); border-radius: 10px; padding: 8px 8px 8px 12px; box-shadow: 0 10px 24px #0009; cursor: pointer; font-size: 14px; }
.helpnudge::before { content: ''; position: absolute; top: -7px; right: 14px; width: 12px; height: 12px; background: var(--panel); border-left: 1px solid var(--accent, #a687f5); border-top: 1px solid var(--accent, #a687f5); transform: rotate(45deg); }
.drawer .quick { background: var(--panel2); border-left: 3px solid var(--accent, #a687f5); border-radius: 8px; padding: 8px 12px; }
.drawer .quick ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.helpnudge .nx { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); padding: 0; color: var(--text); }

/* Draft dice screen (components/dice.js) */
.dice-overlay { position: fixed; inset: 0; z-index: 45; background: #000b; display: grid; place-items: center; padding: 16px; }
.dice-box { background: var(--panel); border: 1px solid var(--accent-line); border-radius: 14px; padding: 16px 18px; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; display: grid; gap: 10px; }
.dice-box h3 { margin: 0; font-family: var(--f-display); font-size: 24px; }
.dice-row { display: flex; gap: 12px; justify-content: center; padding: 8px 0; }
.die { width: 72px; height: 72px; display: grid; place-items: center; align-content: center; background: var(--panel2); border: 2px solid var(--accent-line); border-radius: 14px; font-family: var(--f-display); font-size: 32px; font-weight: 700; }
.die small { font-size: 11px; color: var(--muted); font-family: inherit; font-weight: 400; }
.die.d20 { clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); border-radius: 0; background: var(--accent-soft); }
.die.rolling { animation: dieshake .18s linear infinite; }
.die.landed { border-color: var(--accent); color: var(--accent); animation: dieland .35s ease-out; }
@keyframes dieshake { 0% { transform: rotate(-9deg) translateY(-2px); } 50% { transform: rotate(9deg) translateY(2px); } 100% { transform: rotate(-9deg) translateY(-2px); } }
@keyframes dieland { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.dice-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dice-table li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid transparent; font-size: 14px; }
.dice-table li.hot { border-color: var(--accent-line); background: var(--accent-soft); }
.dice-table li.picked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.dice-result { min-height: 1.4em; text-align: center; font-size: 17px; }
/* phone top bar: keep everything (the Help button above all) on one row */
@media (max-width: 420px) {
  .top { gap: 6px; }
  .brand { font-size: 21px; }
  .top .chip { padding: 3px 8px; }
  .helpbtn, .iconbtn { width: 34px; height: 34px; }
  #opp-chip { max-width: 76px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
}
/* 1.1: the roll as its own draft screen */
.dice-box.inline { width: 100%; max-width: 640px; max-height: none; border-color: var(--accent-line); box-shadow: 0 6px 24px #0006; }
.dice-box.inline h3 { font-size: 28px; }
.dice-box.inline .die { width: 96px; height: 96px; font-size: 42px; }
.dice-box.inline.rolled .dice-result { padding: 10px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.dice-box .btn.big { font-size: 17px; padding: 10px 26px; }
.roll-out { display: grid; gap: 8px; justify-items: center; }
.roll-text { font-size: 19px; }
.roll-chips { display: grid; gap: 8px; width: 100%; }
.roll-card { display: grid; gap: 4px; justify-items: center; text-align: center; }
/* 1.1 sound control */
.soundctl { gap: 6px; flex-wrap: wrap; }
.soundctl .vol { width: 110px; accent-color: var(--accent); }
.soundctl .vol:disabled { opacity: .4; }

/* 1.1 ability scores (components/abilities.js), on every screen: final score, modifier, base + bonus */
.abil { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.abil .stat { background: var(--panel2); border-radius: 6px; padding: 5px 7px; display: grid; gap: 0; text-align: center; }
.abil .stat b { font-size: 17px; }
.abil button.stat { border: 1px solid transparent; color: inherit; font: inherit; cursor: pointer; }
.abil button.stat:hover { border-color: var(--line, #3a3f4b); }
.abil button.stat.picked { border-color: var(--accent, #a687f5); box-shadow: 0 0 0 1px var(--accent, #a687f5) inset; }
.abil .stat .label { text-transform: uppercase; }
.ab-split { display: flex; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 2px; padding-top: 1px; }
.ab-bonus.pos { color: var(--good); }
.ab-bonus.neg { color: var(--bad); }
@media (max-width: 480px) { .abil { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.abil-mini { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0 10px; font-size: 12px; }
.abil-mini .label { text-transform: uppercase; font-size: 10px; }
.abil-mini sup { font-size: 9px; margin-left: 1px; }
.abil.tight { gap: 3px; }
.abil.tight .stat { padding: 3px 2px; }
.abil.tight .stat b { font-size: 15px; }

/* playtest 1.2 C1: pinned bar with the next-step buttons (lib/nextbar.js) */
.nextbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px max(16px, calc((100vw - 1200px) / 2)); padding-bottom: max(10px, env(safe-area-inset-bottom)); background: #0b0e14f2; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px #0007; transition: transform .2s ease; }
.nextbar .nb-acts { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.nextbar .nb-more { display: none; background: none; border: 1px dashed var(--line); color: var(--muted); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
body.nb-more .nextbar .nb-more { display: inline-block; }
body.nb-hide .nextbar { transform: translateY(110%); }
body:has(.nextbar) { padding-bottom: 76px; }

/* playtest 1.2 C2: rearrangeable ability scores stand out */
.swaphint { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 9px; margin-bottom: 5px; border-radius: 6px; border: 1px dashed var(--accent, #a687f5); background: var(--accent-soft, #a687f51a); }
.swaphint .swapic { color: var(--accent, #a687f5); font-weight: 700; font-size: 16px; line-height: 1.1; }
.swaphint.on { border-style: solid; }
.abil button.stat.swappable { border: 1px dashed var(--accent-line, #a687f566); position: relative; }
.abil button.stat.swappable::after { content: '⇄'; position: absolute; top: 1px; right: 4px; font-size: 10px; color: var(--accent, #a687f5); opacity: .8; }
.nextbar .nb-acts > .btn:only-child { background: var(--accent, #a687f5); color: #15120a; border-color: transparent; font-weight: 700; }

/* 1.3: possible results of random cards (components/odds.js) */
.odds { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.odds-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.odds-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.odds-rows .odds-rows { margin: 3px 0 2px 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.odds-line { display: flex; gap: 8px; align-items: baseline; font-size: 13px; line-height: 1.3; }
.odds-pct { min-width: 3.4em; text-align: right; color: var(--accent); font-size: 12px; }
.odds-head > .odds-line { font-weight: 600; }
.odds-more summary { cursor: pointer; color: var(--accent); margin: 2px 0 2px 4.2em; }
.odds-pool { margin: 4px 0 4px 4.2em; max-height: 180px; overflow: auto; }
.odds-pool .tchip { min-width: 0; padding: 2px 7px; font-size: 12px; }
.cardmodal .cardbox { max-height: calc(100vh - 32px); overflow: auto; }
.oddsbtn { margin-top: 6px; justify-self: start; }

/* 1.3 home page */
.home { display: grid; gap: 14px; max-width: 1100px; margin: 0 auto; width: 100%; }
.hero { position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(220px, 300px); gap: 18px; align-items: center;
  padding: 18px 22px; border-radius: 16px; border: 1px solid var(--accent-line); overflow: hidden;
  background: var(--grain), radial-gradient(500px 220px at 15% 50%, #a687f522, transparent 70%),
    repeating-linear-gradient(135deg, #ffffff05 0 2px, transparent 2px 10px), linear-gradient(135deg, #1d2c31, #142025 60%, #1a1720); }
.hero-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 14px #0009); }
.hero-title { margin: 0; font-family: var(--f-display); font-size: 64px; line-height: .9; letter-spacing: .03em; color: var(--accent); text-shadow: 0 2px 0 #1e1538, 0 0 24px #a687f544; }
.hero-sub { margin: 2px 0 6px; font-family: var(--f-display); font-size: 22px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.hero-line { margin: 0; max-width: 46ch; }
.hero-prefs { display: grid; gap: 10px; background: #0f1619aa; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.modes { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 14px; align-items: start; }
.mode { position: relative; display: grid; gap: 10px; align-content: start; padding: 16px; border-radius: 14px; color: inherit; text-decoration: none;
  border: 1px solid var(--line); background: var(--grain), linear-gradient(180deg, #ffffff08, transparent 50%), var(--panel); box-shadow: inset 0 1px 0 #ffffff0d, 0 8px 20px #0005; }
.mode h2 { margin: 0; font-family: var(--f-display); font-size: 26px; letter-spacing: .02em; }
.mode p { margin: 0; color: var(--muted); }
.mode-ic { position: absolute; top: 12px; right: 14px; font-size: 26px; opacity: .35; }
.mode-arena { border-color: var(--accent-line); background: var(--grain), radial-gradient(300px 160px at 80% 0%, #a687f526, transparent 70%), var(--panel); transition: transform .15s, border-color .15s; }
.mode-descent { grid-column: 1 / -1; border-color: #6b4a2f; background: var(--grain), radial-gradient(420px 180px at 85% 10%, #e3b45326, transparent 70%), radial-gradient(300px 140px at 10% 100%, #a4532c22, transparent 70%), var(--panel); transition: transform .15s, border-color .15s; }
.mode-descent:hover { transform: translateY(-2px); border-color: #e3b453; }
.mode-descent .mode-go { color: #e3b453; }
.mode-arena:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode-go { font-family: var(--f-display); font-size: 18px; color: var(--accent); letter-spacing: .04em; }
.mode-create { border-color: #2f5a52; }
.mode-create .btn.primary { justify-self: stretch; font-size: 16px; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.preset { display: grid; gap: 1px; text-align: left; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); }
.preset[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.custom > summary { cursor: pointer; color: var(--teal); padding: 4px 0; }
.custom[open] > summary { margin-bottom: 8px; }
.custom .optgrid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.home-links { display: flex; gap: 10px; flex-wrap: wrap; }
.hl { display: grid; gap: 1px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; }
.hl:hover { border-color: var(--teal); }
@media (max-width: 900px) {
  .hero { grid-template-columns: 110px minmax(0, 1fr); }
  .hero-prefs { grid-column: 1 / -1; }
  .modes { grid-template-columns: 1fr; }
  .mode-arena { order: -1; }
}
@media (max-width: 480px) {
  .hero { grid-template-columns: 84px minmax(0, 1fr); padding: 14px; gap: 12px; }
  .hero-title { font-size: 46px; }
  .hero-sub { font-size: 16px; }
  .hero-line { font-size: 13.5px; }
}

/* 1.4 newcomer help: explained words (i18n/glossary.js) and the stage guide (components/guide.js) */
.gl { text-decoration: underline dotted color-mix(in srgb, currentColor 55%, transparent); text-underline-offset: 3px; cursor: help; }
.gl:focus-visible { outline: 2px solid var(--accent); border-radius: 3px; }
.guide { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 60%, var(--panel)); }
.guide summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.guide[open] summary::after { content: '▴'; }
.guide .gicon { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.guide ul { margin: 8px 0 6px; padding-left: 20px; display: grid; gap: 4px; line-height: 1.4; }
.guide .btn { justify-self: start; }

/* 1.4: the hero names the game on the home page, so the top bar doesn't */
body.home .top .brand { display: none; }
.brand .bs { display: none; }
@media (max-width: 760px) { .brand .bl { display: none; } .brand .bs { display: inline; } .hero-title { font-size: 38px; } }

/* 2026-11-08: auto play switches (components/autoplay.js) */
.autoctl .autorow { gap: 6px; margin: 4px 0; }
.autobanner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #0b0e14e6; border: 1px solid var(--accent, #8b7bff);
  border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.autobanner > span { flex: 1 1 auto; min-width: 0; }
.deploy-side > .autobanner { margin-bottom: 8px; }
