/* Mini Sudoku board. Tokens from style.css (Moonlit). Givens = ink, player digits = lavender, conflicts = coral hatch. */
:root { --ms-line: rgba(27, 26, 63, .16); --ms-thick: #1b1a3f; --ms-note: #6b6890; --ms-peer: rgba(109, 102, 224, .07); --ms-same: rgba(109, 102, 224, .17); --ms-sel: rgba(109, 102, 224, .13); --ms-hatch: rgba(217, 92, 74, .14); }
[data-theme='dark'] { --ms-line: rgba(239, 237, 255, .14); --ms-thick: #efedff; --ms-note: #a09dc9; --ms-peer: rgba(154, 148, 255, .1); --ms-same: rgba(154, 148, 255, .24); --ms-sel: rgba(154, 148, 255, .18); --ms-hatch: rgba(255, 125, 106, .16); }

.msk { width: 100%; position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; --cs: 52px; }
.msk-stage { position: relative; width: fit-content; margin: 0 auto; }
.msk-board { display: grid; grid-template-columns: repeat(6, var(--cs)); position: relative; touch-action: manipulation; border-radius: 12px; overflow: hidden; background: var(--board-bg); cursor: pointer; }
.mc { width: var(--cs); height: var(--cs); position: relative; display: grid; place-items: center; background: transparent; transition: background .12s ease; }
.mc .v { font-family: var(--display); font-weight: 600; font-size: calc(var(--cs) * .56); line-height: 1; color: var(--accent-2); position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.mc.given .v { color: var(--ink); font-weight: 700; }
.mc .notes { position: absolute; inset: 9% 8%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); pointer-events: none; }
.mc .notes i { font-style: normal; font-family: var(--body); font-weight: 700; font-size: calc(var(--cs) * .22); line-height: 1; color: var(--ms-note); display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity .16s ease, transform .16s ease; }
.mc .notes i.on { opacity: 1; transform: scale(1); }
.mc.has-v .notes { display: none; }
@media (hover: hover) { .msk-board:not(.locked) .mc:not(.sel):hover { background: var(--ms-peer); } }
.mc.peer { background: var(--ms-peer); }
.mc.same { background: var(--ms-same); }
.mc.same .v { font-weight: 800; }
.mc.sel { background: var(--ms-sel); box-shadow: inset 0 0 0 2px var(--accent-2), inset 0 0 14px rgba(109, 102, 224, .18); z-index: 2; }
.mc.bad { background-image: repeating-linear-gradient(135deg, var(--ms-hatch) 0 4px, transparent 4px 10px); }
.mc.bad:not(.given) .v { color: var(--bad); }
.mc.pop .v { animation: mpop .2s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes mpop { 0% { transform: scale(.55); opacity: .4; } 70% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
.mc.nudge { animation: mnudge .18s ease; }
@keyframes mnudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-3px); } 70% { transform: translateX(3px); } }
.mc.flash { animation: mflash .55s ease both; animation-delay: var(--d, 0s); }
@keyframes mflash { 0% { background-color: transparent; } 30% { background-color: rgba(233, 181, 74, .45); } 100% { background-color: transparent; } }
.mc.flash .v { animation: mflashv .55s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: var(--d, 0s); }
@keyframes mflashv { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.14); } }
.mc.fade .notes i { transition: opacity .25s ease, transform .25s ease; }

/* grid lines: one SVG on top of the cells */
.msk-lines { position: absolute; inset: 0; pointer-events: none; z-index: 3; transition: opacity .3s ease; }
.msk-lines .thin { stroke: var(--ms-line); stroke-width: 1; }
.msk-lines .thick { stroke: var(--ms-thick); stroke-width: 3; stroke-linecap: round; }
.msk-lines .frame { fill: none; stroke: var(--ms-thick); stroke-width: 3; }

/* hint: dim everything except the cells the hint talks about */
.msk-board.hinting .mc:not(.hl):not(.anchor):not(.uhl) { opacity: .28; }
.msk-board.hinting .mc.uhl { background: var(--ms-peer); }
.mc.hl { z-index: 4; box-shadow: inset 0 0 0 3px var(--accent-2); border-radius: 6px; background: var(--ms-sel); }
.mc.anchor { z-index: 4; box-shadow: inset 0 0 0 2px var(--accent); border-radius: 6px; }
.msk-hint { margin: 12px auto 0; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 10px 12px; font-size: 14px; color: var(--ink); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; line-height: 1.4; animation: hintin .25s cubic-bezier(.3, 1.2, .5, 1); }
.msk-hint[hidden] { display: none; }
.msk-hint .ic { width: 22px; height: 22px; flex: none; color: var(--accent-2); }
.msk-hint .ic svg { width: 22px; height: 22px; }
.msk-hint p { margin: 0; flex: 1 1 200px; }
.msk-hint .acts { display: flex; gap: 6px; flex: none; margin-left: auto; }
@keyframes hintin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* pad */
.msk-pad { margin: 14px auto 0; width: calc(var(--cs) * 6); max-width: 100%; display: grid; gap: 8px; }
.msk-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.msk-keys .key { position: relative; height: max(46px, calc(var(--cs) * .95)); border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 24px; cursor: pointer; padding: 0; touch-action: manipulation; transition: transform .08s ease, background .12s ease, opacity .15s ease; }
.msk-keys .key:active { transform: translateY(1px) scale(.97); }
.msk-keys .key .rem { position: absolute; right: 5px; top: 3px; font-family: var(--body); font-size: 10px; font-weight: 800; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.msk-keys .key.hot { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); }
.msk-keys .key.done { opacity: .38; }
.msk.notes-mode .msk-keys .key { font-family: var(--body); font-weight: 600; font-style: italic; font-size: 19px; color: var(--ms-note); background: var(--surface-2); }
.msk.no-rem .msk-keys .key .rem { display: none; }
.msk-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.msk-tools .btn { height: 42px; padding: 0 12px; font-size: 14px; gap: 6px; }
.msk-tools .btn svg { width: 18px; height: 18px; }
.msk-tools .btn .st { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--ink-faint); }
.msk-tools .btn[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msk-tools .btn[aria-pressed='true'] .st { color: var(--accent); }

/* win: lines fade, a wave rolls out from the last cell, glow, particles */
.msk-board.won .msk-lines { opacity: .35; }
.msk-board.won .mc { animation: mwave .6s cubic-bezier(.3, 1.3, .5, 1) both; animation-delay: var(--d, 0s); }
@keyframes mwave { 0% { background-color: transparent; } 35% { background-color: rgba(233, 181, 74, .5); } 100% { background-color: rgba(233, 181, 74, .1); } }
.msk-board.won .mc .v { animation: mwavev .6s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: var(--d, 0s); }
@keyframes mwavev { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18); } }
.msk-board.won:not(.given) .mc:not(.given) .v { color: var(--accent-2); }
.msk-board.won.quiet .mc, .msk-board.won.quiet .mc .v { animation: none; background-color: rgba(233, 181, 74, .1); }
.msk-stage::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; pointer-events: none; z-index: 5; background: radial-gradient(circle, rgba(255, 236, 190, .75), rgba(233, 181, 74, .25) 45%, transparent 70%); opacity: 0; }
.msk-stage.glow::after { animation: mglow 2s ease-out both; }
@keyframes mglow { 0% { opacity: 0; transform: scale(.7); } 22% { opacity: .85; transform: scale(1); } 100% { opacity: 0; transform: scale(1.15); } }
[data-theme='dark'] .msk-stage::after { background: radial-gradient(circle, rgba(242, 194, 90, .5), rgba(154, 148, 255, .2) 45%, transparent 70%); mix-blend-mode: screen; }
.msk-board.locked { cursor: default; }
.msk-fx { position: absolute; inset: -60px -30px -30px; width: calc(100% + 60px); height: calc(100% + 90px); pointer-events: none; z-index: 30; }
.msk-help { text-align: center; font-size: 12px; color: var(--ink-faint); margin: 10px 0 0; }

/* page bits (same look as the other games) */
.msk-page .board-wrap { padding: 14px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon { position: relative; }
.btn-icon .cnt { position: absolute; right: -5px; top: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.btn-icon .cnt:empty { display: none; }
.snd-off .ic-on, .btn-icon:not(.snd-off) .ic-off { display: none; }
.q-settings { position: relative; }
.q-pop { position: absolute; right: 0; top: 46px; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); box-shadow: var(--shadow-hover); padding: 6px 4px; min-width: 240px; }
.q-pop[hidden] { display: none; }
.q-pop label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.q-pop .sw { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background .15s ease; }
.q-pop .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.q-pop input { position: absolute; opacity: 0; pointer-events: none; }
.q-pop input:checked + .sw { background: var(--good); }
.q-pop input:checked + .sw::after { transform: translateX(16px); }
.q-pop input:focus-visible + .sw { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.q-meta { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.q-meta .pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.q-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
.q-pick button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.q-pick button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msk-demo { margin: 14px 0 6px; }
@media (max-width: 480px) { .msk-page .board-wrap { padding: 8px; } .msk-page .wrap-game { padding: 0 10px; } .msk-keys .key { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .mc.pop .v, .mc.flash, .mc.flash .v, .msk-board.won .mc, .msk-board.won .mc .v, .msk-stage.glow::after { animation: none !important; } }
