:root {
  --sudoku-ink: #20203d;
  --sudoku-indigo: #4338ca;
  --sudoku-violet: #7c3aed;
  --sudoku-lilac: #ede9fe;
  --sudoku-mint: #d1fae5;
  --sudoku-warm: #fff7ed;
}

body.sudoku-page {
  background-color: #f7f7ff;
  background-image: radial-gradient(circle at 10% 15%, rgba(196, 181, 253, 0.28), transparent 24rem),
    radial-gradient(circle at 90% 45%, rgba(153, 246, 228, 0.22), transparent 25rem);
  color: var(--sudoku-ink);
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sudoku-hero { margin-bottom: -46px; padding: 30px 20px 100px; border-radius: 0 0 54px 54px; background: linear-gradient(135deg, #312e81 0%, #6d28d9 58%, #0f766e 130%); }
.sudoku-hero nav { margin-bottom: 26px; }
.sudoku-hero .brand a { color: #fff; text-decoration: none; }
.sudoku-hero .hero-copy { max-width: 760px; margin: auto; }
.sudoku-hero .eyebrow { display: inline-block; margin-bottom: 8px; color: #ddd6fe; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; font-size: .76rem; }
.sudoku-hero h1 { margin: 0; font-size: clamp(2.6rem, 7vw, 4.8rem); letter-spacing: -.05em; line-height: 1; }
.sudoku-hero p { margin: 16px auto 0; color: #ede9fe; font-size: clamp(1rem, 2.5vw, 1.3rem); }
.sudoku-main { position: relative; display: block; width: min(1180px, calc(100% - 28px)); max-width: none; margin: 0 auto 70px; padding: 0; }
.game-shell { padding: clamp(18px, 4vw, 38px); border: 1px solid rgba(99, 102, 241, .14); border-radius: 28px; background: rgba(255,255,255,.98); box-shadow: 0 28px 70px rgba(49,46,129,.18); }
.game-topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.game-kicker { margin: 0 0 6px; color: #6d28d9; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.date-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.date-picker-label { display: flex; height: 42px; margin: 0; }
.date-picker-label input { height: 42px; min-height: 42px; margin: 0; border: 1px solid #c7d2fe; border-radius: 10px; padding: 7px 10px; background: #fff; color: var(--sudoku-ink); font: inherit; font-weight: 700; line-height: 1; }
.icon-button, .today-button { min-width: 42px; height: 42px; min-height: 42px; margin: 0; border: 1px solid #c7d2fe; border-radius: 10px; background: #eef2ff; color: #3730a3; cursor: pointer; font: inherit; font-weight: 800; line-height: 1; }
.icon-button:disabled { opacity: .35; cursor: default; }
.today-button { padding: 0 12px; }
.daily-stats { display: flex; gap: 10px; }
.daily-stats div { min-width: 92px; padding: 10px 14px; border: 1px solid #e0e7ff; border-radius: 14px; background: #f8f7ff; text-align: center; }
.daily-stats strong, .daily-stats span { display: block; }
.daily-stats strong { color: #3730a3; font-size: 1.35rem; line-height: 1.2; }
.daily-stats span { color: #6b7280; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.difficulty-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 470px; margin: 24px 0 14px; padding: 5px; border-radius: 14px; background: #f1f0ff; }
.difficulty-tabs button { border: 0; border-radius: 10px; padding: 10px 16px; background: transparent; color: #5b587c; cursor: pointer; font: inherit; font-weight: 800; }
.difficulty-tabs button[aria-selected="true"] { background: #fff; color: #4338ca; box-shadow: 0 3px 12px rgba(49,46,129,.12); }
.game-status-row { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; color: #686683; font-size: .9rem; }
.game-status, .progress-text { margin: 0; }
.game-status.is-error { color: #b91c1c; }
.game-status.is-success { color: #047857; font-weight: 700; }
.play-area { display: grid; grid-template-columns: minmax(320px, 590px) minmax(230px, 1fr); gap: clamp(24px, 5vw, 54px); align-items: center; }
.board-wrap { position: relative; width: 100%; max-width: 590px; aspect-ratio: 1; }
.sudoku-board { display: grid; width: 100%; height: 100%; grid-template-columns: repeat(9, 1fr); border: 3px solid #27234f; border-radius: 9px; overflow: hidden; background: #27234f; box-shadow: 0 14px 34px rgba(49,46,129,.14); }
.sudoku-cell { position: relative; display: grid; place-items: center; min-width: 0; border: 0; border-right: 1px solid #c4c1dd; border-bottom: 1px solid #c4c1dd; border-radius: 0; background: #fff; color: #3730a3; cursor: pointer; font: inherit; font-size: clamp(1.05rem, 4vw, 2rem); font-weight: 700; line-height: 1; }
.sudoku-cell:nth-child(9n) { border-right: 0; }
.sudoku-cell:nth-child(n+73) { border-bottom: 0; }
.sudoku-cell.box-right { border-right: 3px solid #27234f; }
.sudoku-cell.box-bottom { border-bottom: 3px solid #27234f; }
.sudoku-cell.given { background: #fafaff; color: #20203d; font-weight: 800; cursor: default; }
.sudoku-cell.related { background: #f0efff; }
.sudoku-cell.same-number { background: #ddd6fe; }
.sudoku-cell.selected { z-index: 1; background: #c7d2fe; box-shadow: inset 0 0 0 3px #4f46e5; }
.sudoku-cell.conflict, .sudoku-cell.incorrect { background: #fee2e2; color: #b91c1c; }
.sudoku-cell.hinted { color: #047857; }
.cell-notes { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); color: #625f7d; font-size: clamp(.42rem, 1.35vw, .72rem); font-weight: 600; line-height: 1; }
.cell-note { display: grid; place-items: center; }
.completion-card { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; border-radius: 9px; background: rgba(32,32,61,.94); color: #fff; text-align: center; backdrop-filter: blur(4px); }
.completion-card[hidden] { display: none; }
.completion-mark { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--sudoku-mint); color: #047857; font-size: 2rem; font-weight: 800; }
.completion-card h2 { margin: 16px 0 4px; font-size: clamp(1.7rem, 5vw, 2.7rem); }
.completion-card p { margin: 0 0 20px; color: #ddd6fe; }
.primary-action, .secondary-action { width: min(260px, 100%); margin-top: 8px; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; font: inherit; font-weight: 800; }
.primary-action { background: #8b5cf6; color: #fff; }
.secondary-action { background: rgba(255,255,255,.12); color: #fff; }
.game-controls { display: grid; gap: 18px; }
.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool-button { min-width: 0; border: 1px solid #ddd6fe; border-radius: 13px; padding: 10px 4px; background: #faf9ff; color: #4c4780; cursor: pointer; font: inherit; font-size: .75rem; font-weight: 700; }
.tool-button span { display: block; margin-bottom: 2px; font-size: 1.35rem; }
.tool-button[aria-pressed="true"] { border-color: #7c3aed; background: #ede9fe; color: #5b21b6; }
.tool-button:disabled { opacity: .38; cursor: default; }
.number-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.number-pad button { aspect-ratio: 1.35; border: 1px solid #c7d2fe; border-radius: 13px; background: #eef2ff; color: #3730a3; cursor: pointer; font: inherit; font-size: clamp(1.25rem, 3vw, 1.7rem); font-weight: 800; }
.number-pad button:hover, .number-pad button:focus-visible { background: #ddd6fe; }
.number-pad button.complete-number { opacity: .3; }
.erase-button { border: 1px solid #ddd6fe; border-radius: 12px; padding: 11px; background: #fff; color: #5b587c; cursor: pointer; font: inherit; font-weight: 700; }
.keyboard-tip { margin: 0; color: #77738f; font-size: .8rem; text-align: center; }
kbd { border: 1px solid #c7c5d6; border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: #fff; font: inherit; font-weight: 700; }
.sudoku-ad-slot { margin: 26px 0; min-height: 100px; }
.sudoku-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sudoku-info-grid .card { margin: 0; }
.sudoku-info-grid h2 { color: #3730a3; font-size: 1.25rem; }
.noscript-message { max-width: 800px; margin: 30px auto; }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(124,58,237,.35); outline-offset: 2px; }

@media (max-width: 820px) {
  .play-area { grid-template-columns: 1fr; }
  .board-wrap { margin: auto; }
  .game-controls { max-width: 590px; width: 100%; margin: auto; }
  .number-pad { grid-template-columns: repeat(9, 1fr); }
  .number-pad button { aspect-ratio: 1; padding: 0; }
  .sudoku-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .sudoku-hero { padding: 22px 14px 82px; border-radius: 0 0 32px 32px; }
  .sudoku-main { width: min(100% - 16px, 1180px); }
  .game-shell { padding: 14px; border-radius: 20px; }
  .game-topbar { align-items: flex-start; flex-direction: column; }
  .daily-stats { align-self: stretch; }
  .daily-stats div { flex: 1; }
  .difficulty-tabs { max-width: none; margin-top: 18px; }
  .game-status-row { font-size: .78rem; }
  .tool-row { order: 2; }
  .number-pad { grid-template-columns: repeat(9, 1fr); gap: 4px; }
  .number-pad button { border-radius: 8px; font-size: 1.05rem; }
  .erase-button { order: 3; }
  .keyboard-tip { display: none; }
  .sudoku-cell { font-size: clamp(1rem, 5.6vw, 1.65rem); }
  .cell-notes { inset: 1px; font-size: clamp(.36rem, 2.3vw, .58rem); }
}
