/* StonkScape play page (index.html): header, entry bar, three columns
   (leaderboard | game | ways to score, your season, deposit/withdraw), the
   dock tabs under the game and the How it works drawer.
   Look: the $STONKSCAPE coin's gold on deep navy with teal/ice-blue highlights
   (brand/: coin, wordmark, banner). No third-party images.

   Layout: three columns from 1280 px; below that the game spans the page and
   the side panels pair up under it; at phone width (<= 760 px) everything
   stacks, game first. Touch screens normally play teavm.html instead (see
   the redirect in index.html); body.mobile / body.camera keep their old
   full-screen shells at the end of this file. */

:root {
  color-scheme: dark;
  --bg: #0a1426;
  --bg-2: #0e1b2e;
  --panel: #13223f;
  --panel-2: #172a4b;
  --panel-3: #1c3157;
  --border: #24385f;
  --border-2: #2f4a78;
  --gold: #f2b52a;
  --gold-hi: #ffd24a;
  --gold-lo: #8a5a12;
  --gold-ink: #1d1405;
  --cream: #fff3d6;
  --ice: #9ed3e6;
  --blue: #4fa3c4;
  --blue-2: #2f7fa6;
  --teal: #3f8c8c;
  --text: #e3ebf5;
  --muted: #8ea2bf;
  --dim: #6a7f9e;
  --red: #ff6a5a;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-title: Cinzel, "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-mono: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; color: var(--text); font: 13px/1.45 var(--font-body); overflow-x: hidden; touch-action: manipulation;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(63,140,140,.16), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(47,127,166,.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--gold-hi); }
a:hover { color: var(--cream); }
button { font: inherit; cursor: pointer; color: inherit; }
input, select { font: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.dot.live { background: var(--ice); box-shadow: 0 0 0 3px rgba(158,211,230,.18), 0 0 8px rgba(158,211,230,.8); }
.dot.gold { background: var(--gold-hi); box-shadow: 0 0 0 3px rgba(242,181,42,.18), 0 0 8px rgba(255,210,74,.7); }
.dot.blue { background: var(--blue); }

.contain { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 6px;
  font: 600 13px/1 var(--font-body); text-decoration: none; white-space: nowrap; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-2); transition: border-color .15s, color .15s, background .15s; }
.btn:hover { color: var(--gold-hi); border-color: var(--gold); }
.btn.ghost { background: transparent; }
.btn.primary { color: var(--gold-ink); border-color: #c98d14; font-weight: 700;
  background: linear-gradient(#ffd24a, #f2b52a 60%, #dc9c1c); box-shadow: inset 0 1px 0 rgba(255,246,200,.7), 0 2px 10px rgba(242,181,42,.18); }
.btn.primary:hover { color: var(--gold-ink); background: linear-gradient(#ffe07a, #f6c040 60%, #e4a524); }
.btn.small { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled, .btn.off { opacity: .5; cursor: not-allowed; }
.btn.off:hover, .btn:disabled:hover { color: inherit; border-color: inherit; }
.btn.primary.off, .btn.primary:disabled { opacity: 1; color: var(--gold); background: rgba(242,181,42,.06); border: 1px dashed rgba(242,181,42,.45); box-shadow: none; }
.btn.primary.off:hover, .btn.primary:disabled:hover { color: var(--gold); border-color: rgba(242,181,42,.45); }
.btn.on { color: var(--gold-hi); border-color: var(--gold); background: rgba(242,181,42,.1); }
.btn.active { color: var(--gold-hi); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-hi); text-decoration: underline; cursor: pointer; }

/* ---------- Header ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 18px; position: relative;
  background: linear-gradient(rgba(8,18,34,.80), rgba(8,18,34,.92)), url(header-stone.webp) center / cover, var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242,181,42,.55) 20%, rgba(158,211,230,.4) 80%, transparent); }
.brandmark { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.brandmark .coinmark { width: 52px; height: 52px; filter: drop-shadow(0 2px 8px rgba(242,181,42,.35)); }
.brandmark .wordmark { height: 52px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.potpill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(242,181,42,.5); background: linear-gradient(rgba(242,181,42,.12), rgba(242,181,42,.04)); color: var(--text); white-space: nowrap; }
.potpill:hover { border-color: var(--gold-hi); }
.potpill .k { font-size: 12px; color: var(--muted); }
.potpill .dia { color: var(--gold); font-size: 11px; }
.potpill b { font: 700 16px/1 var(--font-title); color: var(--gold-hi); letter-spacing: .3px; }
.hstats { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hstat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hstat b { font-size: 16px; color: var(--text); font-weight: 700; }
.hstat b.red { color: var(--red); }
.hbtns { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.hbtns .btn { height: 34px; }
.hbtns .btn.buy { border-color: rgba(242,181,42,.6); color: var(--gold-hi); }
#connectBtn.signed { max-width: 220px; }
#connectBtn.signed #connectText { overflow: hidden; text-overflow: ellipsis; }
#connectBtn .dot.live { background: #18406a; box-shadow: none; }

/* ---------- Entry bar (the Gate) ---------- */
.entrybar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 9px 18px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.entry { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.entryLine { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.entryLine b { color: var(--gold-hi); }
.gateIco svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ebar { width: min(420px, 100%); height: 5px; border-radius: 3px; background: #0a1322; border: 1px solid var(--border); overflow: hidden; }
.ebar i { display: block; height: 100%; width: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold-lo), var(--gold) 45%, var(--ice)); }
.entryMeta { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.entryMeta .emeta b { color: var(--ice); font-weight: 600; }
.entryMeta .emeta .tk { color: var(--gold-hi); }
.world { display: flex; gap: 4px; }
.world button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: transparent; border: 1px solid var(--border-2); white-space: nowrap; }
.world button.on { color: var(--text); border-color: var(--blue-2); background: rgba(79,163,196,.12); }
.world button.on .dot { background: var(--ice); box-shadow: 0 0 6px var(--ice); }
.world button:disabled { opacity: .6; cursor: default; }
.btn.ca { height: 26px; padding: 0 10px; font: 12px var(--font-mono); gap: 6px; background: transparent; }
.btn.ca .caLabel { color: var(--gold); font-weight: 700; }
.btn.ca .caIcon { opacity: .7; }
.btn.ca:disabled { opacity: .75; cursor: default; }
.btn.ca:disabled:hover { color: var(--text); border-color: var(--border-2); }

/* ---------- Main grid ---------- */
/* Side columns give way first, so the 765 px game keeps 1:1 down to about
   1366 px wide; below 1360 the game spans the page. */
.main { flex: 1 1 auto; display: grid; gap: 12px; padding: 12px; align-items: start;
  grid-template-columns: clamp(240px, 18vw, 330px) minmax(0, 1fr) clamp(260px, 20vw, 360px); }
.col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.center { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* Panels */
.panel { background: linear-gradient(180deg, var(--panel), #111f3a); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.phead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.ptitle { margin: 0; font: 700 19px/1.1 var(--font-title); color: var(--gold-hi); letter-spacing: .4px; text-shadow: 0 1px 0 #000, 0 0 16px rgba(242,181,42,.25); }
.psub { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.ptoggle { margin-left: auto; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-2); background: transparent; color: var(--text); font-size: 16px; line-height: 1; align-self: center; }
.ptoggle:hover { border-color: var(--gold); color: var(--gold-hi); }
.pbody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.panel.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 24px rgba(255,210,74,.5); } 100% { box-shadow: 0 0 0 0 transparent; } }

.select { width: 100%; height: 38px; padding: 0 34px 0 12px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--text); font-weight: 600;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23f2b52a' stroke-width='2'/%3E%3C/svg%3E") right 12px center no-repeat;
  appearance: none; -webkit-appearance: none; cursor: pointer; }
.select:hover { border-color: var(--gold); }
.select option, .select optgroup { background: var(--bg-2); color: var(--text); }
.input { width: 100%; height: 34px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); }
.input:focus { outline: none; border-color: var(--gold); }
.input::placeholder { color: var(--dim); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; padding: 2px 7px; border: 1px solid; border-radius: 999px; white-space: nowrap; font-weight: 700; }
.pill.live { color: var(--ice); border-color: #2c5f78; background: rgba(79,163,196,.12); }
.pill.soon { color: var(--muted); border-color: var(--border-2); background: transparent; }
.pill.warn { color: #ffc46b; border-color: #7a5320; background: rgba(242,181,42,.08); }
.pill.gold { color: var(--gold-hi); border-color: #7a5a12; background: rgba(242,181,42,.08); }
.chip { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; height: 26px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 12px; font-weight: 600; color: var(--text); background: var(--bg-2); }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
.note b { color: var(--text); font-weight: 600; }
.fine { font-size: 11px; color: var(--dim); margin: 0; }
.box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.box b { color: var(--text); }
.sub { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--ice); padding: 6px 0 4px; margin: 6px 0 0; border-bottom: 1px solid var(--border); }
.sub:first-child { margin-top: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; height: 40px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 700; font-size: 13px; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--gold-hi); border-bottom-color: var(--gold); }

/* ---------- Leaderboard ---------- */
.pot { position: relative; text-align: center; padding: 10px 10px 12px; border-radius: 6px; background: radial-gradient(ellipse at 50% 0%, rgba(242,181,42,.12), transparent 70%), var(--bg-2); border: 1px solid var(--border); }
.potTop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pot .lbl { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.pot .plaque { font-size: 10px; letter-spacing: .6px; color: var(--ice); border: 1px solid #2c5f78; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.pot .fig { font: 700 24px/1.2 var(--font-title); color: var(--gold-hi); margin-top: 6px; text-shadow: 0 2px 0 #000, 0 0 18px rgba(242,181,42,.3); }
.pot .fig small { font: 600 13px var(--font-body); color: var(--muted); }
.pot .usd { font-size: 11px; color: var(--muted); }
.pot .usd:empty { display: none; }
.pot .cd { margin-top: 6px; display: inline-flex; gap: 12px; font: 700 14px var(--font-title); color: var(--text); background: #0a1322; border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; }
.pot .cd span small { display: block; font: 400 9px var(--font-body); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); text-align: center; }
.pot.compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; text-align: left; padding: 10px 12px; }
.pot.compact .potTop { grid-column: 1; grid-row: 1; }
.pot .plaque { display: none; }  /* the board dropdown names the board */
.potTop { justify-content: center !important; }
.pot.compact .potTop { justify-content: flex-start !important; }
.pot.compact .lbl { letter-spacing: .6px; white-space: nowrap; }
.pot.compact .fig { grid-column: 2; grid-row: 1; margin: 0; font: 700 14px var(--font-body); text-shadow: none; text-align: right; white-space: nowrap; }
.pot.compact .usd { grid-column: 1 / -1; }  /* "Rewards paid in $STONK" under the label */
.pot.compact .cd { grid-column: 1 / -1; justify-self: start; margin: 0; font: 600 12px var(--font-body); padding: 3px 10px; border-radius: 999px; }
.pot.compact .cd span small { display: inline; margin-left: 6px; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--ice); }
.splits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.splits > div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; text-align: center; padding: 5px 2px; }
.splits .pl { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.splits .pc { font: 700 15px var(--font-title); color: var(--gold-hi); }
.splits .amt { font-size: 10px; color: var(--text); }
.splits > div > .pc ~ .pc { font: 10px var(--font-body); color: var(--muted); }

table.lb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lb th { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px 6px 6px; border-bottom: 1px solid var(--border); font-weight: 700; }
table.lb td { padding: 8px 6px; border-bottom: 1px solid rgba(36,56,95,.6); vertical-align: middle; line-height: 1.3; }
table.lb tr:last-child td { border-bottom: 0; }
table.lb tr.me td { background: rgba(242,181,42,.07); }
table.lb td.r, table.lb th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.lb .rank { width: 34px; padding-left: 0; color: var(--text); font-weight: 700; }
table.lb .rk { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--border-2); font-size: 12px; color: var(--ice); }
table.lb .rank.g1 .rk { background: radial-gradient(circle at 35% 30%, rgba(255,210,74,.35), rgba(138,90,18,.25)); border-color: var(--gold); }
table.lb .rank.g2 .rk { background: rgba(227,232,238,.12); border-color: #aeb8c4; }
table.lb .rank.g3 .rk { background: rgba(224,153,90,.14); border-color: #b9773d; }
table.lb .rk .trophy { width: 17px; height: 17px; }
table.lb .name { font-weight: 700; color: var(--text); word-break: break-word; }
table.lb .split { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.35; }
table.lb .fig { display: block; font-weight: 700; color: var(--gold-hi); font-size: 14px; white-space: nowrap; }
table.lb .figSub { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; }
table.lb .pay { color: var(--gold-hi); font-weight: 700; }
table.lb td.empty { text-align: center; color: var(--muted); padding: 18px 8px; line-height: 1.5; }
#lbTotal:empty { display: none; }
#viewBoard .note, #viewFinal .note { margin-top: 8px; }
.search { display: flex; gap: 6px; }
.search input { flex: 1; min-width: 0; }
.search .btn { height: 34px; }
#hsResult { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.hs-card { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 6px; padding: 10px 12px; }
.hs-card .who { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hs-card .who b { font: 700 16px var(--font-title); color: var(--gold-hi); }
.hs-card .who span { font-size: 11px; color: var(--muted); }
.hs-card .who span b { font: inherit; color: var(--text); }
.hs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 8px; }
.hs-grid .k { font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.hs-grid .v { font-weight: 700; font-size: 14px; color: var(--text); }
.hs-grid .v.green { color: var(--gold-hi); }
/* The archived Season 2 final line under the Season 3 cells (points only). */
.hs-final { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text); }
.hs-final .k { font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.hs-final b { white-space: nowrap; }
.hs-miss { font-size: 12px; color: #ffc0b6; background: rgba(255,106,90,.08); border: 1px solid #6e3030; border-radius: 6px; padding: 8px 10px; }
.src { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 12px; padding: 4px 2px; border-bottom: 1px solid rgba(36,56,95,.6); color: var(--muted); }
.src .r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }

/* Prizes / rankings (left column, under the leaderboard) */
#coinBoard .cbTabs button { height: 36px; }
#cbRank { max-height: 400px; overflow-y: auto; }
.cbEmpty { padding: 14px; color: var(--muted); }
#coinBoard .cbFoot { padding: 8px 14px 10px; font-size: 11px; color: var(--dim); border-top: 1px solid var(--border); }
.pvTitle { text-align: center; color: var(--ice); font-weight: 700; letter-spacing: 1.6px; font-size: 11px; padding: 12px 0 4px; text-transform: uppercase; }
.pvPot { text-align: center; color: var(--gold-hi); font: 700 26px var(--font-title); padding: 2px 0 10px; text-shadow: 0 2px 0 #000, 0 0 18px rgba(242,181,42,.3); }
.pvPot.soon { font-size: 20px; }  /* "Announced soon" until Season 3's pot is set */
.pvRow { display: flex; align-items: flex-end; justify-content: center; gap: 6px; padding: 0 12px; }
.pvBox { flex: 1; max-width: 96px; border: 1px solid var(--border-2); border-radius: 6px; text-align: center; padding: 6px 2px; background: var(--bg-2); }
.pvBox.first { padding: 12px 2px; border-color: var(--gold); background: rgba(242,181,42,.08); }
.pvBox .pl { color: var(--gold-hi); font-weight: 700; }
.pvBox .pc { font-size: 11px; color: var(--muted); }
.pvBox .amt { color: var(--text); font-weight: 700; font-size: 12px; }
.pvShared { margin: 8px 12px 4px; border: 1px solid var(--border-2); border-radius: 6px; text-align: center; padding: 5px; color: var(--text); background: var(--bg-2); font-size: 12px; }
.pvCloses { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0 12px; }
#cbRank .cbRow { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid rgba(36,56,95,.6); }
#cbRank .cbRow.hd { color: var(--muted); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; }
#cbRank .cbRow .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#cbRank .cbRow .r { width: 30px; color: var(--ice); }
#cbRank .cbRow .pct { width: 44px; text-align: right; color: var(--muted); font-size: 11px; }
#cbRank .cbRow .p { width: 56px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold-hi); font-weight: 700; }
.trophy { display: inline-block; vertical-align: middle; filter: drop-shadow(0 1px 0 rgba(0,0,0,.7)); }

/* ---------- Center: the game ---------- */
.stage-panel { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
/* The gold-bracket frame: fit to #stagewrap, which fitStage
   (teavm/portal-game.js) sizes to the game (765x503 at 1:1). */
.gframe { position: relative; padding: 10px; width: fit-content; max-width: 100%; }
.gframe .cnr { position: absolute; width: 26px; height: 26px; border: 0 solid var(--gold); pointer-events: none; filter: drop-shadow(0 0 6px rgba(242,181,42,.45)); }
.gframe .cnr.tl { left: 0; top: 0; border-left-width: 3px; border-top-width: 3px; border-top-left-radius: 4px; }
.gframe .cnr.tr { right: 0; top: 0; border-right-width: 3px; border-top-width: 3px; border-top-right-radius: 4px; }
.gframe .cnr.bl { left: 0; bottom: 0; border-left-width: 3px; border-bottom-width: 3px; border-bottom-left-radius: 4px; }
.gframe .cnr.br { right: 0; bottom: 0; border-right-width: 3px; border-bottom-width: 3px; border-bottom-right-radius: 4px; }
#stagewrap { position: relative; width: 767px; height: 505px; max-width: 100%; overflow: hidden; background: #000; display: block;
  border: 1px solid var(--border-2); box-shadow: 0 0 0 1px #050a14, 0 12px 40px rgba(0,0,0,.55), 0 0 60px rgba(79,163,196,.10); }
#stage { position: absolute; left: 0; top: 0; width: 1024px; height: 768px; background: #000; -webkit-user-select: none; user-select: none; }
#frame { display: none; }
#landing { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; z-index: 30;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(63,140,140,.22), transparent 70%), linear-gradient(#0e1f38, #070e1b); }
#landing .scroll { width: min(420px, 94%); padding: 18px 22px; background: rgba(19,34,63,.92); color: var(--text); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 10px; align-items: center; }
#landing .lcoin { width: 56px; height: 56px; animation: coinspin 2.4s ease-in-out infinite; filter: drop-shadow(0 2px 8px rgba(242,181,42,.35)); }
#landing .lword { height: 40px; width: auto; max-width: 100%; margin-top: -4px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
@keyframes coinspin { 0%, 100% { transform: rotateY(0); } 50% { transform: rotateY(180deg); } }
#landing p { margin: 0; max-width: 380px; color: var(--muted); font-size: 13px; line-height: 1.5; }
#landing p#bootmsg { color: var(--text); }
#start { height: 38px; padding: 0 30px; font-size: 15px; }
#landing .fine { font-size: 11px; color: var(--dim); }
#landing .fine a { color: var(--muted); }
#landerr { color: #ff9a8d !important; max-width: 380px; }
.playbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; width: 100%; }
.playbar .btn { height: 30px; padding: 0 11px; font-size: 12px; background: transparent; }
.playbar .btn.on { color: var(--gold-hi); border-color: var(--gold); background: rgba(242,181,42,.08); }
.playbar .sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 4px; }
.hint { align-self: stretch; text-align: right; font-size: 11.5px; color: var(--dim); padding: 0 4px; }
.hint b { color: var(--muted); font-weight: 600; }
#stagePanel:fullscreen { justify-content: center; background: #000; padding: 0; gap: 0; }
#stagePanel:fullscreen > :not(.gframe) { display: none !important; }
#stagePanel:fullscreen .gframe { padding: 0; }
#stagePanel:fullscreen .cnr { display: none; }
#stagePanel:fullscreen #stagewrap { max-width: none; border: 0; box-shadow: none; }
#kb { position: fixed; top: -40px; left: 0; width: 10px; height: 10px; opacity: .01; font-size: 16px; border: 0; padding: 0; background: transparent; color: transparent; }
#rotate { display: none; }

/* Big screen: the side columns step aside, the game takes the page width. */
body.bigscreen .main { grid-template-columns: minmax(0, 1fr); }
body.bigscreen .main > .col { display: none; }

/* "Remember me" box over the title screen */
#drem { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border: 1px solid var(--gold); border-radius: 6px; background: rgba(10,20,38,.94); color: var(--text);
  font: 12px/1.4 var(--font-body); box-shadow: 0 4px 14px rgba(0,0,0,.6); white-space: nowrap; }
#drem label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
#drem input { accent-color: var(--gold); }
#drem a { color: var(--muted); font-size: 11px; }
#dremGo { font: 700 12px var(--font-body); color: var(--gold-ink); background: linear-gradient(#ffd24a, #f2b52a); border: 1px solid #c98d14; border-radius: 4px; padding: 4px 10px; cursor: pointer; }
#dremGo:disabled { opacity: .6; cursor: default; }

/* Diagnostics drawer */
#diag { position: fixed; left: 0; right: 0; bottom: 0; max-height: 45%; overflow: auto; background: rgba(8,14,26,.97); border-top: 1px solid var(--gold); padding: 10px; z-index: 90; display: none; -webkit-user-select: text; user-select: text; }
#diag pre { white-space: pre-wrap; font-size: 11px; margin: 6px 0; color: #b9c8dc; font-family: var(--font-mono); }
#diag button { margin-right: 8px; }

/* Ticker + what's new */
.ticker { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; overflow: hidden; min-width: 0; }
.ticker .lbl { font: 700 13px var(--font-title); color: var(--gold-hi); white-space: nowrap; }
.ticker .msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); min-width: 0; flex: 1 1 auto; }
.ticker .msg b { color: var(--ice); }
.ticker .meta { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ticker .meta b { color: var(--ice); font-weight: 600; }
.ticker .meta .tk { color: var(--gold-hi); }
.whatsnew { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.whatsnew .wnHead { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.whatsnew .lbl { font: 700 13px var(--font-title); color: var(--gold-hi); white-space: nowrap; }
.whatsnew time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.whatsnew .wnTools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.whatsnew .wnToggle { width: 26px; height: 26px; padding: 0; border: 1px solid var(--border-2); border-radius: 6px; background: transparent; color: var(--text); font-size: 11px; line-height: 1; }
.whatsnew .wnToggle[aria-expanded="false"] { transform: rotate(-90deg); }
.whatsnew .wnList { list-style: none; margin: 0; padding: 6px 12px 8px; max-height: 140px; overflow-y: auto; }
.whatsnew .wnList li { position: relative; padding: 3px 0 3px 14px; line-height: 1.45; color: var(--text); font-size: 12.5px; }
.whatsnew .wnList li::before { content: "\25C6"; position: absolute; left: 0; top: 6px; font-size: 7px; color: var(--gold); }
.whatsnew .wnList li .new, .post ul.lines .new { color: var(--ice); font-size: 9px; font-weight: 700; letter-spacing: 1px; margin-right: 5px; border: 1px solid #2c5f78; border-radius: 3px; padding: 0 3px; }
.whatsnew.collapsed .wnList { display: none; }
.whatsnew.collapsed .wnHead { border-bottom: 0; }

/* ---------- Dock (under the game) ---------- */
.dock { display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dock .nav ul { list-style: none; margin: 0; padding: 0 6px; display: flex; flex: 1; overflow-x: auto; scrollbar-width: none; }
.dock .nav li { flex: 1 0 auto; }
.dock .nav button.tab { display: block; width: 100%; height: 42px; padding: 0 12px; background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.dock .nav button.tab:hover { color: var(--text); }
.dock .nav .on button.tab { color: var(--gold-hi); border-bottom-color: var(--gold); }
.dock .section { display: flex; flex-direction: column; min-height: 0; }
.tabpane[data-pane="wiki"] { height: 520px; }
.tabpane[data-pane="bridge"] .embed { height: 380px; flex: 0 0 auto; }
.tabpane[data-pane="shop"] .sectionBody, .tabpane[data-pane="news"] .sectionBody { max-height: 560px; }
.dock.attention { animation: dockPulse 0.8s ease-in-out 4; }
@keyframes dockPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,210,74,0); } 50% { box-shadow: 0 0 0 3px var(--gold-hi), 0 0 24px 4px rgba(255,210,74,.4); } }
.tabpane { display: none; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.tabpane.on { display: flex; }
.sectionHeader { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(10,20,38,.35); flex-wrap: wrap; }
.sectionHeader .plaque { font: 700 15px var(--font-title); color: var(--gold-hi); white-space: nowrap; }
.sectionHeader .hl { font-size: 12px; color: var(--muted); }
.sectionHeader .hr { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sectionBody { padding: 12px 14px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.embed { flex: 1 1 auto; min-height: 160px; display: flex; flex-direction: column; }
.embed iframe { flex: 1 1 auto; min-height: 0; width: 100%; border: 0; background: var(--bg-2); }
.embed .foot { padding: 6px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); background: var(--panel-2); display: flex; gap: 8px; align-items: center; }
.embed .foot .spacer { flex: 1; }
.embed .foot a { white-space: nowrap; }

/* Feature rows (shop) */
.feature { display: grid; grid-template-columns: 46px 1fr; gap: 2px 10px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); }
.feature .ico { width: 46px; height: 46px; background: var(--panel-3); border: 1px solid var(--border-2); border-radius: 6px; display: grid; place-items: center; grid-row: 1 / span 2; }
.feature .ico svg { width: 26px; height: 26px; fill: none; stroke: var(--gold-hi); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.feature .t { font-weight: 700; color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.feature .d { color: var(--muted); font-size: 12px; line-height: 1.4; }
.feature .d .p { float: right; font-weight: 700; color: var(--gold-hi); margin-left: 8px; }

/* Updates */
.newsfilters { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.newsfilters button { flex: 1 0 auto; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 700; color: var(--muted); background: transparent; border: 1px solid var(--border-2); border-radius: 999px; }
.newsfilters button:hover { color: var(--text); }
.newsfilters button.on { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.post { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.post .newsTitle { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border-bottom: 1px solid var(--border); }
.post .newsTitle b { color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .newsTitle time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.post p { margin: 0; padding: 8px 10px; line-height: 1.5; color: var(--muted); }
.post .more { padding: 0 10px 8px; font-size: 12px; }
.post .more a { font-weight: 700; text-decoration: none; }
.post.pinned { border-color: rgba(242,181,42,.45); }
.post.pinned .newsTitle { background: linear-gradient(90deg, rgba(242,181,42,.14), transparent); }
.post ul.lines { margin: 0; padding: 8px 10px 6px 26px; color: var(--muted); line-height: 1.45; }
.post ul.lines li { margin-bottom: 3px; }
.cat { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; padding: 1px 6px; border: 1px solid; border-radius: 999px; font-weight: 700; }
.cat.update { color: var(--ice); border-color: #2c5f78; }
.cat.patch { color: #8fc6ff; border-color: #2d4f7a; }
.cat.event { color: #ffad6b; border-color: #7a4320; }
.cat.season { color: var(--gold-hi); border-color: #7a5a12; }

/* Wiki Hopium chat */
.wiki .quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.wiki .quick button { border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.wiki .quick button:hover { border-color: var(--gold); color: var(--gold-hi); }
.chatLog { flex: 1 1 auto; height: 210px; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; background: rgba(5,10,20,.35); }
.chatLog .m { font-size: 13px; line-height: 1.5; word-break: break-word; }
.chatLog .m .who { color: var(--gold-hi); font-weight: 700; margin-right: 6px; }
.chatLog .m a { color: var(--ice); }
.chatLog .sys { font-size: 12px; color: var(--muted); font-style: italic; }
.chatBar { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); background: rgba(5,10,20,.35); }
.chatBar .msg { flex: 1; min-width: 0; }
.chatBar .btn { height: 34px; }
.hopiumLog { height: auto; min-height: 0; }

/* Bridge: accepted-token buttons */
.tokens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.token { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); font: 700 12px var(--font-body); cursor: pointer; }
.token img { width: 56px; height: 56px; object-fit: contain; }
.token:hover, .token.on { border-color: var(--gold); color: var(--gold-hi); }
.token.more { cursor: default; color: var(--muted); font-weight: 400; }
.token.more:hover { border-color: var(--border-2); color: var(--muted); }
.token .plus { display: grid; place-items: center; width: 56px; height: 56px; border: 1px dashed var(--border-2); border-radius: 50%; font-size: 26px; }
.bridgeNote { text-align: center; }
.bridgeRules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.bridgeRules li { background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 4px; padding: 7px 10px; font-size: 13px; color: var(--text); }
.bridgeRules b { color: var(--gold-hi); }

/* ---------- Right column ---------- */
.ways { list-style: none; margin: 0; padding: 4px 0; max-height: 360px; overflow-y: auto; }
.ways li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid rgba(36,56,95,.6); }
.ways li:last-child { border-bottom: 0; }
.ways .wl { flex: 1; min-width: 0; }
.ways .wl b { display: block; color: var(--text); font-size: 13.5px; }
.ways .wl small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 1px; }
.ways .wr { text-align: right; flex: 0 0 auto; }
.ways .wr b { display: block; color: var(--gold-hi); font-size: 14px; white-space: nowrap; }
.ways .wr small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.waysNote { padding: 10px 14px 14px; border-top: 1px solid var(--border); font-size: 11.5px; }
.youHead { display: flex; align-items: center; gap: 8px; }
.youHead b { flex: 1; font: 700 16px var(--font-title); color: var(--gold-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.youRank { font-size: 12px; color: var(--ice); border: 1px solid #2c5f78; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
#youPanel .note.payout { margin: 8px 0 10px; color: var(--ice); }  /* Season 3 rewards are paid in $STONK */
.youGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.youGrid > div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
.youGrid .k { display: block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.youGrid b { font-size: 18px; color: var(--text); }
.moneyTabs button { height: 44px; font-size: 14px; }

/* ---------- The Gate (over the game stage) ---------- */
#gate { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse 70% 60% at 50% 30%, rgba(63,140,140,.25), transparent 70%), linear-gradient(#0e1f38, #070e1b); }
.gatePanel { width: min(470px, 96%); padding: 18px 22px; margin: auto; background: rgba(19,34,63,.95); color: var(--text);
  border: 1px solid var(--border-2); border-top: 2px solid var(--gold); border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.6);
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.gateBrand { display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; }
.gateBrand .gcoin { width: 56px; height: 56px; flex: 0 0 auto; filter: drop-shadow(0 2px 8px rgba(242,181,42,.35)); }
.gateBrand .gword { height: 54px; width: auto; min-width: 0; max-width: calc(100% - 66px); filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
/* The stage behind the Gate: the banner's dark teal stone, faint. */
#gate::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .45;
  background: url(gate-stone.webp?v=3) center / cover; }
#gate { isolation: isolate; }
.gatePanel h2 { margin: 0; font: 700 20px var(--font-title); color: var(--gold-hi); }
.gatePanel p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.gateSteps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; }
.gateSteps li { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 12.5px; color: var(--text); text-align: left; }
.gateSteps b { color: var(--gold-hi); }
.gateBtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#gateStatus { min-height: 14px; font-size: 11.5px; color: var(--ice); }
.gatePanel .fine b { color: var(--muted); }

/* ---------- How it works drawer ---------- */
.drawerShade { position: fixed; inset: 0; z-index: 70; background: rgba(3,8,18,.62); opacity: 0; transition: opacity .25s; }
.drawerShade.in { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(680px, 100%); display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid var(--border-2); box-shadow: -20px 0 60px rgba(0,0,0,.55);
  transform: translateX(100%); transition: transform .25s ease; }
.drawer.in { transform: none; }
.drawerHead { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-2);
  background: linear-gradient(90deg, rgba(242,181,42,.20), rgba(47,127,166,.22)), url(header-stone.webp) center / cover; }
.drawerHead h2 { margin: 0; flex: 1; font: 900 28px/1.1 var(--font-title); color: var(--gold-hi); letter-spacing: .5px; text-shadow: 0 2px 0 #000, 0 0 20px rgba(242,181,42,.35); }
.drawerClose { width: 38px; height: 38px; border-radius: 6px; border: 1px solid var(--border-2); background: rgba(10,20,38,.6); color: var(--text); font-size: 24px; line-height: 1; }
.drawerClose:hover { border-color: var(--gold); color: var(--gold-hi); }
.drawerBody { flex: 1; overflow-y: auto; padding: 18px 22px 26px; display: flex; flex-direction: column; gap: 12px; }
.drawerBody > * { flex-shrink: 0; }
.drawerBody > .btn.block { height: 40px; font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.steps li > b { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font: 900 17px var(--font-title); color: var(--gold-ink);
  background: radial-gradient(circle at 35% 30%, #ffe07a, var(--gold) 60%, #c98d14); box-shadow: 0 0 0 3px rgba(242,181,42,.15); }
.steps h3 { margin: 2px 0 4px; font-size: 15px; color: var(--text); }
.steps p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.steps p b { color: var(--text); }
.warnCard { border: 1px solid #b4473c; border-radius: 8px; padding: 14px 16px; background: linear-gradient(rgba(255,106,90,.10), rgba(255,106,90,.04)); }
.warnCard b { color: #ff8f80; font-size: 14px; }
.warnCard p { margin: 4px 0 0; color: #f2d2cc; font-size: 13px; line-height: 1.55; }

.footer { border-top: 1px solid var(--border); padding: 14px 16px 18px; text-align: center; font-size: 11.5px; color: var(--dim); }
.footBrand { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; text-decoration: none; opacity: .9; }
.footBrand:hover { opacity: 1; }
.footBrand img:first-child { width: 24px; height: 24px; filter: drop-shadow(0 1px 4px rgba(242,181,42,.3)); }
.footBrand img + img { height: 22px; width: auto; }
.footer nav { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; font-weight: 600; }
.footer nav a { text-decoration: none; color: var(--muted); }
.footer nav a:hover { color: var(--gold-hi); }

/* Players online per world (top-left of the game) and the frame-rate /
   ping readout (top-right): see-through and click-through. */
#onlineBadge { position: absolute; left: 10px; top: 10px; z-index: 50; display: none; pointer-events: none;
  padding: 2px 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.45); color: #ffd98a; opacity: 0.8;
  font: bold 11px/1.35 Verdana, Arial, sans-serif; text-shadow: 1px 1px 0 #000; white-space: nowrap; -webkit-user-select: none; user-select: none; }
body.playing #onlineBadge.has { display: block; }
#perfBadge { position: absolute; right: 10px; top: 10px; z-index: 50; display: none; pointer-events: none;
  padding: 2px 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.55); color: #ffd98a;
  font: bold 11px/1.35 Verdana, Arial, sans-serif; text-shadow: 1px 1px 0 #000; white-space: nowrap; -webkit-user-select: none; user-select: none; font-variant-numeric: tabular-nums; }
body.playing.perfhud #perfBadge { display: block; }
#perfBadge .ok { color: var(--ice); } #perfBadge .mid { color: var(--gold-hi); } #perfBadge .bad { color: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .topbar { gap: 14px; }
  .hstats { gap: 14px; }
}
/* Below 1360: the game spans the page; leaderboard and the right column
   pair up under it; the dock follows. */
@media (max-width: 1359px) {
  .main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .center { display: contents; }
  .main > .center > * , .main > .col { min-width: 0; }
  .stage-panel { order: 1; grid-column: 1 / -1; }
  .ticker { order: 2; grid-column: 1 / -1; }
  .whatsnew { order: 3; grid-column: 1 / -1; }
  .col.left { order: 4; }
  .col.right { order: 5; }
  .dock { order: 6; grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  body { font-size: 13px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .brandmark .coinmark { width: 40px; height: 40px; }
  .brandmark .wordmark { height: 38px; }
  .brandmark { order: 1; }
  .hbtns { order: 2; margin-left: auto; gap: 6px; }
  .hbtns .btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .hbtns .btn.ghost:not(#howBtn):not(.buy) { display: none; }
  .potpill { order: 3; height: 34px; padding: 0 12px; }
  .potpill b { font-size: 14px; }
  .hstats { order: 4; gap: 12px; }
  .hstat { font-size: 12px; } .hstat b { font-size: 14px; }
  .entrybar { padding: 8px 12px; gap: 8px; }
  .entryLine { font-size: 13px; }
  .entryMeta { margin-left: 0; gap: 8px; }
  .main { grid-template-columns: minmax(0, 1fr); padding: 10px 8px; gap: 10px; }
  .col.left, .col.right { order: 4; }
  .col.right { order: 5; }
  .gframe { padding: 7px; }
  .gframe .cnr { width: 18px; height: 18px; }
  .playbar .btn { height: 30px; padding: 0 9px; }
  .playbar .sep { display: none; }
  .hint { text-align: center; }
  .ticker { flex-wrap: wrap; row-gap: 4px; }
  .ticker .meta { margin-left: 0; flex-wrap: wrap; }
  .tabpane[data-pane="wiki"] { height: 480px; }
  .drawerHead { padding: 14px 16px; }
  .drawerHead h2 { font-size: 23px; }
  .drawerBody { padding: 14px 14px 22px; }
  /* The boot card and the Gate need more room than a phone-wide game: the
     frame grows to fit them until the game starts. */
  body:not(.playing) #stagewrap { height: auto !important; min-height: 260px; }
  body:not(.playing) #landing, body:not(.playing) #gate:not([hidden]) { position: relative; inset: auto; min-height: 260px; }
  #landing .scroll { padding: 14px 14px; }
  .gatePanel { padding: 14px; }
  .gatePanel .gateBtns .btn { flex: 1 1 100%; }
}
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .brandmark { gap: 6px; }
  .brandmark .coinmark { width: 34px; height: 34px; }
  .brandmark .wordmark { height: 29px; }
  .hbtns .btn { padding: 0 9px; }
  .world button { padding: 0 8px; }
  .entryMeta .emeta { flex: 1 1 100%; }
  .playbar .btn { font-size: 11.5px; padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawerShade { transition: none; }
  #landing .lcoin { animation: none; }
}

/* ---------- Mobile (legacy body.mobile): the full-screen shell ---------- */
body.mobile { padding: 0; overflow: hidden; background: #0a1426; -webkit-user-select: none; user-select: none; }
body.mobile .topbar, body.mobile .entrybar, body.mobile .col, body.mobile .ticker, body.mobile .whatsnew, body.mobile .footer, body.mobile .playbar, body.mobile .hint, body.mobile .dock { display: none !important; }
body.mobile .main { display: block; padding: 0; }
body.mobile .center, body.mobile .stage-panel, body.mobile .gframe { display: contents; }
body.mobile .cnr { display: none; }
body.mobile #landing { position: fixed; inset: 0; z-index: 30; }
body.mobile #stagewrap { position: fixed; inset: 0; width: auto; height: auto; max-width: none; border: 0; box-shadow: none; overflow: hidden; z-index: 10; display: none; }
body.mobile #stage { transform-origin: top left; }
body.mobile.scaleup #stage canvas { image-rendering: pixelated; }
body.mobile #frame { position: fixed; pointer-events: none; z-index: 35; display: none; border: 3px solid var(--gold-lo); border-radius: 3px;
  box-shadow: inset 0 0 0 1px #3a2a10, 0 0 0 2px #0e1b2e, 0 0 0 9999px #0a1426, 0 0 28px rgba(242,181,42,.35); }
body.mobile #kb { font-size: calc(16px*var(--uiScale,1)); }
body.mobile #rotate { position: fixed; inset: 0; background: rgba(10,20,38,.93); z-index: 60; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--gold-hi); font-size: calc(18px*var(--uiScale,1)); text-align: center; padding: 24px; cursor: pointer; }
body.mobile #rotate small { color: var(--muted); font-size: calc(13px*var(--uiScale,1)); }
body.mobile #gate { position: fixed; z-index: 40; }

/* Cameraman mode (?camera=1): nothing but the game, top-left, black. */
body.camera { padding: 0; background: #000; }
body.camera .topbar, body.camera .entrybar, body.camera .col, body.camera .ticker, body.camera .whatsnew,
body.camera .footer, body.camera .playbar, body.camera .hint, body.camera .dock { display: none !important; }
body.camera .main { display: block; padding: 0; }
body.camera .center, body.camera .stage-panel, body.camera .gframe { display: contents; }
body.camera .cnr { display: none; }
body.camera #stagewrap { position: fixed; top: 0; left: 0; border: 0; box-shadow: none; }
