/* Tokens: see DESIGN.md for the reasons behind each choice. A skin is one set of these tokens
   (data-theme); light skins also set data-tone="light", which swaps in the light rarity scale. */
:root,
:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #0c0c10; --surface: #15151b; --surface-2: #1d1d25; --line: #2c2c37;
  --ink: #f1efe9; --muted: #a7a5ae; --faint: #8c8a94;
  --cell: #060608; --cell-ink: #f6f1e3; --cell-lead: #75737d;
  --accent: #d6a84a; --accent-ink: #19130a; --focus: #f1efe9;
}
/* Rarity scale for dark skins: brown-grey to gold, then aqua, pink, white and the pale top tiers. */
:root {
  --r-trash: #b09f8c; --r-common: #b8b7bf; --r-uncommon: #5fd38a; --r-rare: #78acff; --r-epic: #c6a0ff;
  --r-legendary: #ff9f45; --r-anomaly: #ff7272; --r-mythic: #ffd447; --r-divine: #6ee7de; --r-cosmic: #ff7ad1;
  --r-transcendent: #ffffff; --r-ethereal: #cbb8ff; --r-celestial: #ffe6a0; --r-eternal: #ffb0c4;
  --r-infinite: #a5f3c0; --r-omega: #ffb38a; --r-absolute: #e4e4ea; --r-primordial: #ffcf6e; --r-unfathomable: #ff6b9e;
  --r-paradox: #9ee7f7; --r-singularity: #f0abfc; --r-multiversal: #d9f99d; --r-omniversal: #fca5a5; --r-ineffable: #c7d2fe; --r-beyond: #fde7f3;
}
/* The same scale, darkened to read on light skins. */
:root[data-tone="light"] {
  color-scheme: light;
  --r-trash: #77654f; --r-common: #5c5b63; --r-uncommon: #17793f; --r-rare: #1d5bc0; --r-epic: #7637c2;
  --r-legendary: #a14a00; --r-anomaly: #bf2530; --r-mythic: #8d6200; --r-divine: #0b6e66; --r-cosmic: #a8166f;
  --r-transcendent: #1b1a17; --r-ethereal: #5a3fa8; --r-celestial: #6e5300; --r-eternal: #a3204a;
  --r-infinite: #0f6b3a; --r-omega: #9a3b0e; --r-absolute: #3d3d45; --r-primordial: #7a4f00; --r-unfathomable: #9e1446;
  --r-paradox: #0b5f73; --r-singularity: #86198f; --r-multiversal: #4d6200; --r-omniversal: #a11d1d; --r-ineffable: #3a3f9e; --r-beyond: #831843;
}
/* The reels stay dark on light skins too, so inside the cabinet the dark scale applies. */
:root[data-tone="light"] .cabinet {
  --r-trash: #b09f8c; --r-common: #b8b7bf; --r-uncommon: #5fd38a; --r-rare: #78acff; --r-epic: #c6a0ff;
  --r-legendary: #ff9f45; --r-anomaly: #ff7272; --r-mythic: #ffd447; --r-divine: #6ee7de; --r-cosmic: #ff7ad1;
  --r-transcendent: #ffffff; --r-ethereal: #cbb8ff; --r-celestial: #ffe6a0; --r-eternal: #ffb0c4;
  --r-infinite: #a5f3c0; --r-omega: #ffb38a; --r-absolute: #e4e4ea; --r-primordial: #ffcf6e; --r-unfathomable: #ff6b9e;
  --r-paradox: #9ee7f7; --r-singularity: #f0abfc; --r-multiversal: #d9f99d; --r-omniversal: #fca5a5; --r-ineffable: #c7d2fe; --r-beyond: #fde7f3;
}

/* Free skins */
:root[data-theme="felt"] {
  --bg: #0a1511; --surface: #11201a; --surface-2: #172a21; --line: #26392f;
  --ink: #eef3ec; --muted: #a9bbaf; --faint: #8ba193; --cell: #040a07; --cell-lead: #6f8576;
}
:root[data-theme="daylight"] {
  --bg: #f3f1ec; --surface: #ffffff; --surface-2: #faf8f4; --line: #d9d5cb;
  --ink: #1b1a17; --muted: #55524b; --faint: #66635b; --cell: #18171b; --cell-lead: #8a8792;
  --accent: #a8761c; --focus: #1b1a17;
}

/* Secret skins */
:root[data-theme="neon"] {
  --bg: #0a0614; --surface: #140b24; --surface-2: #1c1030; --line: #33204f;
  --ink: #f5eaff; --muted: #c3b0dd; --faint: #a58fc2; --cell: #05020a; --cell-ink: #ff6fe0; --cell-lead: #7a5299;
  --accent: #2ef2ff; --accent-ink: #04121a; --focus: #2ef2ff;
}
:root[data-theme="lcd"] {
  --bg: #0b1a0e; --surface: #102414; --surface-2: #15301a; --line: #234a2b;
  --ink: #c8f7c5; --muted: #8fcf8a; --faint: #79b874; --cell: #0d2a12; --cell-ink: #7dff6a; --cell-lead: #3d7c41;
  --accent: #7dff6a; --accent-ink: #08200b; --focus: #7dff6a;
}
/* Blueprint and Graph Paper draw a ruled grid on purpose: it is the identity of those two skins. */
:root[data-theme="blueprint"] {
  --bg: #0b2545; --surface: #0f2f57; --surface-2: #11325c; --line: #2d5487;
  --ink: #eaf2ff; --muted: #b7cbe6; --faint: #9db3d4; --cell: #071a33; --cell-ink: #ffffff; --cell-lead: #6584ad;
  --accent: #ffd166; --accent-ink: #1b1500; --focus: #ffd166;
}
:root[data-theme="blueprint"] body {
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Bundle skins (500 coins) */
:root[data-theme="gold"] {
  --bg: #120d02; --surface: #1d1504; --surface-2: #261c06; --line: #4a3a12;
  --ink: #fff6dc; --muted: #d9c79b; --faint: #bdaa7c; --cell: #0b0800; --cell-ink: #ffd66b; --cell-lead: #7a6530;
  --accent: #ffd447; --accent-ink: #1a1200; --focus: #ffd447;
}
:root[data-theme="ruby"] {
  --bg: #16050a; --surface: #220810; --surface-2: #2c0b15; --line: #521628;
  --ink: #ffe9ee; --muted: #e3b3c0; --faint: #c999a6; --cell: #0d0306; --cell-ink: #ff9bb2; --cell-lead: #9a5262;
  --accent: #ff4d6d; --accent-ink: #1a0208; --focus: #ff8fa6;
}
:root[data-theme="aurora"] {
  --bg: #04131a; --surface: #082029; --surface-2: #0b2a35; --line: #164556;
  --ink: #e6fffb; --muted: #a6d9d2; --faint: #8ac2ba; --cell: #020b0f; --cell-ink: #7dfbd8; --cell-lead: #377a74;
  --accent: #7dfbd8; --accent-ink: #03201a; --focus: #7dfbd8;
}

/* Legendary skins, from badge book pages */
:root[data-theme="graph"] {
  --bg: #f7f6f0; --surface: #ffffff; --surface-2: #f2f1ea; --line: #d6d3c4;
  --ink: #1c2733; --muted: #4d5866; --faint: #5c6775; --cell: #1c2733; --cell-ink: #f7f6f0; --cell-lead: #8592a0;
  --accent: #c0392b; --accent-ink: #ffffff; --focus: #1c2733;
}
:root[data-theme="graph"] body {
  background-image: linear-gradient(rgba(28, 39, 51, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(28, 39, 51, 0.07) 1px, transparent 1px);
  background-size: 20px 20px;
}
:root[data-theme="spiral"] {
  --bg: #101418; --surface: #171d23; --surface-2: #1e262e; --line: #2f3b47;
  --ink: #f3efe6; --muted: #c9c1ad; --faint: #ada590; --cell: #0a0d10; --cell-ink: #f2c14e; --cell-lead: #66707a;
  --accent: #f2c14e; --accent-ink: #1a1300; --focus: #f2c14e;
}
:root[data-theme="odometer"] {
  --bg: #1b1813; --surface: #24201a; --surface-2: #2d2820; --line: #4a4234;
  --ink: #f1e8d6; --muted: #c8bba1; --faint: #ad9f84; --cell: #0e0d0b; --cell-ink: #f6f0e2; --cell-lead: #75695a;
  --accent: #c8963e; --accent-ink: #1a1206; --focus: #f1e8d6;
}
:root[data-theme="vapor"] {
  --bg: #1a1033; --surface: #241646; --surface-2: #2d1c57; --line: #48307f;
  --ink: #fff0fb; --muted: #e0bde0; --faint: #c7a3c8; --cell: #120a24; --cell-ink: #ff9be0; --cell-lead: #7a5aa0;
  --accent: #ff71ce; --accent-ink: #22001a; --focus: #ff9be0;
}
:root[data-theme="spectrum"] {
  --bg: #f4f4f8; --surface: #ffffff; --surface-2: #f7f7fb; --line: #d8d8e3;
  --ink: #17171f; --muted: #4f4f60; --faint: #5e5e70; --cell: #17171f; --cell-ink: #ffffff; --cell-lead: #8a8a9a;
  --accent: #3b5bdb; --accent-ink: #ffffff; --focus: #17171f;
}

/* Terminal and Console: unlocked from the hidden command line in Settings. They look like a console
   window: one monospace font, plain text on black, no boxes, lines, bars, shadows or effects. Buttons
   read as [Label], the selected one inverted. Console goes further and replaces the page with a
   command line (see .console below). */
:root:is([data-theme="terminal"], [data-theme="console"]) {
  --bg: #0c0c0c; --surface: #0c0c0c; --surface-2: #0c0c0c; --line: #0c0c0c;
  --ink: #cccccc; --muted: #a8a8a8; --faint: #8f8f8f; --cell: #0c0c0c; --cell-ink: #cccccc; --cell-lead: #767676;
  --accent: #cccccc; --accent-ink: #0c0c0c; --focus: #ffffff;
}
:root[data-theme="terminal"] body, :root[data-theme="terminal"] button, :root[data-theme="terminal"] select,
:root[data-theme="terminal"] input, :root[data-theme="terminal"] table {
  font-family: "Cascadia Mono", Consolas, "Lucida Console", ui-monospace, monospace;
}
:root[data-theme="terminal"] *, :root[data-theme="terminal"] *::before, :root[data-theme="terminal"] *::after {
  border-color: transparent !important; border-radius: 0 !important; box-shadow: none !important; text-shadow: none !important;
  background-image: none !important; font-weight: 400 !important; letter-spacing: 0 !important;
}
:root[data-theme="terminal"] :is(.cabinet, .board, .card, .stat, .items li, .coins-panel, .seg, .mult, .effects li, .ach li,
  .chart, .result, .slots li, .skin, .reel, .mini-cell, .toast, .tabs button, .chart-tip, .facts, .opts) { background: transparent; }
:root[data-theme="terminal"] :is(.card, .items li, .toast)::before { display: none; }
:root[data-theme="terminal"] :is(#fx, #flash, .progress, .pity-bar, .swatch, .chart .grid) { display: none; }
:root[data-theme="terminal"] :is(.roll, .btn, .seg button, .tabs button, .icon-btn) { background: transparent; color: var(--ink); min-width: 0; padding: 0 6px; }
:root[data-theme="terminal"] :is(.roll, .btn, .seg button, .tabs button)::before { content: "["; }
:root[data-theme="terminal"] :is(.roll, .btn, .seg button, .tabs button)::after { content: "]"; }
:root[data-theme="terminal"] :is(.btn[aria-pressed="true"], .seg button[aria-pressed="true"], .tabs button[aria-selected="true"], .skin.on) { background: var(--ink); color: var(--bg); }
:root[data-theme="terminal"] :is(input, select) { background: #1e1e1e; color: var(--ink); }
:root[data-theme="terminal"] .reel { width: auto; min-width: 0.7em; }
:root[data-theme="terminal"] .mini-cell { width: auto; }
:root[data-theme="terminal"] dialog { background: var(--bg); outline: 1px solid #767676; }
:root[data-theme="terminal"] .chart :is(.bar, .you) { fill: var(--ink); stroke: none; }
:root[data-theme="terminal"] .chart .expected { stroke: var(--muted); }
:root[data-theme="terminal"] .chart .legend .k-you { background: var(--ink); }
:root[data-theme="terminal"] .chart .legend .k-exp { border: 2px solid var(--muted) !important; }
:root[data-theme="terminal"] *:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }
:root[data-theme="terminal"] .mark::before { content: "PS C:\\LongShot10> "; }
:root[data-theme="terminal"] .mark::after {
  content: ""; display: inline-block; width: 0.6em; height: 1.1em; margin-left: 4px; vertical-align: text-bottom;
  background: var(--ink); animation: cursor-blink 1.06s steps(1) infinite; /* the blinking console cursor */
}
@keyframes cursor-blink { 50% { opacity: 0; } }

/* The Console skin: the whole page is one command line. */
.console { position: fixed; inset: 0; z-index: 40; overflow-y: auto; padding: 12px 16px 40vh; background: #0c0c0c; color: #cccccc; font: 15px/1.35 "Cascadia Mono", Consolas, "Lucida Console", ui-monospace, monospace; cursor: text; }
.console pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.con-line { display: flex; align-items: center; min-height: 44px; }
.con-line label { white-space: pre; }
.con-line input { flex: 1; min-width: 0; min-height: 44px; padding: 0; background: transparent; border: 0; outline: none; color: #cccccc; font: inherit; caret-color: #cccccc; caret-shape: block; }
:root[data-theme="console"] .console { display: block; }
:root[data-theme="console"] :is(.wrap, #toasts, #fx, #flash) { display: none; }
:root[data-theme="console"] body { overflow: hidden; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }
.num { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 72px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 10px; }
.mark { display: flex; flex-wrap: wrap; min-width: 0; align-items: center; gap: 8px; margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.mark .cells { display: flex; gap: 2px; }
.mini-cell {
  display: inline-grid; place-items: center; width: 20px; height: 28px; border-radius: 4px;
  background: var(--cell); color: var(--cell-ink); font-size: 17px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.tabs { display: flex; gap: 4px; margin: 6px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 14px; min-height: 44px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* Roll stage: boards on the sides when there is room */
.stage { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.stage-main { min-width: 0; }
.boards-narrow { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-top: 28px; }
@media (min-width: 1120px) {
  .stage { grid-template-columns: 250px minmax(0, 660px) 250px; justify-content: center; align-items: start; }
  .board-rail { position: sticky; top: 16px; }
  .boards-narrow { display: none; }
}
@media (max-width: 1119px) { .board-rail { display: none; } }
@media (max-width: 560px) { .boards-narrow { grid-template-columns: 1fr; } }

.board { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.board h2 { margin: 0 0 2px; font-size: 15px; }
.board .sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.board ol { list-style: none; margin: 0; padding: 0; }
.board li a {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: baseline;
  padding: 6px 6px; border-radius: 8px; text-decoration: none;
}
.board li a:hover { background: var(--surface-2); }
.board .rank { color: var(--faint); font-size: 13px; }
.board .n { font-size: 14px; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .tier { font-size: 13px; font-weight: 700; color: var(--tc); grid-column: 2; }
.board .sc { font-size: 13px; color: var(--muted); grid-row: 1 / span 2; grid-column: 3; align-self: center; text-align: right; }
.board li.fresh a { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--tc) 22%, transparent); } to { background: transparent; } }
.board .empty { color: var(--muted); font-size: 13px; padding: 6px; }

/* Mode switch */
.modes { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 16px; }
.mode-desc { margin: 0; max-width: 520px; text-align: center; color: var(--muted); font-size: 14px; min-height: 42px; }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: center; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.seg button {
  border: 0; background: none; color: var(--muted); padding: 8px 14px; min-height: 44px;
  border-radius: 6px; font-weight: 600; font-size: 14px;
}
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* Reel cabinet */
.cabinet {
  position: relative; padding: 18px 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.7);
}
.cabinet.shake { animation: shake 0.45s cubic-bezier(.36, .07, .19, .97); }
.cabinet.shake-big { animation: shake-big 0.7s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 20%, 80% { transform: translateX(3px); } 40%, 60% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }
@keyframes shake-big { 20%, 80% { transform: translate(6px, -2px) rotate(.4deg); } 40%, 60% { transform: translate(-9px, 2px) rotate(-.6deg); } 50% { transform: translate(9px, -1px) rotate(.6deg); } }
.reels-row { display: flex; justify-content: center; align-items: flex-start; gap: clamp(4px, 1.4vw, 12px); }
.reels { display: flex; gap: clamp(4px, 1.4vw, 12px); }
.trio { display: flex; gap: clamp(2px, .5vw, 4px); }
.reel {
  --h: clamp(44px, 10.6vw, 80px);
  position: relative; width: clamp(26px, 6.7vw, 52px); height: var(--h); overflow: hidden; border-radius: 6px;
  background: var(--cell);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 10px 12px -8px #000, inset 0 -10px 12px -8px #000;
}
.reel.exp { --h: clamp(30px, 6.4vw, 46px); width: clamp(20px, 4.4vw, 32px); margin-top: -6px; }
.exp-wrap { display: flex; align-items: flex-start; gap: 2px; color: var(--muted); font-weight: 700; }
.strip div {
  height: var(--h); display: grid; place-items: center;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700; font-size: calc(var(--h) * 0.58); color: var(--cell-ink);
}
.reel.lead .strip div { color: var(--cell-lead); }
.reel.spinning .strip { filter: blur(1px); }
.reel.hit .strip div { color: var(--tc); text-shadow: 0 0 18px var(--tc); }
/* The multiplier window sits under the digits, in the same reel language. */
.mult {
  display: flex; align-items: center; gap: 10px; margin: 14px auto 0; width: min(100%, 440px);
  padding: 6px 14px 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line);
}
.mult-x { color: var(--muted); font-weight: 700; font-size: 18px; }
.reel.mult-reel { --h: 40px; width: auto; min-width: 72px; padding: 0 8px; }
.reel.mult-reel .strip div { font-size: 20px; color: var(--rc); white-space: nowrap; }
.mult.unity .reel.mult-reel .strip div { color: var(--cell-lead); }
.mult-text { display: flex; flex-direction: column; min-width: 0; }
/* Fixed sizes with ellipsis, so a long name or factorization never changes the layout mid-run. */
.mult-name, .mult-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mult-name { font-weight: 700; font-size: 14px; }
.mult-meta { color: var(--muted); font-size: 13px; }
.facts { text-align: center; margin: 12px 0 0; height: 22px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts .value { color: var(--ink); }

/* Controls */
.controls { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 20px 0 6px; }
.roll-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.roll {
  border: 0; border-radius: 999px; min-height: 52px; padding: 0 44px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 18px;
  transition: transform .08s;
}
.roll:active { transform: scale(.97); }
.roll:disabled { opacity: .5; cursor: default; }
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.btn:hover { border-color: var(--faint); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger:hover { border-color: var(--r-anomaly); color: var(--r-anomaly); }
.opts { display: flex; gap: 8px 12px; flex-wrap: wrap; justify-content: center; align-items: center; }
.field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
select, input[type="text"], input[type="search"] {
  min-height: 44px; padding: 0 10px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); font-size: 14px;
}
#hunt { max-width: 220px; }
.check { display: flex; gap: 6px; }
.check input { width: 200px; }
.status { margin: 0; color: var(--muted); font-size: 14px; text-align: center; min-height: 21px; }
.status b { color: var(--ink); font-weight: 600; }
.keys { margin: 0; color: var(--faint); font-size: 13px; }
.notice { margin: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--r-anomaly); color: var(--ink); font-size: 14px; }

/* Result */
.result { text-align: center; margin: 26px 0 18px; }
.tier-word { margin: 0; font-size: clamp(40px, 9vw, 64px); font-weight: 900; line-height: 1; letter-spacing: -0.02em; color: var(--tc); }
.tier-word.glow { text-shadow: 0 0 30px color-mix(in srgb, var(--tc) 50%, transparent); }
.tier-word.pop { animation: pop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
.tier-word.sheen {
  background: linear-gradient(100deg, var(--tc) 40%, #fff7d6 50%, var(--tc) 60%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop .5s cubic-bezier(.2, 1.5, .4, 1) both, sheen 1.6s ease-out .3s 1 both;
}
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
.one-in { margin: 10px 0 0; font-size: clamp(26px, 6vw, 36px); font-weight: 700; color: var(--tc); letter-spacing: 0.01em; }
.one-in-note { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.score-line { margin: 10px 0 14px; color: var(--muted); }
.score-line b { color: var(--ink); font-size: 20px; }
.score-line .formula { color: var(--muted); }
.board .x, .list .tag { color: var(--muted); font-weight: 500; }
.hof-pick { margin-bottom: 10px; }
#tab-collection .check { margin: 0 0 16px; flex-wrap: wrap; align-items: center; }
#tab-collection .check input { flex: 1 1 160px; }
.result-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.section-head h2, h2.plain { margin: 0; font-size: 17px; }
.section-head span { color: var(--muted); font-size: 14px; }

/* Badge cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: start;
  padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  text-align: left; width: 100%;
}
button.card:hover { border-color: var(--faint); }
.card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rc); }
.card .name { font-weight: 700; }
.card .desc { color: var(--muted); font-size: 13px; grid-column: 1; }
.card .right { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 13px; }
.card .rar { color: var(--rc); font-weight: 700; }
.card .pts { font-weight: 700; }
.card .odds { color: var(--muted); }
.card .new { margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 12px; font-weight: 700; background: var(--rc); color: var(--bg); }
.card.locked { opacity: 0.62; }
.card.locked::before { background: var(--line); }
.card.in { animation: slide .35s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.empty-state { color: var(--muted); padding: 16px; border: 1px dashed var(--line); border-radius: 12px; margin: 0; text-align: center; }

/* Collection */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filters input { flex: 1 1 220px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 4px 0 20px; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.cat { margin-bottom: 26px; }

/* Trophies and log */
.two-col { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach li { display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.ach .tick { grid-row: 1 / span 2; width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 14px; }
.ach li.got .tick { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ach li:not(.got) { color: var(--muted); }
.ach .when { color: var(--faint); font-size: 13px; }
.ach li > span { overflow-wrap: anywhere; min-width: 0; } /* 1/10¹⁰⁰ written out has no break points */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 26px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { font-size: 13px; color: var(--muted); }
.luck { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 26px; }
.luck th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.luck td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.luck td:not(:first-child), .luck th:not(:first-child) { text-align: right; }
.list { list-style: none; margin: 0 0 26px; padding: 0; }
.list li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.list a { text-decoration: none; letter-spacing: 0.02em; }
.list a:hover { text-decoration: underline; }
.list .t { font-weight: 700; font-size: 13px; color: var(--tc); }
.list .e { color: var(--muted); font-size: 13px; text-align: right; min-width: 8ch; }
.list .x { min-height: 44px; min-width: 44px; padding: 0 10px; }

/* Dialogs */
dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dlg { padding: 18px; }
.dlg h2 { margin: 0 0 4px; font-size: 20px; }
.dlg h3 { margin: 18px 0 8px; font-size: 15px; }
.dlg p { margin: 6px 0; }
.dlg .muted { color: var(--muted); font-size: 14px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.choices { display: flex; gap: 6px; flex-wrap: wrap; }
.choices label { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.choices input { accent-color: var(--ink); }
.items { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.items li { position: relative; display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.items li::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rc); }
.cabinet.slot { margin-bottom: 10px; }
.slot-reels { display: flex; justify-content: center; gap: 8px; }
.reel.slot-reel { --h: clamp(52px, 12vw, 72px); width: clamp(84px, 24vw, 120px); }
.reel.slot-reel .strip div { font-size: clamp(18px, 4.5vw, 24px); white-space: nowrap; }
.reel.slot-reel.lead .strip div { color: var(--cell-lead); }
.slot-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.slot-buttons .roll { min-height: 44px; padding: 0 28px; font-size: 16px; }
.slot-result { list-style: none; margin: 12px 0 0; padding: 0; text-align: center; font-size: 14px; }
.slot-result li { padding: 2px 0; }
.coins-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 22px; overflow-x: auto; }
.coins-panel .muted { font-size: 13px; margin: 6px 0 10px; }
.coins-in-hand { display: flex; align-items: baseline; gap: 8px; }
.coins-in-hand .num { font-size: 34px; font-weight: 800; color: var(--accent); }
.coins-in-hand span:last-child { color: var(--muted); }
.luck.odds { margin-bottom: 0; font-size: 13px; }
.luck.odds td:nth-child(2), .luck.odds td:nth-child(3), .luck.odds th:nth-child(2), .luck.odds th:nth-child(3) { white-space: nowrap; }
.pity { display: flex; align-items: center; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.pity-bar { width: 48px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.pity-bar i { display: block; height: 100%; background: var(--ink); }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.items li.none { opacity: 0.62; }
.book li, .quests li { --rc: var(--line); align-items: flex-start; }
.book li.legend { --rc: var(--r-legendary); }
.book li > div, .quests li > div { flex: 1; min-width: 0; }
.book .progress, .quests .progress, .prestige .progress { margin: 8px 0 0; height: 6px; }
.quests li.muted { display: block; padding-left: 12px; }
.quests li.muted::before { width: 0; }
.prestige .progress { margin-bottom: 12px; }
.prestige-mark { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--accent); color: var(--accent); }
.items li.none::before { background: var(--line); }
.effects { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 6px; }
.effects li { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.effects li.muted { font-weight: 400; }
.muted { color: var(--muted); }
.skins { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.skin-group { grid-column: 1 / -1; margin-top: 6px; font-size: 13px; color: var(--muted); }
.skin { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 10px; text-align: left; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.skin.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.skin:disabled { cursor: default; }
.skin:disabled b { color: var(--muted); }
.skin .muted { font-size: 12px; }
/* Each swatch shows a skin's background and accent, so its colours are written out here. */
.swatch { flex: none; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); }
.skin:disabled .swatch { opacity: 0.35; }
[data-swatch="midnight"] { background: linear-gradient(135deg, #0c0c10 55%, #d6a84a 55%); }
[data-swatch="felt"] { background: linear-gradient(135deg, #0a1511 55%, #d6a84a 55%); }
[data-swatch="daylight"] { background: linear-gradient(135deg, #f3f1ec 55%, #a8761c 55%); }
[data-swatch="neon"] { background: linear-gradient(135deg, #0a0614 55%, #2ef2ff 55%); }
[data-swatch="lcd"] { background: linear-gradient(135deg, #0b1a0e 55%, #7dff6a 55%); }
[data-swatch="blueprint"] { background: linear-gradient(135deg, #0b2545 55%, #ffd166 55%); }
[data-swatch="terminal"], [data-swatch="console"] { background: linear-gradient(135deg, #0c0c0c 55%, #cccccc 55%); }
[data-swatch="gold"] { background: linear-gradient(135deg, #120d02 55%, #ffd447 55%); }
[data-swatch="ruby"] { background: linear-gradient(135deg, #16050a 55%, #ff4d6d 55%); }
[data-swatch="aurora"] { background: linear-gradient(135deg, #04131a 55%, #7dfbd8 55%); }
[data-swatch="graph"] { background: linear-gradient(135deg, #f7f6f0 55%, #c0392b 55%); }
[data-swatch="spiral"] { background: linear-gradient(135deg, #101418 55%, #f2c14e 55%); }
[data-swatch="odometer"] { background: linear-gradient(135deg, #1b1813 55%, #c8963e 55%); }
[data-swatch="vapor"] { background: linear-gradient(135deg, #1a1033 55%, #ff71ce 55%); }
[data-swatch="spectrum"] { background: linear-gradient(135deg, #f4f4f8 55%, #3b5bdb 55%); }
#buyBundle { margin-bottom: 4px; }
#fuseEverything { margin-bottom: 10px; }
.batch-row { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.batch-result { margin: 0; text-align: center; font-size: 14px; max-width: 640px; }
.diff-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: center; margin-top: 8px; }
.diff-row .mode-desc { margin: 0; }
.tokens .coins-in-hand .num { color: var(--r-uncommon); }
.tokens p { margin: 6px 0; }
/* The hidden command line: always a console, whatever the skin. */
.terminal { margin-top: 14px; padding: 10px 12px; background: #0c0c0c; color: #cccccc; border-radius: 6px; font: 14px/1.4 "Cascadia Mono", Consolas, "Lucida Console", ui-monospace, monospace; }
.terminal pre { margin: 0; max-height: 200px; overflow: auto; white-space: pre-wrap; font: inherit; }
.term-line { display: flex; align-items: center; min-height: 44px; }
.term-line label { white-space: pre; }
.term-line input { flex: 1; min-width: 0; min-height: 44px; padding: 0 0 0 2px; background: transparent; border: 0; color: #cccccc; font: inherit; caret-color: #cccccc; outline: none; }
.terminal:focus-within { box-shadow: 0 0 0 2px #cccccc; }
.term-toggle { margin-right: auto; min-width: 44px; min-height: 44px; padding: 0; background: transparent; border: 0; color: var(--faint); font: 13px ui-monospace, monospace; cursor: pointer; opacity: 0.6; }
.term-toggle:hover, .term-toggle:focus-visible { opacity: 1; color: var(--ink); }
/* Stats charts */
.charts { margin-bottom: 18px; }
.chart { margin: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; position: relative; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart { --chart-a: #c77d1a; --chart-b: #3f7fd6; } /* checked with the dataviz palette validator on both surfaces */
:root[data-tone="light"] .chart { --chart-a: #c26a10; --chart-b: #2f6fd0; }
.chart .bar { fill: var(--chart-a); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .row:hover .you { stroke: var(--ink); stroke-width: 2; }
.chart .you { fill: var(--chart-a); stroke: var(--surface); stroke-width: 2; }
.chart .expected { fill: none; stroke: var(--chart-b); stroke-width: 2; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.chart .legend .k-you { background: var(--chart-a); }
.chart .legend .k-exp { border: 2px solid var(--chart-b); width: 6px; height: 6px; }
.chart-tip { position: absolute; pointer-events: none; padding: 6px 8px; font-size: 12px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; z-index: 2; }
.slots { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.slots li { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.slots li.playing { border-color: var(--ink); }
.slot-info { display: flex; flex-direction: column; min-width: 0; }
.slot-tag { font-size: 12px; font-weight: 700; color: var(--muted); }
.slot-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.facts-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.facts-grid dt { color: var(--muted); }
.facts-grid dd { margin: 0; }

/* Toasts and effects */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--tc);
  animation: toast-in .25s ease-out both; transition: opacity .3s, transform .3s;
}
.toast b { color: var(--tc); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 19; opacity: 0; background: var(--tc, #fff); }
#flash.go { animation: flash .7s ease-out; }
@keyframes flash { from { opacity: .28; } to { opacity: 0; } }

.foot { margin-top: 36px; color: var(--faint); font-size: 13px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
:root[data-effects="off"] *, :root[data-effects="off"] *::before, :root[data-effects="off"] *::after { animation: none !important; transition: none !important; }

/* Full-screen skins: each replaces the page with its own way to play, in its own fixed colours. */
:root:is([data-theme="chat"], [data-theme="handheld"], [data-theme="calc"], [data-theme="sheet"], [data-theme="receipt"], [data-theme="ticker"], [data-theme="watch"]) :is(.wrap, #toasts, #fx, #flash) { display: none; }
:root:is([data-theme="chat"], [data-theme="handheld"], [data-theme="calc"], [data-theme="sheet"], [data-theme="receipt"], [data-theme="ticker"], [data-theme="watch"]) body { overflow: hidden; }
:root[data-theme="chat"] .chat, :root[data-theme="handheld"] .handheld, :root[data-theme="calc"] .calc, :root[data-theme="sheet"] .sheet, :root[data-theme="receipt"] .receipt, :root[data-theme="ticker"] .ticker, :root[data-theme="watch"] .watch { display: flex; }
.chat, .handheld, .calc, .sheet, .receipt, .ticker, .watch { position: fixed; inset: 0; z-index: 40; }

/* Chat: a messaging app with Tenny. */
.chat { flex-direction: column; background: #eef1f5; color: #1b1f24; font: 15px/1.4 system-ui, sans-serif; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #ffffff; border-bottom: 1px solid #d3d9e1; }
.chat-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #1b1f24; color: #f6d27a; font: 800 15px ui-monospace, monospace; }
.chat-status { font-size: 13px; color: #4d5866; }
.chat-leave { margin-left: auto; min-height: 44px; padding: 0 14px; border: 1px solid #c8d0da; border-radius: 8px; background: #ffffff; color: #1b1f24; font: inherit; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: min(560px, 85%); padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; animation: bubble-in .18s ease-out; }
.bubble.bot { align-self: flex-start; background: #ffffff; border: 1px solid #d3d9e1; border-bottom-left-radius: 4px; }
.bubble.mono { font: 13px/1.4 ui-monospace, Consolas, monospace; }
.bubble.me { align-self: flex-end; background: #2b6cb0; color: #ffffff; border-bottom-right-radius: 4px; }
.bubble.note { align-self: center; max-width: 90%; padding: 2px 8px; font-size: 13px; color: #4d5866; text-align: center; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } }
.chat-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px 0; }
.chat-chips button { flex: none; min-height: 44px; padding: 0 14px; border: 1px solid #c8d0da; border-radius: 22px; background: #ffffff; color: #1b1f24; font: inherit; font-size: 14px; cursor: pointer; }
.chat-chips button:hover { border-color: #2b6cb0; }
.chat-form { display: flex; gap: 8px; padding: 8px 16px 16px; }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 16px; border: 1px solid #c8d0da; border-radius: 22px; background: #ffffff; color: #1b1f24; font: inherit; }
.chat-form button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px; background: #2b6cb0; color: #ffffff; font: inherit; font-weight: 700; cursor: pointer; }
.chat :focus-visible { outline: 2px solid #1b1f24; outline-offset: 2px; }

/* Handheld: a pocket console. Four shades of green on the screen, like an old monochrome LCD. */
.handheld { justify-content: center; align-items: flex-start; overflow-y: auto; padding: 16px; background: #23232b; }
.hh-body { width: min(360px, 100%); padding: 20px 20px 24px; border-radius: 14px 14px 56px 14px; background: #c9c4bd; color: #22236b; box-shadow: inset -4px -6px 0 rgba(0, 0, 0, 0.15); }
.hh-bezel { position: relative; padding: 18px 18px 18px 30px; border-radius: 10px 10px 30px 10px; background: #4a4a55; }
.hh-led { position: absolute; left: 11px; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: #d8002c; }
.hh-screen { margin: 0; min-height: 15.5em; padding: 8px; background: #9bbc0f; color: #0f380f; font: 700 13px/1.25 ui-monospace, Consolas, monospace; white-space: pre; overflow: hidden; }
.hh-brand { margin: 8px 0 18px; font: italic 800 15px system-ui, sans-serif; letter-spacing: 0.04em; }
.hh-controls { display: flex; justify-content: space-between; align-items: center; }
.hh-dpad { display: grid; grid-template: 44px 44px 44px / 44px 44px 44px; }
.hh-dpad button { border: 0; background: #2b2b2b; color: #c9c4bd; font-size: 14px; cursor: pointer; }
.hh-dpad .up { grid-area: 1 / 2; border-radius: 6px 6px 0 0; }
.hh-dpad .left { grid-area: 2 / 1; border-radius: 6px 0 0 6px; }
.hh-dpad .right { grid-area: 2 / 3; border-radius: 0 6px 6px 0; }
.hh-dpad .down { grid-area: 3 / 2; border-radius: 0 0 6px 6px; }
.hh-dpad::after { content: ""; grid-area: 2 / 2; background: #2b2b2b; }
.hh-ab { display: flex; gap: 14px; transform: rotate(-20deg); }
.hh-ab button { width: 52px; height: 52px; border: 0; border-radius: 50%; background: #8b1e46; color: #ffffff; font: 800 18px system-ui, sans-serif; cursor: pointer; }
.hh-ab .a { margin-top: -18px; }
.hh-small { display: flex; justify-content: center; gap: 16px; margin-top: 18px; }
.hh-small button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 22px; background: #55555f; color: #ffffff; font: 700 11px system-ui, sans-serif; letter-spacing: 0.05em; cursor: pointer; }
.hh-help { margin: 14px 0 6px; font: 12px/1.4 system-ui, sans-serif; color: #2e2e3a; text-align: center; }
.hh-off { display: block; margin: 0 auto; min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: #22236b; font: 700 13px system-ui, sans-serif; text-decoration: underline; cursor: pointer; }
.handheld button:active { transform: translateY(1px); filter: brightness(0.9); }
.handheld :focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* Calculator: ten digits on the display, exactly one roll. */
.calc { justify-content: center; align-items: flex-start; overflow-y: auto; padding: 16px; background: #15171b; }
.calc-body { width: min(340px, 100%); padding: 18px; border-radius: 18px; background: #2a2d33; color: #e8e8e8; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.3); }
.calc-brand { margin: 0 0 12px; font: 800 14px system-ui, sans-serif; letter-spacing: 0.06em; }
.calc-brand span { font-weight: 400; font-size: 11px; color: #b9bcc3; }
.calc-lcd { padding: 8px 12px; border-radius: 6px; background: #c8d4bc; color: #1b261b; font-family: ui-monospace, Consolas, monospace; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35); }
.calc-flags { min-height: 16px; font-size: 11px; font-weight: 700; }
.calc-main { font-size: clamp(30px, 10vw, 40px); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.calc-sub { min-height: 18px; font-size: 13px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.calc-keys button { min-height: 52px; border: 0; border-radius: 10px; background: #4a4f57; color: #ffffff; font: 600 20px system-ui, sans-serif; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3); cursor: pointer; }
.calc-keys .fn { min-height: 44px; background: #3a3d44; font-size: 13px; }
.calc-keys .op, .calc-keys .eq { background: #e08a1e; color: #1a1000; }
.calc-keys .clear { background: #b3261e; }
.calc-keys button:active { transform: translateY(2px); box-shadow: none; }
.calc-help { margin: 14px 0 6px; font: 12px/1.4 system-ui, sans-serif; color: #c6c8ce; }
.calc-off { display: block; margin-left: auto; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: #3a3d44; color: #ffffff; font: 700 13px system-ui, sans-serif; cursor: pointer; }
.calc :focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
[data-swatch="chat"] { background: linear-gradient(135deg, #eef1f5 55%, #2b6cb0 55%); }
[data-swatch="handheld"] { background: linear-gradient(135deg, #c9c4bd 55%, #9bbc0f 55%); }
[data-swatch="calc"] { background: linear-gradient(135deg, #2a2d33 55%, #e08a1e 55%); }

/* v3.4 */
/* Text size scales the page and its dialogs, not the full-screen skins, which have their own fixed sizes. */
:root[data-text="large"] { --zoom: 1.15; }
:root[data-text="larger"] { --zoom: 1.3; }
.wrap, dialog { zoom: var(--zoom, 1); }
dialog { width: min(520px, calc((100vw - 32px) / var(--zoom, 1))); max-height: calc((100vh - 48px) / var(--zoom, 1)); }
/* Buttons that read as links: the footer's What's new and the Keys link. Still 44px tall to tap. */
.link-btn { min-height: 44px; padding: 0 2px; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.foot a { display: inline-block; min-height: 44px; line-height: 44px; }
.keys .link-btn { min-height: 32px; }
kbd { display: inline-block; min-width: 1.8em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); font: 600 13px ui-monospace, monospace; text-align: center; }
.keys-grid { align-items: baseline; }
.keys-grid dd { margin: 0; }
.release { padding: 10px 0; border-top: 1px solid var(--line); }
.release h3 { margin: 0; font-size: 15px; }
.release p { margin: 2px 0 4px; }
.release ul { margin: 0; padding-left: 18px; font-size: 14px; }
.release li { margin: 3px 0; }
.check-row { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 0; color: var(--muted); font-size: 14px; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--ink); width: 18px; height: 18px; flex: none; }

/* High Contrast: for low vision and bright screens. Pure black and white, visible borders, a thick
   yellow focus ring and underlined links. Free, like Midnight. */
:root[data-theme="contrast"] {
  --bg: #000000; --surface: #000000; --surface-2: #111111; --line: #a3a3a3;
  --ink: #ffffff; --muted: #f0f0f0; --faint: #dddddd; --cell: #000000; --cell-ink: #ffffff; --cell-lead: #a3a3a3;
  --accent: #ffd400; --accent-ink: #000000; --focus: #ffd400;
}
:root[data-theme="contrast"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
:root[data-theme="contrast"] .reel { box-shadow: inset 0 0 0 1px #a3a3a3; }
:root[data-theme="contrast"] .card.locked, :root[data-theme="contrast"] .items li.none { opacity: 1; }
/* Chalkboard: slate green with chalk-white digits and a chalk-yellow Roll button. */
:root[data-theme="chalk"] {
  --bg: #161f1b; --surface: #1b2621; --surface-2: #202c27; --line: #3d5048;
  --ink: #f4f1e8; --muted: #cbd1c6; --faint: #b3bcaf; --cell: #101714; --cell-ink: #f4f1e8; --cell-lead: #6f8077;
  --accent: #efe08f; --accent-ink: #18201c; --focus: #efe08f;
}
[data-swatch="contrast"] { background: linear-gradient(135deg, #000000 55%, #ffd400 55%); }
[data-swatch="chalk"] { background: linear-gradient(135deg, #161f1b 55%, #efe08f 55%); }
/* Long numbers (1/1,000,000,000,000) may wrap, so tables and lists fit a phone at any text size. */
.luck td, .list .e, .list .t { overflow-wrap: anywhere; }
.list li { grid-template-columns: minmax(0, 1fr) auto auto; }
.list .e { min-width: 0; max-width: 14ch; }

/* v3.5: the Log tab's luck rating, odds calculator, records and milestones */
.log-filters { margin-bottom: 8px; }
.log-filters select { flex: 1 1 140px; }
.rating { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.rating li { padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.rating .tc { color: var(--tc); }
.rating a { text-decoration: underline; }
.odds-calc { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 0; }
.odds-calc input { width: 9em; }
.odds-calc select { max-width: 100%; }
.oc-out { flex-basis: 100%; margin: 4px 0 0; font-size: 15px; }
.oc-out b { font-size: 20px; }
.records { margin: 0 0 26px; }
.records dd { overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0 0 26px; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 6px 0 6px 8px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--tc); border: 2px solid var(--bg); }
.timeline li b { color: var(--tc); }
.timeline .empty-state { display: block; }
.timeline .empty-state::before { display: none; }
/* Nixie: ten glowing orange tubes behind smoked glass. The reward for the Pandigital badge, the
   roll that lights every digit once. */
:root[data-theme="nixie"] {
  --bg: #120d0a; --surface: #1a130f; --surface-2: #211813; --line: #3e2e24;
  --ink: #ffe9d6; --muted: #dcbfa8; --faint: #c2a48d; --cell: #0a0705; --cell-ink: #ff9a4a; --cell-lead: #8a5c40;
  --accent: #ff8f3a; --accent-ink: #1a0d04; --focus: #ffb27a;
}
/* Index Card: a ruled white card with a red top line. The faint blue rules are what an index card
   is, so here they are identity, as the grid is for Graph Paper. */
:root[data-theme="card"] {
  --bg: #fbfaf5; --surface: #ffffff; --surface-2: #f6f4ec; --line: #d9d4c3;
  --ink: #1f2430; --muted: #4b5162; --faint: #5a6072; --cell: #1f2430; --cell-ink: #fbfaf5; --cell-lead: #7d8496;
  --accent: #c62f3b; --accent-ink: #ffffff; --focus: #1f2430;
}
:root[data-theme="card"] body {
  background-image: linear-gradient(#c62f3b, #c62f3b), repeating-linear-gradient(transparent 0 27px, rgba(70, 110, 200, 0.14) 27px 28px);
  background-size: 100% 3px, auto; background-repeat: no-repeat, repeat;
}
[data-swatch="nixie"] { background: linear-gradient(135deg, #120d0a 55%, #ff9a4a 55%); }
[data-swatch="card"] { background: linear-gradient(135deg, #fbfaf5 55%, #c62f3b 55%); }
.odds-calc .field { flex-wrap: wrap; white-space: nowrap; }
.odds-calc .field { max-width: 100%; }
.odds-calc .field select { flex: 1 1 auto; min-width: 0; }

/* v3.6 */
.inv-tools { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: center; margin-bottom: 10px; }
.inv-tools #fuseEverything { margin-bottom: 0; }
.quickbar { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn[data-pin][aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.workshop .progress { margin: 8px 0 0; height: 6px; }
.workshop li, .shop li { align-items: flex-start; }
.workshop li > div:first-child, .shop li > div:first-child { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .items li { flex-wrap: wrap; }
  .items li .item-actions { width: 100%; justify-content: flex-start; }
}
/* Steel: brushed blue-grey metal with a safety-orange Roll button, for the workshop. */
:root[data-theme="steel"] {
  --bg: #101317; --surface: #161a20; --surface-2: #1c2129; --line: #303844;
  --ink: #e8edf3; --muted: #b3bcc8; --faint: #97a1ae; --cell: #090b0e; --cell-ink: #e8edf3; --cell-lead: #66707e;
  --accent: #ff7a1a; --accent-ink: #1a0b00; --focus: #ffa25e;
}
/* Ledger: an accounts book, pale green paper with dark green ink and red for the Roll button. */
:root[data-theme="ledger"] {
  --bg: #eef3ea; --surface: #f9fbf6; --surface-2: #e7eee2; --line: #c4d2bc;
  --ink: #183020; --muted: #3c5444; --faint: #4a6352; --cell: #183020; --cell-ink: #f4f8f0; --cell-lead: #7a9282;
  --accent: #b3261e; --accent-ink: #ffffff; --focus: #183020;
}
[data-swatch="steel"] { background: linear-gradient(135deg, #101317 55%, #ff7a1a 55%); }
[data-swatch="ledger"] { background: linear-gradient(135deg, #eef3ea 55%, #b3261e 55%); }
/* A folded section: the summary is the heading, with a turning marker so it reads as openable. */
.fold { margin: 0 0 10px; }
.fold summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-height: 44px; padding: 8px 0; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary h2 { margin: 0; font-size: 17px; }
.fold summary h2::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
.fold[open] summary h2::before { transform: rotate(90deg); }
.fold summary .muted { font-size: 14px; }

/* v3.7 */
.streak .coins-in-hand .num { color: var(--accent); }
.streak p { margin: 6px 0; }
.quests .item-actions { flex-wrap: nowrap; }
/* Sakura: cherry-blossom paper for a week-long streak, with deep cherry ink. */
:root[data-theme="sakura"] {
  --bg: #fbf3f5; --surface: #ffffff; --surface-2: #f8eaee; --line: #e7cdd5;
  --ink: #3a1f2b; --muted: #6b4655; --faint: #7a5463; --cell: #3a1f2b; --cell-ink: #fff5f7; --cell-lead: #a48593;
  --accent: #c2185b; --accent-ink: #ffffff; --focus: #3a1f2b;
}
/* Glacier: pale ice blue for a clean sweep of the weekly quests, with deep sea-blue ink. */
:root[data-theme="glacier"] {
  --bg: #eef5f9; --surface: #fbfdfe; --surface-2: #e4eff5; --line: #c3d7e2;
  --ink: #10293a; --muted: #3a566a; --faint: #4a6679; --cell: #10293a; --cell-ink: #eef8ff; --cell-lead: #7f9cb0;
  --accent: #0b6fa4; --accent-ink: #ffffff; --focus: #10293a;
}
[data-swatch="sakura"] { background: linear-gradient(135deg, #fbf3f5 55%, #c2185b 55%); }
[data-swatch="glacier"] { background: linear-gradient(135deg, #eef5f9 55%, #0b6fa4 55%); }
.book li > .item-actions, .quests li > .item-actions { flex: none; }
@media (max-width: 560px) { .items li > .item-actions { flex-basis: 100%; } }

/* v3.8: bingo card, bounty board, also-hunt chips */
.goals { margin-bottom: 8px; }
.bingo { display: grid; gap: 4px; margin-bottom: 8px; }
.bingo [role="row"] { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.bingo .cell {
  min-height: 56px; padding: 4px; border-radius: 4px; border: 1px solid var(--line); border-top: 3px solid var(--rc, var(--line));
  background: var(--surface); color: var(--muted); font: 600 11px/1.2 system-ui, sans-serif; text-align: center;
  display: grid; place-items: center; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
}
.bingo button.cell:hover { border-color: var(--faint); border-top-color: var(--rc); }
/* A marked cell is filled in, like a dauber on paper: ink on the cell, so it reads at a glance. */
.bingo .cell.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.bingo .cell.free { font-size: 13px; }
@media (min-width: 600px) { .bingo .cell { min-height: 64px; font-size: 12px; } }
.also-hunt { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 0 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--muted); }
.bounties li.none { opacity: 0.62; }
.opts .check-row { flex-basis: 100%; justify-content: center; padding: 0; }
/* Bingo Hall: cream card stock and red dauber ink, for a first bingo line. */
:root[data-theme="bingo"] {
  --bg: #fdf6e4; --surface: #fffcf3; --surface-2: #f7eed5; --line: #e2d3a8;
  --ink: #2a1d0e; --muted: #5c4a33; --faint: #6b5940; --cell: #2a1d0e; --cell-ink: #fff8e7; --cell-lead: #9a8566;
  --accent: #c81d3a; --accent-ink: #ffffff; --focus: #2a1d0e;
}
/* Punch Card: manila card stock and the deep blue of a tabulating machine, for the tenth bounty. */
:root[data-theme="punch"] {
  --bg: #f7efd8; --surface: #fcf8ec; --surface-2: #f4ebd0; --line: #d6c49a;
  --ink: #2b2618; --muted: #504731; --faint: #5c533b; --cell: #2b2618; --cell-ink: #f8f0dc; --cell-lead: #8c8064;
  --accent: #1f4e79; --accent-ink: #ffffff; --focus: #2b2618;
}
[data-swatch="bingo"] { background: linear-gradient(135deg, #fdf6e4 55%, #c81d3a 55%); }
[data-swatch="punch"] { background: linear-gradient(135deg, #f7efd8 55%, #1f4e79 55%); }

/* v3.9 */
/* Spreadsheet: a plain sheet. White cells on grey gridlines, lettered columns and numbered rows,
   a formula bar, and sheet tabs along the bottom. One teal for the selected tab and the focus. */
.sheet { flex-direction: column; background: #ffffff; color: #1f2328; font: 14px/1.4 system-ui, sans-serif; }
.sh-top { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: #f3f4f6; border-bottom: 1px solid #d4d7dc; }
.sh-title { font-weight: 700; }
.sh-status { color: #57606a; font-size: 13px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sh-leave { min-height: 44px; padding: 0 14px; border: 1px solid #c5c9cf; border-radius: 4px; background: #ffffff; color: #1f2328; font: inherit; cursor: pointer; }
.sh-bar { display: flex; align-items: center; border-bottom: 1px solid #d4d7dc; }
.sh-fx { padding: 0 12px; color: #57606a; font: italic 600 14px Georgia, serif; border-right: 1px solid #d4d7dc; align-self: stretch; display: grid; place-items: center; }
.sh-bar input { flex: 1; min-width: 0; min-height: 44px; padding: 0 10px; border: 0; background: #ffffff; color: #1f2328; font: 14px ui-monospace, Consolas, monospace; }
.sh-out { margin: 0; padding: 4px 12px; min-height: 28px; font: 13px ui-monospace, Consolas, monospace; color: #1f2328; background: #fafbfc; border-bottom: 1px solid #d4d7dc; overflow-wrap: anywhere; }
.sh-wrap { flex: 1; overflow: auto; }
.sh-grid { border-collapse: collapse; font: 13px ui-monospace, Consolas, monospace; min-width: 100%; }
.sh-grid th, .sh-grid td { border: 1px solid #d4d7dc; padding: 3px 8px; white-space: nowrap; text-align: left; }
.sh-grid thead th { position: sticky; top: 0; z-index: 1; background: #f3f4f6; color: #57606a; font-weight: 600; text-align: center; }
.sh-grid tbody th { position: sticky; left: 0; background: #f3f4f6; color: #57606a; font-weight: 600; text-align: right; min-width: 3em; }
.sh-grid .corner { left: 0; z-index: 2; }
.sh-grid .names td { font-weight: 700; background: #fafbfc; }
.sh-grid td.tier { color: var(--tc); font-weight: 700; }
.sh-grid td.empty { color: #57606a; white-space: normal; }
.sh-tabs { display: flex; gap: 2px; padding: 0 8px; background: #f3f4f6; border-top: 1px solid #d4d7dc; overflow-x: auto; }
.sh-tabs button { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #1f2328; font: inherit; cursor: pointer; }
.sh-tabs button[aria-selected="true"] { background: #ffffff; border-bottom-color: #0f766e; font-weight: 700; }
.sheet :focus-visible { outline: 2px solid #0f766e; outline-offset: -2px; }
[data-swatch="sheet"] { background: linear-gradient(135deg, #ffffff 55%, #0f766e 55%); }
/* Mastery: four small reel cells under a badge's odds, filled up to the level reached. */
.mastery { display: inline-flex; gap: 2px; margin-top: 4px; }
.mastery i { width: 7px; height: 10px; border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.mastery i.on { background: var(--rc); box-shadow: none; }
.skins li { display: grid; gap: 4px; }
.buy-skin { width: 100%; }
/* Olive: olive-drab and khaki with a chartreuse Roll button. Bought for coins. */
:root[data-theme="olive"] {
  --bg: #121309; --surface: #18190e; --surface-2: #1e2012; --line: #3a3d24;
  --ink: #f1f2e2; --muted: #c6c9a8; --faint: #abae8c; --cell: #0b0c05; --cell-ink: #e9edc0; --cell-lead: #6b6f48;
  --accent: #b9cc3a; --accent-ink: #151807; --focus: #d6e46a;
}
[data-swatch="olive"] { background: linear-gradient(135deg, #121309 55%, #b9cc3a 55%); }

/* v4.0: the Arcade tab */
.arcade-intro { margin: 0 0 18px; max-width: 760px; }
.cabinet.game { margin-bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.game-label { margin: 0; color: var(--muted); font-size: 14px; }
.mini-reels { display: flex; gap: 3px; flex-wrap: nowrap; }
.mini-reels .mini-cell { width: clamp(22px, 6vw, 30px); height: clamp(32px, 8vw, 42px); font-size: clamp(16px, 4.4vw, 22px); }
.mini-reels .mini-cell.lead { color: var(--cell-lead); }
/* In Digit pick the cells showing your digit light in the accent: they are the result. */
.mini-reels .mini-cell.mark { background: var(--accent); color: var(--accent-ink); }
.hl-now { margin: 0; font-size: 16px; }
.hl-now b { font-size: 22px; }
.bet-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.game-out { margin: 0; min-height: 21px; font-size: 14px; }
.game .luck.odds { margin-top: 4px; }
.digit-seg button { min-width: 44px; padding: 8px 0; font-family: ui-monospace, monospace; font-size: 16px; }
.wheel-box { position: relative; width: min(260px, 70vw); aspect-ratio: 1; }
.wheel { width: 100%; height: 100%; display: block; }
#wheelSpinGroup { transition: transform 3s cubic-bezier(.12, .7, .2, 1); }
.wheel .seg { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.wheel .seg.alt { fill: var(--cell); }
.wheel .seg.won { fill: var(--accent); }
.wheel text { fill: var(--ink); font: 600 9px system-ui, sans-serif; pointer-events: none; }
.wheel .alt + text { fill: var(--cell-ink); }
.wheel .hub { fill: var(--surface); stroke: var(--line); }
/* The pointer at the top, in the accent: the one thing that decides the prize. */
.wheel-pin { position: absolute; top: -6px; left: 50%; width: 0; height: 0; transform: translateX(-50%); border: 10px solid transparent; border-top: 18px solid var(--accent); }
.scratch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: min(300px, 100%); }
.scratch .empty-state { grid-column: 1 / -1; }
.scr { min-height: 56px; border-radius: 8px; border: 1px dashed var(--faint); background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--line) 6px 8px); color: var(--ink); font-weight: 700; cursor: pointer; }
.scr.shown { background: var(--surface); border-style: solid; border-color: var(--line); cursor: default; }
/* Casino: deep roulette red felt with a gold Roll button, for five right calls in a row. */
:root[data-theme="casino"] {
  --bg: #170607; --surface: #1f0a0b; --surface-2: #260d0f; --line: #4a1d20;
  --ink: #fbeeea; --muted: #dfb9b2; --faint: #c69f98; --cell: #0e0304; --cell-ink: #f8e7b5; --cell-lead: #8c5a55;
  --accent: #e2b545; --accent-ink: #1a1203; --focus: #f2d48a;
}
/* Marquee: a dark theatre front with warm bulb-white digits, for a week of daily wheel spins. */
:root[data-theme="marquee"] {
  --bg: #0f0d0b; --surface: #171411; --surface-2: #1d1915; --line: #3a332a;
  --ink: #fff6e6; --muted: #d9ccb4; --faint: #bfb197; --cell: #080706; --cell-ink: #fff2cc; --cell-lead: #6f6352;
  --accent: #ffd27a; --accent-ink: #1a1305; --focus: #fff2cc;
}
[data-swatch="casino"] { background: linear-gradient(135deg, #170607 55%, #e2b545 55%); }
[data-swatch="marquee"] { background: linear-gradient(135deg, #0f0d0b 55%, #ffd27a 55%); }
.wheel .seg.won + text { fill: var(--accent-ink); }
.game .luck { text-align: left; }
.game .luck td:first-child { text-align: left; }

/* v4.2 */
/* Receipt: a till roll of thermal paper on a dark counter, printed in a narrow monospace column. */
.receipt { justify-content: center; align-items: flex-start; overflow-y: auto; padding: 16px; background: #2b2a2e; }
.rc-body { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.rc-paper { height: min(62vh, 560px); overflow-y: auto; padding: 14px 16px 20px; background: #fbfaf5; color: #232220; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6); }
.rc-paper pre { margin: 0; font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.rc-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rc-keys button { min-height: 48px; border: 0; border-radius: 8px; background: #47464c; color: #ffffff; font: 700 14px system-ui, sans-serif; cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.rc-keys [data-rc="print"] { background: #e6e3d6; color: #232220; }
.rc-keys button:active { transform: translateY(2px); box-shadow: none; }
.rc-help { margin: 0; color: #d4d2d8; font: 12px/1.4 system-ui, sans-serif; text-align: center; }
.receipt :focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
[data-swatch="receipt"] { background: linear-gradient(135deg, #fbfaf5 55%, #47464c 55%); }
/* Profile */
.profile-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.profile-name { font-size: 22px; }
.profile-title { color: var(--accent); font-weight: 700; }
.profile .facts-grid { margin-bottom: 12px; }
.backups { margin-top: 6px; }
.backups summary h2 { font-size: 15px; }
/* Newsprint: grey newsprint and black ink, with a deep red Roll button, for your first front page. */
:root[data-theme="news"] {
  --bg: #f2f1ec; --surface: #faf9f6; --surface-2: #eeece6; --line: #c9c6bc;
  --ink: #161616; --muted: #45443f; --faint: #55534d; --cell: #161616; --cell-ink: #efeee9; --cell-lead: #8a877e;
  --accent: #9d1c1c; --accent-ink: #ffffff; --focus: #161616;
}
[data-swatch="news"] { background: linear-gradient(135deg, #f2f1ec 55%, #9d1c1c 55%); }

/* v4.4 */
.sound-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.sound-row input[type="range"] { width: 140px; min-height: 44px; accent-color: var(--accent); }
/* Abacus: dark polished wood with a bead-red Roll button, for coming back to rolls made while away. */
:root[data-theme="abacus"] {
  --bg: #17100a; --surface: #1f160e; --surface-2: #261b11; --line: #4a3622;
  --ink: #f6ebdc; --muted: #d6c2a8; --faint: #bca78c; --cell: #0d0805; --cell-ink: #f3e1c4; --cell-lead: #7d6248;
  --accent: #e05a3a; --accent-ink: #1c0802; --focus: #f3a58f;
}
/* Royal: deep navy and gold, for the third prestige. */
:root[data-theme="royal"] {
  --bg: #070b1c; --surface: #0c1228; --surface-2: #111833; --line: #26315c;
  --ink: #eef1ff; --muted: #b9c0e0; --faint: #9da6cb; --cell: #04060f; --cell-ink: #f5d77a; --cell-lead: #5c6690;
  --accent: #e6c35c; --accent-ink: #140f00; --focus: #f5d77a;
}
[data-swatch="abacus"] { background: linear-gradient(135deg, #17100a 55%, #e05a3a 55%); }
[data-swatch="royal"] { background: linear-gradient(135deg, #070b1c 55%, #e6c35c 55%); }

/* v4.6 */
/* Ticker: a market board. Near-black, one amber for prices and symbols, green and red only for up
   and down, and a line chart in amber. */
.ticker { flex-direction: column; overflow-y: auto; background: #0b0d10; color: #e8e6df; font: 14px/1.4 system-ui, sans-serif; }
.tk-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 10px 16px; border-bottom: 1px solid #262a31; }
.tk-sym { color: #f5b942; font: 800 20px ui-monospace, monospace; }
.tk-last { font-size: 28px; font-weight: 700; }
.tk-change.up { color: #4cc38a; }
.tk-change.down { color: #ff7b72; }
.tk-top .tk-btn { margin-left: auto; }
.tk-tape { overflow: hidden; border-bottom: 1px solid #262a31; background: #111419; }
.tk-tape-in { display: flex; gap: 22px; padding: 8px 16px; white-space: nowrap; font: 13px ui-monospace, monospace; }
.tk-tape-in b { color: #f5b942; }
.tk-tape-in i { font-style: normal; }
.tk-main { display: grid; gap: 14px; padding: 14px 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .tk-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.tk-chart { margin: 0; padding: 10px; border: 1px solid #262a31; border-radius: 8px; }
.tk-chart figcaption { color: #a7a9b0; font-size: 13px; margin-bottom: 6px; }
.tk-chart svg { display: block; width: 100%; height: auto; }
.tk-chart polyline { fill: none; stroke: #f5b942; stroke-width: 2; stroke-linejoin: round; }
.tk-chart .grid { stroke: #262a31; }
.tk-chart text { fill: #a7a9b0; font-size: 11px; }
.tk-quotes { width: 100%; border-collapse: collapse; font-size: 14px; align-self: start; }
.tk-quotes th { text-align: left; color: #a7a9b0; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid #262a31; }
.tk-quotes td { padding: 7px 4px; border-bottom: 1px solid #1c1f25; }
.tk-quotes td:not(:first-child), .tk-quotes th:not(:first-child) { text-align: right; }
.tk-quotes b { color: #f5b942; font-family: ui-monospace, monospace; }
.tk-quotes tr.on td { background: #161a20; }
.tk-keys { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.tk-btn { min-height: 44px; padding: 0 14px; border: 1px solid #3a3f48; border-radius: 6px; background: #161a20; color: #e8e6df; font: 600 14px system-ui, sans-serif; cursor: pointer; }
.tk-btn kbd { background: #0b0d10; border-color: #3a3f48; color: #a7a9b0; margin-left: 4px; }
.tk-note { margin: 10px 16px 16px; color: #a7a9b0; font-size: 13px; }
.ticker :focus-visible { outline: 2px solid #f5b942; outline-offset: 2px; }
[data-swatch="ticker"] { background: linear-gradient(135deg, #0b0d10 55%, #f5b942 55%); }
.hof-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.perks li { align-items: flex-start; }
.perks li > div:first-child { flex: 1; min-width: 0; }
/* Prestige skins, in the order of the metals: Bronze for the first prestige, Silver for the second,
   Platinum (light, like polished metal) for the fifth. */
:root[data-theme="bronze"] {
  --bg: #130d08; --surface: #1b130c; --surface-2: #221810; --line: #463220;
  --ink: #f7ece0; --muted: #d8c2aa; --faint: #bea68d; --cell: #0b0704; --cell-ink: #f0c89a; --cell-lead: #7c5f45;
  --accent: #d08a4a; --accent-ink: #1a0d02; --focus: #f0c89a;
}
:root[data-theme="silver"] {
  --bg: #0e1013; --surface: #15181c; --surface-2: #1b1f24; --line: #343a43;
  --ink: #f2f4f7; --muted: #c2c8d0; --faint: #a6adb7; --cell: #08090b; --cell-ink: #e6eaf0; --cell-lead: #66707c;
  --accent: #c9d1dc; --accent-ink: #12151a; --focus: #e6eaf0;
}
:root[data-theme="platinum"] {
  --bg: #f1f3f6; --surface: #fbfcfd; --surface-2: #edf0f4; --line: #cdd3db;
  --ink: #1b1f25; --muted: #444b55; --faint: #535b66; --cell: #1b1f25; --cell-ink: #f1f3f6; --cell-lead: #858e9a;
  --accent: #4f5b6b; --accent-ink: #ffffff; --focus: #1b1f25;
}
[data-swatch="bronze"] { background: linear-gradient(135deg, #130d08 55%, #d08a4a 55%); }
[data-swatch="silver"] { background: linear-gradient(135deg, #0e1013 55%, #c9d1dc 55%); }
[data-swatch="platinum"] { background: linear-gradient(135deg, #f1f3f6 55%, #4f5b6b 55%); }

/* v4.8 */
.challenges li { align-items: flex-start; }
.challenges li > div:first-child { flex: 1; min-width: 0; }
.challenges .progress { margin: 8px 0 0; height: 6px; }
/* Smartwatch: a round black face in a steel case, with a crown and a side button on the right. */
.watch { flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; background: #1d1f23; overflow-y: auto; }
.w-body { position: relative; width: min(300px, 78vw); aspect-ratio: 1; border-radius: 50%; background: #8d939b; padding: 14px; box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.35); }
.w-face { width: 100%; height: 100%; border: 0; border-radius: 50%; background: #000000; color: #f2f2f2; cursor: pointer; padding: 0; display: grid; place-items: center; }
.w-screen { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 14px/1.2 system-ui, sans-serif; text-align: center; }
.w-time { color: #b9bcc2; font-size: 13px; }
.w-num { font-size: clamp(22px, 7vw, 30px); font-weight: 700; letter-spacing: 0.04em; line-height: 1.1; }
.w-tier { font-size: 18px; }
.w-label { color: #b9bcc2; font-size: 13px; }
.w-big { font-size: clamp(34px, 11vw, 48px); line-height: 1; }
.w-dots { display: flex; gap: 5px; margin-top: 4px; }
.w-dots i { width: 6px; height: 6px; border-radius: 50%; background: #55585e; }
.w-dots i.on { background: #f2f2f2; }
.w-run { color: #8fd18f; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.w-crown { position: absolute; right: -16px; top: 28%; width: 22px; height: 52px; border: 0; border-radius: 6px; background: repeating-linear-gradient(#b5bac1 0 3px, #7d828a 3px 5px); cursor: pointer; }
.w-side { position: absolute; right: -10px; top: 58%; width: 14px; height: 44px; border: 0; border-radius: 5px; background: #7d828a; cursor: pointer; }
.w-crown::after, .w-side::after { content: ""; position: absolute; inset: -12px -12px -12px -4px; } /* a 44px target around a slim control */
.w-help { margin: 0; max-width: 320px; color: #c9ccd2; font: 13px/1.4 system-ui, sans-serif; text-align: center; }
.w-off { min-height: 44px; padding: 0 16px; border: 1px solid #55585e; border-radius: 22px; background: transparent; color: #f2f2f2; font: 600 14px system-ui, sans-serif; cursor: pointer; }
.watch :focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
[data-swatch="watch"] { background: linear-gradient(135deg, #000000 55%, #8d939b 55%); }
/* Compact: tighter spacing everywhere, the same 44px controls. */
:root[data-density="compact"] .tabs { margin-bottom: 12px; }
:root[data-density="compact"] .result { margin: 14px 0 10px; }
:root[data-density="compact"] .controls { gap: 8px; margin: 12px 0 4px; }
:root[data-density="compact"] .cabinet { padding: 12px 10px 10px; }
:root[data-density="compact"] .modes { gap: 4px; margin-bottom: 10px; }
:root[data-density="compact"] .mode-desc { min-height: 0; }
:root[data-density="compact"] .two-col { gap: 18px; }
:root[data-density="compact"] .cat, :root[data-density="compact"] .coins-panel, :root[data-density="compact"] .luck, :root[data-density="compact"] .list { margin-bottom: 14px; }
:root[data-density="compact"] .card, :root[data-density="compact"] .items li { padding-top: 6px; padding-bottom: 6px; }
:root[data-density="compact"] .keys { display: none; }
/* Sunset: dusk over brick, with a coral Roll button, for a first challenge won. */
:root[data-theme="sunset"] {
  --bg: #170d0b; --surface: #1f1310; --surface-2: #261814; --line: #4a2f27;
  --ink: #fff0ea; --muted: #e2c1b6; --faint: #c8a69a; --cell: #0d0706; --cell-ink: #ffd0b8; --cell-lead: #84594c;
  --accent: #ff8a5b; --accent-ink: #210a02; --focus: #ffb59a;
}
/* Lagoon: shallow tropical water on white sand, light, with deep teal ink, for four challenges won. */
:root[data-theme="lagoon"] {
  --bg: #eef8f6; --surface: #fbfefd; --surface-2: #e5f3f0; --line: #bfdcd6;
  --ink: #0b302d; --muted: #2f5752; --faint: #3f6762; --cell: #0b302d; --cell-ink: #eafaf7; --cell-lead: #78a39d;
  --accent: #00777f; --accent-ink: #ffffff; --focus: #0b302d;
}
[data-swatch="sunset"] { background: linear-gradient(135deg, #170d0b 55%, #ff8a5b 55%); }
[data-swatch="lagoon"] { background: linear-gradient(135deg, #eef8f6 55%, #00777f 55%); }

/* v5.0 */
.season .coins-in-hand .num { color: var(--accent); }
.season .progress { margin: 8px 0; height: 8px; }
/* The season track: thirty small reel cells, filled as levels are reached; the last is the accent. */
.season-track { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.season-track li { display: grid; place-items: center; height: 26px; border-radius: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--faint); font-size: 11px; }
.season-track li.got { background: var(--cell); color: var(--cell-ink); box-shadow: none; }
.season-track li.last { box-shadow: inset 0 0 0 2px var(--accent); }
.season-track li.last.got { background: var(--accent); color: var(--accent-ink); }
#skinMode { margin: 10px 0 6px; }
/* Void: nothing but black and white, the reward for a Rare roll on Oblivion. */
:root[data-theme="void"] {
  --bg: #030304; --surface: #08080a; --surface-2: #0e0e11; --line: #24242a;
  --ink: #f4f4f6; --muted: #c4c4cc; --faint: #a8a8b2; --cell: #000000; --cell-ink: #ffffff; --cell-lead: #5d5d66;
  --accent: #ececf0; --accent-ink: #050506; --focus: #ffffff;
}
/* Diamond: ice-blue light on near-black, the reward for completing a season. */
:root[data-theme="diamond"] {
  --bg: #061015; --surface: #0b171d; --surface-2: #101e25; --line: #24414d;
  --ink: #ecfaff; --muted: #b5d5e0; --faint: #98bccb; --cell: #03090c; --cell-ink: #c9f2ff; --cell-lead: #4f7684;
  --accent: #8fdcff; --accent-ink: #04141c; --focus: #c9f2ff;
}
[data-swatch="void"] { background: linear-gradient(135deg, #030304 55%, #ececf0 55%); }
[data-swatch="diamond"] { background: linear-gradient(135deg, #061015 55%, #8fdcff 55%); }

/* Phones: command lines get the full width under their prompt, 16px text so iPhones do not zoom
   in on focus, and a Run button for keyboards whose Enter key does not submit. */
.run-btn { flex: none; min-height: 44px; min-width: 56px; margin-left: 8px; padding: 0 12px; border: 1px solid #767676; border-radius: 4px; background: transparent; color: #cccccc; font: inherit; cursor: pointer; }
.sh-run { border-color: #c5c9cf; color: #1f2328; margin: 0 6px; }
@media (hover: none), (max-width: 560px) {
  .con-line, .term-line { flex-wrap: wrap; }
  .con-line label, .term-line label { flex-basis: 100%; }
  .con-line input, .term-line input, .chat-form input, .sh-bar input { font-size: 16px; }
  .con-line input, .term-line input { flex: 1 1 160px; }
}
/* Six tabs fit a phone: they share the width and may wrap to a second row instead of scrolling
   out of sight. */
@media (max-width: 560px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tabs button { flex: 1 1 auto; padding: 10px 8px; }
}
