/* Sudoku on washi paper: sumi ink givens, indigo entries, vermilion seal. */
:root {
  --paper: #f4efe4; --paper-2: #ebe4d6; --paper-3: #e0d8c7; --sumi: #1c1a17; --sumi-2: #5b554c; --indigo: #2f4a6d; --indigo-soft: #dbe4ef; --vermilion: #d1462f; --vermilion-soft: #f3d9d3;
  --bg: var(--paper); --surface: #faf7f0; --surface-2: var(--paper-2); --ink: var(--sumi); --ink-2: var(--sumi-2); --line: #cfc7b6;
  --ok: #3b8f5e; --warn: #c98a1b; --bad: var(--vermilion); --info: var(--indigo); --accent: var(--vermilion); --accent-ink: #fff;
  --font-display: "Shippori Mincho", "Noto Serif JP", Georgia, serif; --font-ui: "Zen Kaku Gothic New", "Inter", system-ui, sans-serif;
  --grid-line: #b9b09d; --grid-thick: var(--sumi); --cell-sel: #f7d4cb; --cell-peer: #ebe5d8; --cell-same: #d7e0ec; --cell-hint: #fbe7b0;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --paper: #15171c; --paper-2: #1c1f26; --paper-3: #262a33; --sumi: #f1ede4; --sumi-2: #a8a396; --indigo: #9dbce6; --indigo-soft: #26364c; --bg: var(--paper); --surface: #1c1f26; --surface-2: #262a33; --line: #343945; --grid-line: #3b4150; --grid-thick: #e6e1d6; --cell-sel: #5a2f28; --cell-peer: #1f232b; --cell-same: #26364c; --cell-hint: #4a3d14; --vermilion-soft: #4a2620; } }
:root[data-theme="dark"] { --paper: #15171c; --paper-2: #1c1f26; --paper-3: #262a33; --sumi: #f1ede4; --sumi-2: #a8a396; --indigo: #9dbce6; --indigo-soft: #26364c; --bg: var(--paper); --surface: #1c1f26; --surface-2: #262a33; --line: #343945; --grid-line: #3b4150; --grid-thick: #e6e1d6; --cell-sel: #5a2f28; --cell-peer: #1f232b; --cell-same: #26364c; --cell-hint: #4a3d14; --vermilion-soft: #4a2620; }
:root[data-contrast="1"] { --grid-line: var(--sumi-2); --cell-peer: var(--paper-3); }

body { background-image: radial-gradient(ellipse at 30% 0%, rgb(255 255 255 / .35), transparent 60%); }
.screen { gap: 14px; max-width: 560px; margin-inline: auto; }
.topbar { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.screen-title { font-size: 1.9rem; font-weight: 500; margin-left: 6px; }
.btn { font-weight: 500; } .cta { font-size: 1.15rem; min-height: 52px; }
.label { color: var(--ink-2); font-size: .9rem; margin: 0 0 6px 2px; }
.hero { text-align: center; padding-top: 4px; }
.hero-grid { display: grid; grid-template-columns: repeat(9, 1fr); width: min(42vw, 180px); aspect-ratio: 1; margin: 0 auto 8px; border: 2px solid var(--grid-thick); background: var(--surface); }
.hero-grid span { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: clamp(.6rem, 2.6vw, .9rem); border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); color: var(--ink); opacity: 0; transition: opacity .6s; }
.hero-grid span[data-on="true"] { opacity: 1; } .hero-grid span:nth-child(3n) { border-right-width: 2px; border-right-color: var(--grid-thick); } .hero-grid span:nth-child(n+19):nth-child(-n+27), .hero-grid span:nth-child(n+46):nth-child(-n+54) { border-bottom-width: 2px; border-bottom-color: var(--grid-thick); }
.hero-grid span:nth-child(9n) { border-right: 0; } .hero-grid span:nth-child(n+73) { border-bottom: 0; }
.title { font-size: clamp(2.6rem, 12vw, 3.6rem); font-weight: 500; letter-spacing: .06em; }
.tagline { color: var(--ink-2); margin-top: 4px; }
.streak-pill { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); color: var(--warn); font-weight: 700; box-shadow: var(--shadow-1); }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; min-height: 66px; border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow-1); border: 2px solid transparent; }
.mode b { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; } .mode span { color: var(--ink-2); font-size: .82rem; line-height: 1.2; }
.mode[aria-pressed="true"] { border-color: var(--vermilion); }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tiers button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); border: 2px solid transparent; }
.tiers button b { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; } .tiers button small { color: var(--ink-2); font-size: .72rem; }
.tiers button[aria-checked="true"] { border-color: var(--indigo); background: var(--indigo-soft); }
.seg-line { display: flex; background: var(--surface); border-radius: var(--r-pill); padding: 3px; box-shadow: var(--shadow-1); }
.seg-line button { flex: 1; height: 38px; border-radius: var(--r-pill); color: var(--ink-2); font-weight: 500; } .seg-line button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.home-actions { display: flex; gap: 8px; } .home-actions .cta { flex: 2; } .home-actions > .btn:not(.cta) { flex: 1; background: var(--surface); box-shadow: var(--shadow-1); }

/* Play */
.screen[data-screen="play"] { height: 100dvh; min-height: 0; overflow: hidden; gap: 8px; }
.hud { gap: 8px; } .hud-title { font-family: var(--font-display); font-size: clamp(1rem, 4.2vw, 1.3rem); font-weight: 500; white-space: nowrap; } .hud-note { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-wrap { position: relative; flex: 0 0 auto; width: min(100%, calc(100dvh - 300px), 520px); margin-inline: auto; aspect-ratio: 1; }
.board { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: 100%; height: 100%; border: 2.5px solid var(--grid-thick); background: var(--surface); box-shadow: var(--shadow-2); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cell { position: relative; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); font-family: var(--font-display); font-weight: 500; font-size: var(--digit); color: var(--indigo); background: transparent; transition: background var(--t-fast); padding: 0; min-height: 0; cursor: pointer; }
.cell[data-boxr="1"] { border-right: 2.5px solid var(--grid-thick); } .cell[data-boxb="1"] { border-bottom: 2.5px solid var(--grid-thick); } .cell[data-last-col="1"] { border-right: 0; } .cell[data-last-row="1"] { border-bottom: 0; }
.cell[data-given="true"] { color: var(--ink); font-weight: 700; }
.cell[data-diag="true"] { background: repeating-linear-gradient(45deg, transparent 0 4px, rgb(120 110 90 / .08) 4px 6px); }
.cell[data-peer="true"] { background-color: var(--cell-peer); } .cell[data-same="true"] { background-color: var(--cell-same); } .cell[data-sel="true"] { background-color: var(--cell-sel); box-shadow: inset 0 0 0 2px var(--vermilion); z-index: 1; }
.cell[data-hint="true"] { background-color: var(--cell-hint); } .cell[data-hint-target="true"] { box-shadow: inset 0 0 0 3px var(--warn); z-index: 1; }
.cell[data-wrong="true"] { color: var(--bad); } .cell[data-conflict="true"] { color: var(--bad); }
.cell .v.anim-in { animation: digit-in var(--t-base) var(--ease-spring); } @keyframes digit-in { from { transform: scale(.55); opacity: 0; } }
.cell.anim-shake { animation: shake-x var(--t-slow); } .cell.anim-pulse { animation: cell-pulse .6s var(--ease-out); animation-delay: calc(var(--i) * 40ms); } @keyframes cell-pulse { 30% { background-color: var(--indigo-soft); } }
.cell:focus-visible { outline: 3px solid var(--indigo); outline-offset: -3px; z-index: 2; }
.notes { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(var(--nc), 1fr); grid-template-rows: repeat(var(--nr), 1fr); font-family: var(--font-ui); font-size: calc(var(--digit) * .34); color: var(--ink-2); line-height: 1; }
.notes span { display: flex; align-items: center; justify-content: center; } .notes span[data-hl="true"] { color: var(--indigo); font-weight: 700; }
.board[data-n="9"] { --digit: clamp(1.1rem, 5.2vw, 2rem); } .board[data-n="6"] { --digit: clamp(1.4rem, 7vw, 2.6rem); }
.paused { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(8px); font-family: var(--font-display); font-size: 1.6rem; }
.seal { position: absolute; right: 6%; bottom: 6%; width: 26%; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--vermilion); color: #fff; border-radius: 6px; border: 3px solid #fff; box-shadow: 0 6px 20px rgb(0 0 0 / .3); transform: rotate(-8deg) scale(0); opacity: 0; font-family: var(--font-display); pointer-events: none; }
.seal span { font-size: clamp(2rem, 12vw, 4rem); line-height: 1; } .seal small { font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; }
.seal[data-on="true"] { animation: stamp .55s var(--ease-out) forwards; } @keyframes stamp { 0% { transform: rotate(-8deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-8deg) scale(.92); opacity: 1; } 100% { transform: rotate(-8deg) scale(1); opacity: .96; } }
.play-msg { text-align: center; min-height: 1.3em; color: var(--ink-2); font-size: .95rem; }
.pad { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 5px; }
.pad button { position: relative; height: 50px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-1); font-family: var(--font-display); font-size: 1.5rem; color: var(--indigo); font-weight: 500; }
.pad button small { position: absolute; right: 5px; bottom: 3px; font-family: var(--font-ui); font-size: .62rem; color: var(--ink-2); }
.pad button[data-done="true"] { opacity: .3; } .pad button[aria-pressed="true"] { background: var(--indigo); color: #fff; } .pad button[aria-pressed="true"] small { color: #fff; }
.pad[data-notes="true"] button { font-family: var(--font-ui); font-size: 1.1rem; color: var(--ink-2); }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-bottom: env(safe-area-inset-bottom); }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 54px; border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: .78rem; } .tool .icon { width: 20px; height: 20px; }
.tool[aria-pressed="true"] { background: var(--indigo); color: #fff; } .tool:disabled { opacity: .4; }
@media (max-height: 700px) { .pad button { height: 44px; } .tool { height: 48px; } .board-wrap { width: min(100%, calc(100dvh - 268px), 520px); } }
@media (min-width: 640px) { .screen[data-screen="play"] { max-width: 640px; } }

/* Sheets */
.hint-text { font-size: 1.05rem; line-height: 1.5; } .hint-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .hint-actions .btn { flex-direction: column; gap: 0; min-height: 56px; padding: 0 8px; font-size: .95rem; } .hint-actions small { color: inherit; opacity: .7; font-size: .75rem; }
.result-verdict { font-family: var(--font-display); font-size: clamp(2rem, 9vw, 2.8rem); text-align: center; font-weight: 500; line-height: 1.1; } .result-verdict[data-won="false"] { color: var(--bad); }
.stars { display: flex; justify-content: center; gap: 6px; } .stars .icon { width: 32px; height: 32px; color: var(--line); } .stars .icon[data-on="true"] { color: var(--warn); fill: var(--warn); animation: pop var(--t-slow) var(--ease-spring) both; animation-delay: calc(var(--i) * 140ms); }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; } .result-actions .cta { grid-column: 1 / -1; }
.set-row small { display: block; color: var(--ink-2); font-size: .8rem; }
