:root {
  color-scheme: light;
  --canvas: #f4f6f1;
  --surface: #fff;
  --surface-2: #f7f8f4;
  --ink: #172b24;
  --text: #31463c;
  --muted: #5a7064;
  --line: #dbe3d8;
  --soft-line: #e6ebe3;
  --primary: #154b39;
  --primary-ink: #fff;
  --primary-hover: #0d3c2e;
  --selected: #b9e7c9;
  --related: #edf6ea;
  --same: #d7efdb;
  --green-text: #1f684c;
  --gold: #f3cc76;
  --danger: #a13234;
  --danger-bg: #ffedeb;
  --grid-bg: #fff;
  --grid-line: #344c40;
  --cell-line: #cdd8cd;
  --cage-line: #607b51;
  --cage-ink: #416241;
  --shadow: 0 2px 5px #182c2210, 0 12px 28px #223c2711;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #15201b;
  --surface: #1e2b24;
  --surface-2: #23342b;
  --ink: #f2f8ef;
  --text: #d0dfd1;
  --muted: #a7bbac;
  --line: #384c3f;
  --soft-line: #34473a;
  --primary: #a6dfb7;
  --primary-ink: #10271b;
  --primary-hover: #c2efd0;
  --selected: #3d6a50;
  --related: #283f32;
  --same: #314e3c;
  --green-text: #b0e6bf;
  --gold: #dfb76b;
  --danger: #ffb3b1;
  --danger-bg: #523237;
  --grid-bg: #23352c;
  --grid-line: #aec4b3;
  --cell-line: #4b6052;
  --cage-line: #abc8a7;
  --cage-ink: #c4dfbf;
  --shadow: 0 2px 6px #0002, 0 14px 28px #0003;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 1rem/1.5 var(--font); }
button, select, textarea, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
svg { display: inline-block; flex: none; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #4c9b6a; outline-offset: 3px; }
.skip { position: fixed; top: 10px; left: 10px; z-index: 10; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); background: var(--surface); padding: 8px 16px; }
.assistive { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1264px; margin: auto; min-height: 70px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; width: 165px; height: auto; }
.brand .wordmark-night, :root[data-theme="dark"] .brand .wordmark-day { display: none; }
:root[data-theme="dark"] .brand .wordmark-night { display: block; }
.header-actions { display: flex; align-items: center; gap: 17px; }
.help-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 650; font-size: .88rem; }
.help-link:hover { color: var(--green-text); }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.icon-button:hover:not(:disabled) { background: var(--related); color: var(--ink); }
.icon-button:disabled { opacity: .47; }
.icon-knob { fill: var(--surface); }

.site-layout { max-width: 1264px; margin: 0 auto; padding: 38px 32px 22px; display: grid; grid-template-columns: 202px minmax(0,1fr); gap: 38px; }
.sidebar { align-self: start; min-width: 0; padding: 13px 14px 14px 0; border-right: 1px solid var(--line); }
.sidebar nav { display: flex; flex-direction: column; gap: 25px; }
.nav-group { display: grid; gap: 4px; }
.nav-label { margin: 0 0 2px 13px; color: var(--muted); text-transform: uppercase; font-size: .71rem; font-weight: 800; letter-spacing: .11em; }
.nav-link { display: inline-flex; gap: 11px; align-items: center; min-height: 43px; padding: 9px 12px; border: 1px solid transparent; border-radius: 9px; color: var(--text); font-size: .91rem; font-weight: 615; background: transparent; text-align: left; white-space: nowrap; }
.nav-link:hover { background: var(--surface-2); color: var(--green-text); }
.nav-link[aria-current="page"] { color: var(--green-text); background: var(--same); font-weight: 760; border-color: color-mix(in srgb, var(--line), var(--selected) 37%); }
.compact-nav { display: none; }
.main { min-width: 0; }
.page-heading { margin: 0 0 25px; }
h1 { margin: 0 0 5px; font-size: clamp(2.13rem, 4.1vw, 3.05rem); line-height: 1.14; font-weight: 795; letter-spacing: -.062em; }
.page-heading p { color: var(--muted); max-width: 56ch; }
h2, h3 { margin: 0; font-weight: 750; line-height: 1.2; letter-spacing: -.037em; }
h2 { font-size: 1.38rem; }
h3 { font-size: 1.05rem; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); margin-top: 35px; padding: 15px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.footer > span { font-weight: 740; }
.footer > div { display: flex; align-items: center; gap: 18px; }
.footer button, .text-button { border: 0; background: transparent; color: var(--green-text); font-weight: 660; padding: 6px 0; }
.footer button { color: var(--muted); font-weight: 500; padding: 0; }
.footer a:hover, .footer button:hover, .text-button:hover { text-decoration: underline; }
.footer a:focus-visible, .footer button:focus-visible { outline-offset: 4px; }
.page-placeholder { aspect-ratio: 1; width: min(100%, 530px); border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }

.button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; font-size: .91rem; line-height: 1.3; font-weight: 730; text-align: center; white-space: nowrap; }
.primary { background: var(--primary); color: var(--primary-ink); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.secondary:hover:not(:disabled) { background: var(--related); }
.button:disabled { opacity: .48; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 2px 4px #16352808; }
.tabs { display: inline-flex; gap: 3px; border: 1px solid var(--line); background: var(--surface-2); padding: 3px; border-radius: 9px; }
.tabs button { padding: 7px 13px; font-weight: 660; border: 0; border-radius: 6px; background: transparent; color: var(--muted); min-height: 36px; }
.tabs button[aria-pressed="true"] { color: var(--green-text); background: var(--same); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1.77fr) minmax(232px, 1fr); grid-template-areas: "intro score" "board controls" "bottom controls"; column-gap: 24px; row-gap: 13px; align-items: start; max-width: 960px; }
.game-intro { grid-area: intro; display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 50px; }
.difficulty { display: flex; flex: 1; justify-content: space-between; gap: 3px; padding: 4px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.difficulty a { flex: 1; min-width: 0; padding: 8px 5px; border-radius: 7px; text-align: center; white-space: nowrap; font-size: .88rem; color: var(--muted); font-weight: 675; }
.difficulty a:hover { background: var(--surface-2); color: var(--green-text); }
.difficulty a[aria-current="page"] { background: var(--same); color: var(--green-text); font-weight: 795; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 680; color: var(--green-text); font-size: .91rem; }
.back-link:hover { text-decoration: underline; }
.level-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 11px; border-radius: 999px; color: var(--green-text); background: var(--same); font-size: .83rem; font-weight: 740; white-space: nowrap; }
.score-panel { grid-area: score; display: flex; gap: 8px; align-self: center; justify-content: space-between; min-height: 48px; }
.score-part { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; background: var(--surface); color: var(--muted); }
.score-glyph { color: var(--green-text); }
.score-text { display: flex; flex-direction: column; justify-content: center; }
.score-text small { font-size: .71rem; line-height: 1.16; font-weight: 660; white-space: nowrap; }
.score-text strong { font-size: .98rem; line-height: 1.24; font-weight: 760; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pause-button { margin-left: auto; width: 30px; height: 30px; border-radius: 7px; flex: none; background: var(--surface-2); }
.board-wrap { grid-area: board; position: relative; width: 100%; max-width: 584px; aspect-ratio: 1; }
.board { width: 100%; height: 100%; display: grid; grid-template-rows: repeat(9,minmax(0,1fr)); border: 2px solid var(--grid-line); border-radius: 9px; overflow: hidden; background: var(--grid-bg); box-shadow: var(--shadow); user-select: none; }
.board-row { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); min-width: 0; min-height: 0; }
.cell { --cage-top: 0; --cage-right: 0; --cage-bottom: 0; --cage-left: 0; display: grid; place-items: center; background: var(--grid-bg); color: var(--green-text); border: 0; border-right: 1px solid var(--cell-line); border-bottom: 1px solid var(--cell-line); border-radius: 0; margin: 0; padding: 0; min-width: 0; min-height: 0; position: relative; line-height: 1; }
.cell.box-right { border-right: 2px solid var(--grid-line); }
.cell.box-bottom { border-bottom: 2px solid var(--grid-line); }
.cell:last-child { border-right: 0; }
.board-row:last-child .cell { border-bottom: 0; }
.cell.given { color: var(--ink); font-weight: 740; }
.cell-value { font-size: clamp(1.24rem, 3.1vw, 2.12rem); font-weight: 620; z-index: 1; font-variant-numeric: tabular-nums; }
.cell.given .cell-value { font-weight: 765; }
.cell:hover { background: var(--surface-2); }
.cell.related { background: var(--related); }
.cell.same { background: var(--same); }
.cell.picked { background: var(--selected); z-index: 1; }
.cell.invalid { background: var(--danger-bg); color: var(--danger); }
.cell.picked:not(:focus-visible) { box-shadow: inset 0 0 0 2px #4c9b6a; }
.cell:focus-visible { outline: 2px solid #26824f; outline-offset: -3px; z-index: 2; }
.cage-cell::after { content: ""; position: absolute; pointer-events: none; z-index: 0; top: var(--cage-top); right: var(--cage-right); bottom: var(--cage-bottom); left: var(--cage-left); border-color: var(--cage-line); border-style: dotted; border-width: 0; }
.cage-top::after { --cage-top: 3px; border-top-width: 1px; }
.cage-right::after { --cage-right: 3px; border-right-width: 1px; }
.cage-bottom::after { --cage-bottom: 3px; border-bottom-width: 1px; }
.cage-left::after { --cage-left: 3px; border-left-width: 1px; }
.cage-sum { position: absolute; z-index: 1; top: 5px; left: 6px; font-size: clamp(.56rem, 1.1vw, .77rem); font-weight: 750; color: var(--cage-ink); }
.cage-cell .cell-value { padding-top: 7px; font-size: clamp(1.12rem, 2.8vw, 1.89rem); }
.pencil-grid { width: 84%; height: 80%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center; gap: 0; color: var(--muted); font-size: clamp(.55rem, 1.3vw, .86rem); font-weight: 690; z-index: 1; }
.cage-cell .pencil-grid { height: 61%; margin-top: 8px; }
.board-curtain { position: absolute; inset: 0; border: 2px solid var(--grid-line); border-radius: 9px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; justify-content: center; align-items: center; z-index: 4; }
.curtain-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; background: var(--same); color: var(--green-text); }
.board-curtain strong { font-size: 1.65rem; letter-spacing: -.045em; }
.game-bottom { grid-area: bottom; max-width: 584px; }
.progress-bar { height: 5px; border-radius: 10px; background: color-mix(in srgb,var(--line),var(--canvas) 20%); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: #4a9c6d; transition: width .2s; }
.progress-caption { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .81rem; }
.keyboard-help { display: inline-flex; gap: 6px; align-items: center; }
.keyboard-help:hover { text-decoration: underline; }

.controls { grid-area: controls; display: grid; gap: 13px; }
.control-panel, .solver-controls { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 4px #17302106; }
.game-toolbar { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin-bottom: 13px; }
.game-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 3px 0; color: var(--text); font-size: .81rem; font-weight: 680; border-radius: 9px; border: 0; background: transparent; }
.tool-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: var(--surface-2); color: var(--green-text); }
.game-tool:hover:not(:disabled) .tool-icon, .game-tool[aria-pressed="true"] .tool-icon { background: var(--same); }
.game-tool[aria-pressed="true"] .tool-icon { box-shadow: inset 0 0 0 1.5px #62a67a; }
.game-tool:disabled { opacity: .49; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.digit { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; min-width: 0; min-height: clamp(48px, 5.05vw, 72px); display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--ink); position: relative; padding: 3px 5px; font-variant-numeric: tabular-nums; }
.digit > span { font-size: clamp(1.45rem, 2.5vw, 2.15rem); font-weight: 610; line-height: 1; }
.digit small { position: absolute; bottom: 4px; right: 6px; color: var(--muted); font-size: .71rem; font-weight: 655; }
.digit:hover:not(:disabled) { background: var(--same); border-color: var(--selected); color: var(--green-text); }
.digit:active:not(:disabled) { transform: translateY(1px); }
.digit-complete { opacity: .58; }
.digit:disabled { opacity: .46; }
.game-feedback, .solver-message { text-align: left; margin: 0; font-size: .83rem; color: var(--muted); min-height: 0; }
.game-feedback:not(:empty), .solver-message:not(:empty) { margin-top: 8px; }
.feedback-error { color: var(--danger); }
.under-keys { display: grid; gap: 4px; margin-top: 14px; text-align: center; }
.under-keys .text-button { font-size: .79rem; height: 32px; }
.daily-card { display: flex; justify-content: space-between; align-items: center; gap: 5px; background: var(--same); border: 1px solid var(--line); border-radius: 12px; padding: 13px; color: var(--ink); }
.daily-card:hover { border-color: #67aa82; }
.daily-card strong, .daily-card small { display: block; }
.daily-card strong { font-size: .95rem; }
.daily-card small { font-size: .8rem; color: var(--muted); }
.daily-card-icon { display: inline-grid; place-items: center; width: 39px; height: 39px; background: var(--surface); color: var(--green-text); border-radius: 11px; flex: none; }

dialog { margin: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; width: min(94vw, 490px); padding: 25px; max-height: 86vh; overflow: auto; position: fixed; box-shadow: 0 16px 60px #102a2852; }
dialog::backdrop { background: #0f2318a3; backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.67rem; margin: 5px 35px 8px 0; }
dialog p { color: var(--muted); margin-bottom: 10px; }
.modal-close { position: absolute; top: 13px; right: 13px; width: 35px; height: 35px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.modal-glyph, .feature-icon { display: inline-grid; place-items: center; background: var(--same); color: var(--green-text); width: 48px; height: 48px; border-radius: 13px; flex: none; }
.modal-glyph { margin-bottom: 7px; }
.settings-modal { width: min(94vw, 520px); }
.settings-list { display: grid; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--soft-line); }
.settings-row b { display: block; font-size: .94rem; }
.settings-row small { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.switch { appearance: none; background: var(--line); border: 1px solid var(--line); width: 40px; height: 23px; border-radius: 14px; margin: 0 2px 0 0; position: relative; flex: none; cursor: pointer; }
.switch::after { content: ""; width: 17px; height: 17px; border-radius: 50%; position: absolute; left: 2px; top: 2px; background: var(--surface); box-shadow: 0 1px 2px #0e201a40; }
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { transform: translateX(17px); }
select, textarea { color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
select { padding: 8px 11px; min-height: 41px; }
textarea { width: 100%; padding: 9px; resize: vertical; }
.win-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 14px 0; }
.win-metrics div { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--surface-2); border-radius: 9px; text-align: center; }
.win-metrics strong { font-size: 1.23rem; font-variant-numeric: tabular-nums; }
.win-metrics small { color: var(--muted); }
.win-reveal { margin-top: 15px; padding: 14px; border-radius: 10px; background: var(--related); }
.win-reveal p { margin: 7px 0 0; color: var(--text); }
.share-text { min-height: 6rem; }

.calendar-layout, .tournament-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(230px,1fr); gap: 20px; align-items: start; }
.calendar-panel, .daily-feature, .tournament-feature, .personal-score, .leaderboard-panel { padding: 19px; }
.calendar-head, .leader-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.calendar-head p, .leader-head p { color: var(--muted); font-size: .86rem; margin-top: 3px; }
.calendar-nav { display: flex; gap: 6px; }
.calendar-nav .icon-button { width: 35px; height: 35px; }
.weekdays, .calendar-cells { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.weekdays { margin: 17px 0 4px; color: var(--muted); font-size: .76rem; text-align: center; font-weight: 690; }
.calendar-day, .calendar-blank { aspect-ratio: 1.15; min-height: 32px; display: flex; justify-content: center; align-items: center; gap: 2px; border-radius: 7px; font-size: .95rem; font-weight: 700; }
.calendar-day { border: 1px solid var(--line); background: var(--surface-2); }
.calendar-day:is(a):hover { background: var(--same); }
.calendar-day.is-today { background: var(--same); box-shadow: inset 0 0 0 1px var(--green-text); color: var(--green-text); }
.calendar-day.is-solved { background: var(--same); color: var(--green-text); }
.calendar-day.is-future { opacity: .47; }
.calendar-aside, .tournament-aside { display: grid; gap: 12px; }
.daily-feature h2, .tournament-feature h2 { margin: 12px 0 3px; }
.daily-feature p, .tournament-feature p, .personal-score p { color: var(--muted); font-size: .91rem; margin: 3px 0 12px; }
.daily-feature .button, .tournament-feature .button { width: 100%; }
.stat-link { display: flex; gap: 10px; align-items: center; padding: 11px; }
.stat-link:hover { border-color: var(--green-text); }
.stat-link strong, .stat-link small { display: block; }
.stat-link small { color: var(--muted); }

.collection-grid, .awards-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.postcards-list { grid-template-columns: repeat(3, minmax(0,1fr)); }
.collection-card { overflow: hidden; }
.collection-body { padding: 15px; }
.collection-body p { color: var(--muted); font-size: .94rem; margin: 6px 0 12px; min-height: 2.9em; }
.collection-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.collection-actions > span { color: var(--muted); font-size: .8rem; font-weight: 650; }
.collection-intro { display: flex; justify-content: space-between; gap: 9px; align-items: center; margin-bottom: 11px; }
.art { aspect-ratio: 1.95; background-image: var(--art); background-size: cover; background-position: center; background-color: #44966e; }
.art-ridge { --art: url("/play/ridge.webp"); }
.art-coast { --art: url("/play/coast.webp"); }
.art-garden { --art: url("/play/garden.webp"); }
.collection-hero { border-radius: 13px; overflow: hidden; margin-bottom: 14px; }
.collection-hero .art { aspect-ratio: 3.5; }
.chapter-list { display: grid; gap: 8px; }
.chapter { padding: 13px 15px; }
.chapter-top { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.chapter h2 { font-size: 1.11rem; }
.chapter p { color: var(--text); line-height: 1.6; margin: 12px 0 1px; }
.small-label, .locked-label { color: var(--muted); font-size: .81rem; }
.feature-icon.muted { color: var(--muted); background: var(--surface-2); }
.feature-icon.earned { background: var(--same); color: var(--green-text); }
.postcard-detail { max-width: 560px; margin: 0 auto; padding: 14px; }
.postcard-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; aspect-ratio: 1.4; }
.postcard-piece { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; border-radius: 5px; min-width: 0; font-size: 1.45rem; font-weight: 760; background: var(--related); color: var(--green-text); }
.postcard-piece small { font-size: .84rem; font-weight: 660; }
.piece-medium { background: #f7e6b5; color: #59480c; }
.piece-hard, .piece-expert, .piece-master { background: #eee3fa; color: #543876; }
.postcard-piece:hover { outline: 2px solid #4c9b6a; outline-offset: -3px; }
.postcard-piece.revealed { justify-content: flex-end; align-items: flex-end; padding: 5px; background-image: var(--art); background-size: 300% 300%; background-position: var(--piece-x) var(--piece-y); }
.piece-check { display: grid; place-items: center; padding: 4px; color: var(--green-text); background: var(--surface); border-radius: 7px; }
.postcard-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 12px; }
.postcard-caption p { color: var(--muted); font-size: .89rem; }

.loading-panel, .empty-state { text-align: center; padding: 28px 14px; color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.empty-state strong { color: var(--ink); }
.empty-state .button { margin-top: 4px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.35rem !important; color: var(--green-text) !important; white-space: nowrap; margin: 7px 0 2px !important; }
.tournament-feature form { display: grid; gap: 8px; }
.tournament-feature form label { font-size: .88rem; color: var(--text); font-weight: 700; }
.personal-score strong, .personal-score small { display: block; }
.personal-score strong { font-size: 1.24rem; color: var(--green-text); }
.personal-score small { color: var(--muted); }
.leaderboard { border-collapse: collapse; width: 100%; font-size: .88rem; }
.leaderboard th, .leaderboard td { padding: 10px 6px; border-bottom: 1px solid var(--soft-line); }
.leaderboard th { text-align: left; }
.leaderboard td:first-child, .leaderboard td:nth-last-child(2) { font-variant-numeric: tabular-nums; }
.leaderboard th:last-child, .leaderboard td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard .mine { background: var(--related); }
.mode-note { color: var(--muted); margin-top: 14px; max-width: 65ch; }

.stats-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.stat { display: flex; gap: 9px; align-items: center; padding: 12px; }
.stat strong, .stat small { display: block; }
.stat strong { font-size: 1.33rem; }
.stat small { color: var(--muted); }
.section-heading { margin: 23px 0 12px; }
.awards-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; }
.award-card { padding: 13px; }
.award-card h3 { margin-top: 11px; }
.award-card p { color: var(--muted); margin-top: 4px; font-size: .88rem; }
.award-state { display: inline-block; margin-top: 10px; color: var(--muted); font-size: .78rem; font-weight: 730; }
.is-earned .award-state { color: var(--green-text); }

.tool-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(230px,1fr); gap: 18px; align-items: start; }
.solver-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.solver-tools .button { min-height: 35px; font-size: .79rem; padding: 5px 8px; }
.solver-tools .text-button { font-size: .79rem; padding: 5px; }
.solver-buttons { margin-top: 13px; display: grid; gap: 7px; }
.print-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 13px; margin-bottom: 14px; }
.print-controls label { display: grid; gap: 4px; color: var(--text); font-size: .88rem; font-weight: 680; }
.print-controls label.print-check { display: flex; align-items: center; gap: 5px; min-height: 41px; }
.print-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.print-controls > div { display: flex; gap: 7px; margin-left: auto; }
.paper { margin-bottom: 13px; padding: 17px; }
.worksheet-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; margin-top: 12px; align-items: start; }
.print-puzzle h3 { margin-bottom: 5px; font-size: .95rem; }
.print-board { background: var(--surface); border: 2px solid var(--grid-line); width: 100%; aspect-ratio: 1; display: grid; grid-template: repeat(9,1fr) / repeat(9,1fr); }
.print-board span { display: grid; place-items: center; border: 0 solid var(--cell-line); border-right-width: 1px; border-bottom-width: 1px; line-height: 1; font-weight: 650; }
.print-board .edge-right { border-right: 2px solid var(--grid-line); }
.print-board .edge-bottom { border-bottom: 2px solid var(--grid-line); }
.print-board span:nth-child(9n) { border-right: 0; }
.print-board span:nth-last-child(-n+9) { border-bottom: 0; }
.guide { max-width: 700px; }
.guide h2 { margin: 21px 0 5px; }
.guide p { color: var(--text); }
.guide .button { margin-top: 15px; }
.shortcuts { display: grid; gap: 3px; }
.shortcuts div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.shortcuts dt { font-weight: 720; }
.shortcuts dd { margin: 0; color: var(--muted); }

@media (max-width: 1060px) {
  .site-layout { gap: 23px; grid-template-columns: 178px minmax(0,1fr); padding-inline: 22px; }
  .header-inner { padding-inline: 22px; }
  .game-layout { gap: 11px 15px; }
  .control-panel { padding: 10px; }
  .score-part { padding-inline: 6px; gap: 5px; }
}
@media (min-width: 851px) and (max-height: 870px) {
  .site-layout { padding-top: 23px; }
  .page-heading { margin-bottom: 17px; }
  .game-layout { max-width: clamp(650px, calc(155svh - 400px), 960px); }
}
@media (max-width: 850px) {
  .site-layout { display: block; padding: 24px 21px; }
  .header-inner { min-height: 60px; }
  .compact-nav { display: flex; gap: 5px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 5px 15px; }
  .compact-nav .nav-link { flex: 1; justify-content: center; min-height: 39px; gap: 6px; padding: 6px; }
  .sidebar { display: none; position: absolute; z-index: 8; top: 115px; right: 16px; width: min(330px, calc(100% - 32px)); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
  .sidebar.is-open { display: block; }
  .sidebar nav { gap: 10px; }
  .nav-label { margin-top: 5px; }
  .page-heading { margin-bottom: 18px; }
  .game-layout { grid-template-columns: minmax(0,1.7fr) minmax(223px,1fr); }
}
@media (max-width: 610px) {
  .site-layout { max-width: 520px; padding: 17px 12px 10px; }
  .header-inner { min-height: 55px; padding-inline: 13px; }
  .brand img { width: 146px; }
  .header-actions { gap: 10px; }
  .help-link { font-size: .78rem; }
  .top-settings { width: 35px; height: 35px; }
  .compact-nav { padding: 4px 8px; }
  .compact-nav .nav-link { font-size: .82rem; gap: 5px; }
  .compact-nav .nav-link svg { width: 17px; height: 17px; }
  .sidebar { top: 102px; right: 9px; }
  h1 { font-size: 2.02rem; }
  .page-heading { margin-bottom: 10px; }
  .page-heading p { font-size: .87rem; line-height: 1.35; }
  .game-layout { grid-template-columns: minmax(0,1fr); grid-template-areas: "intro" "score" "board" "controls" "bottom"; gap: 7px; }
  .game-intro { min-height: 34px; }
  .difficulty { padding: 3px; gap: 2px; border-radius: 8px; }
  .difficulty a { padding: 6px 2px; font-size: .81rem; }
  .score-panel { min-height: 38px; gap: 6px; }
  .score-part { padding: 3px 7px; min-height: 37px; }
  .score-text { flex-direction: row; gap: 5px; align-items: center; flex-wrap: wrap; }
  .score-text strong { font-size: .89rem; }
  .score-glyph svg { width: 16px; height: 16px; }
  .pause-button { width: 28px; height: 28px; }
  .board { border-radius: 7px; }
  .cell-value { font-size: clamp(1.26rem, 6vw, 1.99rem); }
  .cage-cell .cell-value { font-size: clamp(1.06rem, 4.9vw, 1.76rem); padding-top: 6px; }
  .cage-sum { font-size: clamp(.52rem, 2.15vw,.73rem); top: 4px; left: 5px; }
  .pencil-grid { font-size: clamp(.55rem, 2.3vw, .81rem); }
  .controls { gap: 9px; }
  .control-panel { padding: 6px 0 0; border: 0; background: transparent; box-shadow: none; }
  .game-toolbar { margin-bottom: 5px; gap: 3px; }
  .game-tool { gap: 2px; padding: 2px 0; font-size: .75rem; }
  .tool-icon { width: 34px; height: 32px; background: var(--surface); border: 1px solid var(--line); }
  .tool-icon svg { width: 19px; height: 19px; }
  .keypad { grid-template-columns: repeat(9,minmax(0,1fr)); gap: 4px; }
  .digit { min-height: 44px; padding: 3px 1px 8px; border-radius: 6px; background: var(--surface); }
  .digit span { font-size: clamp(1.11rem, 5.2vw, 1.7rem); }
  .digit small { font-size: .61rem; bottom: 1px; right: 3px; }
  .under-keys { display: grid; grid-template-columns: 1.3fr 1fr; gap: 7px; margin-top: 8px; align-items: center; }
  .under-keys .button { min-height: 41px; }
  .under-keys .button:only-child { grid-column: 1/-1; }
  .daily-card { display: none; }
  .game-bottom { margin-top: 4px; }
  .progress-caption { min-height: 29px; }
  .keyboard-help { display: none; }
  .footer { margin-top: 17px; font-size: .77rem; gap: 4px; }
  .footer > div { gap: 9px; }
  .calendar-layout, .tournament-layout, .tool-layout { display: flex; flex-direction: column; gap: 10px; }
  .calendar-layout > *, .tournament-layout > *, .tool-layout > * { width: 100%; }
  .calendar-panel, .daily-feature, .tournament-feature, .leaderboard-panel { padding: 12px; }
  .calendar-aside { order: -1; }
  .calendar-aside .stat-link { display: none; }
  .daily-feature { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 5px 9px; }
  .daily-feature h2, .daily-feature p { margin: 0; }
  .daily-feature .feature-icon { grid-row: 1 / 3; }
  .daily-feature .button { grid-column: 1 / -1; }
  .collection-grid, .postcards-list { grid-template-columns: 1fr; gap: 9px; }
  .collection-body { padding: 11px; }
  .collection-body p { min-height: 0; }
  .tournament-aside { order: -1; }
  .stats-row, .awards-grid { gap: 7px; }
  .stat, .award-card { padding: 8px; }
  .stat { flex-direction: column; align-items: start; gap: 6px; }
  .stat strong { font-size: 1.11rem; }
  .stat small { font-size: .72rem; }
  .awards-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tournament-layout .feature-icon, .stat .feature-icon { width: 37px; height: 37px; }
  .solver-tools { margin-bottom: 6px; }
  .solver-controls { padding: 9px; }
  .solver-buttons { grid-template-columns: 1fr 1fr; margin-top: 8px; }
  .print-controls { gap: 6px 9px; }
  .print-controls > div { margin-left: 0; }
  .worksheet-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .print-board span { font-size: .83rem; }
}
@media (max-width: 350px) {
  .header-actions { gap: 6px; }
  .help-link span { display: none; }
  .difficulty a { font-size: .74rem; }
  .chapter-top { gap: 5px; }
  .chapter .button { padding-inline: 7px; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  @page { margin: 11mm; }
  :root, :root[data-theme="dark"] { --ink: #111; --grid-line: #111; --cell-line: #777; --surface: #fff; color-scheme: light; }
  body { background: white; }
  .site-header, .sidebar, .compact-nav, .page-heading, .print-controls, .footer, dialog, .skip { display: none !important; }
  .site-layout { display: block; margin: 0; padding: 0; width: 100%; max-width: none; }
  .paper { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .paper h2 { font-size: 16pt; margin: 0 0 5mm; }
  .worksheet-grid { grid-template-columns: repeat(3, 53mm); gap: 4mm 6mm; margin: 0; }
  .print-puzzle { break-inside: avoid; }
  .print-puzzle h3 { font-size: 10pt; margin: 0 0 1.5mm; }
  .print-board span { font-size: 11pt; }
  .answer-sheet { break-before: page; }
}

.daily-receipt { background:var(--related); border-radius:12px; padding:14px; margin:12px 0; }
.daily-receipt p { margin:3px 0; }
.daily-receipt progress { width:100%; accent-color:var(--green-text); height:8px; }
.daily-receipt small { display:block; margin-top:6px; color:var(--text); }
@media(max-width:610px) {
 body:is([data-view="classic"],[data-view="killer"]) .page-heading p { display:none; }
 .game-toolbar { margin-bottom:3px; }
 .game-tool { flex-direction:row; justify-content:center; min-height:44px; }
 .tool-icon { background:transparent; border:0; width:22px; }
 .digit { min-height:48px; }
 .win-actions .button { flex:1; }
}
