
/* Layout: mobile-first single column of soft holographic glass panels; desktop widens the library grid and lets the board grow. */
:root {
  --void: #070b11;
  --panel: #0e1822;
  --panel-2: #142231;
  --panel-3: #1a2b3c;
  --line: rgba(110, 205, 255, 0.16);
  --line-strong: rgba(110, 205, 255, 0.34);
  --holo: #66d6ff;
  --amber: #ffad5c;
  --text: #e2eff6;
  --dim: #8299a8;
  --danger: #ff6b78;
  --good: #6ee7ad;
  --font-display: "Chakra Petch", "Rajdhani", "Arial Narrow", sans-serif;
  --font-body: "Barlow Semi Condensed", "Barlow", "Segoe UI", sans-serif;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(90% 50% at 50% -8%, rgba(102, 214, 255, 0.13), transparent 62%),
    radial-gradient(60% 40% at 100% 100%, rgba(255, 173, 92, 0.05), transparent 70%);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; }
.app { position: relative; z-index: 1; width: 100%; max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 20px; min-height: 100%; display: flex; flex-direction: column; }
.chamfer { border-radius: var(--r-md); }
.label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- Home ---------- */
.hud { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: end; padding: 18px 18px 16px; margin-bottom: 18px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 30px; letter-spacing: 0.22em; line-height: 1; }
.brand span { color: var(--holo); }
.hud .meta { text-align: right; }
.lvl-ring { width: 54px; height: 54px; position: relative; display: grid; place-items: center; margin-left: auto; }
.lvl-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.lvl-ring b { font-family: var(--font-display); font-size: 20px; color: var(--holo); }
.xpbar { grid-column: 1 / -1; height: 6px; background: rgba(255,255,255,0.06); position: relative; overflow: hidden; border-radius: 99px; }
.xpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--holo), #a9ecff); border-radius: 99px; box-shadow: 0 0 10px rgba(102,214,255,.6); transition: width .6s ease; }
.hud .sub { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 14px; }
.hintchip { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); font-family: var(--font-display); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { --c: var(--holo); position: relative; text-align: left; background: linear-gradient(165deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 14px 13px; display: grid; grid-template-columns: 44px 1fr; gap: 3px 12px; align-items: center; min-height: 104px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.tile:hover { border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent), var(--shadow); }
.tile:active { transform: scale(0.97); }
.tile .ico { grid-row: 1 / 3; width: 44px; height: 44px; padding: 6px; border-radius: 12px; background: color-mix(in srgb, var(--c) 12%, transparent); }
.tile .nm { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--c); letter-spacing: 0.03em; }
.tile .tl { font-size: 13px; color: var(--dim); }
.tile .bar { grid-column: 1 / -1; height: 4px; background: rgba(255,255,255,0.06); margin-top: 10px; position: relative; border-radius: 99px; overflow: hidden; }
.tile .bar i { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 99px; }
.foot { margin-top: 20px; color: var(--dim); font-size: 13px; text-align: center; }

/* ---------- Play ---------- */
.topbar { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 6px; padding-block: 2px 8px; }
.iconbtn { width: 42px; height: 42px; display: grid; place-items: center; color: var(--text); border-radius: 12px; transition: background .15s; }
.iconbtn:hover { background: var(--panel-2); }
.iconbtn svg { width: 22px; height: 22px; }
.ttl { min-width: 0; }
.ttl .g { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: 0.04em; color: var(--c, var(--holo)); line-height: 1.1; }
.ttl .s { font-size: 13px; color: var(--dim); }
.timer { font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--text); font-size: 14px; padding: 6px 10px; border-radius: 99px; background: var(--panel-2); margin-right: 2px; }
.status { min-height: 22px; text-align: center; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.status b { color: var(--text); font-weight: 600; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; }
.frame { position: relative; padding: 10px; border-radius: 22px; background: linear-gradient(160deg, rgba(20,34,49,.9), rgba(10,17,25,.9)); border: 1px solid var(--line); box-shadow: var(--shadow), 0 0 40px -18px var(--c, var(--holo)); }
.board { display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.extra { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.extra:empty { display: none; }
.rules { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.rules h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c, var(--holo)); }
.rules p { margin: 0 0 6px; font-size: 16px; line-height: 1.35; }
.rules ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.45; color: var(--text); }
.rules li::marker { color: var(--c, var(--holo)); }
.toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 16px; width: 100%; max-width: 420px; margin: 0 auto; }
.tool { position: relative; height: 58px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text); transition: background .15s, transform .12s; }
.tool:hover { background: var(--panel-3); }
.tool:active { transform: scale(.96); }
.tool svg { width: 22px; height: 22px; }
.tool:disabled { opacity: .35; }
.tool .cnt { position: absolute; top: 6px; right: 10px; font-family: var(--font-display); font-size: 12px; color: var(--amber); }
.tool small { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }

.palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.swatch { width: 50px; height: 50px; border-radius: 14px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); transition: transform .12s; }
.swatch:active { transform: scale(.92); }
.swatch.sm { width: 42px; height: 42px; border-radius: 50%; }
.swatch.on { box-shadow: 0 0 0 3px var(--void), 0 0 0 5px var(--text); }
.pill { font-family: var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; font-size: 13px; padding: 12px 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; color: var(--text); transition: background .15s; }
.pill:hover { background: var(--panel-3); }
.pill.go { background: var(--holo); border-color: transparent; color: #031520; font-weight: 700; }
.pill.go:hover { background: #8ae1ff; }
.pill.warn { background: var(--danger); border-color: transparent; color: #1a0306; font-weight: 700; }
.pill:disabled { opacity: .4; }
.cards { display: grid; gap: 10px; width: 100%; }
.card { background: var(--card, #eef6fa); aspect-ratio: 5 / 7; display: grid; place-items: center; border-radius: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.35); transition: transform .14s ease, box-shadow .14s; }
.card svg { width: 76%; height: 86%; }
.card { position: relative; overflow: hidden; }
.cmark { position: absolute; background: currentColor; }
.cmark.cm0 { top: 0; left: 0; width: 26%; aspect-ratio: 1; clip-path: polygon(0 0, 100% 0, 0 100%); }
.cmark.cm1 { top: 0; right: 0; width: 26%; aspect-ratio: 1; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.cmark.cm2 { bottom: 0; left: 50%; transform: translateX(-50%); width: 34%; aspect-ratio: 2; border-radius: 999px 999px 0 0; }
.swatch.numd { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: rgba(6,18,26,.8); }
.card.sel { background: var(--card-sel, #d4f3ff); box-shadow: 0 0 0 3px var(--holo), 0 10px 22px rgba(0,0,0,.4); transform: translateY(-4px); }
.card.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.found-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.found-list span { font-family: var(--font-display); font-size: 12px; color: var(--good); background: rgba(110,231,173,.08); border: 1px solid rgba(110,231,173,.35); border-radius: 99px; padding: 3px 10px; }

.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(3, 6, 10, 0.72); padding: 16px; backdrop-filter: blur(6px); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet .box { width: min(100%, 420px); max-height: calc(100% - 16px); overflow-y: auto; background: linear-gradient(170deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-strong); border-radius: 22px; padding: 22px 20px 20px; box-shadow: var(--shadow); animation: rise .22s ease; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.sheet h2 { margin: 2px 0 0; font-family: var(--font-display); font-size: 28px; letter-spacing: 0.08em; color: var(--holo); }
.sheet .rows { margin: 16px 0 18px; display: grid; gap: 8px; }
.sheet .row { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.sheet .row b { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.sheet .up { color: var(--amber); font-family: var(--font-display); letter-spacing: 0.04em; }
.sheet .acts { display: grid; gap: 10px; }
.sheet .acts.two { grid-template-columns: 1fr 1fr; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.06em; padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; }
.chip.on { border-color: var(--holo); color: var(--holo); background: rgba(102,214,255,.08); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; background: var(--panel-3); border: 1px solid var(--line-strong); border-radius: 99px; padding: 10px 18px; font-size: 15px; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow); animation: rise .18s ease; }
.loading { flex: 1; display: grid; place-items: center; font-family: var(--font-display); letter-spacing: 0.2em; color: var(--dim); }
.sweep { animation: sweep 1s ease-out; }
@keyframes sweep { from { box-shadow: 0 0 0 2px var(--c, var(--holo)), 0 0 60px var(--c, var(--holo)); } }

/* desktop: wider library, bigger boards */
@media (min-width: 720px) {
  .app.wide { max-width: 980px; padding-inline: 32px; padding-block: 28px 32px; }
  .app.play { max-width: 760px; padding-block: 20px 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
  .tile { min-height: 118px; padding: 18px; }
  .brand { font-size: 36px; }
  .rules { max-width: 560px; }
}
@media (max-width: 360px) { .grid { gap: 8px; } .tile { grid-template-columns: 36px 1fr; padding: 12px 10px; } .tile .ico { width: 36px; height: 36px; } .tile .nm { font-size: 17px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- PWA shell: full height, safe areas ---------- */
html { background: var(--void); }
body { min-height: 100dvh; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); overscroll-behavior: none; }
.app { min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.dim { color: var(--dim); }
.wide { width: 100%; }
.linkbtn { color: var(--holo); font-family: var(--font-display); font-size: 13px; letter-spacing: .06em; padding: 6px 2px; }
.field { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.field:focus { outline: none; border-color: var(--holo); box-shadow: 0 0 0 3px rgba(102,214,255,.15); }

/* sign in */
.app.auth { justify-content: center; }
.auth-card { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-block: 24px; }
.auth-logo { width: 104px; height: 104px; margin: 0 auto 4px; }
.auth-logo svg { width: 100%; height: 100%; }
.auth-card .brand { text-align: center; margin: 0; }
.auth-tag { text-align: center; color: var(--dim); margin: 0 0 8px; }
.auth-form { display: grid; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-err { color: var(--danger); min-height: 1.2em; margin: 0; text-align: center; font-size: 15px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.auth-legal { text-align: center; color: var(--dim); font-size: 13px; }

/* home additions */
.hud { grid-template-columns: 1fr; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hud-actions { display: flex; gap: 4px; }
.hud-stats { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: center; }
.hud-stats .meta { text-align: left; display: flex; align-items: center; gap: 8px; }
.hud-stats .lvl-ring { margin: 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; text-align: left; }
.stat b { display: block; font-size: 17px; margin-top: 2px; }
.hintbtn b { color: var(--amber); }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: rgba(255,173,92,.08); border: 1px solid rgba(255,173,92,.35); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-size: 15px; }
.replaybar { width: 100%; display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; color: var(--text); }
.replaybar svg { width: 22px; height: 22px; color: var(--holo); }
.replaybar span { font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; }
.replaybar small { color: var(--dim); }
.foot { display: flex; justify-content: center; gap: 16px; align-items: center; }
.top-r { display: flex; align-items: center; gap: 2px; }

/* info, tables, tabs */
.sheet .box.tall { max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.info-body { overflow-y: auto; flex: 1; min-height: 0; margin-bottom: 14px; line-height: 1.4; }
.info-body p { margin: 0 0 10px; }
.tbl-wrap { overflow-x: auto; margin: 0 0 12px; }
.tbl { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-family: var(--font-display); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 500; }

/* settings */
.set-sec { margin-bottom: 18px; }
.set-sec h3 { font-family: var(--font-display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px 4px; font-weight: 500; }
.set-list { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.set-row:last-child { border-bottom: 0; }
.set-row.arr { justify-content: flex-start; padding-left: 6px; background: var(--panel); }
.set-row.arr.drag { background: var(--panel-3, var(--panel-2)); box-shadow: 0 8px 22px -8px rgba(0,0,0,.7); position: relative; z-index: 2; }
.grip { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--dim); background: none; border: 0; border-radius: 10px; touch-action: none; cursor: grab; }
.grip:focus-visible { outline: 2px solid var(--holo); outline-offset: -2px; }
.set-row span { min-width: 0; }
.set-row b { display: block; font-weight: 600; }
.set-row small { display: block; color: var(--dim); font-size: 13px; margin-top: 2px; }
.set-row .field { flex: 1; }
.set-sec.danger .set-list { border-color: rgba(255,107,120,.3); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--panel-3); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch:checked { background: var(--holo); }
.switch:checked::after { transform: translateX(18px); background: #031520; }
.update { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; gap: 12px; align-items: center; background: var(--panel-3); border: 1px solid var(--line-strong); border-radius: 99px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); white-space: nowrap; }
.update .pill { padding: 8px 14px; }
@media (max-width: 380px) { .hud-stats { grid-template-columns: 1fr 1fr; } .hud-stats .meta { grid-column: 1 / -1; } }

/* ---------- v0.02: one-screen game layout ---------- */
.app.play {
  height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: 0; overflow: hidden; padding-block: 6px 10px;
}
.app.play .stage { flex: 1 1 auto; min-height: 0; overflow: hidden; gap: 10px; justify-content: center; }
.app.play .frame { flex: none; max-width: 100%; }
.app.play .toolbar { flex: none; padding-top: 10px; }
.app.play .status { flex: none; margin-bottom: 4px; }
.app.play .topbar { flex: none; }
.app.play .extra { flex: none; gap: 8px; }
.rules.tut { flex: none; max-height: 28%; overflow-y: auto; padding: 10px 14px; }
.rules.tut ul { font-size: 14px; }
.cards { gap: 10px; }
@media (max-height: 700px) {
  .app.play .toolbar .tool { height: 50px; }
  .app.play .toolbar .tool small { display: none; }
  .swatch { width: 44px; height: 44px; }
  .swatch.sm { width: 36px; height: 36px; }
}
/* settings and other text pages scroll; game screens never do */
.app.wide, .app.settings { overflow-x: hidden; }

/* safe areas for overlays (notch, home indicator, landscape sides) */
.sheet { padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet .box { max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px); }

/* sticky hint messages */
.toast { display: flex; align-items: center; gap: 10px; border-radius: 18px; touch-action: none; transition: opacity .15s; }
.toast.sticky { padding: 12px 10px 12px 16px; text-align: left; border-color: var(--holo); box-shadow: 0 0 0 1px rgba(102,214,255,.2), var(--shadow); width: max-content; max-width: min(440px, calc(100% - 32px)); }
.toast-x { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--panel); color: var(--dim); font-size: 13px; }

/* archive game picker: the home-screen icons, all on one line */
.gamepick { display: grid; gap: 6px; margin: 4px 0 6px; }
.gp { aspect-ratio: 1; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; padding: 0; min-width: 0; transition: transform .12s, border-color .12s; }
.gp .ico { width: 78%; height: 78%; padding: 0; background: none; }
.gp.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); box-shadow: 0 0 0 1px var(--c); }
.gp:disabled { opacity: .28; }
.gp:not(:disabled):active { transform: scale(.94); }
.gp-name { font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; margin: 2px 0 4px; }

/* leaderboard */
.board-page .tabs { margin: 4px 0 12px; }
.lb { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.lb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lb .lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: rgba(102,214,255,.08); box-shadow: inset 3px 0 0 var(--holo); }
.lb-row.pinned { margin-top: 10px; border: 1px solid var(--line-strong); border-radius: 14px; }
.lb-pos { font-family: var(--font-display); font-weight: 600; color: var(--dim); text-align: center; }
.lb-pos.top1 { color: #ffd36b; } .lb-pos.top2 { color: #d8e3ea; } .lb-pos.top3 { color: #e3a46b; }
.lb-name { min-width: 0; } .lb-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lb-name small { color: var(--dim); font-size: 13px; }
.lb-val { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.small { font-size: 13px; text-align: center; margin-top: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-grid .stat b { font-size: 20px; }
.sec-h { font-family: var(--font-display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 500; margin: 0 0 8px 4px; }
.pop { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px; }
.pop-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 40px; gap: 10px; align-items: center; padding: 6px 0; }
.pop-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; white-space: nowrap; }
.pop-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; } .pop-bar i { display: block; height: 100%; border-radius: 99px; }
.pop-val { text-align: right; color: var(--dim); font-size: 13px; }
.board-page .tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.board-page .tabs .chip { padding: 8px 0; text-align: center; font-size: 12px; letter-spacing: .02em; }

/* Color pickers (Surge, Cipher) always sit on one line and scale to fit. */
.palette.one-line { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 52px)); justify-content: center; gap: clamp(4px, 2vw, 10px); width: 100%; flex-wrap: nowrap; }
.palette.one-line .swatch { width: 100%; height: auto; aspect-ratio: 1; }
.palette.one-line .swatch.sm { border-radius: 50%; }

/* Status bar: Latys blue. iPhone draws the page under the status bar, so paint that strip;
   Android uses theme-color. */
html::before { content: ""; position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--holo); pointer-events: none; }
.lb-err { background: var(--panel); border: 1px solid rgba(255,107,120,.35); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; justify-items: start; }
.lb-err p { margin: 0; } .lb-err .small { text-align: left; margin-bottom: 8px; }

/* ---------- v0.03: page layouts ---------- */
/* Home and sign-in: centered vertically when they fit, scroll normally when they don't. */
.app.wide { justify-content: center; padding-block: 32px 36px; }
.app.auth { padding-block: 32px 36px; }
/* Text pages (settings, guide, leaderboard) read top-down and scroll. */
.app.page { justify-content: flex-start; padding-block: 24px 40px; overflow: visible; }
.app.page .topbar { margin-bottom: 8px; }
.app.page .info-body { overflow: visible; margin-bottom: 0; }
.app.page .rules { margin-bottom: 10px; }
.app.page .tabs { margin: 4px 0 14px; }
/* Game screens: a little more breathing room from the screen edges. */
.app.play { padding-block: 14px 18px; }
@media (min-width: 720px) { .app.page { max-width: 720px; padding-inline: 32px; } }

/* puzzle-in-progress marker on home tiles */
.tile.has-run { border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.run-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 99px; background: color-mix(in srgb, var(--c) 18%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); color: var(--text); font-family: var(--font-display); font-size: 11px; font-variant-numeric: tabular-nums; }
.run-badge i { width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 6px; border-color: transparent transparent transparent var(--c); }
/* in-progress badge: a small play marker on the corner of the game icon */
.run-badge { top: 8px; left: 46px; right: auto; bottom: auto; width: 20px; height: 20px; padding: 0; justify-content: center; border-radius: 50%; background: var(--c); border: 2px solid var(--panel); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); animation: runpulse 2.4s ease-in-out infinite; }
.run-badge i { border-width: 4px 0 4px 6px; border-color: transparent transparent transparent #061018; margin-left: 2px; }
@keyframes runpulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); } }
@media (min-width: 720px) { .run-badge { top: 12px; left: 50px; } }
@media (max-width: 360px) { .run-badge { left: 36px; } }

/* install sheet */
.install-steps { margin: 14px 0 16px; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
.install-steps li { counter-increment: st; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-size: 15.5px; line-height: 1.4; }
.install-steps li::before { content: counter(st); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(102, 214, 255, 0.14); color: var(--holo); font-family: var(--font-display); font-size: 14px; }
.install-steps svg { color: var(--holo); }
.sheet p.small { font-size: 13.5px; margin-top: -4px; }

/* ---------- v0.05 ---------- */
/* home fits one screen */
.app.home { padding-block: 18px 18px; }
.app.home .hud { margin-bottom: 14px; }
.app.home .tile { min-height: 0; }
.grid.compact { gap: 10px; }
.grid.compact .tile { padding: 8px 12px; grid-template-columns: 34px 1fr; gap: 1px 10px; }
.grid.compact .tile .ico { width: 34px; height: 34px; padding: 5px; border-radius: 10px; }
.grid.compact .tile .nm { font-size: 17px; }
.grid.compact .tile .tl { font-size: 12.5px; }
.grid.compact .tile .bar { margin-top: 6px; }
.hud .sub { flex-wrap: wrap; row-gap: 2px; align-items: center; }
.hud .sub .life { white-space: nowrap; }
.sync-r { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.syncbtn { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--holo); margin: -4px -6px -4px 0; }
.syncbtn svg, .iconbtn.refresh svg { width: 16px; height: 16px; }
.syncbtn:active { background: rgba(102,214,255,.12); }
.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* settings: haptic strength */
.set-row.set-col { flex-direction: column; align-items: stretch; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--panel-3); border-radius: 12px; padding: 4px; }
.seg-b { padding: 8px 4px; border-radius: 9px; font-family: var(--font-display); font-size: 13px; letter-spacing: .04em; color: var(--dim); }
.seg-b.on { background: var(--holo); color: #031520; font-weight: 600; }

/* leave confirm, archive */
.sheet h2.q { font-size: 22px; letter-spacing: .03em; line-height: 1.2; margin-top: 4px; }
.sheet .chips .chip[aria-pressed="false"] { opacity: .75; }
.sheet p.mix { margin: 10px 0 12px; }
.gamepick .gp[aria-pressed="false"]:not(:disabled) { opacity: .45; filter: grayscale(.6); }

/* tutorial coach */
.coach { flex: none; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, var(--panel-2)), var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 16px; padding: 10px 14px 12px; }
.coach-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.coach-dots { display: flex; gap: 5px; }
.coach-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.coach-dots i.on { background: var(--c); box-shadow: 0 0 8px var(--c); }
.coach-dots i.done { background: color-mix(in srgb, var(--c) 55%, transparent); }
.coach p { margin: 6px 0 0; font-size: 15px; line-height: 1.4; }
.coach .coach-next { margin-top: 10px; padding: 8px 18px; }
.coach.pop { animation: coachpop .35s ease; }
@keyframes coachpop { 0% { transform: scale(.98); box-shadow: 0 0 0 0 var(--c); } 60% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); } 100% { transform: none; box-shadow: none; } }

/* triad tutorial */
.card.glow { box-shadow: 0 0 0 3px var(--c), 0 0 18px color-mix(in srgb, var(--c) 70%, transparent); animation: glowpulse 1.4s ease-in-out infinite; }
@keyframes glowpulse { 50% { box-shadow: 0 0 0 3px var(--c), 0 0 4px transparent; } }
.checklist { width: 100%; max-width: 420px; display: grid; gap: 3px; font-size: 13.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.checklist p { margin: 0; text-align: center; }
.ck-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; }
.ck-row b { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.ck-row em { font-style: normal; font-family: var(--font-display); font-size: 12.5px; }
.ck-row.ok em { color: #63e6a4; }
.ck-row.bad em { color: var(--danger); }
/* short phones: a tighter header so all ten games fit */
@media (max-height: 740px) and (max-width: 560px) {
  .app.home { padding-block: 10px 10px; }
  .app.home .hud { padding: 12px 14px 10px; gap: 6px; margin-bottom: 10px; }
  .app.home .brand { font-size: 24px; }
  .app.home .hud-stats { gap: 8px; }
  .app.home .hud .stat { padding: 5px 10px; }
  .app.home .hud .stat b { font-size: 15px; }
  .app.home .lvl-ring { width: 44px; height: 44px; }
  .app.home .replaybar { padding: 9px 12px; margin-bottom: 10px; }
  .app.home .grid { gap: 8px; }
  .app.home .hud .sub { font-size: 13px; }
}
@media (max-width: 380px) { .app.home .hud-stats { grid-template-columns: auto 1fr 1fr; } .app.home .hud-stats .meta { grid-column: auto; } .app.home .hud-stats .meta .label { display: none; } }

/* ---------- v0.06 ---------- */
/* privacy policy (in-app page and standalone privacy.html share this) */
.policy { line-height: 1.55; font-size: 16.5px; padding-bottom: 12px; }
.policy h2 { font-family: var(--font-display); font-size: 18px; letter-spacing: .04em; margin: 26px 0 8px; color: var(--holo); }
.policy ul { padding-left: 20px; }
.policy a { color: var(--holo); }
.policy hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.policy > p:first-child { margin-top: 4px; }
a.iconbtn { color: var(--text); }
.auth-legal.linkbtn { color: var(--dim); align-self: center; }

/* launch screen */
.splash { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: 1fr auto; place-items: center; background: radial-gradient(120% 80% at 50% 38%, #0e1b28 0%, #070b11 62%); padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(40px + env(safe-area-inset-bottom, 0px)); text-align: center; transition: opacity .45s ease, visibility .45s; }
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-in { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.splash-logo { width: 150px; height: 150px; margin-bottom: 14px; }
.splash-logo svg { width: 100%; height: 100%; }
.splash-label { font-family: var(--font-display); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--dim); animation: splash-fade .6s .25s both; }
.splash .brand { font-size: 46px; margin: 0; animation: splash-fade .6s .32s both; }
.splash-tag { margin: 6px 0 0; font-family: var(--font-display); font-size: 17px; letter-spacing: .08em; color: var(--holo); animation: splash-fade .6s .45s both; }
.splash-sub { margin: 0; max-width: 300px; color: var(--dim); font-size: 15px; line-height: 1.4; animation: splash-fade .6s .55s both; }
.splash-load { width: min(220px, 60vw); display: grid; gap: 10px; justify-items: center; font-family: var(--font-display); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--dim); }
.splash-load i { display: block; width: 100%; height: 3px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; position: relative; }
.splash-load i::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 99px; background: linear-gradient(90deg, transparent, var(--holo), transparent); animation: splash-bar 1.2s ease-in-out infinite; }
.splash.err .splash-load { color: var(--danger); letter-spacing: .12em; max-width: 320px; width: auto; line-height: 1.5; }
.splash.err .splash-load i { display: none; }
@keyframes splash-rise { from { opacity: 0; transform: scale(.86); } }
@keyframes splash-fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes splash-bar { from { left: -40%; } to { left: 100%; } }

/* ---------- v0.07 ---------- */
.iconbtn.holo { color: var(--holo); }
.hud .sub .life { margin-left: auto; }
.syncbar { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; }
.syncbar-t { display: flex; align-items: baseline; gap: 10px; min-width: 0; color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.syncbar .syncbtn { width: 38px; height: 38px; margin: 0; border-radius: 10px; }
.syncbar .syncbtn svg { width: 18px; height: 18px; }
@media (max-height: 740px) and (max-width: 560px) { .app.home .syncbar { margin-top: 8px; padding-block: 3px; } }
/* update prompt: centered over everything */
.update-panel { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 10, 0.72); backdrop-filter: blur(6px); animation: fade .18s ease; }
.update-panel .box { width: min(100%, 380px); background: linear-gradient(170deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-strong); border-radius: 22px; padding: 22px 20px 20px; box-shadow: var(--shadow); text-align: left; }
.update-panel h2 { margin: 2px 0 6px; font-family: var(--font-display); font-size: 26px; letter-spacing: .06em; color: var(--holo); }
.update-panel .acts { display: grid; gap: 10px; margin-top: 16px; }
.update-panel .acts.two { grid-template-columns: 1fr 1fr; }

/* ---------- v0.08: animated logo (logo-anim.js) ---------- */
.logo-anim { position: relative; }
.logo-anim canvas { position: absolute; left: -30%; top: -30%; width: 160%; height: 160%; pointer-events: none; }
/* launch screen words arrive after the tiles have played in */
.splash-label { animation-delay: 2.55s; }
.splash .brand { animation-delay: 2.65s; }
.splash-tag { animation-delay: 3.2s; }
.splash-sub { animation-delay: 3.4s; }

/* ---------------------------------------------------------------- admin: puzzle check */
.app.admin { max-width: 1240px; }
.adm-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; margin: 0 -4px 10px; background: rgba(9, 15, 22, .94); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; }
.adm-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; color: var(--dim); }
.adm-sum b { color: var(--text); font-size: 17px; }
.adm-t { font-family: var(--font-display); font-size: 12px; letter-spacing: .04em; }
.adm-t.ok { color: var(--good); } .adm-t.flag { color: var(--danger); }
.adm-fbtn { padding: 8px 14px; font-size: 12px; flex: none; }
.adm-fbtn.on { border-color: var(--holo); color: var(--holo); }
.adm-panel { display: grid; gap: 12px; padding: 14px; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.adm-panel[hidden] { display: none; }
.adm-f { display: grid; gap: 6px; min-width: 0; }
.adm-f .chips { margin: 0; }
.adm-f .chip { color: var(--dim); }
.adm-f .chip.on { color: var(--cc, var(--holo)); border-color: var(--cc, var(--holo)); background: color-mix(in srgb, var(--cc, var(--holo)) 10%, transparent); }
.adm-f .seg { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
.adm-f .field { padding: 9px 12px; }
.adm-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.adm-f .field, .adm-panel .field { min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
.adm-group { margin-bottom: 18px; }
.adm-gh { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 50px); z-index: 4; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 8px; padding: 7px 10px; font-family: var(--font-display); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--c); background: rgba(9, 15, 22, .92); border-left: 3px solid var(--c); border-radius: 6px; }
.adm-gh span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-gh small { flex: none; color: var(--dim); letter-spacing: .04em; font-size: 11px; text-transform: none; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; align-items: start; }
.adm-card { min-width: 0; padding: 10px; background: linear-gradient(165deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r-md); }
.adm-card[data-s="ok"] { border-color: rgba(110, 231, 173, .45); }
.adm-card[data-s="flag"] { border-color: rgba(255, 107, 120, .6); }
.adm-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.adm-head b { font-size: 15px; }
.adm-id { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-family: ui-monospace, monospace; font-size: 11px; user-select: all; }
.adm-size { color: var(--dim); }
.adm-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--panel-3); align-self: center; flex: none; }
[data-s="ok"] .adm-dot { background: var(--good); } [data-s="flag"] .adm-dot { background: var(--danger); }
.adm-board { width: 100%; margin-inline: auto; pointer-events: none; border-radius: 12px; }
.adm-board svg.board { display: block; width: 100% !important; height: auto !important; }
.adm-body { display: grid; gap: 8px; margin-top: 8px; }
.adm-body:empty { display: none; }
.adm-body .status { margin: 0; min-height: 0; }
.adm-extra { pointer-events: none; }
.adm-desc { margin: 0; font-size: 13px; color: var(--dim); text-align: center; }
.adm-sw { display: inline-flex; gap: 3px; vertical-align: -2px; margin-inline: 3px; }
.adm-sw i { width: 14px; height: 14px; border-radius: 4px; }
.adm-bad { margin: 0; padding: 8px 10px; font-size: 13px; color: #ffd0d4; background: rgba(255, 107, 120, .12); border: 1px solid rgba(255, 107, 120, .5); border-radius: 10px; }
.adm-ctl { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.pill.sm { padding: 8px 10px; font-size: 11px; letter-spacing: .06em; }
.pill.sm.on { border-color: var(--holo); color: var(--holo); }
.pill.sm.ok { background: var(--good); border-color: transparent; color: #03190f; font-weight: 700; }
.pill.sm.flag { background: var(--danger); border-color: transparent; color: #1a0306; font-weight: 700; }
.adm-step { min-width: 48px; text-align: center; font-size: 13px; color: var(--dim); }
.adm-note { padding: 9px 12px; font-size: 15px; }
.adm-empty { text-align: center; padding: 30px 0; }
.adm-list.compact .adm-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.adm-list.compact .adm-card { padding: 6px; cursor: pointer; }
.adm-list.compact .adm-card:not(.open) .adm-body, .adm-list.compact .adm-card:not(.open) .adm-id, .adm-list.compact .adm-card:not(.open) .adm-size { display: none; }
.adm-list.compact .adm-card:not(.open) .adm-head { justify-content: space-between; margin-bottom: 4px; }
.adm-list.compact .adm-card:not(.open) .adm-board { min-height: 0 !important; }
.adm-list.compact .adm-card.open { grid-column: 1 / -1; padding: 10px; cursor: default; }
@media (max-width: 420px) { .adm-two { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- settings: search, collapsible sections, volume */
.set-search { margin: 0 0 14px; }
.set-none { text-align: center; }
.set-h { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px 8px; font-family: var(--font-display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); text-align: left; }
.set-h svg { width: 18px; height: 18px; flex: none; transition: transform .18s ease; }
.set-sec.shut:not(.force) .set-h svg { transform: rotate(-90deg); }
.set-sec.shut:not(.force) .set-list { display: none; }
.set-sec.shut:not(.force) { margin-bottom: 6px; }
.set-row[hidden], .set-sec[hidden] { display: none !important; }
.vol-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; }
.vol-v { color: var(--holo); }
input.vol { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input.vol::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--holo) var(--p, 0%), var(--panel-3) var(--p, 0%)); }
input.vol::-moz-range-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--holo) var(--p, 0%), var(--panel-3) var(--p, 0%)); }
input.vol::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 3px solid var(--holo); }
input.vol::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text); border: 3px solid var(--holo); }
/* the labels sit exactly under the points the slider thumb snaps to (the thumb is 22px wide, so its centre travels 11px in from each end) */
.vol-t { position: relative; height: 14px; margin: -6px 11px 0; font-size: 11px; color: var(--dim); font-family: var(--font-display); }
.vol-t span { position: absolute; top: 0; transform: translateX(-50%); }
.vol-t span:nth-child(1) { left: 0; } .vol-t span:nth-child(2) { left: 25%; } .vol-t span:nth-child(3) { left: 50%; } .vol-t span:nth-child(4) { left: 75%; } .vol-t span:nth-child(5) { left: 100%; }
input.vol::-moz-range-thumb { box-sizing: border-box; width: 22px; height: 22px; }
/* five header icons: keep them on one line beside the wordmark on narrow phones */
.hud-top .label { white-space: nowrap; }
.hud-actions { gap: 2px; }
@media (max-width: 430px) { .hud-actions .iconbtn { width: 36px; } .hud-actions { gap: 0; } }
@media (max-width: 350px) { .hud-actions .iconbtn { width: 32px; } .hud-actions .iconbtn svg { width: 20px; height: 20px; } }
@media (max-width: 350px) { .hud-actions .iconbtn { width: 28px; } }

/* themed board frame (see themes.js) */
.themed { background: var(--frame-bg); }
.frame.themed { border-color: var(--frame-line); }
.adm-board.themed { padding: 8px; }

/* ---------------------------------------------------------------- store, themes & SFX, events */
.field.pick { flex: 0 1 46%; min-width: 0; padding: 9px 10px; font-size: 15px; }
.marquee { overflow: hidden; max-width: 100%; margin: 0 0 12px; padding: 9px 0; background: rgba(102,214,255,.07); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; color: var(--holo); white-space: nowrap; }
.mq-run { display: inline-flex; gap: 48px; padding-left: 16px; animation: mq 30s linear infinite; }
@keyframes mq { to { transform: translateX(calc(-50% - 24px)); } }
@media (prefers-reduced-motion: reduce) { .marquee { white-space: normal; padding: 9px 14px; } .mq-run { animation: none; display: grid; gap: 6px; padding: 0; } .mq-run span:nth-child(n + 4) { display: none; } }
.store-wallet { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; margin-bottom: 16px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r-md); }
.store-wallet b { font-size: 22px; }
.store-wallet small { color: var(--dim); font-size: 13px; text-align: right; max-width: 60%; }
.store-acts { display: flex; gap: 6px; flex: none; align-items: center; }
.tile .ready { position: absolute; right: 12px; bottom: 24px; width: 20px; height: 20px; color: var(--good); display: grid; place-items: center; }
.ready svg { width: 100%; height: 100%; display: block; }
.grid.compact .tile .ready { bottom: 17px; right: 10px; width: 18px; height: 18px; }
.ready.inline { flex: none; width: 26px; height: 26px; color: var(--good); }
.up-row .bar { display: block; height: 4px; margin-top: 7px; border-radius: 99px; background: rgba(255,255,255,.06); position: relative; overflow: hidden; }
.up-row .bar i { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 99px; }
.set-list .set-row.has-ico > span.ready, .set-list .set-row.has-ico > span.up-n { flex: none; }
.tile.has-ready .tl { padding-right: 24px; }
.up-n { flex: none; color: var(--dim); font-size: 13px; white-space: nowrap; }
.two { display: inline-flex; flex-direction: column; line-height: 1.12; letter-spacing: 0; }
.two > span { display: flex; justify-content: space-between; gap: .1em; } .two i { font-style: normal; }
.lb-lv { display: inline-flex; align-items: center; gap: 8px; } .lb-lv .two { font-size: 9px; color: var(--dim); } .lb-lv b { font: inherit; }
.grid.scrolls { overflow-y: auto; overscroll-behavior: contain; align-content: start; padding: 2px 4px 2px 2px; margin-inline: -2px -4px; scrollbar-width: thin; scrollbar-color: var(--line-2, var(--line)) transparent; -webkit-overflow-scrolling: touch; }
.tile .icow { grid-row: 1 / 3; position: relative; display: block; width: 44px; height: 44px; }
.tile .icow .ico { grid-row: auto; display: block; width: 100%; height: 100%; }
.tile .icow .run-badge { top: -7px; right: -7px; left: auto; bottom: auto; }
.grid.compact .tile .icow { width: 34px; height: 34px; }
@media (max-width: 360px) { .tile .icow { width: 36px; height: 36px; } }
.rowico { flex: none; width: 30px; height: 30px; border-radius: 9px; padding: 4px; background: rgba(255,255,255,.05); display: grid; place-items: center; } .rowico .ico { width: 100%; height: 100%; padding: 0; background: none; display: block; }
.set-row.has-ico { justify-content: flex-start; } .set-row.has-ico > span:not(.rowico) { flex: 1; } .set-row.has-ico .field { flex: 0 1 46%; }
.set-row.arr .rowico { margin-right: 2px; }
.set-all { flex: none; white-space: nowrap; }
.ms-field { width: 92px; flex: none !important; text-align: right; }
.auto-next { grid-column: 1 / -1; display: grid; gap: 6px; color: var(--dim); font-size: 14px; text-align: center; margin-bottom: 4px; }
.auto-bar { display: block; height: 4px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; } .auto-bar i { display: block; height: 100%; width: 0; background: var(--holo); border-radius: 99px; }
@media (prefers-reduced-motion: reduce) { .auto-bar i { transition: none !important; width: 100% !important; } }
.grid.scrolls.fade-top { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px); mask-image: linear-gradient(to bottom, transparent 0, #000 26px); }
.grid.scrolls.fade-end { -webkit-mask-image: linear-gradient(to top, transparent 0, #000 26px); mask-image: linear-gradient(to top, transparent 0, #000 26px); }
.grid.scrolls.fade-top.fade-end { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%); }
.bundle-row > span:first-child { flex: 1 1 0; } .bundle-row .pill, .bundle-row .owned { flex: none; white-space: nowrap; }
.more-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--holo); font-family: var(--font-display); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; text-align: left; }
.more-btn svg { width: 18px; height: 18px; flex: none; transition: transform .15s; } .more-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.theme-grid[hidden] { display: none; }
.owned { flex: none; color: var(--good); font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; white-space: nowrap; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 12px; }
.theme-tile { display: grid; gap: 6px; justify-items: center; text-align: center; min-width: 0; }
.theme-tile b { font-size: 13px; font-weight: 600; }
.mini { width: 100%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 10px; pointer-events: none; background: var(--frame-bg, var(--panel-2)); padding: 4px !important; }
.mini svg.board { width: 100% !important; height: 100% !important; }
.mini .cards { gap: 3px; } .mini .card { border-radius: 4px; box-shadow: none; }
.ev-list { display: grid; gap: 10px; margin: 10px 0 14px; }
.ev-item { display: grid; gap: 2px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.ev-item small { color: var(--dim); }

/* ---------------------------------------------------------------- about, reports */
.about { display: grid; gap: 14px; }
.about h3 { margin: 10px 0 0; font-family: var(--font-display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--holo); font-weight: 500; }
.about p { margin: 0; color: var(--text); line-height: 1.55; }
.about .credit { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.about .credit b { display: block; font-size: 17px; }
.about .credit span { color: var(--dim); font-size: 14px; }
.about .foot { color: var(--dim); font-size: 13px; text-align: center; margin-top: 6px; }
.report-form { display: grid; gap: 12px; }
.report-form textarea.field { min-height: 130px; resize: vertical; font: inherit; }
.adm-report p { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- store: buying panel, purchase history */
.busy { height: 4px; border-radius: 99px; margin-top: 14px; background: linear-gradient(90deg, transparent, var(--holo), transparent) 0 0 / 40% 100% no-repeat, var(--panel-3); animation: busy 1.1s linear infinite; }
@keyframes busy { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .busy { animation: none; background: var(--holo); opacity: .5; } }
.ledger { display: grid; margin: 12px 0; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.led-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.led-row:last-child { border-bottom: 0; }
.led-row span { min-width: 0; } .led-row span b { display: block; font-weight: 600; font-size: 15px; } .led-row small { color: var(--dim); font-size: 12px; }
.led-row .minus { color: var(--amber, #ffb454); white-space: nowrap; } .led-row .plus { color: var(--good); white-space: nowrap; }

/* ---- v0.16: daily challenge, settings pop-up, unlock chooser ---- */
.daily { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.daily-t { min-width: 0; }
.daily-s { font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-s b { font-family: var(--font-display); letter-spacing: .04em; }
.daily-b { display: flex; gap: 6px; flex: none; }
.daily-b .pill:disabled:not(.ok) { opacity: .5; }
.daily-b .pill.ok:disabled { opacity: 1; }
.cal-top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-top b { font-family: var(--font-display); letter-spacing: .08em; font-size: 16px; }
.iconbtn.flip svg { transform: scaleX(-1); }
.iconbtn:disabled { opacity: .3; }
.cal-bar { margin: 10px 0 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-h { text-align: center; font-family: var(--font-display); font-size: 11px; letter-spacing: .1em; color: var(--dim); padding-bottom: 2px; }
.cal-d { aspect-ratio: 1; display: grid; place-items: center; align-content: center; gap: 1px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); line-height: 1; }
.cal-d i { font-style: normal; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cal-d b { font-size: 15px; height: 15px; }
.cal-d.ok { background: color-mix(in srgb, var(--good) 16%, var(--panel)); border-color: color-mix(in srgb, var(--good) 55%, transparent); color: var(--good); }
.cal-d.bad { background: color-mix(in srgb, var(--danger) 13%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.cal-d.miss { color: var(--dim); }
.cal-d.now { border-color: var(--holo); color: var(--holo); box-shadow: 0 0 0 1px var(--holo) inset; }
.cal-d.now b { font-size: 10px; }
.cal-d.soon { background: transparent; }
.cal-d.none { background: transparent; border-style: dashed; opacity: .4; }
.cal-key { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key .cal-d { width: 22px; height: 22px; aspect-ratio: auto; border-radius: 7px; font-size: 13px; }
.cal-key .cal-d.now { font-size: 9px; }
.sheet .box.tips { display: flex; flex-direction: column; }
.tips-list { overflow-y: auto; min-height: 0; margin-top: 4px; }
.tips-h { padding: 14px 15px 4px; color: var(--holo); }
.use-chips .chip.on { border-color: var(--c, var(--holo)); color: var(--c, var(--holo)); background: color-mix(in srgb, var(--c, var(--holo)) 12%, transparent); }
.up-intro { margin-bottom: 18px; }
.adm-open { width: 100%; text-align: left; }
.adm-days { display: grid; gap: 2px; margin-top: 6px; max-height: 320px; overflow-y: auto; }
.adm-day { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.adm-day:nth-child(odd) { background: var(--panel); }
.adm-day.now { outline: 1px solid var(--holo); }
.syncbar { padding-left: 6px; }
.syncbar-t { margin-left: auto; justify-content: flex-end; text-align: right; }
.pill.sm.journey { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 9px 13px; border-color: color-mix(in srgb, var(--holo) 55%, transparent); color: var(--holo); background: linear-gradient(120deg, rgba(102,214,255,.14), rgba(169,140,255,.14)); }
.syncbar { position: relative; }
.more-down { position: absolute; left: 50%; top: -25px; width: 34px; height: 22px; margin-left: -17px; display: grid; place-items: center; color: var(--holo); border-radius: 99px; background: color-mix(in srgb, var(--bg, #060b14) 78%, transparent); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 2; }
.more-down.on { opacity: .95; pointer-events: auto; }
.more-down.on svg { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { .more-down.on svg { animation: none; } }

/* ---- v0.18: light mode. The same layout with a pale palette; set by Settings > Appearance. ---- */
.seg.seg.two { grid-template-columns: 1fr 1fr !important; }
:root { --on-holo: #031520; --track: rgba(255,255,255,.06); }
.pill.go, .seg-b.on { color: var(--on-holo); }
.switch:checked::after { background: var(--on-holo); }
:root[data-mode="light"] {
  --void: #eef3f8; --panel: #ffffff; --panel-2: #f7fafc; --panel-3: #e6edf4;
  --line: rgba(20, 70, 110, 0.16); --line-strong: rgba(20, 70, 110, 0.36); --line-2: rgba(20, 70, 110, 0.28);
  --holo: #0b7fc2; --amber: #c2650c; --text: #0f2231; --dim: #566b7b; --danger: #d43a4a; --good: #178a55;
  --shadow: 0 8px 24px rgba(20, 50, 80, 0.12); --on-holo: #ffffff; --track: rgba(15, 34, 49, .1); --bg: #eef3f8;
  color-scheme: light;
}
[data-mode="light"] body::before { background: radial-gradient(90% 50% at 50% -8%, rgba(11, 127, 194, 0.12), transparent 62%), radial-gradient(60% 40% at 100% 100%, rgba(194, 101, 12, 0.06), transparent 70%); }
[data-mode="light"] .xpbar, [data-mode="light"] .tile .bar, [data-mode="light"] .pop-bar, [data-mode="light"] .up-row .bar, [data-mode="light"] .auto-bar, [data-mode="light"] .splash-load i { background: var(--track); }
[data-mode="light"] .xpbar i { background: linear-gradient(90deg, var(--holo), #45b4ee); box-shadow: none; }
[data-mode="light"] .frame { background: linear-gradient(160deg, #ffffff, #f3f7fa); }
[data-mode="light"] .pill.go:hover { background: #0a6fa9; }
[data-mode="light"] .pill.warn, [data-mode="light"] .pill.sm.flag, [data-mode="light"] .pill.sm.ok { color: #ffffff; }
[data-mode="light"] .sheet, [data-mode="light"] .update-panel { background: rgba(30, 50, 70, 0.45); }
[data-mode="light"] .chip.on, [data-mode="light"] .lb-row.me { background: rgba(11, 127, 194, .1); }
[data-mode="light"] .rowico, [data-mode="light"] .coach-dots i { background: rgba(15, 34, 49, .07); }
[data-mode="light"] .lb-pos.top1 { color: #b8860b; } [data-mode="light"] .lb-pos.top2 { color: #6f8291; } [data-mode="light"] .lb-pos.top3 { color: #a8642a; }
[data-mode="light"] .run-badge i { border-left-color: #ffffff; }
[data-mode="light"] .ck-row.ok em { color: var(--good); }
[data-mode="light"] .splash { background: radial-gradient(120% 80% at 50% 38%, #ffffff 0%, #eef3f8 62%); }
[data-mode="light"] .adm-bar, [data-mode="light"] .adm-gh { background: rgba(255, 255, 255, .94); }
[data-mode="light"] .adm-bad { color: #9c1f2c; }
[data-mode="light"] .marquee { background: rgba(11, 127, 194, .07); }
[data-mode="light"] .found-list span { background: rgba(23, 138, 85, .08); border-color: rgba(23, 138, 85, .4); }
[data-mode="light"] .banner { background: rgba(194, 101, 12, .08); border-color: rgba(194, 101, 12, .4); }
[data-mode="light"] .pill.sm.journey { background: linear-gradient(120deg, rgba(11,127,194,.1), rgba(111,95,224,.12)); }
[data-mode="light"] .set-row.arr.drag { box-shadow: 0 8px 22px -8px rgba(20,50,80,.4); }
