/* Single Line — calm chrome around a drawing board. Every colour arrives
   as a custom property from themes.js; the defaults below are gold leaf. */

:root {
  --bg-a: #ebe4d6;
  --bg-b: #d7cdb9;
  --blob-1: rgba(255, 251, 240, 0.95);
  --blob-2: rgba(214, 170, 80, 0.22);
  --blob-3: rgba(150, 120, 80, 0.2);
  --ink: #2f2820;
  --ink-soft: #76695a;
  --paper: #faf6ec;
  --paper-2: #f0e9da;
  --line: rgba(60, 45, 25, 0.13);
  --accent: #a5781f;
  --accent-2: #d6a945;
  --accent-ink: #fffaf0;
  --glow: #f2c75c;
  --card: rgba(255, 252, 244, 0.45);
  --card-border: rgba(255, 255, 255, 0.6);
  --btn-bg: rgba(255, 252, 244, 0.6);
  --btn-hover: rgba(255, 252, 244, 0.9);
  --btn-border: rgba(60, 45, 25, 0.15);
  --hover: rgba(60, 45, 25, 0.08);
  --track: #d3c7b0;
  --shadow: 60, 42, 18;
  --backdrop: rgba(45, 32, 15, 0.38);
  --toast-bg: rgba(47, 40, 32, 0.94);
  --toast-ink: #fff8ea;
  --mark: #b98a26;
  --mark-2: #c2462b;
  --mark-ink: #fffaf0;
  --radius: 18px;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-a), var(--bg-b));
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  transition: background 0.8s, color 0.8s;
}

/* ---------------------------------------------------------- background */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.6; will-change: transform; transition: background 0.8s; }
.bg .b1 { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--blob-1); animation: drift 48s ease-in-out infinite alternate; }
.bg .b2 { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -20vmax; background: var(--blob-2); animation: drift 60s ease-in-out infinite alternate-reverse; }
.bg .b3 { width: 40vmax; height: 40vmax; left: 30vw; bottom: -25vmax; background: var(--blob-3); animation: drift 72s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8vmax, 6vmax) scale(1.12); }
}

/* -------------------------------------------------------------- layout */
.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px 4px 16px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; filter: drop-shadow(0 2px 4px rgba(var(--shadow), 0.3)); }
.brand span { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-soft); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="neon"] .brand b { text-shadow: 0 0 14px color-mix(in oklab, var(--glow) 55%, transparent); }
.menu { display: flex; gap: 2px; flex: 0 0 auto; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
#board:focus-visible { outline: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 16px 4px; }
.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 2px rgba(var(--shadow), 0.06);
  border-radius: 12px;
  padding: 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  min-width: 0;
}
.stat span { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stat b { font-family: var(--serif); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  margin: 2px 0;
}
#board {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
#board.enter { animation: board-in 0.55s var(--ease); }
@keyframes board-in { from { opacity: 0; transform: scale(0.985); } }
.caption {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}
.caption b { font-style: italic; font-weight: 600; color: var(--ink); opacity: 0.85; overflow: hidden; text-overflow: ellipsis; }
.caption span { font-style: italic; font-size: 13.5px; }
.caption span::before { content: "·"; margin-right: 8px; opacity: 0.6; }
.caption em { font-style: normal; color: var(--mark); letter-spacing: 0.1em; font-size: 12px; }

/* Marks over the board: pen, start rings, keyboard badges, line counts. */
.marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marks > i { position: absolute; left: 0; top: 0; display: block; }
.mark-head::before, .mark-head::after, .mark-ring::before, .mark-cursor::before {
  content: "";
  position: absolute;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.mark-head::before { border: 2px solid var(--mark); box-shadow: 0 0 12px color-mix(in oklab, var(--mark) 60%, transparent); animation: breathe 2.2s ease-in-out infinite; }
.mark-head::after { left: -5px; top: -5px; width: 10px; height: 10px; background: var(--mark); opacity: 0.85; }
.mark-head.active::before { animation: none; transform: scale(0.8); opacity: 0.6; transition: transform 0.2s var(--ease); }
.mark-head.pulse::before { animation: nudge 0.6s var(--spring); }
@keyframes breathe { 50% { transform: scale(1.18); opacity: 0.55; } }
@keyframes nudge { 40% { transform: scale(1.7); opacity: 1; } }
.mark-ring::before { left: -17px; top: -17px; width: 34px; height: 34px; border: 2.5px solid var(--mark-2); box-shadow: 0 0 16px color-mix(in oklab, var(--mark-2) 70%, transparent); animation: ring 1.4s ease-in-out infinite; }
@keyframes ring { 50% { transform: scale(1.22); opacity: 0.55; } }
.mark-cursor::before { left: -16px; top: -16px; width: 32px; height: 32px; border: 2px dashed var(--accent-2); animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.mark-num, .mark-deg {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  display: grid !important;
  place-items: center;
  font: 600 12.5px var(--sans);
  font-style: normal;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(var(--shadow), 0.35), 0 0 0 1.5px var(--accent);
  animation: pop-in 0.2s var(--spring);
}
.mark-deg { margin: -26px 0 0 4px; width: 20px; height: 20px; font-size: 11.5px; box-shadow: 0 1px 3px rgba(var(--shadow), 0.3); opacity: 0.92; }
.mark-deg.odd { background: var(--mark-2); color: #fff; box-shadow: 0 0 10px color-mix(in oklab, var(--mark-2) 70%, transparent); }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } }

.actions { display: flex; gap: 8px; padding: 4px 16px 14px; }
.btn {
  appearance: none;
  flex: 1;
  min-height: 46px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--ink);
  font: 500 15px var(--sans);
  padding: 10px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(var(--shadow), 0.08);
  transition: transform 0.15s, background 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-color: color-mix(in oklab, var(--accent) 80%, black);
  box-shadow: 0 4px 14px -5px color-mix(in oklab, var(--accent) 70%, black), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
[data-theme="chalk"] .btn.primary { text-shadow: none; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.subtle { flex: 0 0 auto; background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); font-size: 13.5px; margin: 18px auto 0; display: flex; min-height: 40px; }

/* ------------------------------------------------------------- notice */
.notice {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 15;
  width: max-content;
  max-width: min(92vw, 480px);
  transform: translate(-50%, 12px);
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}
.notice.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.notice span { padding: 2px 6px 2px 0; }
.notice:not(:has(.notice-btn:not([hidden]))) { padding-right: 16px; }
.notice-btn {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-radius: 11px;
  padding: 9px 13px;
  min-height: 38px;
  font: 600 13.5px var(--sans);
  color: var(--toast-bg);
  background: var(--toast-ink);
  cursor: pointer;
}

/* -------------------------------------------------------- sheets, dialogs */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--backdrop); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  z-index: 21;
  max-width: 560px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(var(--shadow), 0.3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise 0.32s var(--ease);
}
.sheet-wide { max-width: 640px; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 22px; flex: 0 0 auto; }
.sheet h2, .dialog h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0; letter-spacing: 0.01em; }
.sheet-body { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px 22px 26px; font-size: 15px; line-height: 1.55; }
.sheet-body h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; margin: 20px 0 8px; color: var(--ink); }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin: 4px 0; }
.muted { color: var(--ink-soft); }
.about { font-size: 13px; margin-top: 22px; text-align: center; font-family: var(--serif); font-style: italic; }

.secret { display: flex; gap: 14px; align-items: flex-start; }
.secret p { margin: 0; }
.secret-fig { flex: 0 0 104px; width: 104px; height: 104px; }
.secret-fig path { fill: none; stroke: var(--ink-soft); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.secret-fig circle { stroke: var(--paper); stroke-width: 2; }
.secret-fig .even circle { fill: var(--ink); }
.secret-fig .odd circle { fill: var(--mark-2); }
.secret-fig text { font: 700 10px var(--sans); fill: var(--paper); text-anchor: middle; }
@media (max-width: 400px) { .secret { flex-direction: column; align-items: center; } }

@media (min-width: 700px) and (min-height: 560px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; max-height: 82dvh; animation: pop 0.28s var(--ease); }
}
@keyframes pop { from { opacity: 0; transform: translateY(-50%) scale(0.96); } }

.dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 22;
  width: min(92vw, 400px);
  background: var(--paper);
  border-radius: 24px;
  padding: 24px 22px 20px;
  box-shadow: 0 20px 60px rgba(var(--shadow), 0.4);
  text-align: center;
  animation: popc 0.32s var(--ease);
  overflow: hidden;
}
@keyframes popc { from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); } }
.dialog p { margin: 8px 0 16px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.dialog .row { display: flex; gap: 10px; }
.result .glow { position: absolute; inset: -40% -20% auto; height: 70%; background: radial-gradient(ellipse at 50% 40%, color-mix(in oklab, var(--glow) 45%, transparent), transparent 65%); pointer-events: none; opacity: 0.8; }
.result h2 { position: relative; font-size: 30px; }
.result p { position: relative; font-family: var(--serif); font-style: italic; }
.stars { position: relative; display: flex; justify-content: center; gap: 6px; margin: -4px 0 6px; }
.stars svg { width: 30px; height: 30px; color: color-mix(in oklab, var(--ink-soft) 30%, transparent); }
.stars svg.on { color: var(--mark); filter: drop-shadow(0 0 6px color-mix(in oklab, var(--mark) 60%, transparent)); animation: star-in 0.5s var(--spring) both; animation-delay: calc(var(--i) * 0.12s + 0.15s); }
@keyframes star-in { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; position: relative; }
.result-stats div, .summary div { display: flex; flex-direction: column; align-items: center; background: var(--paper-2); border-radius: 12px; padding: 8px 4px; line-height: 1.2; min-width: 0; }
.result-stats span, .summary span { font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.result-stats b, .summary b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.score { display: flex; flex-direction: column; align-items: center; margin: 4px 0 18px; position: relative; }
.score span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.score b { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1.05; }

/* ------------------------------------------------------------- results */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th { text-align: left; vertical-align: bottom; font-weight: 500; color: var(--ink-soft); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 4px; border-bottom: 1px solid var(--line); }
td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.c-figure b { display: block; font-weight: 600; }
td.c-figure small { color: var(--ink-soft); font-size: 11.5px; }
.c-time, .c-hints, .c-score { text-align: right !important; white-space: nowrap; }
td.c-date { white-space: nowrap; color: var(--ink-soft); }
td.c-score b { font-family: var(--serif); font-size: 15px; display: block; }
td.c-score .stars-s { color: var(--mark); font-size: 10px; letter-spacing: 0.08em; }
@media (max-width: 400px) { .c-hints { display: none; } td { padding: 7px 3px; } }

/* ------------------------------------------------------------- levels */
.daily {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin: 6px 0 4px;
  border-radius: 16px;
  border: 1.5px solid color-mix(in oklab, var(--accent) 45%, transparent);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent-2) 22%, var(--paper)), var(--paper-2));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s, box-shadow 0.2s;
}
.daily:active { transform: scale(0.99); }
.daily[aria-current="true"] { box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 35%, transparent); }
.daybadge { position: relative; width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; }
.daybadge svg { position: absolute; inset: 0; width: 46px; height: 46px; fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; }
.daybadge b { position: relative; font: 600 13px var(--serif); color: var(--accent); }
.dailytext { display: flex; flex-direction: column; line-height: 1.25; }
.dailytext b { font-family: var(--serif); font-size: 18px; }
.dailytext small { color: var(--ink-soft); font-size: 13px; }
.daily.done .dailytext small { color: var(--accent); }
.pack h3 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.pack h3 small { margin-left: auto; font: 500 12.5px var(--sans); color: var(--mark); letter-spacing: 0.04em; }
.pack h3 .lock { width: 16px; height: 16px; margin-left: auto; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; align-self: center; }
.pack-d { margin: 0 0 10px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.4; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.lv {
  appearance: none;
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.lv:active { transform: scale(0.96); }
.lv .thumb { position: absolute; inset: 14%; width: 72%; height: 72%; }
.lv .thumb path { fill: none; stroke: currentColor; stroke-width: 0.055; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }
.lv.done { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.lv.done .thumb path { opacity: 0.95; }
.lv[aria-current="true"] { box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 40%, transparent); }
.lv .num { position: absolute; left: 6px; top: 4px; font: 600 11px var(--sans); color: var(--ink-soft); }
.lv .st { position: absolute; right: 5px; bottom: 3px; font-size: 9.5px; letter-spacing: 0.05em; color: var(--mark); }
.grid.locked .lv { opacity: 0.4; cursor: default; }
.pack { margin-bottom: 6px; }

/* ------------------------------------------------------------- settings */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: 500 14px var(--sans);
  padding: 8px 14px 8px 10px;
  min-height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.opt:active { transform: scale(0.97); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.opts.lang .opt { padding-left: 14px; min-width: 96px; justify-content: center; }
.swatch { display: inline-block; width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); position: relative; overflow: hidden; }
.swatch::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.sw-gold { background: radial-gradient(circle at 40% 35%, #fbf6e8, #e9dfc7); }
.sw-gold::after { background: linear-gradient(135deg, transparent 44%, #b07c22 45%, #f3d98a 50%, #c08a2a 55%, transparent 56%); }
.sw-neon { background: radial-gradient(circle at 40% 35%, #1e2433, #0b0e15); }
.sw-neon::after { background: linear-gradient(135deg, transparent 43%, rgba(255, 79, 154, 0.5) 46%, #fff 50%, rgba(79, 140, 255, 0.5) 54%, transparent 57%); }
.sw-chalk { background: radial-gradient(circle at 40% 35%, #3a4743, #26302d); box-shadow: inset 0 0 0 3px #8a5d38; }
.sw-chalk::after { background: linear-gradient(135deg, transparent 45%, rgba(246, 243, 234, 0.9) 47%, rgba(246, 243, 234, 0.9) 53%, transparent 55%); }
.sw-auto { background: linear-gradient(90deg, #f3ecda 50%, #121620 50%); }
.toggle { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-size: 15px; line-height: 1.35; min-height: 32px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: var(--track); position: relative; transition: background 0.25s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ------------------------------------------------------- small screens */
@media (max-height: 680px) {
  .top { padding-top: 6px; }
  .brand img { width: 36px; height: 36px; }
  .brand b { font-size: 20px; }
  .stat { padding: 4px 6px; }
  .stat b { font-size: 17px; }
  .actions { padding-bottom: 10px; }
}
@media (max-width: 520px) {
  .btn { flex-direction: column; gap: 3px; padding: 7px 4px 6px; font-size: 12.5px; min-height: 52px; }
  .btn span { white-space: nowrap; }
  .btn svg { width: 21px; height: 21px; }
  .stats { gap: 6px; padding: 4px 12px; }
  .actions { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .top { padding-left: 12px; padding-right: 8px; }
}
@media (max-width: 380px) {
  .brand { gap: 8px; }
  .brand img { width: 34px; height: 34px; }
  .brand b { font-size: 19px; }
  .brand small { font-size: 12px; }
  .icon-btn { width: 42px; height: 42px; }
  .stat span { font-size: 9.5px; letter-spacing: 0.04em; }
  .stat b { font-size: 17px; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .brand b { font-size: 26px; }
  .brand small { font-size: 14px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .app { display: grid; grid-template-columns: minmax(286px, 320px) 1fr; grid-template-rows: auto auto 1fr; max-width: none; column-gap: 8px; }
  .brand img { width: 34px; height: 34px; }
  .brand b { font-size: 19px; }
  .icon-btn { width: 40px; height: 40px; }
  .top { grid-column: 1; grid-row: 1; }
  .stats { grid-column: 1; grid-row: 2; grid-template-columns: 1fr 1fr; }
  .actions { grid-column: 1; grid-row: 3; flex-wrap: wrap; align-content: end; }
  .actions .btn { flex: 1 1 45%; }
  .stage { grid-column: 2; grid-row: 1 / 4; }
  .brand small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .blob { animation: none; }
  .sheet, .dialog, .backdrop, #board.enter, .stars svg.on, .mark-num, .mark-deg { animation: none; }
  .mark-head::before, .mark-ring::before, .mark-cursor::before { animation: none; }
}
