:root {
  color-scheme: light;
  --canvas: #f5f7f2;
  --ink: #233b35;
  --muted: #74827b;
  --accent: #247567;
  --accent-dark: #195c51;
  --line: #dce5dd;
  --danger: #b34535;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse at 80% 8%, #eaf1e6 0, transparent 45%), var(--canvas); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .42; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #66a994; outline-offset: 4px; }
.page { width: min(1040px, calc(100% - 64px)); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding-top: 30px; }
.brand { text-decoration: none; color: var(--ink); font-size: 23px; font-weight: 750; letter-spacing: -.8px; display: flex; align-items: center; gap: 8px; }
.brand-mark { display: inline-grid; place-items: center; width: 33px; height: 33px; background: var(--accent); border-radius: 9px; color: #fff; font-size: 29px; line-height: 1; }
.brand-dot { color: var(--accent); margin-left: -7px; }
.prototype-tag { color: var(--muted); font-size: 12px; letter-spacing: .4px; }
.intro { padding: 38px 0 26px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: 2.6px; }
h1 { font-size: clamp(25px, 3vw, 35px); letter-spacing: -1.1px; margin: 0 0 12px; line-height: 1.35; font-weight: 750; }
.intro-copy { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.8; }
.game-layout { display: grid; grid-template-columns: minmax(0, 610px) minmax(250px, 1fr); align-items: start; gap: 26px; }
.board-card { padding: 24px; background: #fff; border: 1px solid #e1e8df; border-radius: 22px; box-shadow: 0 14px 45px #1f3d2a08; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.board-heading > div:first-child { display: flex; gap: 10px; align-items: center; }
h2 { margin: 0; font-size: 14px; font-weight: 650; }
.difficulty-tag { padding: 4px 8px; border-radius: 6px; background: #e9f3e7; color: #4a7943; font-size: 10px; white-space: nowrap; }
.timer-wrap { display: flex; align-items: center; gap: 10px; }
.timer-label { font-size: 10px; color: var(--muted); }
.timer { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.board-shell { position: relative; }
.board { display: grid; grid-template-rows: repeat(9, minmax(0, 1fr)); aspect-ratio: 1; width: 100%; border: 2px solid #36564b; border-radius: 8px; overflow: hidden; background: #fff; }
.board-row { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); min-height: 0; }
.cell { position: relative; min-width: 0; padding: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; color: var(--accent); display: grid; place-items: center; font-size: clamp(20px, 2.6vw, 30px); line-height: 1; font-variant-numeric: tabular-nums; transition: background-color .1s; user-select: none; }
.cell.box-right { border-right: 2px solid #6c8577; }
.cell.box-bottom { border-bottom: 2px solid #6c8577; }
.cell.last-column { border-right: 0; }
.cell.last-row { border-bottom: 0; }
.cell.is-given { color: var(--ink); font-weight: 650; }
.cell.is-related { background: #f0f5ee; }
.cell.is-same { background: #dfeee1; }
.cell.is-selected { background: #d7ebe4; box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.cell.is-conflict, .cell.is-mistake { color: var(--danger); background: #fff0eb; }
.cell.is-selected.is-conflict, .cell.is-selected.is-mistake { box-shadow: inset 0 0 0 2px var(--danger); }
.cell:focus-visible { outline: none; box-shadow: inset 0 0 0 3px #3e9480; z-index: 2; }
.notes { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); font-size: clamp(8px, 1vw, 11px); font-weight: 500; color: #72857b; }
.notes > span { display: grid; place-items: center; }
.board-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; font-size: 11px; color: var(--muted); }
.text-button { border: 0; padding: 4px 0; background: transparent; color: var(--accent); font-size: 11px; }
.text-button:hover { color: var(--accent-dark); text-decoration: underline; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.progress-card, .input-card { background: #fff; border: 1px solid #e1e8df; border-radius: 18px; padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.state-pill { color: #6e8077; font-size: 10px; background: #eff3ed; border-radius: 20px; padding: 4px 8px; }
.state-pill.is-finished { background: #dcefe4; color: var(--accent); }
.progress-summary { display: flex; align-items: baseline; gap: 6px; margin: 16px 0 10px; }
.progress-summary strong { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
.progress-summary > span { font-size: 12px; color: var(--muted); }
.progress-track { height: 5px; overflow: hidden; border-radius: 10px; background: #edf1e9; }
.progress-track > span { display: block; height: 100%; width: 0; background: #76a387; border-radius: inherit; transition: width .2s ease; }
.small-copy { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.keyboard-label { color: var(--muted); font-size: 10px; }
.number-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 17px 0 14px; }
.number-button { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 53px; border: 1px solid #e2e9df; border-radius: 10px; background: #f8faf6; color: var(--ink); font-size: 20px; line-height: 1.2; font-weight: 550; }
.number-button small { color: #97a298; font-size: 9px; margin-top: 3px; font-weight: 400; }
.number-button:hover:not(:disabled) { border-color: #98b8a6; background: #edf5ed; }
.number-button.is-active { border-color: var(--accent); color: var(--accent); background: #e5f1e8; }
.notes-toggle { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid #e0e7dd; background: #fff; border-radius: 10px; min-height: 40px; padding: 8px 12px; color: #63756a; font-size: 12px; }
.notes-icon { font-size: 19px; }
.toggle-state { margin-left: auto; font-size: 10px; color: #87988c; }
.notes-toggle[aria-pressed="true"] { background: #e8f3ed; color: var(--accent); border-color: #94b9a5; }
.notes-toggle[aria-pressed="true"] .toggle-state { color: var(--accent); }
.tool-row { display: flex; gap: 8px; margin-top: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; padding: 9px 14px; border-radius: 9px; border: 1px solid transparent; font-size: 12px; font-weight: 550; }
.tool-row .button { flex: 1; }
.primary { color: #fff; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { color: #4e665a; background: #f5f8f1; border-color: #e3e9de; }
.secondary:hover:not(:disabled) { background: #eaf1e4; }
.shortcut { font-size: 13px; opacity: .6; }
.feedback { margin: 13px 0 0; min-height: 36px; font-size: 11px; line-height: 1.7; color: var(--muted); }
.feedback.is-warning { color: var(--danger); }
.feedback.is-success { color: var(--accent); }
.help-card { padding: 0 5px; font-size: 11px; color: var(--muted); }
.help-card summary { cursor: pointer; color: #526a5b; padding: 3px 0; }
.help-card ul { margin: 10px 0 16px; padding-left: 18px; line-height: 1.9; }
.save-status { display: flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 10px; }
.save-dot { width: 5px; height: 5px; border-radius: 50%; background: #85aa78; flex: none; }
.reset-button { margin-top: 10px; color: #7b8980; }
.site-footer { text-align: center; margin: 24px 0; font-size: 10px; color: #94a092; letter-spacing: .3px; }
.pause-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 8px; background: #f6faf5ed; z-index: 4; }
.pause-symbol { color: var(--accent); font-size: 37px; }
.pause-overlay h3 { margin: 13px 0 0; font-size: 22px; }
.pause-overlay p { color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.board-shell.is-paused .board { filter: blur(3px); pointer-events: none; }
.modal { width: min(410px, calc(100% - 36px)); padding: 30px; border: 1px solid #e1e9df; border-radius: 20px; color: var(--ink); box-shadow: 0 24px 80px #1430212b; }
.modal::backdrop { background: #18352950; backdrop-filter: blur(3px); }
.modal h2 { font-size: 22px; }
.modal > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.8; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.win-modal { text-align: center; }
.win-icon { display: grid; place-items: center; width: 60px; height: 60px; background: #e3f1e5; border-radius: 50%; margin: 0 auto 20px; color: var(--accent); font-size: 34px; }
.win-modal .dialog-actions { justify-content: center; }
.noscript { position: fixed; inset: auto 0 0; padding: 20px; background: #fff0eb; text-align: center; color: var(--danger); }
@media (max-width: 760px) {
  .page { width: min(520px, calc(100% - 28px)); }
  .site-header { padding-top: 18px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 29px; height: 29px; font-size: 25px; }
  .prototype-tag { font-size: 10px; }
  .intro { padding: 24px 2px 19px; }
  h1 { font-size: 26px; }
  .intro-copy { font-size: 11px; }
  .eyebrow { font-size: 9px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .board-card { padding: 15px; border-radius: 16px; }
  .board-heading { margin-bottom: 14px; }
  .board-heading > div:first-child { gap: 7px; }
  .board-heading h2 { font-size: 12px; }
  .timer-label { display: none; }
  .timer { font-size: 17px; }
  .cell { font-size: clamp(20px, 5.7vw, 28px); }
  .notes { font-size: clamp(8px, 2.2vw, 11px); inset: 2px; }
  .sidebar { gap: 12px; }
  .progress-card { padding: 13px 15px; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
  .progress-card .section-heading { justify-content: flex-start; }
  .progress-summary { margin: 0; }
  .progress-summary strong { font-size: 23px; }
  .progress-summary > span { font-size: 10px; }
  .progress-track { margin-top: 9px; grid-column: 1 / -1; }
  .progress-card .small-copy { display: none; }
  .input-card { padding: 15px; border-radius: 15px; }
  .number-pad { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin: 13px 0; }
  .number-button { min-height: 47px; font-size: 19px; border-radius: 7px; }
  .number-button small { font-size: 8px; }
  .notes-toggle { min-height: 42px; }
  .tool-row .button { min-height: 43px; }
  .feedback { min-height: 0; margin-top: 12px; }
  .help-card { padding: 0 7px; }
  .site-footer { margin: 22px 0; }
}
@media (max-width: 350px) {
  .page { width: calc(100% - 18px); }
  .board-card { padding: 10px; }
  .input-card { padding: 10px; }
  .number-pad { gap: 3px; }
  .number-button { font-size: 17px; }
  .progress-card .state-pill { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
