/* styles.css: how Sudoku looks. A dark navy page with blue and purple
   accents; the board is the centre of the game screen. Sizes follow the
   window, so it fits phones, tablets, computers and a frame on another page. */

:root {
  --bg: #0b1020;
  --bg2: #10172e;
  --panel: #141c37;
  --panel2: #1a2446;
  --line: #2a3766;
  --line-strong: #6d7fc4;
  --text: #e9edff;
  --muted: #94a0cc;
  --blue: #4f8cff;
  --blue-soft: rgba(79, 140, 255, 0.16);
  --purple: #9b5cff;
  --purple-soft: rgba(155, 92, 255, 0.18);
  --grad: linear-gradient(135deg, #4f8cff 0%, #7b6bff 55%, #a35cff 100%);
  --red: #ff5d7a;
  --red-soft: rgba(255, 93, 122, 0.16);
  --green: #3ddc97;
  --easy: #3ddc97;
  --medium: #4fb3ff;
  --hard: #a37bff;
  --expert: #ff6fa8;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { fill: currentColor; }

/* The background: soft glows and a faint Sudoku grid. */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 60vmax at 10% -10%, rgba(79, 140, 255, 0.18), transparent 60%),
    radial-gradient(50vmax 50vmax at 110% 110%, rgba(155, 92, 255, 0.18), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='270' height='270'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.035'%3E%3Cpath d='M30 0V270M60 0V270M120 0V270M150 0V270M210 0V270M240 0V270M0 30H270M0 60H270M0 120H270M0 150H270M0 210H270M0 240H270'/%3E%3C/g%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.07' stroke-width='2'%3E%3Cpath d='M90 0V270M180 0V270M0 90H270M0 180H270'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='0.05' font-family='sans-serif' font-size='18' text-anchor='middle'%3E%3Ctext x='15' y='22'%3E5%3C/text%3E%3Ctext x='105' y='52'%3E3%3C/text%3E%3Ctext x='195' y='142'%3E7%3C/text%3E%3Ctext x='45' y='172'%3E9%3C/text%3E%3Ctext x='225' y='232'%3E1%3C/text%3E%3Ctext x='135' y='262'%3E8%3C/text%3E%3Ctext x='255' y='82'%3E4%3C/text%3E%3C/g%3E%3C/svg%3E"),
    var(--bg);
}

/* ---------- Screens ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; animation: fade-in 0.35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer;
  font-weight: 600; font-size: 1rem; letter-spacing: 0.01em; white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  user-select: none;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(108, 99, 255, 0.35); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(108, 99, 255, 0.55); transform: translateY(-1px); }
.btn.soft { background: var(--panel2); border: 1px solid var(--line); }
.btn.soft:hover:not(:disabled) { background: #212c56; border-color: #3a4a85; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn.danger { color: var(--red); }
.btn.big { padding: 16px 28px; font-size: 1.2rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover:not(:disabled) { background: var(--panel2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- Main menu ---------- */
#menu { flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px 18px; gap: 14px; }
.menu-card {
  width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: stretch; gap: 14px;
  background: linear-gradient(180deg, rgba(26, 36, 70, 0.92), rgba(18, 25, 50, 0.92));
  border: 1px solid var(--line); border-radius: 26px; padding: 30px 24px 24px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.logo {
  width: 84px; height: 84px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 3px; padding: 5px; border-radius: 20px; background: var(--grad);
  box-shadow: 0 10px 30px rgba(108, 99, 255, 0.45); animation: float 5s ease-in-out infinite;
}
.logo span {
  background: rgba(11, 16, 32, 0.82); border-radius: 6px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; color: #fff;
}
.logo span:nth-child(5) { color: #c9b6ff; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
h1 {
  margin: 4px 0 0; text-align: center; font-size: clamp(2.6rem, 9vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(90deg, #8fb6ff, #c3a6ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: -8px 0 0; text-align: center; color: var(--muted); }
.player { margin: -6px auto 0; padding: 4px 12px; border-radius: 999px; background: var(--blue-soft); color: #bcd2ff; font-size: 0.85rem; font-weight: 600; }
.label { margin: 6px 0 -4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }

.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.level {
  border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.level b { font-size: 0.98rem; }
.level small { color: var(--muted); font-size: 0.7rem; }
.level:hover { transform: translateY(-2px); }
.level[aria-checked="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); box-shadow: 0 0 0 1px var(--c) inset, 0 6px 18px color-mix(in srgb, var(--c) 25%, transparent); }
.level[aria-checked="true"] b { color: var(--c); }
.lv-easy { --c: var(--easy); }
.lv-medium { --c: var(--medium); }
.lv-hard { --c: var(--hard); }
.lv-expert { --c: var(--expert); }

#continue-btn { margin-top: -4px; }
.menu-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.menu-row .btn { flex-direction: column; gap: 4px; border-radius: 14px; padding: 12px 6px; font-size: 0.85rem; }
.menu-row .btn svg { width: 22px; height: 22px; color: #a9b9ff; }

.bests { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.best { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: 12px; padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; }
.best-level { font-weight: 600; color: var(--c); font-size: 0.9rem; }
.best b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.best small { grid-column: 1 / -1; color: var(--muted); font-size: 0.72rem; }

.links { color: var(--muted); font-size: 0.85rem; display: flex; gap: 8px; }
.links a { color: #aebdff; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* ---------- Game screen ---------- */
#game {
  flex-direction: column; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  gap: 10px;
  --board: min(94vw, calc(100dvh - 330px), 560px);
}
.topbar { width: 100%; max-width: 980px; display: flex; align-items: center; gap: 10px; }
.info { flex: 1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.chip { padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.stat { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.stat b.bad { color: var(--red); }
.timer-wrap { display: flex; align-items: center; gap: 8px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; min-width: 64px; text-align: right; }

.play-area { width: 100%; max-width: 980px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.board-wrap { position: relative; width: var(--board); height: var(--board); flex: none; }

/* The board: 9 by 9 cells, with thick lines between the 3 by 3 boxes. */
.board {
  width: 100%; height: 100%; display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  background: var(--bg2); border: 3px solid var(--line-strong); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 6px rgba(79, 140, 255, 0.06);
  transition: filter 0.3s ease, opacity 0.3s ease;
  touch-action: manipulation;
}
.board.hidden-board { filter: blur(14px); opacity: 0.35; pointer-events: none; }
.board.empty .cell { cursor: default; }
.cell {
  position: relative; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
  font-size: calc(var(--board) / 9 * 0.56); line-height: 1; font-weight: 500;
  transition: background-color 0.15s ease;
  user-select: none;
}
.cell:nth-child(9n) { border-right: 0; }
.cell:nth-child(n + 73) { border-bottom: 0; }
.cell.box-right { border-right: 2.5px solid var(--line-strong); }
.cell.box-bottom { border-bottom: 2.5px solid var(--line-strong); }
.cell:focus { outline: none; }
.cell:focus-visible { box-shadow: inset 0 0 0 2px var(--blue); }
.cell .value { grid-area: 1 / 1; position: relative; z-index: 1; }
.cell .notes {
  grid-area: 1 / 1; width: 100%; height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 6%; font-size: calc(var(--board) / 9 * 0.24); font-weight: 600; color: #8f9fd8;
}
.cell .notes i { font-style: normal; display: grid; place-items: center; border-radius: 4px; }
.cell .notes i.match { background: var(--purple); color: #fff; }
.cell.given .value { color: #ffffff; font-weight: 700; }
.cell.user .value { color: #7fb0ff; }
.cell.hinted .value { color: #c4a3ff; font-weight: 700; }
.cell.related { background: rgba(79, 140, 255, 0.13); }
.cell.match { background: var(--purple-soft); }
.cell.clash { background: var(--red-soft); }
.cell.wrong { background: var(--red-soft); }
.cell.wrong .value { color: var(--red); }
.cell.selected { background: rgba(79, 140, 255, 0.34); }
.cell.selected::after {
  content: ''; position: absolute; inset: 2px; border-radius: 6px; border: 2px solid var(--blue);
  box-shadow: 0 0 14px rgba(79, 140, 255, 0.6); animation: sel 0.22s ease-out;
}
@keyframes sel { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.cell.pop .value { animation: pop 0.28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(0.4); opacity: 0.3; } to { transform: none; opacity: 1; } }
.cell.shake { animation: shake 0.35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.cell.sweep::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(79, 140, 255, 0.55), rgba(155, 92, 255, 0.55)); animation: sweep 0.6s ease-out both; }
@keyframes sweep { from { opacity: 1; } to { opacity: 0; } }
.cell.appear .value, .cell.appear .notes { animation: appear 0.4s ease both; animation-delay: inherit; }
@keyframes appear { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.cell.won { animation: won 0.7s ease both; }
@keyframes won { 0% { background: transparent; } 40% { background: rgba(155, 92, 255, 0.55); } 100% { background: rgba(79, 140, 255, 0.08); } }

.board-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border-radius: 14px; background: rgba(11, 16, 32, 0.72); color: var(--muted); font-weight: 600; z-index: 2;
  animation: fade-in 0.25s ease both;
}
.board-cover p { margin: 0; }
.board-cover[hidden] { display: none; }
.board-cover.paused { background: rgba(11, 16, 32, 0.45); color: var(--text); font-size: 1.3rem; }
.board-cover.paused svg { width: 54px; height: 54px; color: #9fb6ff; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); border-right-color: var(--purple); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tools and the number pad */
.controls { width: var(--board); display: flex; flex-direction: column; gap: 10px; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 8px 4px 7px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; color: #c9d3ff; transition: background 0.2s, transform 0.12s, border-color 0.2s;
}
.tool svg { width: 24px; height: 24px; color: #a9b9ff; }
.tool:hover:not(:disabled) { background: var(--panel2); }
.tool:active:not(:disabled) { transform: scale(0.95); }
.tool:disabled { opacity: 0.4; cursor: default; }
.tool .badge {
  position: absolute; top: 4px; right: 6px; font-style: normal; font-size: 0.62rem; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; background: var(--line); color: var(--muted);
}
.tool.on { border-color: var(--purple); background: var(--purple-soft); color: #fff; }
.tool.on svg { color: #d2bcff; }
.tool.on .badge { background: var(--purple); color: #fff; }

.numpad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.num {
  aspect-ratio: 0.82; border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
  background: linear-gradient(180deg, #1d2850, #162043); display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform 0.12s, background 0.2s, border-color 0.2s, opacity 0.2s; padding: 0;
}
.num b { font-size: clamp(1.3rem, 5.4vw, 2rem); font-weight: 600; color: #8fb6ff; line-height: 1.05; }
.num small { font-size: 0.68rem; color: var(--muted); }
.num:hover:not(:disabled) { border-color: var(--blue); }
.num:active:not(:disabled) { transform: scale(0.93); background: var(--blue-soft); }
.num:disabled { opacity: 0.3; cursor: default; }
.num.done small { color: var(--green); }
.numpad.notes-on .num b { color: #c9b0ff; font-size: clamp(1rem, 4vw, 1.4rem); }
.numpad.notes-on .num { border-color: rgba(155, 92, 255, 0.45); }

.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Wide screens: the controls sit beside the board. */
@media (min-width: 900px) and (min-height: 560px) {
  #game { --board: min(calc(100dvh - 110px), 620px, calc(100vw - 460px)); justify-content: center; }
  .play-area { flex-direction: row; justify-content: center; align-items: center; gap: 28px; flex: none; }
  .controls { width: 340px; gap: 14px; }
  .numpad { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .num { aspect-ratio: 1.15; }
  .num b { font-size: 2rem; }
  .topbar { max-width: calc(var(--board) + 368px); }
}
/* Short, wide windows (a phone on its side): board left, controls right. */
@media (max-height: 560px) and (min-width: 600px) {
  #game { --board: min(calc(100dvh - 76px), 60vw); }
  .play-area { flex-direction: row; justify-content: center; align-items: flex-start; gap: 16px; }
  .controls { width: min(300px, calc(100vw - var(--board) - 48px)); gap: 8px; }
  .numpad { grid-template-columns: repeat(3, 1fr); }
  .num { aspect-ratio: 1.6; }
}
@media (max-width: 420px) {
  .info { gap: 8px; }
  .stat-label { display: none; }
  #mistakes::before { content: '✕ '; color: var(--muted); font-weight: 400; }
  #live-score::after { content: ' pts'; color: var(--muted); font-weight: 400; }
  .menu-card { padding: 24px 16px 18px; }
  .level small { font-size: 0.62rem; }
  .tool { font-size: 0.72rem; }
}

/* ---------- Windows ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 8, 18, 0.62); backdrop-filter: blur(5px); opacity: 0; transition: opacity 0.22s ease;
}
.overlay.show { opacity: 1; }
.overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto;
  background: linear-gradient(180deg, #1b2549, #131b38); border: 1px solid var(--line); border-radius: 22px;
  padding: 24px 22px 20px; box-shadow: var(--shadow); transform: translateY(12px) scale(0.97); transition: transform 0.25s cubic-bezier(.2, 1.2, .4, 1);
}
.overlay.show .modal { transform: none; }
.modal[hidden] { display: none; }
.modal h2 { margin: 0 0 10px; font-size: 1.5rem; }
.modal h3 { margin: 16px 0 6px; font-size: 1rem; color: #b9c6ff; }
.modal .sub { color: var(--muted); margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.modal-stack { display: flex; flex-direction: column; gap: 10px; }
.how p, .how li { color: #c9d1f3; line-height: 1.5; }
.how ul { padding-left: 20px; margin: 8px 0; }
.how li { margin: 4px 0; }
.red { color: var(--red); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 0.86rem; color: var(--muted); }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--panel); color: var(--text); font-family: var(--font); font-size: 0.8rem; text-align: center; }

.stats-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 2px; cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.tab[aria-selected="true"] { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat-card b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat-card span { font-size: 0.72rem; color: var(--muted); }
.stats-total { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }

.settings { display: flex; flex-direction: column; gap: 8px; }
.setting { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; position: relative; }
.setting-text { flex: 1; display: flex; flex-direction: column; }
.setting-text small { color: var(--muted); font-size: 0.8rem; }
.setting input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.22s cubic-bezier(.3, 1.4, .5, 1); }
.setting input:checked + .switch { background: var(--grad); }
.setting input:checked + .switch::after { transform: translateX(20px); }
.setting input:focus-visible + .switch { outline: 3px solid var(--blue); outline-offset: 2px; }

.modal.win { text-align: center; }
.trophy { width: 76px; height: 76px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); box-shadow: 0 10px 30px rgba(108, 99, 255, 0.5); animation: trophy 0.7s cubic-bezier(.3, 1.6, .5, 1) both; }
.trophy svg { width: 40px; height: 40px; color: #fff; }
@keyframes trophy { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.win-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.win-grid div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; gap: 2px; }
.win-grid span { font-size: 0.72rem; color: var(--muted); }
.win-grid b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.lv-text { color: var(--c); }
.score-box { margin-top: 12px; background: linear-gradient(135deg, rgba(79, 140, 255, 0.16), rgba(155, 92, 255, 0.16)); border: 1px solid rgba(123, 107, 255, 0.45); border-radius: 16px; padding: 14px; }
.score-box > span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.score-box > b { display: block; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; background: linear-gradient(90deg, #8fb6ff, #c3a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.score-box ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.85rem; color: var(--muted); }
.score-box li { display: flex; justify-content: space-between; padding: 2px 4px; }
.score-box li b { color: var(--text); font-variant-numeric: tabular-nums; }
.score-box li.minus b { color: var(--red); }
.records { min-height: 1.2em; margin: 12px 0 0; color: var(--muted); font-weight: 600; }
.records.new { color: #ffd36e; }
.level-pick { flex-direction: column; gap: 2px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); align-items: flex-start; padding: 12px 16px; }
.level-pick b { color: var(--c); font-size: 1.05rem; }
.level-pick small { color: var(--muted); font-weight: 400; }
.level-pick:hover { background: var(--panel2); }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20; transform: translate(-50%, 20px);
  background: #223061; border: 1px solid #3b4d8f; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  box-shadow: var(--shadow); opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* In a frame on another page, a little less padding. */
.embedded #menu { padding-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
