:root {
  color-scheme: dark;
  --bg: #0b1118;
  --surface: #111a24;
  --surface-2: #162231;
  --surface-3: #1d2b3b;
  --border: #2b3b4d;
  --border-strong: #7d91a8;
  --text: #edf4fb;
  --muted: #91a3b7;
  --accent: #68d5c0;
  --accent-strong: #36baa1;
  --accent-soft: rgba(104, 213, 192, .15);
  --blue: #78aefa;
  --blue-soft: rgba(120, 174, 250, .15);
  --danger: #ff7e8c;
  --danger-soft: rgba(255, 126, 140, .16);
  --warning: #f4cb71;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 15% 0%, rgba(78, 157, 144, .13), transparent 30rem), radial-gradient(circle at 90% 20%, rgba(74, 112, 176, .11), transparent 28rem), var(--bg); }
button, select { font: inherit; }
button { color: inherit; }
button:focus-visible, select:focus-visible { outline: 3px solid rgba(104, 213, 192, .42); outline-offset: 2px; }
.hidden { display: none !important; }
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 10px max(20px, calc((100vw - 1380px) / 2)); border-bottom: 1px solid rgba(125, 145, 168, .16); background: rgba(11, 17, 24, .86); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 44px; aspect-ratio: 1; border-radius: 13px; color: #07120f; background: linear-gradient(145deg, #96ebd9, #45c0a9); font-size: 1.45rem; font-weight: 900; box-shadow: 0 9px 24px rgba(54, 186, 161, .2); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.header-actions { display: flex; gap: 9px; }
.icon-button, .theme-toggle { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; cursor: pointer; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.1rem; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 13px; color: var(--muted); cursor: default; }
.app-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 64px; }
.hero-copy { max-width: 820px; margin-bottom: 34px; }
.eyebrow, .status-kicker, .label { color: var(--accent); font-size: .72rem; font-weight: 850; letter-spacing: .16em; }
.hero-copy h1 { max-width: 760px; margin: 10px 0 12px; font-size: clamp(2rem, 5vw, 3.65rem); line-height: 1.04; letter-spacing: -.045em; }
.hero-copy > p:last-child { max-width: 700px; margin: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.7; }
.game-layout { display: grid; grid-template-columns: minmax(430px, 700px) minmax(270px, 330px) minmax(220px, 290px); gap: 22px; align-items: start; }
.board-panel, .control-panel, .ad-rail, .feature-grid article, .how-to-play { border: 1px solid rgba(125, 145, 168, .2); background: linear-gradient(150deg, rgba(22, 34, 49, .96), rgba(14, 23, 33, .96)); box-shadow: var(--shadow); }
.board-panel { padding: clamp(12px, 2vw, 22px); border-radius: var(--radius); }
.game-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.game-bar > div { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); background: rgba(10, 17, 25, .62); border-radius: 12px; }
.game-bar .label { display: block; margin-bottom: 3px; color: var(--muted); font-size: .62rem; }
.game-bar strong { font-variant-numeric: tabular-nums; font-size: .98rem; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; }
.sudoku-board { display: grid; grid-template-columns: repeat(9, 1fr); width: 100%; aspect-ratio: 1; overflow: hidden; border: 3px solid var(--border-strong); border-radius: 10px; background: #0c141e; touch-action: manipulation; }
.cell { position: relative; display: grid; place-items: center; min-width: 0; border: 0; border-right: 1px solid #314255; border-bottom: 1px solid #314255; background: #111c28; color: var(--text); cursor: pointer; font-weight: 650; font-size: clamp(1.12rem, 4.1vw, 2rem); transition: background .12s ease, transform .08s ease; }
.cell:nth-child(9n) { border-right: 0; }
.cell:nth-child(n+73) { border-bottom: 0; }
.cell.box-right { border-right: 3px solid var(--border-strong); }
.cell.box-bottom { border-bottom: 3px solid var(--border-strong); }
.cell:hover { background: #182838; }
.cell.related { background: #172534; }
.cell.same-value { background: #203b46; }
.cell.selected { z-index: 1; background: #25475a; box-shadow: inset 0 0 0 3px var(--accent); }
.cell.given { color: #f3f8fc; font-weight: 850; }
.cell.user-value { color: var(--blue); }
.cell.hint-value { color: var(--accent); }
.cell.error { color: var(--danger); background: var(--danger-soft); animation: shake .28s ease; }
.cell:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.notes-grid { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); align-items: center; justify-items: center; color: #a8c6e6; font-size: clamp(.45rem, 1.35vw, .72rem); font-weight: 650; line-height: 1; }
.note-slot { opacity: .92; }
.generating-overlay, .pause-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; border-radius: 10px; background: rgba(8, 14, 21, .91); backdrop-filter: blur(8px); text-align: center; }
.generating-overlay strong, .pause-overlay strong { font-size: 1.05rem; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(104, 213, 192, .18); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pause-overlay > span { display: grid; place-items: center; width: 62px; aspect-ratio: 1; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.5rem; }
.progress-track { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: #0b141d; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), #83dfce); transition: width .25s ease; }
.board-message { min-height: 21px; margin: 10px 2px 0; color: var(--muted); font-size: .86rem; }
.control-panel { position: sticky; top: 94px; padding: 18px; border-radius: var(--radius); }
.status-card { display: flex; flex-direction: column; gap: 5px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: rgba(8, 15, 22, .56); }
.status-card strong { font-size: 1rem; }
.status-card > span:last-child { color: var(--muted); font-size: .79rem; line-height: 1.45; }
.field-label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.new-game-row { display: grid; grid-template-columns: 1fr 1.1fr; gap: 9px; }
select, .button { min-height: 44px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text); }
select { width: 100%; padding: 0 11px; cursor: pointer; }
.button { padding: 0 14px; font-weight: 750; cursor: pointer; }
.button:hover { border-color: #526a82; background: var(--surface-3); }
.button.primary { border-color: transparent; color: #06120f; background: linear-gradient(145deg, #8ae5d3, #43c2a9); }
.button.primary:hover { filter: brightness(1.06); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.number-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 18px; }
.number-pad button { min-width: 0; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 11px; background: #132131; color: var(--blue); cursor: pointer; font-size: 1.15rem; font-weight: 850; }
.number-pad button:hover { border-color: var(--blue); background: var(--blue-soft); }
.number-pad button.completed-number { opacity: .28; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.tool-button { position: relative; display: flex; min-width: 0; min-height: 62px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--border); border-radius: 11px; background: #101d2a; cursor: pointer; }
.tool-button:hover, .tool-button.active { border-color: var(--accent); background: var(--accent-soft); }
.tool-button > span { color: var(--accent); font-size: 1.14rem; }
.tool-button small { font-size: .67rem; }
.tool-button b { position: absolute; top: 5px; right: 5px; padding: 2px 4px; border-radius: 5px; background: #25384a; color: var(--muted); font-size: .48rem; }
.tool-button.active b { background: var(--accent); color: #07120f; }
.tool-button.wide { grid-column: span 4; min-height: 44px; flex-direction: row; gap: 7px; }
.keyboard-card { margin-top: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); background: rgba(8, 15, 22, .38); }
.keyboard-card strong { color: var(--text); font-size: .78rem; }
.keyboard-card p { margin: 7px 0 0; font-size: .7rem; line-height: 1.55; }
kbd { padding: 2px 5px; border: 1px solid #3a4c60; border-bottom-width: 2px; border-radius: 5px; color: #dce8f2; background: #1a2938; font-size: .65rem; }
.ad-rail { min-height: 560px; padding: 24px; border-radius: var(--radius); text-align: center; }
.ad-label, .ad-size { display: inline-block; color: var(--muted); font-size: .62rem; font-weight: 850; letter-spacing: .15em; }
.ad-art { display: grid; place-items: center; width: 112px; aspect-ratio: 1; margin: 72px auto 24px; border: 1px solid rgba(104, 213, 192, .4); border-radius: 28px; color: var(--accent); background: var(--accent-soft); font-size: 1.9rem; font-weight: 900; transform: rotate(-4deg); }
.ad-rail h2 { margin: 0; font-size: 1.22rem; }
.ad-rail p { margin: 10px 0 34px; color: var(--muted); font-size: .83rem; line-height: 1.6; }
.ad-size { margin-top: auto; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.feature-grid article { padding: 22px; border-radius: 16px; box-shadow: none; }
.feature-grid article > span { display: grid; place-items: center; width: 38px; aspect-ratio: 1; border-radius: 11px; color: var(--accent); background: var(--accent-soft); font-size: 1.2rem; }
.feature-grid h2 { margin: 14px 0 6px; font-size: 1rem; }
.feature-grid p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.how-to-play { margin-top: 20px; padding: 28px; border-radius: 18px; box-shadow: none; }
.how-to-play h2 { max-width: 780px; margin: 9px 0 9px; font-size: clamp(1.35rem, 3vw, 2rem); }
.how-to-play > p:last-child { max-width: 820px; margin: 0; color: var(--muted); line-height: 1.65; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px max(20px, calc((100vw - 1380px) / 2)); border-top: 1px solid rgba(125, 145, 168, .16); color: var(--muted); font-size: .74rem; }
::backdrop { background: rgba(2, 7, 11, .74); backdrop-filter: blur(5px); }
dialog { width: min(470px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 20px; color: var(--text); background: transparent; box-shadow: var(--shadow); }
.modal-card { padding: 22px; border-radius: inherit; background: linear-gradient(155deg, #172536, #0f1924); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-heading h2 { margin: 5px 0 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.stats-grid > div { padding: 13px 6px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8, 15, 22, .42); text-align: center; }
.stats-grid strong, .stats-grid span { display: block; }
.stats-grid strong { font-size: 1.22rem; }
.stats-grid span { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.notice { color: var(--muted); font-size: .79rem; line-height: 1.55; }
.celebration-card { text-align: center; }
.celebration-mark { display: grid; place-items: center; width: 68px; aspect-ratio: 1; margin: 0 auto 16px; border-radius: 50%; color: #07120f; background: var(--accent); font-size: 2rem; font-weight: 900; }
.celebration-card h2 { margin: 8px 0; font-size: 1.8rem; }
.celebration-card p { color: var(--muted); line-height: 1.65; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100% - 30px); padding: 11px 16px; border: 1px solid #3f556b; border-radius: 999px; color: var(--text); background: #172535; box-shadow: 0 12px 32px rgba(0,0,0,.38); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity .2s ease, transform .2s ease; font-size: .82rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1120px) { .game-layout { grid-template-columns: minmax(430px, 1fr) 310px; } .ad-rail { display: none; } }
@media (max-width: 790px) { .site-header { min-height: 64px; } .app-shell { width: min(100% - 24px, 650px); padding-top: 28px; } .hero-copy h1 { font-size: clamp(2rem, 10vw, 3rem); } .game-layout { grid-template-columns: 1fr; } .control-panel { position: static; } .feature-grid { grid-template-columns: 1fr; } .number-pad { grid-template-columns: repeat(9, 1fr); gap: 4px; } .number-pad button { border-radius: 8px; font-size: 1rem; } }
@media (max-width: 480px) { .theme-toggle span:last-child { display: none; } .theme-toggle { width: 42px; justify-content: center; padding: 0; } .app-shell { width: min(100% - 16px, 650px); } .hero-copy { margin-bottom: 22px; } .hero-copy > p:last-child { font-size: .9rem; } .board-panel { padding: 8px; border-radius: 14px; } .game-bar { margin-bottom: 8px; } .game-bar > div { padding: 8px; border-radius: 9px; } .game-bar .label { font-size: .52rem; } .game-bar strong { font-size: .82rem; } .sudoku-board { border-width: 2px; border-radius: 7px; } .cell.box-right { border-right-width: 2px; } .cell.box-bottom { border-bottom-width: 2px; } .cell.selected { box-shadow: inset 0 0 0 2px var(--accent); } .notes-grid { inset: 1px; } .control-panel { padding: 13px; border-radius: 14px; } .number-pad button { min-height: 38px; aspect-ratio: auto; } .keyboard-card { display: none; } .how-to-play { padding: 20px; } footer { flex-direction: column; align-items: center; gap: 6px; text-align: center; } .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; } }
