:root {
  --bg: #09101f;
  --bg-deep: #050913;
  --bg-elevated: rgba(14, 24, 46, 0.86);
  --panel: rgba(12, 21, 40, 0.78);
  --panel-strong: rgba(18, 30, 58, 0.94);
  --panel-soft: rgba(16, 26, 51, 0.72);
  --text-main: #eff7ff;
  --text-soft: #93a8c9;
  --text-dim: #6f82a4;
  --ink-dark: #10203d;
  --line: rgba(134, 187, 255, 0.18);
  --line-strong: rgba(111, 208, 255, 0.42);
  --glow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --neon-cyan: #68e7ff;
  --neon-cyan-strong: #22d7ff;
  --neon-pink: #ff4fd8;
  --neon-pink-strong: #ff2bbf;
  --accent-gold: #ffc85a;
  --accent-gold-strong: #ffb01f;
  --success: #63e9b3;
  --danger: #ff6d8e;
  --danger-soft: rgba(255, 109, 142, 0.2);
  --focus-ring: rgba(255, 200, 90, 0.7);
  --cell-background: rgba(255, 255, 255, 0.96);
  --cell-size: 54px;
  --cell-font: clamp(1.1rem, 2.2vw, 1.8rem);
  --note-font: clamp(0.5rem, 1vw, 0.72rem);
  --app-height: 100svh;
  --viewport-width: 100vw;
  --radius: 30px;
  --shell-padding: 16px;
  --shell-gap: 14px;
  --header-height: 70px;
  --footer-height: 32px;
  --menu-top: clamp(18px, 4vh, 42px);
  --menu-chrome-height: calc((var(--shell-padding) * 2) + (var(--shell-gap) * 2) + var(--header-height) + var(--footer-height));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--text-main);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(5, 9, 19, 0.39), rgba(5, 9, 19, 0.68)),
    radial-gradient(circle at top, rgba(46, 89, 174, 0.48), transparent 44%),
    url("assets/neon-shibuya-bg-v1.webp") center/cover fixed;
}

body {
  position: relative;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.scene-backdrop,
.city-haze,
.hero-grid,
.hero-orb {
  position: fixed;
  pointer-events: none;
}

.scene-backdrop {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 8, 16, 0.05), rgba(4, 8, 16, 0.34)),
    radial-gradient(circle at 50% 18%, rgba(83, 210, 255, 0.24), transparent 28%);
  z-index: 0;
}

.city-haze {
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.48;
  z-index: 0;
}

.city-haze-left {
  top: -10vw;
  left: -8vw;
  background: rgba(70, 177, 255, 0.2);
}

.city-haze-right {
  right: -12vw;
  bottom: -14vw;
  background: rgba(255, 64, 202, 0.18);
}

.hero-grid {
  inset: auto 0 0;
  height: 36vh;
  background-image:
    linear-gradient(rgba(84, 221, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 74, 215, 0.14) 1px, transparent 1px);
  background-size: 74px 74px;
  mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.95) 30%);
  opacity: 0.5;
  z-index: 0;
}

.hero-orb {
  width: 24vw;
  height: 24vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.26;
  z-index: 0;
}

.hero-orb-cyan {
  top: 12vh;
  right: 10vw;
  background: var(--neon-cyan);
}

.hero-orb-pink {
  bottom: 24vh;
  left: 12vw;
  background: var(--neon-pink);
}

.app-shell {
  position: relative;
  z-index: 1;
  height: var(--app-height);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(var(--shell-padding), env(safe-area-inset-top)) max(var(--shell-padding), env(safe-area-inset-right)) max(var(--shell-padding), env(safe-area-inset-bottom)) max(var(--shell-padding), env(safe-area-inset-left));
  gap: var(--shell-gap);
  overflow: hidden;
}

.app-main {
  min-height: 0;
  overflow: hidden;
}

.view-playing .app-shell {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

.view-playing .app-main {
  min-height: 0;
  height: 100%;
}

.view-menu .app-main {
  display: grid;
  place-items: center;
  align-content: start;
}

.card,
.card-soft {
  position: relative;
  border: 1px solid rgba(117, 175, 255, 0.18);
  box-shadow: var(--glow);
  backdrop-filter: blur(18px);
}

.card {
  background:
    linear-gradient(180deg, rgba(17, 29, 58, 0.9), rgba(10, 18, 34, 0.88));
}

.card-soft {
  background:
    linear-gradient(180deg, rgba(19, 32, 62, 0.76), rgba(12, 21, 40, 0.68));
}

.card::before,
.card-soft::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(104, 231, 255, 0.12), transparent 36%, rgba(255, 79, 216, 0.12));
  opacity: 0.8;
  pointer-events: none;
}

.site-header,
.site-footer {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

.site-header {
  min-height: 70px;
  display: flex;
  align-items: center;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  border-radius: 14px;
  background: rgba(228, 241, 255, 0.84);
  border: 1px solid rgba(104, 231, 255, 0.2);
  box-shadow: 0 0 22px rgba(104, 231, 255, 0.16);
}

.site-logo img {
  width: min(146px, 32vw);
  height: auto;
  display: block;
  filter:
    drop-shadow(0 0 16px rgba(104, 231, 255, 0.3))
    drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.site-footer {
  min-height: 32px;
  padding: 6px 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--neon-cyan);
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.menu-screen {
  width: min(560px, 100%);
  max-width: 560px;
  height: auto;
  max-height: calc(100% - var(--menu-top));
  margin: 0;
  display: grid;
  grid-template-rows: auto;
  gap: 10px;
  border-radius: 30px;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  justify-self: center;
  align-self: start;
  margin-top: var(--menu-top);
  background: linear-gradient(180deg, rgba(14, 25, 48, 0.74), rgba(11, 20, 39, 0.68));
}

.menu-copy h1,
.game-heading h2,
.section-heading h2,
.section-heading h3,
.modal-card h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu-hero {
  display: block;
}

.menu-copy {
  padding: 0;
  text-align: center;
}

.menu-copy h1 {
  font-size: clamp(2.9rem, 8vw, 4.6rem);
  line-height: 0.92;
  text-shadow:
    0 0 18px rgba(104, 231, 255, 0.22),
    0 0 26px rgba(255, 79, 216, 0.16);
}

.menu-lead {
  max-width: 58ch;
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.55;
}

.hero-tags {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tag {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(104, 231, 255, 0.24);
  background: rgba(10, 19, 36, 0.7);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 79, 216, 0.1);
}

.menu-visual {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  border-radius: 30px;
  padding: 14px;
  min-height: 220px;
}

.visual-frame {
  position: relative;
  min-height: 0;
  border-radius: 26px;
  border: 1px solid rgba(104, 231, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(5, 12, 25, 0.9), rgba(10, 18, 34, 0.7)),
    radial-gradient(circle at top, rgba(255, 79, 216, 0.12), transparent 34%);
  overflow: hidden;
}

.visual-frame::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(104, 231, 255, 0.06),
    0 0 40px rgba(104, 231, 255, 0.12);
}

.visual-grid {
  position: absolute;
  inset: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(7, 16, 32, 0.8), rgba(13, 24, 47, 0.65));
  border: 1px solid rgba(104, 231, 255, 0.16);
  box-shadow:
    inset 0 0 18px rgba(104, 231, 255, 0.08),
    0 0 32px rgba(255, 79, 216, 0.12);
}

.visual-grid span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 14px;
  background: rgba(18, 34, 66, 0.58);
  color: var(--text-main);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1rem, 2vw, 1.7rem);
  text-shadow: 0 0 14px rgba(104, 231, 255, 0.34);
}

.visual-grid span:nth-child(odd) {
  color: var(--neon-cyan);
}

.visual-grid span:nth-child(3n) {
  color: var(--neon-pink);
}

.visual-scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0, rgba(104, 231, 255, 0.1) 48%, transparent 54%);
  animation: scanline 4.4s linear infinite;
}

.visual-copy {
  position: relative;
  z-index: 1;
  color: var(--text-soft);
  line-height: 1.4;
  font-size: 0.92rem;
}

.visual-copy p:last-child {
  margin: 0;
}

.menu-grid {
  display: block;
}

.menu-panel,
.board-panel,
.control-panel {
  border-radius: 30px;
}

.menu-panel,
.board-panel {
  padding: 16px;
}

.menu-panel {
  overflow: hidden;
}

.section-heading,
.game-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.section-heading h2,
.section-heading h3,
.game-heading h2 {
  color: var(--text-main);
}

.menu-panel .section-heading {
  justify-content: center;
  text-align: center;
}

.menu-actions,
.secondary-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.menu-panel .difficulty-grid,
.menu-panel .menu-actions {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.menu-status,
.status-message {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.difficulty-grid,
.action-grid,
.numpad {
  display: grid;
  gap: 10px;
}

.difficulty-grid {
  margin-top: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-grid {
  grid-template-columns: 1fr;
}

.difficulty-button,
.action-button,
.numpad-button,
.ghost-button {
  border: 1px solid rgba(134, 187, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(16, 27, 53, 0.9), rgba(11, 20, 40, 0.88));
  color: var(--text-main);
  border-radius: 18px;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 10px 22px rgba(0, 0, 0, 0.18);
}

.difficulty-button:hover,
.action-button:hover,
.numpad-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: rgba(104, 231, 255, 0.38);
  box-shadow:
    inset 0 0 0 1px rgba(104, 231, 255, 0.12),
    0 0 22px rgba(104, 231, 255, 0.12);
}

.difficulty-button {
  position: relative;
  padding: 11px 10px;
  text-align: left;
}

.difficulty-button strong,
.difficulty-button span {
  display: block;
}

.difficulty-button strong {
  margin-bottom: 4px;
  color: var(--text-main);
}

.difficulty-button span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.difficulty-button-active {
  background:
    linear-gradient(135deg, rgba(255, 79, 216, 0.34), rgba(104, 231, 255, 0.28)),
    linear-gradient(180deg, rgba(18, 33, 64, 0.99), rgba(12, 23, 45, 0.99));
  border-color: rgba(104, 231, 255, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 0 0 2px rgba(104, 231, 255, 0.18),
    0 0 0 1px rgba(104, 231, 255, 0.32),
    0 0 28px rgba(104, 231, 255, 0.2),
    0 0 34px rgba(255, 79, 216, 0.16);
  transform: translateY(-1px) scale(1.01);
}

.difficulty-button-active strong {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(104, 231, 255, 0.28);
}

.difficulty-button-active span {
  color: rgba(239, 247, 255, 0.9);
}

.action-grid {
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-button,
.ghost-button {
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 700;
}

.action-primary {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan-strong));
  color: #07111e;
  border-color: rgba(255, 200, 90, 0.45);
  text-shadow: none;
}

.action-primary:hover {
  color: #07111e;
  box-shadow:
    0 0 24px rgba(104, 231, 255, 0.24),
    0 0 28px rgba(255, 79, 216, 0.18);
}

.action-wide {
  width: 100%;
}

.action-active {
  background: linear-gradient(180deg, rgba(28, 64, 78, 0.96), rgba(19, 47, 55, 0.92));
  border-color: rgba(99, 233, 179, 0.48);
  color: var(--success);
  box-shadow: 0 0 18px rgba(99, 233, 179, 0.14);
}

.action-disabled,
.numpad-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.info-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-soft);
  display: grid;
  gap: 6px;
  line-height: 1.45;
  font-size: 0.94rem;
}

.game-screen {
  max-width: 1320px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  align-items: start;
  overscroll-behavior: contain;
}

.game-layout {
  width: min(1080px, 100%);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 650px) minmax(224px, 286px);
  gap: 18px;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

.board-panel {
  display: grid;
  grid-template-rows: auto auto auto auto;
  min-height: 0;
  padding: 12px;
  align-self: center;
}

.board-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.board-topbar .game-heading {
  min-width: 0;
  justify-content: center;
  text-align: center;
}

.board-topbar .game-heading h2 {
  font-size: clamp(1.05rem, 2.2vw, 1.42rem);
  line-height: 0.95;
}

.game-back-button {
  min-height: 44px;
  padding: 8px 14px;
}

.hud-strip,
.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 24, 45, 0.88);
  border: 1px solid rgba(104, 231, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.badge {
  padding: 7px 11px;
  font-size: 0.8rem;
}

.badge-soft {
  border-color: rgba(255, 79, 216, 0.24);
  color: #ffd3f5;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.board-wrap {
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4px 0 0;
  overflow: hidden;
}

.status-message {
  min-height: 20px;
  margin: 0 0 4px;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.25;
  text-align: center;
}

.status-message-conflict {
  color: #ffd5df;
  font-weight: 700;
}

.status-message-conflict::before {
  content: "⚠ ";
  color: var(--danger);
}

.storage-notice {
  margin: 4px 0;
  color: #ffe4ae;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, var(--cell-size));
  grid-template-rows: repeat(9, var(--cell-size));
  gap: 0;
  padding: 10px;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(238, 248, 255, 0.98), rgba(224, 239, 255, 0.98));
  border: 1px solid rgba(104, 231, 255, 0.24);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 16px 38px rgba(3, 9, 19, 0.36),
    0 0 32px rgba(104, 231, 255, 0.12);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  line-height: 1;
  width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  border: 1px solid rgba(16, 32, 61, 0.14);
  background: var(--cell-background);
  color: var(--ink-dark);
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.cell:hover:not(.cell-given) {
  background: var(--cell-background);
}

.cell:focus-visible,
.difficulty-button:focus-visible,
.action-button:focus-visible,
.numpad-button:focus-visible,
.ghost-button:focus-visible,
.site-logo:focus-visible,
.site-footer a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.cell-strong-right {
  border-right: 2px solid rgba(15, 35, 69, 0.44);
}

.cell-strong-bottom {
  border-bottom: 2px solid rgba(15, 35, 69, 0.44);
}

.cell-given {
  color: #08172e;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}

.cell-value {
  font-size: min(var(--cell-font), calc(var(--cell-size) * 0.7));
  font-weight: 800;
  line-height: 1;
}

.cell-player .cell-value {
  color: #0d56d6;
  font-weight: 700;
  text-shadow:
    0 0 10px rgba(34, 215, 255, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.12);
}

.cell-selected {
  box-shadow: inset 0 0 0 3px var(--neon-cyan-strong);
  z-index: 3;
}

.cell-conflict {
  background: var(--cell-background);
  color: #9f1538;
  box-shadow: inset 0 0 0 3px var(--danger);
  z-index: 2;
}

.cell-hint-flash {
  animation: hintFlash 800ms ease;
}

.notes-grid {
  position: absolute;
  inset: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  align-items: center;
  justify-items: center;
}

.note {
  font-size: min(var(--note-font), calc(var(--cell-size) / 4));
  color: #6e7f9f;
  font-weight: 600;
  opacity: 0.9;
  line-height: 1;
}

.control-panel {
  padding: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-self: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 17, 33, 0.78), rgba(8, 15, 29, 0.82));
}

.control-section {
  background: linear-gradient(180deg, rgba(18, 29, 54, 0.78), rgba(11, 20, 39, 0.72));
  border: 1px solid rgba(134, 187, 255, 0.15);
  border-radius: 20px;
  padding: 10px;
  min-height: 0;
  overflow: hidden;
}

.numpad {
  margin-top: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.numpad-button {
  min-height: 44px;
  min-width: 44px;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  font-weight: 800;
}

.numpad-button-action {
  min-height: 44px;
  padding: 6px 3px;
  font-size: 0.82rem;
}

.numpad-button-active {
  background: linear-gradient(180deg, rgba(36, 67, 118, 0.96), rgba(24, 50, 92, 0.94));
  border-color: rgba(86, 141, 255, 0.72);
  color: #d8e4ff;
  box-shadow: 0 0 18px rgba(86, 141, 255, 0.18);
}

.numpad-button-danger {
  border-color: rgba(255, 109, 142, 0.3);
  color: #ffdbe4;
}

.numpad-button-danger:hover {
  border-color: rgba(255, 109, 142, 0.46);
  box-shadow: 0 0 20px rgba(255, 109, 142, 0.16);
}

.numpad-button-note {
  border-color: rgba(86, 141, 255, 0.34);
  color: #dbe6ff;
}

.numpad-button-note:hover {
  border-color: rgba(86, 141, 255, 0.5);
  box-shadow: 0 0 22px rgba(86, 141, 255, 0.16);
}

.numpad-button-hint {
  border-color: rgba(255, 200, 90, 0.38);
  color: #ffe4ae;
}

.numpad-button-hint:hover {
  border-color: rgba(255, 200, 90, 0.54);
  box-shadow: 0 0 22px rgba(255, 200, 90, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 5, 10, 0.58), rgba(2, 5, 10, 0.8));
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(480px, 100%);
  border-radius: 30px;
  padding: 30px 28px;
  max-height: calc(var(--app-height) - 88px);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(17, 29, 58, 0.96), rgba(9, 18, 35, 0.94));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 32px rgba(104, 231, 255, 0.12);
}

.modal-card .eyebrow {
  color: var(--neon-cyan);
}

.modal-text {
  color: var(--text-soft);
  margin: 12px 0 0;
  line-height: 1.6;
}

.modal-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-actions button {
  min-width: 140px;
  min-height: 48px;
}

.fullscreen-button {
  position: fixed;
  z-index: 25;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  padding: 9px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(104, 231, 255, 0.38);
  border-radius: 14px;
  color: var(--text-main);
  background: rgba(9, 18, 36, 0.88);
  box-shadow: 0 0 22px rgba(104, 231, 255, 0.16);
  backdrop-filter: blur(14px);
}

.fullscreen-button:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.fullscreen-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.fullscreen-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-icon-exit,
.fullscreen-button[aria-pressed="true"] .fullscreen-icon-enter {
  display: none;
}

.fullscreen-button[aria-pressed="true"] .fullscreen-icon-exit {
  display: block;
}

.modal-open:not(.is-fullscreen) .fullscreen-button {
  visibility: hidden;
  pointer-events: none;
}

.view-playing .site-header,
.view-playing .site-footer,
.modal-open .site-header,
.modal-open .site-footer {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.view-playing .site-header,
.view-playing .site-footer,
.modal-open .site-header,
.modal-open .site-footer {
  display: none;
}

.has-fullscreen.view-playing .app-shell {
  padding-top: max(64px, calc(env(safe-area-inset-top) + 56px));
}

.modal-open .app-shell {
  grid-template-rows: minmax(0, 1fr);
}

.view-playing .hero-grid,
.view-playing .hero-orb,
.modal-open .hero-grid,
.modal-open .hero-orb {
  opacity: 0.18;
}

@keyframes hintFlash {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(104, 231, 255, 0);
  }
  30%,
  70% {
    box-shadow: inset 0 0 0 999px rgba(104, 231, 255, 0.18);
  }
}

@keyframes scanline {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(100%);
  }
}

@media (max-width: 1180px) {
  .game-layout {
    width: min(980px, 100%);
    grid-template-columns: minmax(0, 650px) 264px;
  }
}

@media (max-width: 1024px) {
  .game-layout {
    width: min(920px, 100%);
    grid-template-columns: minmax(0, 1fr) 214px;
    gap: 12px;
  }

  .control-panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .game-layout {
    width: min(760px, 100%);
    grid-template-columns: minmax(0, 1fr) 188px;
    gap: 10px;
  }

  .control-panel {
    padding: 6px;
  }

  .control-section {
    padding: 8px;
  }

  .numpad {
    gap: 6px;
  }

  .numpad-button {
    min-height: 44px;
    font-size: 0.96rem;
  }

  .numpad-button-action {
    min-height: 44px;
    font-size: 0.84rem;
  }
}

@media (max-width: 900px) {
  .menu-screen {
    width: min(500px, 100%);
  }
}

@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {
  .game-layout {
    grid-template-columns: minmax(0, 640px) 252px;
  }
}

@media (min-width: 431px) and (max-width: 900px) and (orientation: portrait) {
  .game-screen {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .game-layout {
    width: min(700px, 100%);
    height: auto;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: safe center;
    gap: 10px;
  }

  .board-panel,
  .control-panel {
    width: min(650px, 100%);
    justify-self: center;
  }

  .control-panel,
  .control-section {
    padding: 8px;
  }

  .control-section .eyebrow {
    display: none;
  }

  .control-section h3 {
    font-size: 0.9rem;
  }

  .numpad {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .numpad-button,
  .numpad-button-action {
    min-height: 44px;
    padding: 6px 4px;
    font-size: 0.82rem;
  }
}

@media (min-width: 431px) and (max-width: 640px) and (orientation: landscape) {
  .game-layout {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 8px;
  }

  .control-panel {
    padding: 6px;
  }

  .control-section {
    padding: 7px;
    border-radius: 18px;
  }

  .control-section .eyebrow {
    margin-bottom: 4px;
    font-size: 0.62rem;
  }

  .control-section h3 {
    font-size: 0.86rem;
  }

  .numpad {
    gap: 5px;
  }

  .numpad-button {
    min-height: 44px;
    font-size: 0.9rem;
  }

  .numpad-button-action {
    min-height: 44px;
    font-size: 0.72rem;
  }
}

@media (max-width: 430px) {
  :root {
    --shell-padding: 10px;
    --shell-gap: 10px;
    --header-height: 58px;
    --footer-height: 26px;
    --menu-top: 12px;
  }

  .app-shell {
    padding-left: max(var(--shell-padding), env(safe-area-inset-left));
    padding-right: max(var(--shell-padding), env(safe-area-inset-right));
  }

  .menu-screen,
  .board-panel,
  .control-panel,
  .modal-card {
    border-radius: 24px;
  }

  .menu-screen,
  .board-panel,
  .control-panel {
    padding: 12px;
  }

  .menu-screen {
    width: min(400px, 100%);
    border-radius: 26px;
    padding: 14px;
    margin-top: var(--menu-top);
  }

  .menu-visual {
    display: none;
  }

  .site-logo img {
    width: min(110px, 34vw);
  }

  .site-logo {
    padding: 6px 8px;
    border-radius: 14px;
  }

  .menu-copy h1 {
    font-size: clamp(2.3rem, 13vw, 3.1rem);
  }

  .hud-strip,
  .status-badges {
    flex-direction: row;
    align-items: center;
  }

  .section-heading,
  .game-heading {
    flex-direction: row;
    align-items: flex-start;
  }

  .game-layout {
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
    height: auto;
    min-height: 100%;
    align-content: start;
  }

  .board-panel {
    padding: 10px;
  }

  .board-topbar {
    margin-bottom: 6px;
  }

  .board-topbar .game-heading h2 {
    font-size: 1rem;
  }

  .hud-strip {
    gap: 6px;
  }

  .stat-pill,
  .badge {
    padding: 6px 10px;
  }

  .board-wrap {
    padding-top: 4px;
  }

  .control-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  .control-section {
    padding: 8px;
    border-radius: 18px;
  }

  .control-section .eyebrow {
    margin-bottom: 4px;
    font-size: 0.66rem;
  }

  .control-section h3 {
    font-size: 1rem;
  }

  .action-button,
  .ghost-button {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .difficulty-button {
    padding: 8px;
  }

  .difficulty-button span {
    font-size: 0.7rem;
  }

  .numpad-button {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .numpad-button-action {
    min-height: 44px;
    font-size: 0.86rem;
  }

  .numpad {
    margin-top: 6px;
    gap: 6px;
  }

  .hero-grid,
  .hero-orb {
    opacity: 0.12;
  }
}

@media (max-height: 740px) and (min-width: 700px) {
  :root {
    --menu-top: 0px;
    --shell-padding: 12px;
    --shell-gap: 10px;
  }
  .menu-screen {
    margin-top: 0;
    padding: 12px;
    gap: 6px;
  }

  .menu-copy h1 {
    font-size: 2.7rem;
  }

  .menu-lead {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .menu-panel {
    padding: 8px;
  }

  .menu-panel .section-heading h2 {
    font-size: 1.2rem;
  }

  .difficulty-grid {
    margin-top: 6px;
    gap: 6px;
  }

  .difficulty-button {
    min-height: 44px;
    padding: 6px 8px;
  }

  .menu-status {
    margin-top: 6px;
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .menu-actions {
    margin-top: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .menu-actions #rulesButton {
    grid-column: 1 / -1;
  }

  .menu-actions .action-button,
  .menu-actions .ghost-button {
    min-height: 44px;
    padding: 6px 10px;
  }

  .board-panel {
    padding: 8px;
  }

  .board-topbar {
    margin-bottom: 4px;
  }

  .status-message {
    min-height: 18px;
    margin-bottom: 2px;
    font-size: 0.72rem;
  }

  .sudoku-board {
    padding: 7px;
    border-radius: 24px;
  }
}

@media (max-height: 499px) {
  .app-main,
  .game-screen {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .game-layout {
    min-height: 410px;
    height: auto;
    align-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
