.game-page {
  --game-max-width: 1100px;
  --game-edge: clamp(10px, 2.8vw, 24px);
  --game-gap: clamp(10px, 2vw, 20px);
  --game-panel: rgba(19, 18, 16, .95);
  --game-panel-2: rgba(28, 26, 22, .98);
  --game-outline: rgba(255, 255, 255, .12);
  --accent: #b779ff;
  --accent-strong: #d9b8ff;
  --header-height: clamp(58px, 13vw, 82px);
  --header-icon: clamp(58px, 13vw, 82px);
  --bg-grid-scale: 1;
  --bg-grid-brightness: 1;
  --bg-grid-shift-x: 0px;
  --bg-grid-shift-y: 0px;
  --bg-grid-base: #161616;
  --bg-grid-color: #242424;
  background: #0c0c0b;
  position: relative;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

.game-page[data-ui-mode="light"] {
  --game-panel: rgba(247, 242, 234, .96);
  --game-panel-2: rgba(255, 251, 244, .98);
  --game-outline: rgba(43, 34, 24, .16);
  --text: #231a12;
  --muted: #6f655a;
  --accent-strong: #8a57d4;
  background: #f4ede4;
}

.game-page::before,
.game-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: background-color .42s ease, background .42s ease, filter .42s ease, transform .42s ease;
}

.game-page::before {
  z-index: -2;
  background-color: var(--bg-grid-base);
  background-image:
    linear-gradient(45deg, var(--bg-grid-color) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-grid-color) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-grid-color) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-grid-color) 75%);
  background-size: 72px 72px;
  background-position: 0 0, 0 36px, 36px -36px, -36px 0;
  animation: gameBgDrift 2.6s linear infinite;
  transform: translate3d(var(--bg-grid-shift-x), var(--bg-grid-shift-y), 0) scale(var(--bg-grid-scale));
  filter: brightness(var(--bg-grid-brightness));
  transform-origin: 50% 50%;
  will-change: transform, filter;
}

.game-page::after {
  z-index: -1;
  background:
    radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.78) 100%);
}

.game-page[data-ui-mode="light"]::after {
  background:
    radial-gradient(circle at center, rgba(255,255,255,.04) 0%, rgba(255,255,255,.1) 48%, rgba(126, 94, 63, .18) 100%);
}

.game-shell {
  width: min(var(--game-max-width), 100%);
  height: 100svh;
  min-height: 0;
  padding: var(--game-edge);
  gap: var(--game-gap);
  position: relative;
  overflow: hidden;
}

.game-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, var(--header-icon));
  align-items: stretch;
  gap: 8px;
}

.level-copy {
  min-width: 0;
  min-height: var(--header-height);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--game-outline);
  background:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
    var(--game-panel);
  background-size: 12px 12px;
  box-shadow: 6px 6px 0 rgba(0,0,0,.22);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.game-page[data-ui-mode="light"] .level-copy,
.game-page[data-ui-mode="light"] .game-footer,
.game-page[data-ui-mode="light"] .game-hud .icon-button,
.game-page[data-ui-mode="light"] .hint-button,
.game-page[data-ui-mode="light"] .progress-chip {
  box-shadow: 6px 6px 0 rgba(92, 74, 52, .12);
}

.level-copy .eyebrow {
  margin-bottom: 6px;
  font-size: clamp(.66rem, 1.8vw, .84rem);
  line-height: 1;
}

.level-copy h1 {
  margin: 0;
  font-size: clamp(1rem, 3.2vw, 1.7rem);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  max-width: 100%;
}

.level-title {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-moves {
    flex: 0 0 auto;
    font-size: .9em;
    letter-spacing: 0.25em;
    color: var(--accent-strong);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, .28);
    white-space: nowrap;
}

.hud-actions {
  display: contents;
}

.game-hud .icon-button {
  width: var(--header-icon);
  height: var(--header-height);
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--game-panel-2);
  transition: background .28s ease, border-color .28s ease, box-shadow .28s ease, color .28s ease, transform .16s ease;
}

.game-hud .ui-icon {
  width: clamp(20px, 4vw, 28px);
  height: clamp(20px, 4vw, 28px);
}

.game-stage {
  min-height: 0;
  height: 100%;
  padding: clamp(10px, 2.4vw, 24px);
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.game-stage .board-frame {
  max-width: 100%;
  max-height: 100%;
}

.daily-progress {
  position: absolute;
  top: calc(var(--game-edge) + var(--header-height) + 8px);
  left: var(--game-edge);
  right: var(--game-edge);
  z-index: 12;
  min-height: clamp(42px, 8vw, 54px);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  border: 1px solid var(--game-outline);
  background:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
    var(--game-panel);
  background-size: 12px 12px;
  box-shadow: 6px 6px 0 rgba(0,0,0,.18);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.daily-progress[hidden] {
  display: none;
}

.daily-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-strong);
  font-size: clamp(.66rem, 1.9vw, .86rem);
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.daily-progress-copy strong {
  color: #fff2c2;
  font-size: clamp(.9rem, 2.5vw, 1.14rem);
  text-shadow: 2px 2px 0 rgba(0,0,0,.38);
}

.daily-progress-track {
  height: clamp(8px, 1.8vw, 12px);
  overflow: hidden;
  border: 1px solid rgba(255, 212, 133, .22);
  background: rgba(0, 0, 0, .26);
}

.daily-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #b779ff, #fff2c2);
  transition: width .34s cubic-bezier(.18, 1, .32, 1);
}

.game-page[data-ui-mode="light"] .daily-progress {
  box-shadow: 6px 6px 0 rgba(92, 74, 52, .12);
}

.game-page[data-ui-mode="light"] .daily-progress-copy strong {
  color: #6b4513;
  text-shadow: none;
}

.game-page[data-ui-mode="light"] .daily-progress-track {
  border-color: rgba(150, 102, 36, .22);
  background: rgba(92, 74, 52, .1);
}

.game-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--game-outline);
  background: var(--game-panel);
  box-shadow: 6px 6px 0 rgba(0,0,0,.18);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.progress-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.progress-chip {
  min-width: 0;
  min-height: 62px;
  padding: 8px 10px;
  background: var(--game-panel-2);
  border: 1px solid rgba(255,255,255,.1);
  display: grid;
  align-content: center;
  justify-items: start;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
  justify-items: center;
  transition: background .28s ease, border-color .28s ease, box-shadow .28s ease, color .28s ease;
}

.moves-progress-chip span {
  font-size: clamp(1.45rem, 4.6vw, 2.18rem);
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.moves-progress-chip strong {
  font: inherit;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.moves-progress-chip small {
  display: none;
}

.progress-chip-secondary {
  background: rgba(38, 35, 31, .98);
}

.progress-chip span {
  font-size: 1.45rem;
  line-height: .9;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.progress-chip small {
  margin-top: 5px;
  font-size: .78rem;
  letter-spacing: 0;
  line-height: 1;
  opacity: .8;
}

.timed-morph-chip {
  min-width: 108px;
  background: rgba(66, 38, 94, .96);
  border-color: rgba(199, 144, 255, .22);
  justify-items: center;
  text-align: center;
}

.timed-morph-chip.is-hidden {
  display: none !important;
}

.timed-morph-chip .timed-morph-next {
  margin-top: 4px;
  font-size: .62rem;
  opacity: .78;
}

.loading-state {
  padding: 18px;
  text-align: center;
}

.loading-state p {
  max-width: 18ch;
  line-height: 1.45;
}

.toast {
  width: min(calc(100vw - 24px), 460px);
  bottom: 16px;
  padding: 12px 14px;
  text-align: center;
  font-size: clamp(.72rem, 1.9vw, .82rem);
  transition: background .28s ease, border-color .28s ease, color .28s ease, box-shadow .28s ease;
}

.complete-card {
  width: min(520px, 100%);
  padding: clamp(18px, 4vw, 28px);
  position: relative;
  overflow: hidden;
  border-color: rgba(188, 139, 255, .26);
  background:
    linear-gradient(180deg, rgba(41, 24, 62, .96), rgba(18, 15, 24, .98)),
    var(--game-panel);
  box-shadow:
    10px 10px 0 rgba(0,0,0,.28),
    inset 0 0 0 1px rgba(255,255,255,.03);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.complete-card .eyebrow {
  margin-bottom: 12px;
  color: var(--accent-strong);
}

.complete-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, transparent, rgba(183, 121, 255, .95), rgba(233, 214, 255, .9), rgba(183, 121, 255, .95), transparent);
}

.complete-card h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3.4vw, 1.55rem);
  letter-spacing: .06em;
  color: #fff;
  text-transform: uppercase;
  transition: color .32s ease;
}

.complete-reward {
  margin: 12px 0 0;
  color: var(--accent-strong);
  font-size: clamp(.82rem, 2.4vw, 1rem);
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.hint-card {
  width: min(520px, 100%);
  padding: clamp(18px, 4vw, 28px);
  position: relative;
  overflow: hidden;
  border-color: rgba(188, 139, 255, .26);
  background:
    linear-gradient(180deg, rgba(36, 22, 52, .98), rgba(18, 15, 24, .98)),
    var(--game-panel);
  box-shadow:
    10px 10px 0 rgba(0,0,0,.28),
    inset 0 0 0 1px rgba(255,255,255,.03);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.hint-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, transparent, rgba(183, 121, 255, .95), rgba(233, 214, 255, .9), rgba(183, 121, 255, .95), transparent);
}

.hint-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.hint-icon-shell {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(188, 139, 255, .26);
  background: rgba(34, 21, 49, .92);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.hint-hero-icon {
  width: 34px;
  height: 34px;
  color: var(--accent-strong);
}

.hint-copy h2 {
  margin-bottom: 8px;
  font-size: clamp(1.04rem, 3.1vw, 1.38rem);
  color: #fff;
  transition: color .32s ease;
}

.hint-copy p {
  margin-bottom: 0;
  font-size: clamp(.78rem, 2vw, .92rem);
  line-height: 1.55;
  color: rgba(241, 236, 247, .82);
  transition: color .32s ease;
}

.hint-preview {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(188, 139, 255, .18);
  background: rgba(255,255,255,.03);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.hint-preview span,
.hint-preview strong {
  display: block;
  line-height: 1.2;
}

.hint-preview span {
  color: rgba(240, 232, 255, .68);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: color .32s ease;
}

.hint-preview strong {
  margin-top: 4px;
  color: #fff;
  font-size: .92rem;
  transition: color .32s ease;
}

.hint-preview[hidden] {
  display: none;
}

.hint-button {
  position: relative;
  min-width: 62px;
  min-height: 62px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 0;
  border: 1px solid rgba(188, 139, 255, .24);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(61, 35, 87, .98), rgba(33, 20, 46, .98));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
  transition: background .28s ease, border-color .28s ease, box-shadow .28s ease, color .28s ease, transform .16s ease;
}

.hint-button:hover {
  background: linear-gradient(180deg, rgba(74, 44, 103, .98), rgba(37, 22, 53, .98));
}

.hint-button:active {
  transform: translateY(1px);
}

.hint-button .hint-icon {
  width: 26px;
  height: 26px;
  color: #f6ecff;
}

.game-page[data-ui-mode="light"] .game-hud .icon-button,
.game-page[data-ui-mode="light"] .hint-button {
  color: #2a2118;
  background: linear-gradient(180deg, rgba(255, 250, 243, .98), rgba(237, 228, 216, .98));
}

.game-page[data-ui-mode="light"] .hint-button .hint-icon,
.game-page[data-ui-mode="light"] .settings-button .settings-icon,
.game-page[data-ui-mode="light"] .settings-hero-icon {
  color: #2a2118;
}

.game-page[data-ui-mode="light"] .progress-chip {
  background: rgba(255,255,255,.72);
  border-color: rgba(73, 58, 41, .12);
}

.game-page[data-ui-mode="light"] .progress-chip-secondary {
  background: rgba(240, 232, 221, .96);
}

.game-page[data-ui-mode="light"] .hint-badge {
  background: rgba(255,255,255,.95);
  color: #2a2118;
  border-color: rgba(73, 58, 41, .14);
}

.game-page[data-ui-mode="light"] .toast {
  background: rgba(255, 247, 240, .96);
  color: #8f211c;
  border-color: rgba(239,109,98,.36);
}

.settings-button .settings-icon {
  width: 23px;
  height: 23px;
  color: #f6ecff;
}

.hint-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10, 8, 13, .94);
  color: #fff;
  font-size: .74rem;
  line-height: 1;
  box-shadow: 2px 2px 0 rgba(0,0,0,.2);
}

.hint-button.is-empty .hint-badge {
  color: #ffcfcb;
  border-color: rgba(239, 109, 98, .28);
}

.hint-card.is-ad .hint-icon-shell {
  animation: hintAdPulse 1s steps(2, end) infinite;
}

.hint-card.is-empty .hint-preview {
  border-color: rgba(239, 109, 98, .18);
}

.game-page[data-ui-mode="light"] .complete-card,
.game-page[data-ui-mode="light"] .hint-card {
  border-color: rgba(138, 87, 212, .22);
  background:
    linear-gradient(180deg, rgba(255, 249, 241, .98), rgba(243, 234, 223, .98)),
    var(--game-panel);
  box-shadow:
    10px 10px 0 rgba(92, 74, 52, .12),
    inset 0 0 0 1px rgba(255,255,255,.65);
}

.game-page[data-ui-mode="light"] .complete-card h2,
.game-page[data-ui-mode="light"] .hint-copy h2,
.game-page[data-ui-mode="light"] .hint-copy p,
.game-page[data-ui-mode="light"] .hint-preview strong,
.game-page[data-ui-mode="light"] .hint-preview span {
  color: #231a12;
}

.game-page[data-ui-mode="light"] .hint-icon-shell {
  border-color: rgba(138, 87, 212, .18);
  background: rgba(247, 239, 230, .96);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.62);
}

.game-page[data-ui-mode="light"] .hint-preview {
  border-color: rgba(73, 58, 41, .12);
  background: rgba(255,255,255,.58);
}

.game-page[data-ui-mode="light"] .modal-actions .button.secondary {
  background: rgba(232, 223, 212, .98);
  color: #231a12;
  border-color: rgba(73, 58, 41, .12);
}

.game-page[data-ui-mode="light"] .modal-actions .button.primary {
  color: #fffaf6;
}

.game-page[data-ui-mode="light"] .modal {
  background: rgba(239, 232, 222, .78);
}

.settings-card {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100svh - 24px);
  padding: clamp(16px, 3.4vw, 24px);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(188, 139, 255, .22);
  background:
    linear-gradient(180deg, rgba(27, 21, 38, .98), rgba(17, 14, 24, .985)),
    rgba(18, 15, 24, .98);
  box-shadow:
    8px 8px 0 rgba(0,0,0,.24),
    inset 0 0 0 1px rgba(255,255,255,.025);
  transition: background .32s ease, border-color .32s ease, box-shadow .32s ease, color .32s ease;
}

.settings-card::-webkit-scrollbar {
  width: 6px;
}

.settings-card::-webkit-scrollbar-track {
  background: rgba(255,255,255,.035);
}

.settings-card::-webkit-scrollbar-thumb {
  background: rgba(183, 121, 255, .72);
}

.settings-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, transparent, rgba(183, 121, 255, .95), rgba(233, 214, 255, .9), rgba(183, 121, 255, .95), transparent);
}

.settings-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.settings-icon-shell {
  width: 58px;
  height: 58px;
  border-width: 1px;
  background: rgba(255,255,255,.035);
}

.settings-hero-icon {
  width: 26px;
  height: 26px;
  color: var(--accent-strong);
}

.settings-copy h2 {
  margin-bottom: 4px;
  font-size: clamp(.98rem, 2.6vw, 1.22rem);
  color: #fff;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-copy p {
  margin-bottom: 0;
  font-size: clamp(.72rem, 1.8vw, .84rem);
  line-height: 1.45;
  color: rgba(241, 236, 247, .68);
}

.settings-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-section {
  padding: 12px 12px 13px;
  border: 1px solid rgba(188, 139, 255, .12);
  background: rgba(255,255,255,.025);
  min-width: 0;
}

.settings-section-head {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.settings-section-head span {
  color: rgba(241, 236, 247, .72);
}

.settings-section-head strong {
  color: var(--accent-strong);
  font-size: .82rem;
}

.slider-shell {
  position: relative;
  display: block;
  width: 100%;
  height: 34px;
  padding: 0;
}

.slider-rail {
  position: absolute;
  inset: 50% 0 auto;
  height: 10px;
  transform: translateY(-50%);
  border: 1px solid rgba(188, 139, 255, .16);
  background:
    linear-gradient(90deg, rgba(183, 121, 255, .92) 0 var(--slider-fill, 100%), rgba(255,255,255,.08) var(--slider-fill, 100%) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
  pointer-events: none;
}

.pixel-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.setting-toggle {
  min-height: 42px;
  padding: 0 12px;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid rgba(188, 139, 255, .16);
  background: rgba(255,255,255,.03);
  color: rgba(241, 236, 247, .8);
  cursor: pointer;
  transition: background .22s ease, border-color .22s ease, color .22s ease, transform .14s ease, box-shadow .22s ease;
}

.pixel-slider::-webkit-slider-runnable-track {
  height: 34px;
  background: transparent;
}

.pixel-slider::-moz-range-track {
  height: 34px;
  background: transparent;
  border: 0;
}

.pixel-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 34px;
  border: 1px solid rgba(233, 214, 255, .42);
  background:
    linear-gradient(180deg, rgba(242, 230, 255, .98), rgba(183, 121, 255, .95));
  box-shadow:
    0 0 0 1px rgba(52, 28, 74, .35),
    2px 2px 0 rgba(0,0,0,.18);
}

.pixel-slider::-moz-range-thumb {
  width: 20px;
  height: 34px;
  border-radius: 0;
  border: 1px solid rgba(233, 214, 255, .42);
  background:
    linear-gradient(180deg, rgba(242, 230, 255, .98), rgba(183, 121, 255, .95));
  box-shadow:
    0 0 0 1px rgba(52, 28, 74, .35),
    2px 2px 0 rgba(0,0,0,.18);
}

.pixel-slider:focus-visible {
  outline: none;
}

.slider-shell:focus-within .slider-rail {
  border-color: rgba(233, 214, 255, .34);
}

.settings-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-toggle-row-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setting-toggle.is-active {
  border-color: rgba(233, 214, 255, .32);
  background: linear-gradient(180deg, rgba(115, 70, 161, .98), rgba(61, 35, 87, .98));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.setting-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(233, 214, 255, .28);
}

.settings-section.settings-section-wide {
  grid-column: 1 / -1;
}

.game-page[data-ui-mode="light"] .settings-card {
  border-color: rgba(138, 87, 212, .22);
  background:
    linear-gradient(180deg, rgba(255, 249, 241, .98), rgba(243, 234, 223, .98)),
    var(--game-panel);
  box-shadow:
    10px 10px 0 rgba(92, 74, 52, .12),
    inset 0 0 0 1px rgba(255,255,255,.65);
}

.game-page[data-ui-mode="light"] .settings-copy h2,
.game-page[data-ui-mode="light"] .settings-copy p,
.game-page[data-ui-mode="light"] .settings-section-head span {
  color: #231a12;
}

.game-page[data-ui-mode="light"] .settings-section {
  border-color: rgba(73, 58, 41, .12);
  background: rgba(255,255,255,.58);
}

.game-page[data-ui-mode="light"] .slider-rail {
  border-color: rgba(73, 58, 41, .12);
  background:
    linear-gradient(90deg, rgba(138, 87, 212, .94) 0 var(--slider-fill, 100%), rgba(111, 94, 76, .12) var(--slider-fill, 100%) 100%);
}

.game-page[data-ui-mode="light"] .pixel-slider::-webkit-slider-thumb {
  border-color: rgba(138, 87, 212, .28);
  background:
    linear-gradient(180deg, rgba(255, 251, 246, .98), rgba(209, 185, 242, .98));
  box-shadow:
    0 0 0 1px rgba(94, 74, 52, .2),
    2px 2px 0 rgba(92, 74, 52, .12);
}

.game-page[data-ui-mode="light"] .pixel-slider::-moz-range-thumb {
  border-color: rgba(138, 87, 212, .28);
  background:
    linear-gradient(180deg, rgba(255, 251, 246, .98), rgba(209, 185, 242, .98));
  box-shadow:
    0 0 0 1px rgba(94, 74, 52, .2),
    2px 2px 0 rgba(92, 74, 52, .12);
}

.game-page[data-ui-mode="light"] .setting-toggle {
  border-color: rgba(73, 58, 41, .12);
  background: rgba(255,255,255,.45);
  color: #46372c;
}

.game-page[data-ui-mode="light"] .setting-toggle.is-active {
  background: linear-gradient(180deg, rgba(167, 121, 236, .98), rgba(126, 85, 198, .98));
  color: #fffaf6;
  border-color: rgba(138, 87, 212, .22);
}

.tile.hint-focus::before {
  box-shadow:
    inset 0 0 0 3px rgba(126, 58, 191, .95),
    inset 0 0 0 6px rgba(245, 235, 255, .16),
    0 0 0 1px rgba(0,0,0,.2);
}

.modal-actions {
  flex-wrap: wrap;
}

.modal-actions .button {
  min-width: min(100%, 180px);
}

@media (max-width: 640px) {
  .game-page {
    --header-height: 56px;
    --header-icon: 56px;
  }

  .game-shell {
    height: 100svh;
    min-height: 0;
  }

  .level-copy {
    padding: 8px 10px;
  }

  .level-copy h1 {
    font-size: clamp(.92rem, 4vw, 1.15rem);
  }

  .game-stage {
    min-height: 0;
    height: 100%;
    padding: 10px;
  }

  .game-footer {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: stretch;
    gap: 8px;
    padding: 9px;
  }

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

  .progress-chip,
  .moves-chip {
    min-height: 60px;
    padding: 8px;
  }

  .progress-chip span {
    font-size: 1.5rem;
  }

  .moves-progress-chip span {
    font-size: clamp(1.28rem, 5.4vw, 1.76rem);
  }

  .progress-chip small,
  .moves-chip small {
    font-size: .78rem;
  }

  .moves-chip {
    min-width: 70px;
    justify-items: center;
  }

  .timed-morph-chip {
    min-width: 86px;
  }

  .moves-chip span,
  .moves-chip small {
    text-align: center;
  }

  .modal {
    padding: 12px;
    align-items: center;
  }

  .modal-actions .button {
    width: 100%;
  }

  .complete-hero {
    grid-template-columns: 1fr;
  }

  .hint-hero {
    grid-template-columns: 1fr;
  }

  .hint-icon-shell {
    width: 72px;
    height: 72px;
  }

  .hint-button {
    min-width: 56px;
    min-height: 56px;
  }

  .hint-button .hint-icon,
  .settings-button .settings-icon {
    width: 22px;
    height: 22px;
  }

  .settings-hero {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 10px;
  }

  .settings-icon-shell {
    width: 48px;
    height: 48px;
  }

  .settings-card {
    width: min(100%, calc(100vw - 18px));
    max-height: calc(100svh - 18px);
    padding: 14px;
  }

  .settings-card .eyebrow {
    margin-bottom: 8px;
  }

  .settings-copy h2 {
    margin-bottom: 2px;
    font-size: .96rem;
  }

  .settings-copy p {
    font-size: .68rem;
    line-height: 1.3;
  }

  .settings-stack {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-section {
    padding: 9px;
  }

  .settings-section-head {
    margin-bottom: 7px;
    font-size: .62rem;
  }

  .settings-section-head strong {
    font-size: .72rem;
  }

  .slider-shell,
  .pixel-slider,
  .pixel-slider::-webkit-slider-runnable-track,
  .pixel-slider::-moz-range-track {
    height: 28px;
  }

  .pixel-slider::-webkit-slider-thumb,
  .pixel-slider::-moz-range-thumb {
    width: 18px;
    height: 28px;
  }

  .setting-toggle {
    min-height: 34px;
    padding: 0 8px;
    font-size: .64rem;
    letter-spacing: .08em;
  }

  .settings-toggle-row {
    gap: 6px;
  }

  .settings-toggle-row-wide {
    grid-template-columns: 1fr;
  }

  .settings-card .modal-actions {
    margin-top: 12px;
  }
}

@media (max-width: 420px) {
  .game-page {
    --header-height: 52px;
    --header-icon: 52px;
  }

  .game-hud {
    gap: 6px;
  }

  .level-copy {
    padding: 8px;
  }

  .level-copy .eyebrow {
    font-size: .62rem;
  }

  .game-hud .ui-icon {
    width: 18px;
    height: 18px;
  }

  .hint-button .hint-icon,
  .settings-button .settings-icon {
    width: 20px;
    height: 20px;
  }

  .game-footer {
    padding: 8px;
  }

  .settings-card {
    width: min(100%, calc(100vw - 12px));
    max-height: calc(100svh - 12px);
    padding: 10px;
  }

  .settings-hero {
    gap: 8px;
    margin-bottom: 8px;
  }

  .settings-icon-shell {
    width: 40px;
    height: 40px;
  }

  .settings-hero-icon {
    width: 20px;
    height: 20px;
  }

  .settings-copy p {
    display: none;
  }

  .settings-section {
    padding: 8px;
  }

  .settings-stack {
    gap: 6px;
  }

  .progress-metrics {
    gap: 6px;
  }

  .progress-chip,
  .moves-chip {
    min-height: 58px;
    padding: 7px;
  }

  .progress-chip span {
    font-size: 1.38rem;
  }

  .hint-chip span {
    font-size: .94rem;
  }

  .level-copy h1 {
    gap: 6px;
  }

  .level-moves {
    font-size: .64em;
  }
}

@keyframes gameBgDrift {
  from { background-position: 0 0, 0 36px, 36px -36px, -36px 0; }
  to { background-position: 72px 72px, 72px 108px, 108px 36px, 36px 72px; }
}

@keyframes hintAdPulse {
  0%, 100% {
    background: rgba(34, 21, 49, .92);
    border-color: rgba(188, 139, 255, .26);
  }
  50% {
    background: rgba(70, 36, 96, .98);
    border-color: rgba(233, 214, 255, .34);
  }
}
