:root {
  --coral: #ff7b61;
  --sky: #44a9f3;
  --leaf: #45bd7b;
  --sun: #ffd15c;
  --lav: #9678ed;
  --ink: #243047;
  --muted: #65718a;
  --paper: #fffdf7;
  --card: #ffffff;
  --line: #cad3e4;
  --shadow: 0 12px 34px rgba(42, 57, 91, .14);
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #edf8ff; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background:
  radial-gradient(circle at 10% 10%, rgba(255, 209, 92, .3), transparent 25rem),
  radial-gradient(circle at 90% 20%, rgba(150, 120, 237, .18), transparent 28rem),
  linear-gradient(180deg, #e8f8ff, #fff8e9 68%, #eefbf3); }
button, input, select { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 4px solid #123fcb; outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; transform: translateY(-160%); background: white; padding: .75rem 1rem; border-radius: 10px; }
.skip-link:focus { transform: none; }

#app { width: min(1180px, 100%); margin: 0 auto; padding: clamp(.7rem, 2vw, 1.5rem); min-height: calc(100dvh - 72px); }
.screen { animation: screen-in .25s ease both; }
.screen h2, .screen h3 { font-family: 'Fredoka', system-ui, sans-serif; line-height: 1.12; margin: 0; }
.screen h2 { font-size: clamp(1.8rem, 5vw, 3rem); }
.screen h3 { font-size: clamp(1.25rem, 3vw, 1.65rem); }
.eyebrow { margin: 0 0 .25rem; color: #286f87; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; font-size: .78rem; }

.hero-card { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; align-items: center; padding: clamp(1.25rem, 4vw, 2.5rem); background: linear-gradient(135deg, rgba(255,255,255,.96), #fdf7ff); border: 2px solid white; border-radius: 28px; box-shadow: var(--shadow); }
.hero-card p:last-child { max-width: 65ch; margin-bottom: 0; color: var(--muted); font-size: 1.06rem; }
.hero-badge { display: grid; grid-template-columns: repeat(3, 62px); gap: 5px; transform: rotate(-4deg); }
.hero-badge span { display: grid; place-items: center; aspect-ratio: 1; background: var(--card); border: 3px solid var(--ink); border-radius: 13px; font-family: 'Fredoka'; font-weight: 700; box-shadow: 3px 4px 0 var(--sun); }
.progress-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; margin: 1rem 0 1.5rem; }
.progress-strip span { background: rgba(255,255,255,.88); border: 1px solid #dde6f3; border-radius: 999px; padding: .55rem .9rem; }
.section-heading, .screen-bar, .modal-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.25rem 0 .85rem; }
.heading-actions { display: flex; align-items: center; gap: .55rem; }
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.65rem, 2vw, 1.1rem); }
.mode-card { display: flex; min-height: 180px; flex-direction: column; align-items: flex-start; gap: .45rem; text-align: left; padding: 1.15rem; border-radius: 22px; border: 2px solid rgba(255,255,255,.9); background: var(--card); box-shadow: 0 8px 22px rgba(42,57,91,.11); transition: transform .18s ease, box-shadow .18s ease; }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.mode-card strong { font-family: 'Fredoka'; font-size: 1.25rem; }
.mode-card small { color: var(--muted); line-height: 1.35; }
.mode-emoji { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px; background: #fff5d7; font-size: 2rem; }
.mode-picture .mode-emoji { background: #fff0e8; }.mode-shape .mode-emoji { background: #eeeaff; }.mode-color .mode-emoji { background: #e7f8ff; }.mode-number .mode-emoji { background: #e9faef; }

button.primary, button.secondary, button.text-button, .tool-row button, .block-focus-btn { min-height: 48px; border-radius: 14px; border: 0; padding: .7rem 1.05rem; font-weight: 900; }
button.primary { color: white; background: linear-gradient(135deg, #ef654b, var(--coral)); box-shadow: 0 6px 0 #b94431; }
button.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b94431; }
button.secondary { background: white; border: 2px solid #bfc9db; }
button.text-button { background: transparent; color: #245d9b; text-decoration: underline; }
button.wide { width: 100%; }
.icon-btn { display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; padding: 0; border: 2px solid rgba(85,103,138,.22); border-radius: 15px; background: rgba(255,255,255,.9); font-size: 1.3rem; }

.level-screen { max-width: 900px; margin: auto; }
.screen-bar { justify-content: flex-start; }
.screen-bar .icon-btn:last-child { margin-left: auto; }
.theme-shelf { padding: 1rem; border-radius: 18px; background: rgba(255,255,255,.75); margin-bottom: 1rem; }
.theme-shelf h3 { font-size: 1.05rem; margin-bottom: .55rem; }
.theme-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.theme-chip { min-height: 42px; padding: .45rem .75rem; border: 2px solid #d6deea; border-radius: 999px; background: white; font-weight: 800; }
.theme-chip.active { border-color: var(--lav); background: #f1edff; }
.level-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.level-card { display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; align-items: center; min-height: 88px; padding: .8rem 1rem; text-align: left; background: white; border: 2px solid #dfe6f1; border-radius: 18px; box-shadow: 0 5px 15px rgba(42,57,91,.08); }
.level-card strong, .level-card small { display: block; }.level-card strong { font-family: 'Fredoka'; font-size: 1.15rem; }.level-card small { color: var(--muted); margin-top: .18rem; }
.level-card.locked { opacity: .72; background: #eef1f5; }.level-emoji { font-size: 1.75rem; }

.game-screen { padding-bottom: 1rem; }
.game-hud { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .65rem; padding: .45rem .65rem; background: rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 5px 18px rgba(42,57,91,.09); }
.game-hud .eyebrow { margin: 0; }.game-hud strong { text-transform: capitalize; }
.hud-stats { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }.hud-stats span { padding: .35rem .55rem; border-radius: 10px; background: #f4f7fb; font-size: .9rem; }
.feedback { min-height: 1.5em; margin: .5rem 0; text-align: center; font-weight: 900; color: #416176; }.feedback.wrong, .feedback.no-hints { color: #9d3b31; }.feedback.correct { color: #1a7950; }
.play-layout { display: grid; grid-template-columns: minmax(280px, 720px) minmax(220px, 330px); gap: clamp(.75rem, 3vw, 1.5rem); align-items: center; justify-content: center; }
.board-wrap { display: grid; justify-items: center; min-width: 0; }
.sudoku-board { width: min(100%, 720px, calc(100dvh - 190px)); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); background: #27344f; border: clamp(3px, .5vw, 6px) solid #27344f; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 30px rgba(25,40,70,.18); touch-action: manipulation; }
.sudoku-cell { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: clamp(1px, .6vw, 5px); border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; overflow: hidden; transition: background .15s ease, transform .15s ease; }
.sudoku-cell.block-right { border-right: 4px solid #27344f; }.sudoku-cell.block-bottom { border-bottom: 4px solid #27344f; }
.sudoku-cell.given { background: #eef3f9; }.sudoku-cell.same-unit { background: #eef8ff; }.sudoku-cell.same-value { background: #dceeff; }.sudoku-cell.selected { z-index: 2; background: #fff4b9; box-shadow: inset 0 0 0 4px #e18623; }
.sudoku-cell.correct { animation: cell-pop .32s ease; }.sudoku-cell.wrong { animation: cell-wobble .28s ease; background: #ffe5e2; box-shadow: inset 0 0 0 4px #dc594a; }.sudoku-cell.conflict { background: #ffd8d3; }.sudoku-cell.hinted { animation: hint-pulse .8s ease 2; }
.token-visual { display: grid; place-items: center; width: 88%; height: 88%; min-width: 0; min-height: 0; }.token-svg { width: 100%; height: 100%; display: block; }.number-token { display: grid; place-items: center; width: 82%; aspect-ratio: 1; border-radius: 26%; font-family: 'Fredoka'; font-size: clamp(1rem, calc(11vw / var(--size, 4)), 3rem); font-weight: 700; color: #243047; background: #fff; }.sudoku-cell.given .number-token { background: transparent; color: #152238; }
.color-token { position: relative; display: grid; place-items: center; width: 86%; aspect-ratio: 1; border-radius: 50%; background-color: var(--token-color); border: 2px solid rgba(21,34,56,.85); overflow: hidden; }.color-token::before { content: ''; position: absolute; inset: 0; opacity: .32; background: repeating-linear-gradient(45deg, transparent 0 6px, #fff 6px 9px); }.pattern-1::before { background: radial-gradient(#fff 2px, transparent 3px); background-size: 9px 9px; }.pattern-2::before { background: repeating-linear-gradient(90deg, transparent 0 6px, #fff 6px 9px); }.pattern-3::before { background: repeating-linear-gradient(135deg, transparent 0 4px, #fff 4px 7px); }.pattern-4::before { background: radial-gradient(circle at 30% 30%, #fff 0 3px, transparent 4px); background-size: 14px 14px; }.color-token b { position: relative; color: white; text-shadow: 0 1px 3px #000; font-size: clamp(.75rem, 2vw, 1.35rem); }
.notes-grid { display: grid; grid-template-columns: repeat(var(--size), 1fr); width: 100%; height: 100%; align-items: center; }.notes-grid i { font-style: normal; font-size: clamp(.4rem, 1.5vw, .72rem); color: #3c5b87; }

.game-controls { min-width: 0; }.token-tray { display: grid; grid-template-columns: repeat(min(var(--size), 3), minmax(0, 1fr)); gap: .5rem; padding: .7rem; border-radius: 20px; background: rgba(255,255,255,.86); box-shadow: 0 8px 24px rgba(42,57,91,.1); }
.token-choice { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: .15rem; min-height: 74px; padding: .25rem; border: 2px solid #d8e0ed; border-radius: 14px; background: white; touch-action: none; user-select: none; }.token-choice .token-visual { width: 50px; height: 50px; }.token-choice small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .68rem; text-transform: capitalize; }.token-choice.completed { opacity: .35; }
.tool-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; margin-top: .6rem; }.tool-row button { display: flex; justify-content: center; align-items: center; gap: .35rem; background: white; border: 2px solid #d5deeb; }.tool-row button.active { background: #ece7ff; border-color: var(--lav); }.tool-row button:disabled { opacity: .45; }
.block-focus-btn { margin-top: .5rem; background: white; border: 2px solid #cad4e4; }
.drag-ghost { position: fixed; z-index: 5000; left: 0; top: 0; width: 60px; height: 60px; padding: 5px; border-radius: 15px; background: white; box-shadow: var(--shadow); pointer-events: none; will-change: transform; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(20,31,54,.62); backdrop-filter: blur(4px); }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; padding: clamp(1rem, 4vw, 1.6rem); border-radius: 24px; background: white; box-shadow: 0 20px 60px rgba(14,24,43,.35); }.modal h2 { font-family: 'Fredoka'; margin: 0; }.modal-title { margin-top: 0; }
.tutorial-modal { text-align: center; }.tutorial-icon { display: grid; place-items: center; width: 86px; height: 86px; margin: 0 auto 1rem; border-radius: 28px; background: #fff1c5; font-size: 2.7rem; }.dot-progress { display: flex; justify-content: center; gap: .35rem; margin: 1rem; }.dot-progress i { width: 9px; height: 9px; border-radius: 50%; background: #d6dce7; }.dot-progress i.active { width: 25px; border-radius: 99px; background: var(--coral); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 64px; padding: .65rem 0; border-top: 1px solid #e5eaf1; }.setting-row strong, .setting-row small { display: block; }.setting-row small { color: var(--muted); }.setting-row input { width: 24px; height: 24px; }.setting-row select { min-height: 42px; border: 2px solid #cbd5e2; border-radius: 10px; }
.focus-grid { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); border: 4px solid #27344f; }.focus-grid .sudoku-cell { aspect-ratio: 1; }.focus-grid .block-right, .focus-grid .block-bottom { border-width: 1px; }

.complete-screen { min-height: calc(100dvh - 110px); display: grid; place-items: center; }.complete-card { width: min(620px, 100%); padding: clamp(1.2rem, 5vw, 2.4rem); text-align: center; border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }.stars { margin: .75rem 0; color: #efa900; font-size: clamp(2.2rem, 9vw, 4rem); letter-spacing: .08em; }.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .55rem; }.result-grid div { padding: .8rem .45rem; border-radius: 15px; background: #f2f6fb; }.result-grid strong, .result-grid span { display: block; }.result-grid strong { font-family: 'Fredoka'; font-size: 1.35rem; }.result-grid span { color: var(--muted); font-size: .82rem; }.new-best { color: #167347; font-weight: 900; }.unlock-note { padding: .65rem; border-radius: 14px; background: #fff3bf; font-weight: 900; }.complete-actions { display: grid; gap: .6rem; margin-top: 1rem; }.loading-card { margin: 15vh auto; max-width: 400px; padding: 2rem; text-align: center; background: white; border-radius: 20px; box-shadow: var(--shadow); font-weight: 800; }

#particles { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; pointer-events: none; }

body.high-contrast { background: white; }.high-contrast .sudoku-board { border-color: #000; }.high-contrast .sudoku-cell { border-color: #333; }.high-contrast .same-unit { background: #eef; }.high-contrast .selected { background: #fff4a8; box-shadow: inset 0 0 0 4px #000; }.high-contrast .color-token { border-width: 4px; }

@media (max-width: 850px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .play-layout { grid-template-columns: 1fr; }
  .sudoku-board { width: min(94vw, calc(100dvh - 320px), 720px); min-width: min(94vw, 280px); }
  .game-controls { width: min(94vw, 720px); margin: auto; }
  .token-tray { grid-template-columns: repeat(var(--size), minmax(0, 1fr)); gap: .3rem; padding: .45rem; }
  .game-screen.size-9 .token-tray { grid-template-columns: repeat(5, minmax(48px, 1fr)); }
  .token-choice { min-height: 56px; }.token-choice .token-visual { width: min(45px, 8vw); height: min(45px, 8vw); }.token-choice small { display: none; }
  .tool-row { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  #app { padding: .45rem; }.hero-card { grid-template-columns: 1fr; }.hero-badge { display: none; }
  .mode-card { min-height: 145px; padding: .85rem; }.mode-emoji { width: 52px; height: 52px; }
  .level-list { grid-template-columns: 1fr; }.level-card { min-height: 76px; }
  .game-hud { grid-template-columns: auto 1fr auto; }.game-hud > .icon-btn:last-child { grid-column: 3; grid-row: 1; }.hud-stats { grid-column: 1 / -1; justify-content: center; }
  .feedback { margin: .25rem 0; font-size: .9rem; }.sudoku-board { width: min(96vw, calc(100dvh - 315px)); }
  .tool-row button { padding: .5rem .25rem; font-size: .85rem; }.tool-row button span { display: none; }
  .token-choice { border-radius: 9px; padding: 2px; }.token-choice .token-visual { width: min(42px, 8.5vw); height: min(42px, 8.5vw); }
}

@media (max-height: 540px) and (orientation: landscape) {
  .play-layout { grid-template-columns: minmax(260px, 62vh) minmax(250px, 1fr); align-items: start; }
  .sudoku-board { width: min(62vh, 48vw); }.game-controls { width: auto; }.token-tray { grid-template-columns: repeat(3, 1fr); }.game-hud { padding: .25rem .5rem; }.feedback { margin: .15rem; }
}

/* 2026 visual refresh: image-led logic adventure */
.hero-card { position: relative; isolation: isolate; min-height: clamp(350px, 44vw, 510px); display: flex; align-items: center; overflow: hidden; padding: clamp(28px, 5vw, 58px); border-color: rgba(255,255,255,.5); background: #07376c url('../assets/images/sudoku-adventure-banner.webp') center / cover no-repeat; box-shadow: 0 24px 60px rgba(29,50,108,.28); }
.hero-card::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(4,34,96,.97) 0%, rgba(7,55,108,.78) 38%, rgba(7,55,108,.08) 69%, transparent 100%); }
.hero-card::after { content: 'PlayPuzzle.in'; position: absolute; right: 14px; bottom: 12px; padding: 6px 9px; border-radius: 999px; background: rgba(4,34,96,.62); color: rgba(255,255,255,.92); font: 800 .76rem/1 'Nunito', system-ui, sans-serif; letter-spacing: .03em; text-shadow: 0 1px 6px rgba(0,0,0,.5); backdrop-filter: blur(6px); }
.hero-copy { width: min(47%, 510px); color: white; text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.hero-card .eyebrow { display: inline-flex; margin: 0; padding: 7px 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; background: rgba(255,255,255,.14); color: white; backdrop-filter: blur(8px); }
.hero-card h2 { max-width: 11ch; margin: 16px 0 12px; font-size: clamp(2.35rem, 5.3vw, 4.5rem); line-height: .95; }
.hero-card p:last-of-type { max-width: 39ch; margin: 0; color: rgba(255,255,255,.88); font-size: clamp(1rem, 1.8vw, 1.18rem); line-height: 1.5; }
.hero-card .hero-badge { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; transform: none; }
.hero-card .hero-badge span { width: auto; min-width: 60px; aspect-ratio: auto; padding: 8px 12px; border: 0; border-radius: 999px; background: rgba(255,255,255,.94); color: #173f79; box-shadow: 0 8px 20px rgba(0,0,0,.14); text-shadow: none; font-size: .84rem; }
.progress-strip span { box-shadow: 0 8px 22px rgba(42,57,91,.08); }
.mode-card { position: relative; overflow: hidden; border-color: rgba(255,255,255,.95); }
.mode-card::after { content: ''; position: absolute; inset: auto -28px -36px auto; width: 94px; height: 94px; border-radius: 50%; background: rgba(68,169,243,.08); pointer-events: none; }
@media (max-width: 720px) { .hero-card { min-height: 520px; align-items: flex-end; padding: 24px; background-position: 62% center; } .hero-card::before { background: linear-gradient(0deg, rgba(4,34,96,.98) 0%, rgba(4,34,96,.76) 36%, rgba(4,34,96,.08) 70%, transparent 100%); } .hero-copy { width: 100%; } .hero-card h2 { font-size: clamp(2.25rem, 11vw, 3.45rem); } }
@media (max-width: 480px) { .hero-card { min-height: 470px; border-radius: 24px; padding: 20px; } }
