:root {
  color-scheme: dark;
  --bg: #0c1118;
  --surface: #151b24;
  --surface-2: #1b2330;
  --surface-3: #202a37;
  --panel: rgba(21, 27, 36, 0.96);
  --panel-strong: #1b2330;
  --line: rgba(190, 203, 220, 0.18);
  --line-strong: rgba(190, 203, 220, 0.32);
  --text: #f4f7fb;
  --muted: #a2adba;
  --muted-strong: #c0cad6;
  --blue: #58b8e8;
  --orange: #dca458;
  --purple: #a58ce5;
  --green: #63d49d;
  --danger: #e56f7e;
  --focus: #8bd4ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.26);
  --shadow-2: 0 12px 28px rgba(0, 0, 0, 0.22);
  --shadow-blue: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  --shadow-orange: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  --shadow-purple: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  --shadow-green: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  --radius: 8px;
  --radius-sm: 6px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --section-header-height: 84px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  --guide-body-size: 1rem;
  --guide-heading-size: 1.02rem;
  --guide-intro-size: 1.02rem;
  --guide-line-height: 1.45;
  --guide-intro-line-height: 1.35;
  --guide-formula-size: 1rem;
  --section-title-size: 1.45rem;
  --section-title-size-compact: 1rem;
  --menu-title-size: 1.45rem;
  --menu-heading-size: 1.24rem;
  --menu-large-size: 1.38rem;
  --menu-control-size: 1.08rem;
  --menu-body-size: 1rem;
  --menu-small-size: 0.88rem;
  --menu-xsmall-size: 0.78rem;
}

body.guide-size-medium {
  --guide-body-size: 1.24rem;
  --guide-heading-size: 1.2rem;
  --guide-intro-size: 1.28rem;
  --guide-line-height: 1.56;
  --guide-intro-line-height: 1.46;
  --guide-formula-size: 1.18rem;
  --section-title-size: 1.58rem;
  --section-title-size-compact: 1.08rem;
  --menu-title-size: 1.58rem;
  --menu-heading-size: 1.36rem;
  --menu-large-size: 1.52rem;
  --menu-control-size: 1.18rem;
  --menu-body-size: 1.1rem;
  --menu-small-size: 0.96rem;
  --menu-xsmall-size: 0.84rem;
}

body.guide-size-large {
  --guide-body-size: 1.52rem;
  --guide-heading-size: 1.4rem;
  --guide-intro-size: 1.58rem;
  --guide-line-height: 1.62;
  --guide-intro-line-height: 1.5;
  --guide-formula-size: 1.34rem;
  --section-title-size: 1.72rem;
  --section-title-size-compact: 1.16rem;
  --menu-title-size: 1.72rem;
  --menu-heading-size: 1.5rem;
  --menu-large-size: 1.7rem;
  --menu-control-size: 1.3rem;
  --menu-body-size: 1.2rem;
  --menu-small-size: 1.04rem;
  --menu-xsmall-size: 0.9rem;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  -webkit-user-select: none;
  user-select: none;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: visible;
  background:
    linear-gradient(125deg, rgba(69, 194, 244, 0.09), transparent 32%),
    linear-gradient(235deg, rgba(255, 180, 90, 0.075), transparent 34%),
    linear-gradient(160deg, #0b0d13 0%, #111722 48%, #171018 100%);
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.72;
  background-image:
    radial-gradient(circle at center, rgba(95, 225, 170, 0.16) 0, rgba(95, 225, 170, 0.16) 1px, transparent 1.6px),
    linear-gradient(rgba(229, 236, 245, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 236, 245, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0, transparent 47%, rgba(69, 194, 244, 0.1) 49%, transparent 51%, transparent 100%);
  background-size: 42px 42px, 42px 42px, 42px 42px, 240px 240px;
  animation: gridCurrent 24s linear infinite;
}

.ambient-grid::before,
.ambient-grid::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
}

.ambient-grid::before {
  background:
    linear-gradient(90deg, transparent 0, transparent 42%, rgba(69, 194, 244, 0.15) 48%, rgba(95, 225, 170, 0.16) 50%, rgba(69, 194, 244, 0.1) 52%, transparent 58%, transparent 100%),
    linear-gradient(0deg, transparent 0, transparent 46%, rgba(255, 180, 90, 0.09) 50%, transparent 54%, transparent 100%);
  mix-blend-mode: screen;
  animation: gridSweep 12s ease-in-out infinite;
}

.ambient-grid::after {
  background-image:
    linear-gradient(45deg, transparent 0, transparent 48%, rgba(255, 248, 239, 0.08) 49%, transparent 50%, transparent 100%),
    linear-gradient(-45deg, transparent 0, transparent 49%, rgba(95, 225, 170, 0.08) 50%, transparent 51%, transparent 100%);
  background-size: 180px 180px, 220px 220px;
  opacity: 0.65;
  animation: gridPhase 18s linear infinite;
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100svh;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: calc(22px + var(--safe-top)) 18px calc(24px + var(--safe-bottom));
}

.screen.is-active {
  display: block;
}

.screen-main {
  display: none;
  align-content: center;
  gap: 32px;
  height: 100svh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.screen-main.is-active {
  display: grid;
}

.brand-panel {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding-top: min(5vh, 44px);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(5, 27px);
  grid-auto-rows: 27px;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    rgba(17, 22, 31, 0.82);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28), 0 0 34px rgba(69, 194, 244, 0.08);
}

.brand-mark span {
  border-radius: 8px;
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 10px rgba(255, 248, 239, 0.12);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, filter 180ms ease;
}

.brand-mark .splash-state-0 {
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
  border-color: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 10px rgba(255, 248, 239, 0.12);
}

.brand-mark .splash-state-1 {
  background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(31, 95, 133, 0.94));
  border-color: rgba(162, 230, 255, 0.74);
  box-shadow: 0 0 17px rgba(69, 194, 244, 0.34);
}

.brand-mark .splash-state-2 {
  background: linear-gradient(145deg, rgba(255, 180, 90, 0.98), rgba(140, 76, 42, 0.94));
  border-color: rgba(255, 217, 161, 0.74);
  box-shadow: 0 0 17px rgba(255, 180, 90, 0.32);
}

.brand-mark .splash-state-3 {
  background: linear-gradient(145deg, rgba(181, 140, 255, 0.98), rgba(78, 54, 137, 0.92));
  border-color: rgba(218, 199, 255, 0.74);
  box-shadow: 0 0 17px rgba(181, 140, 255, 0.32);
}

.brand-mark .is-splash-pulse {
  animation: splashTilePulse 360ms ease-out;
}

.brand-mark .is-splash-tap {
  outline: 2px solid rgba(255, 248, 239, 0.9);
  outline-offset: 2px;
}

.kicker {
  margin: 0;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 3.25rem;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 820;
  text-shadow: 0 0 26px rgba(69, 194, 244, 0.12);
}

h2 {
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 760;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  letter-spacing: 0;
}

.menu-stack {
  display: grid;
  gap: 12px;
  width: min(100%, 420px);
  margin: 0 auto;
}

.primary-action,
.menu-action,
.tool-button,
.icon-button,
.chip,
.daily-card {
  min-height: 48px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  touch-action: manipulation;
}

.primary-action {
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  border: 1px solid rgba(95, 225, 170, 0.55);
  background: linear-gradient(135deg, rgba(95, 225, 170, 0.96), rgba(69, 194, 244, 0.92));
  color: #07110f;
  font-weight: 840;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), 0 0 22px rgba(95, 225, 170, 0.18);
}

.menu-action,
.tool-button,
.icon-button,
.chip,
.daily-card {
  background: rgba(21, 27, 38, 0.86);
  border: 1px solid var(--line);
  color: var(--text);
}

.menu-action {
  padding: 0 18px;
  font-size: var(--menu-control-size);
  font-weight: 720;
}

.primary-action:active,
.menu-action:active,
.tool-button:active,
.icon-button:active,
.chip:active,
.daily-card:active {
  transform: translateY(1px) scale(0.99);
}

.primary-action:hover {
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24), 0 0 28px rgba(95, 225, 170, 0.24);
}

.primary-action:focus-visible,
.menu-action:focus-visible,
.tool-button:focus-visible,
.icon-button:focus-visible,
.chip:focus-visible,
.daily-card:focus-visible,
.guide-size-button:focus-visible,
.level-node:not([disabled]):focus-visible,
.tile:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(69, 194, 244, 0.45);
  outline-offset: 2px;
}

.full-width {
  width: 100%;
}

.screen-header,
.game-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.game-header {
  grid-template-columns: auto 1fr auto;
}

.sticky-screen-header,
#screen-howto .guide-header,
#screen-math .guide-header {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: calc(-24px - var(--safe-top)) -18px 18px;
  min-height: calc(var(--section-header-height) + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 18px 8px;
  border-bottom: 1px solid rgba(229, 236, 245, 0.14);
  background:
    linear-gradient(180deg, #0b0d13, #0e131b 72%, #0e131b),
    linear-gradient(125deg, rgba(69, 194, 244, 0.1), transparent 42%),
    linear-gradient(235deg, rgba(95, 225, 170, 0.075), transparent 38%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.section-header {
  position: relative;
  grid-template-columns: 44px clamp(46px, 8vw, 54px) minmax(0, 1fr) auto;
  gap: 8px;
  align-content: center;
  margin-bottom: 18px;
}

.section-header-icon {
  display: block;
  width: clamp(46px, 8vw, 54px);
  height: clamp(46px, 8vw, 54px);
  object-fit: contain;
  opacity: 0.94;
  pointer-events: none;
}

.section-title-block {
  min-width: 0;
}

.screen-header > div > .kicker {
  display: none;
}

.screen-header h2 {
  margin: 0;
  min-width: 0;
}

.section-header h2 {
  overflow: hidden;
  font-size: var(--section-title-size);
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-size-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  justify-self: end;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 13, 19, 0.48);
}

.section-header .guide-size-control {
  align-self: end;
  flex: 0 0 auto;
  margin-bottom: 0;
  opacity: 0.68;
  transform: translateY(15px) scale(0.82);
  transform-origin: right bottom;
}

.section-header .guide-size-control:hover,
.section-header .guide-size-control:focus-within {
  opacity: 1;
}

.guide-size-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.guide-size-button::before {
  content: "A";
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-weight: 780;
  line-height: 1;
  transform: translateY(-1px);
}

.guide-size-button::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 5px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.4;
}

.guide-size-button.is-selected {
  border-color: rgba(95, 225, 170, 0.44);
  background: rgba(69, 194, 244, 0.14);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 18px rgba(69, 194, 244, 0.08);
}

.guide-size-button.guide-size-small::before {
  font-size: 0.86rem;
}

.guide-size-button.guide-size-medium::before {
  font-size: 1.08rem;
}

.guide-size-button.guide-size-large::before {
  font-size: 1.42rem;
}

.screen-game {
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: calc(12px + var(--safe-bottom));
}

.screen-game .game-header {
  gap: 12px;
  margin-bottom: 12px;
}

.screen-game .icon-button {
  min-width: 48px;
  min-height: 44px;
}

.game-title-block {
  min-width: 0;
}

.screen-game .game-title-block .kicker {
  font-size: 0.9rem;
  line-height: 1;
}

.game-title-block h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-game .game-title-block h2 {
  font-size: 1.58rem;
  line-height: 1.05;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 720;
}

.icon-button.icon-only {
  padding: 0;
}

.settings-mark,
.back-mark,
.chevron-mark {
  width: 22px;
  height: 22px;
}

.settings-mark path,
.back-mark path,
.chevron-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chapter-list {
  display: grid;
  gap: 20px;
  padding-bottom: 28px;
}

.chapter {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.chapter h3 {
  margin-bottom: 14px;
}

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

.level-node {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-height: 74px;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(25, 31, 43, 0.9);
  color: var(--text);
  cursor: pointer;
}

.level-node:not([disabled]):hover,
.campaign-group-tile:not([disabled]):hover,
.menu-action:hover,
.tool-button:hover,
.icon-button:hover,
.chip:hover,
.daily-card:hover {
  border-color: var(--line-strong);
  background: rgba(31, 39, 54, 0.94);
}

.level-node[disabled] {
  cursor: not-allowed;
  opacity: 0.46;
}

.level-number {
  font-weight: 900;
  font-size: var(--menu-heading-size);
}

.level-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 16px;
  color: var(--orange);
}

.level-stars .star-icon {
  width: 13px;
  height: 13px;
}

.zero-star-icon {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 180, 90, 0.34);
  border-radius: 999px;
  color: rgba(255, 180, 90, 0.9);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
}

.level-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  color: var(--green);
}

.level-hint-eye {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  color: var(--danger);
  filter: drop-shadow(0 0 8px rgba(255, 111, 130, 0.38));
}

.campaign-list {
  display: grid;
  gap: 22px;
  padding-bottom: 28px;
}

.campaign-map-section,
.campaign-group-detail {
  display: grid;
  gap: 14px;
}

.campaign-map-heading,
.campaign-group-detail-heading {
  display: grid;
  gap: 4px;
}

.campaign-map-heading p,
.campaign-group-detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: var(--menu-small-size);
  line-height: 1.35;
}

.campaign-map-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.campaign-group-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  min-width: 0;
  aspect-ratio: 1;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(25, 31, 43, 0.92);
  color: var(--text);
  cursor: pointer;
}

.campaign-group-tile.is-selected {
  border-color: rgba(139, 212, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(139, 212, 255, 0.2), 0 12px 26px rgba(0, 0, 0, 0.2);
}

.campaign-group-tile.is-open {
  box-shadow: inset 0 0 0 1px rgba(99, 212, 157, 0.28);
}

.campaign-group-tile.is-unlocked {
  border-color: rgba(244, 247, 251, 0.86);
}

.campaign-group-tile.is-unlocked.is-selected {
  border-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(139, 212, 255, 0.28), 0 12px 26px rgba(0, 0, 0, 0.2);
}

.campaign-group-tile[disabled] {
  cursor: not-allowed;
  opacity: 0.50;
  background: rgba(21, 27, 36, 0.56);
}

.campaign-group-number {
  align-self: start;
  justify-self: start;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(190, 203, 220, 0.22);
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: var(--menu-xsmall-size);
  font-weight: 900;
  line-height: 1;
}

.campaign-group-mini-grid {
  align-self: center;
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: min(100%, 58px);
  aspect-ratio: 1;
}

.campaign-mini-level {
  min-width: 0;
  border: 1px solid rgba(190, 203, 220, 0.15);
  border-radius: 3px;
  background: rgba(244, 247, 251, 0.08);
}

.campaign-mini-level.stars-1 {
  background: rgba(88, 184, 232, 0.58);
  border-color: rgba(139, 212, 255, 0.36);
}

.campaign-mini-level.stars-2 {
  background: rgba(220, 164, 88, 0.66);
  border-color: rgba(248, 205, 137, 0.42);
}

.campaign-mini-level.stars-3 {
  background: rgba(99, 212, 157, 0.72);
  border-color: rgba(151, 238, 194, 0.46);
}

.campaign-mini-level.is-hinted {
  box-shadow: inset 0 0 0 1px rgba(229, 111, 126, 0.72);
}

.campaign-group-progress {
  align-self: end;
  justify-self: stretch;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  min-height: 18px;
  color: var(--muted);
  font-size: var(--menu-xsmall-size);
  line-height: 1;
}

.campaign-group-progress strong {
  color: var(--text);
  font-size: var(--menu-small-size);
}

.campaign-group-lock {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: rgba(210, 218, 230, 0.52);
}

.campaign-group-lock .lock-mark {
  width: 18px;
  height: 18px;
}

.campaign-group-lock .lock-shackle,
.campaign-group-lock .lock-key {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.campaign-group-lock .lock-body {
  fill: currentColor;
  opacity: 0.72;
}

.campaign-level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.check-icon {
  width: 17px;
  height: 17px;
}

.check-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-icon {
  width: 18px;
  height: 18px;
}

.eye-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-icon circle {
  fill: currentColor;
}

.modal-stars {
  color: var(--orange);
  font-weight: 900;
  letter-spacing: 0;
  min-height: 1.25rem;
}

.daily-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.daily-list {
  display: grid;
  gap: 22px;
  padding-bottom: 28px;
}

.daily-section {
  display: grid;
  gap: 10px;
}

.daily-section h3 {
  margin: 0;
  color: var(--text);
  font-size: var(--menu-body-size);
  font-weight: 860;
}

.daily-challenge-list {
  display: grid;
  gap: 10px;
}

.daily-leaderboard-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  padding-top: 0;
}

.daily-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(92px, auto);
  align-items: center;
  width: 100%;
  min-height: 78px;
  gap: 14px;
  padding: 14px 16px;
  overflow: hidden;
  text-align: left;
}

.daily-card.is-complete {
  border-color: rgba(95, 225, 170, 0.34);
  background: rgba(22, 32, 39, 0.98);
}

.daily-card-top {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.daily-tier-label {
  display: block;
  font-size: var(--menu-large-size);
  line-height: 1.15;
  color: var(--blue);
  font-weight: 840;
}

.daily-card-easy .daily-tier-label {
  color: var(--green);
}

.daily-card-medium .daily-tier-label {
  color: var(--blue);
}

.daily-card-hard .daily-tier-label {
  color: var(--orange);
}

.daily-tier-grid {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 4px;
  border: 1px solid rgba(229, 236, 245, 0.16);
  border-radius: var(--radius);
  background: rgba(7, 10, 14, 0.24);
  color: var(--blue);
}

.daily-tier-grid-small {
  width: 40px;
  height: 40px;
  padding: 3px;
}

.daily-card-easy .daily-tier-grid {
  color: var(--green);
}

.daily-card-hard .daily-tier-grid {
  color: var(--orange);
}

.daily-leaderboard-easy .daily-tier-grid {
  color: var(--green);
}

.daily-leaderboard-hard .daily-tier-grid {
  color: var(--orange);
}

.daily-leaderboard-global .daily-tier-grid {
  color: var(--muted-strong);
}

.daily-tier-grid-inner {
  display: grid;
  width: 100%;
  height: 100%;
  gap: 2px;
}

.daily-grid-size-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.daily-grid-size-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.daily-grid-size-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.daily-grid-cell {
  border-radius: 2px;
  background: rgba(244, 247, 251, 0.88);
}

.daily-grid-cell-a {
  background: currentColor;
}

.daily-grid-cell-b {
  background: var(--blue);
}

.daily-card-meta {
  display: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.32;
}

.daily-card-status {
  display: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.daily-card-record {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 0;
  max-width: 132px;
  text-align: right;
  color: var(--text);
  font-size: var(--menu-small-size);
  font-weight: 760;
}

.daily-card-record span {
  color: var(--muted);
}

.daily-card-record strong {
  font-size: var(--menu-body-size);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.daily-card-record.is-empty strong {
  color: var(--muted);
  font-size: var(--menu-small-size);
  font-weight: 800;
}

.daily-leaderboard-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  align-items: center;
  justify-items: stretch;
  gap: 8px;
  min-width: 0;
  min-height: 76px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
}

.daily-leaderboard-global {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-self: center;
  justify-items: stretch;
  width: min(72%, 300px);
  min-height: 82px;
  margin-top: 24px;
  padding: 12px 16px;
  gap: 12px;
  text-align: left;
}

.daily-leaderboard-icon {
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  align-self: center;
  width: 48px;
  height: 58px;
  color: var(--orange);
}

.daily-crown-icon {
  width: 20px;
  height: 16px;
  margin-bottom: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.daily-leaderboard-global .daily-leaderboard-icon {
  width: 62px;
  height: 70px;
}

.daily-leaderboard-global .daily-tier-grid-small {
  width: 50px;
  height: 50px;
  padding: 4px;
}

.daily-leaderboard-global .daily-crown-icon {
  width: 24px;
  height: 18px;
}

.daily-leaderboard-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-leaderboard-text strong {
  color: var(--text);
  font-size: var(--menu-small-size);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.daily-leaderboard-global .daily-leaderboard-text strong {
  font-size: var(--menu-heading-size);
}

.daily-leaderboard-text span {
  color: var(--muted);
  font-size: var(--menu-xsmall-size);
  line-height: 1.2;
}

.setup-panel,
.settings-list {
  display: grid;
  gap: 18px;
}

.setup-group,
.settings-list,
.advanced-note {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chip {
  padding: 0 10px;
  color: var(--muted);
  font-size: var(--menu-control-size);
  font-weight: 760;
}

#screen-freeplay .setup-group h3 {
  font-size: var(--menu-heading-size);
}

#screen-freeplay .chip {
  font-size: var(--menu-control-size);
}

#screen-freeplay .custom-size label,
#screen-freeplay .toggle-row {
  font-size: var(--menu-body-size);
}

.chip.is-selected {
  border-color: rgba(69, 194, 244, 0.72);
  color: var(--text);
  background: rgba(48, 82, 104, 0.66);
  box-shadow: inset 0 0 16px rgba(69, 194, 244, 0.14), 0 0 14px rgba(69, 194, 244, 0.08);
}

.custom-size {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.custom-size label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 750;
}

.custom-size input,
.select-field {
  min-height: 48px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(25, 31, 43, 0.96);
  color: var(--text);
  padding: 0 12px;
}

.playground-live-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.playground-toolbelt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 8px;
}

.playground-tool-button {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(25, 31, 43, 0.82);
  color: var(--muted);
  cursor: pointer;
}

.playground-tool-button.is-selected {
  border-color: rgba(69, 194, 244, 0.72);
  background: rgba(42, 91, 115, 0.82);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 18px rgba(69, 194, 244, 0.12);
}

.playground-tool-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.playground-swatch {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 6px 12px rgba(0, 0, 0, 0.22);
}

.playground-swatch.state-0 {
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
}

.playground-swatch.state-1 {
  background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(28, 91, 132, 0.92));
}

.playground-swatch.state-2 {
  background: linear-gradient(145deg, rgba(255, 180, 90, 0.98), rgba(144, 76, 37, 0.92));
}

.playground-swatch.state-3 {
  background: linear-gradient(145deg, rgba(181, 140, 255, 0.98), rgba(78, 54, 137, 0.92));
}

.playground-swatch.state-4 {
  background: linear-gradient(145deg, rgba(95, 225, 170, 0.98), rgba(36, 112, 88, 0.92));
}

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

.playground-foldout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(22, 27, 38, 0.78);
}

.playground-foldout summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.playground-foldout summary::-webkit-details-marker {
  display: none;
}

.playground-foldout summary span {
  font-size: var(--menu-body-size);
  font-weight: 820;
}

.playground-foldout summary strong {
  color: var(--text);
  font-size: var(--menu-small-size);
  font-weight: 860;
}

.playground-foldout[open] {
  background: rgba(25, 31, 43, 0.88);
}

.playground-foldout[open] summary {
  border-bottom: 1px solid rgba(229, 236, 245, 0.1);
}

.playground-foldout > .chip-row,
.playground-foldout > .custom-size,
.playground-code-row {
  padding: 10px;
}

.playground-size-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.playground-board-wrap {
  min-height: auto;
  padding: 4px 0 10px;
}

.playground-editor-board {
  width: min(94vw, 560px, calc(62svh * var(--board-ratio-number, 1)));
  max-height: min(62svh, 620px);
  margin: 0 auto;
}

.playground-editor-board .tile.locked {
  cursor: pointer;
}

.playground-editor-board .tile::after {
  opacity: 0.92 !important;
}

.playground-hole {
  width: 100%;
  border: 0;
  cursor: pointer;
}

.playground-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: stretch;
}

.playground-code-input {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: var(--menu-small-size);
}

.playground-seed-status {
  min-height: 22px;
  margin: 4px 10px 10px;
  text-align: left;
}

.playground-actions {
  display: grid;
  grid-template-columns: minmax(0, 220px);
  justify-content: center;
  gap: 10px;
  padding-bottom: calc(28px + var(--safe-bottom));
}

@media (max-width: 620px) {
  .playground-foldouts,
  .playground-code-row,
  .playground-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .section-header {
    grid-template-columns: 40px 46px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .section-header-icon {
    width: 46px;
    height: 46px;
  }

  .section-header h2 {
    font-size: var(--section-title-size-compact);
  }
}

.toggle-list,
.settings-list {
  display: grid;
  gap: 10px;
}

.toggle-row,
.setting-select-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(25, 31, 43, 0.74);
  color: var(--text);
  font-size: var(--menu-body-size);
  font-weight: 720;
}

.setting-select-row .select-field {
  min-width: min(46vw, 190px);
}

.toggle-row input {
  width: 48px;
  height: 28px;
  accent-color: var(--green);
}

.settings-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(25, 31, 43, 0.74);
  color: var(--text);
  font-size: var(--menu-body-size);
  font-weight: 720;
  text-align: left;
  cursor: pointer;
}

.settings-button:hover {
  border-color: var(--line-strong);
  background: rgba(31, 39, 54, 0.94);
}

.settings-button:focus-visible {
  outline: 3px solid rgba(69, 194, 244, 0.45);
  outline-offset: 2px;
}

.settings-button .chevron-mark {
  color: var(--muted);
}

#screen-about {
  padding-bottom: calc(104px + var(--safe-bottom));
}

.about-panel {
  display: grid;
  gap: 12px;
  padding-bottom: 28px;
}

.github-credit,
.about-version-card,
.about-changelog-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.github-credit {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(calc(100% - 36px), 420px);
  min-height: 54px;
  padding: 0 18px;
  transform: translateX(-50%);
  color: var(--text);
  font-size: var(--menu-body-size);
  text-decoration: none;
  font-weight: 820;
}

.github-credit:hover {
  border-color: var(--line-strong);
  background: rgba(31, 39, 54, 0.94);
}

.github-logo {
  width: 24px;
  height: 24px;
  color: var(--text);
}

.github-logo path {
  fill: currentColor;
}

.github-credit strong,
.about-version-card strong {
  display: block;
}

.about-changelog {
  color: var(--muted);
}

.about-version-card,
.about-changelog-card {
  padding: 16px;
}

.about-version-card {
  display: grid;
  place-items: center start;
  min-height: 74px;
}

.about-version-card strong {
  color: var(--text);
  font-size: var(--menu-title-size);
  line-height: 1.12;
}

.about-changelog-card h3 {
  margin-bottom: 12px;
}

.about-changelog {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.1rem;
  font-size: var(--menu-body-size);
  line-height: 1.45;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.status-strip > div {
  display: grid;
  align-content: center;
  min-height: 66px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(22, 27, 38, 0.8);
}

.status-strip > div > span {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
  line-height: 1;
  text-transform: uppercase;
}

.status-strip > div > strong {
  display: block;
  margin-top: 5px;
  font-size: 1.72rem;
  line-height: 1;
}

.star-ranking-card {
  align-content: center;
}

.star-ranking {
  display: grid;
  gap: 1px;
  width: 100%;
}

.star-ranking-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.star-icons {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

.star-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
}

.star-icon path {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0.9;
  stroke-linejoin: round;
}

.star-icon.is-filled {
  color: var(--orange);
  filter: drop-shadow(0 0 5px rgba(255, 180, 90, 0.26));
}

.star-icon.is-empty {
  color: rgba(255, 180, 90, 0.20);
}

.star-icon.is-empty path {
  fill: rgba(255, 180, 90, 0.08);
  stroke: rgba(255, 180, 90, 0.38);
  stroke-width: 1.35;
}

.star-ranking-row.is-highlighted {
  border-radius: 5px;
  background: rgba(255, 180, 90, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 180, 90, 0.18);
}

.star-ranking-row.is-highlighted em {
  color: var(--text);
}

.star-ranking-row em {
  color: var(--text);
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
}

.star-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.star-breakdown span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 13, 19, 0.58);
}

.star-breakdown span.is-highlighted {
  border-color: rgba(255, 180, 90, 0.36);
  background: rgba(255, 180, 90, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 180, 90, 0.08);
}

.star-breakdown .star-icons {
  gap: 2px;
}

.star-breakdown .star-icon {
  width: 12px;
  height: 12px;
}

.star-breakdown strong {
  color: var(--orange);
  font-size: 0.68rem;
  font-weight: 880;
  line-height: 1;
  text-transform: uppercase;
}

.star-breakdown em {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 820;
  line-height: 1.15;
}

.pattern-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-height: 60px;
  margin-bottom: 10px;
}

.pattern-card,
.personal-best-card {
  min-width: 0;
  min-height: 60px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(22, 27, 38, 0.8);
}

.pattern-card {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.pattern-card-copy {
  min-width: 0;
}

.pattern-heading {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.pattern-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 760;
  line-height: 1;
  text-transform: uppercase;
}

.pattern-strip .pattern-info-button {
  display: inline-grid;
  place-content: center;
  place-items: center;
  position: relative;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 1px solid rgba(229, 236, 245, 0.52);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0;
  text-transform: none;
}

.pattern-strip .pattern-info-button::before,
.pattern-strip .pattern-info-button::after {
  content: "";
  display: block;
  background: currentColor;
}

.pattern-strip .pattern-info-button::before {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 2px;
  height: 7px;
  border-radius: 999px;
  transform: translateX(-50%);
}

.pattern-strip .pattern-info-button::after {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  transform: translateX(-50%);
}

.pattern-card:hover .pattern-info-button {
  border-color: rgba(95, 225, 170, 0.72);
  color: var(--text);
}

.pattern-card:focus-visible {
  outline: 3px solid rgba(95, 225, 170, 0.36);
  outline-offset: 2px;
}

.pattern-strip strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-size: 1.36rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personal-best-card strong {
  color: var(--green);
  font-size: 1.42rem;
}

.personal-best-card {
  display: grid;
  align-content: center;
}

.personal-best-card span {
  font-size: 0.84rem;
  white-space: nowrap;
}

.pattern-mini {
  display: grid;
  width: 48px;
  height: 48px;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(229, 236, 245, 0.48);
  border-radius: 7px;
  background: #05070b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.pattern-dot {
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(7, 10, 14, 0.16);
  border-radius: 2px;
  background: linear-gradient(145deg, #fffdf7, #e7eef5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.pattern-dot.is-active {
  border-color: rgba(41, 174, 118, 0.92);
  box-shadow: inset 0 0 0 1px rgba(95, 225, 170, 0.68), 0 0 8px rgba(95, 225, 170, 0.36);
}

.pattern-dot.is-center {
  border-width: 2px;
  box-shadow: inset 0 0 0 1px rgba(95, 225, 170, 0.76), 0 0 10px rgba(95, 225, 170, 0.42);
}

.pattern-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.pattern-legend span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 4px;
  border: 1px solid rgba(229, 236, 245, 0.14);
  border-radius: 5px;
  background: rgba(7, 10, 14, 0.34);
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.1;
  text-transform: none;
}

.pattern-legend b {
  color: var(--text);
  font-size: 0.6rem;
}

.tool-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.tool-button {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 1.24rem;
  font-weight: 840;
}

.tool-button:disabled {
  opacity: 0.42;
}

.icon-tool {
  padding: 0;
}

.tool-icon {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hint-tool {
  border-color: rgba(255, 111, 130, 0.34);
  background:
    linear-gradient(145deg, rgba(255, 111, 130, 0.13), rgba(255, 111, 130, 0.04)),
    rgba(30, 20, 28, 0.86);
  color: var(--danger);
  box-shadow: 0 0 18px rgba(255, 111, 130, 0.08);
}

.hint-tool .tool-icon {
  width: 30px;
  height: 30px;
}

.hint-tool .eye-icon circle {
  fill: currentColor;
  stroke-width: 0;
}

.reset-tool {
  color: var(--text);
  font-size: 1.32rem;
  font-weight: 900;
}

.board-wrap {
  display: grid;
  place-items: center;
  min-height: 52svh;
  padding: 4px 0 4px;
}

.board {
  display: grid;
  width: min(94vw, 560px, calc(68svh * var(--board-ratio-number, 1)));
  max-height: min(68svh, 620px);
  aspect-ratio: var(--board-ratio, 1);
  gap: 7px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(69, 194, 244, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(255, 180, 90, 0.06), transparent 42%),
    rgba(10, 13, 19, 0.82);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.32), 0 0 32px rgba(69, 194, 244, 0.08);
}

.tile,
.hole {
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 7px;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  border: 1px solid rgba(238, 240, 235, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 820;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.74);
  transition: opacity 160ms ease, transform 160ms ease, filter 160ms ease;
}

.tile::after {
  content: attr(data-number);
  position: relative;
  z-index: 2;
  opacity: 0.92;
  font-size: 1rem;
}

body.hide-numbers .tile::after {
  opacity: 0;
}

.tile.solution::after {
  content: attr(data-solution);
  color: #111411;
  opacity: 0.92;
}

.tile.state-0 {
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
  border-color: rgba(255, 255, 255, 0.8);
  color: #111822;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 248, 239, 0.16);
}

.tile.state-1 {
  background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(28, 91, 132, 0.92));
  box-shadow: var(--shadow-blue);
}

.tile.state-2 {
  background: linear-gradient(145deg, rgba(255, 180, 90, 0.98), rgba(144, 76, 37, 0.92));
  box-shadow: var(--shadow-orange);
}

.tile.state-3 {
  background: linear-gradient(145deg, rgba(181, 140, 255, 0.98), rgba(78, 54, 137, 0.92));
  box-shadow: var(--shadow-purple);
}

.tile.state-4 {
  background: linear-gradient(145deg, rgba(95, 225, 170, 0.98), rgba(36, 112, 88, 0.92));
  box-shadow: var(--shadow-green);
}

.tile.state-1::before,
.tile.state-2::before,
.tile.state-3::before,
.tile.state-4::before {
  opacity: 0.34;
  transform: scale(1);
  background: rgba(255, 255, 255, 0.38);
  filter: blur(8px);
}

.tile:not(.locked):not(.state-0):hover {
  filter: brightness(1.08);
}

.tile.locked {
  cursor: not-allowed;
  border-color: rgba(238, 240, 235, 0.28);
}

.tile.locked .lock-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid rgba(238, 240, 235, 0.22);
  border-radius: 7px;
  background: rgba(7, 10, 14, 0.58);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}

.tile.locked .lock-mark {
  width: 14px;
  height: 14px;
  overflow: visible;
}

.tile.locked .lock-shackle,
.tile.locked .lock-key {
  fill: none;
  stroke: rgba(255, 248, 239, 0.95);
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile.locked .lock-body {
  fill: rgba(255, 248, 239, 0.94);
  stroke: rgba(255, 248, 239, 0.94);
  stroke-width: 1.8;
}

.tile.locked .lock-key {
  stroke: rgba(7, 10, 14, 0.72);
}

.tile .pattern-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid rgba(255, 248, 239, 0.28);
  border-radius: 6px;
  background: rgba(7, 10, 14, 0.62);
  color: #fff8ef;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tile.preview {
  z-index: 1;
  border-width: 4px;
  border-color: rgba(95, 225, 170, 1);
  box-shadow: inset 0 0 0 4px rgba(95, 225, 170, 0.62), 0 0 24px rgba(95, 225, 170, 0.32);
}

.tile.preview::before {
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: rgba(2, 7, 12, 0.34);
  filter: none;
  opacity: 1;
  transform: none;
}

.tile.hint {
  border-color: rgba(255, 180, 90, 0.92);
  box-shadow: inset 0 0 0 2px rgba(255, 180, 90, 0.34), 0 0 18px rgba(255, 180, 90, 0.18);
}

.tile.preview.hint {
  z-index: 2;
  border-color: rgba(255, 180, 90, 1);
  box-shadow: inset 0 0 0 4px rgba(255, 180, 90, 0.64), 0 0 26px rgba(255, 180, 90, 0.3);
}

.tile.hint-affected {
  border-width: 3px;
  border-color: rgba(180, 106, 111, 0.7);
  box-shadow: inset 0 0 0 2px rgba(180, 106, 111, 0.36), 0 0 16px rgba(180, 106, 111, 0.16);
}

.tile.hint-suggested {
  z-index: 2;
  border-width: 3px;
  border-color: rgba(210, 91, 100, 0.98);
  box-shadow: inset 0 0 0 3px rgba(210, 91, 100, 0.62), 0 0 24px rgba(210, 91, 100, 0.28);
}

.tile.hint-changed {
  z-index: 2;
  border-width: 3px;
  border-color: rgba(210, 91, 100, 0.98);
  box-shadow: inset 0 0 0 3px rgba(210, 91, 100, 0.58), 0 0 24px rgba(210, 91, 100, 0.26);
}

.tile.pulsed {
  animation: pulseTile 260ms ease-out;
}

.hole {
  border: 1px dashed rgba(229, 236, 245, 0.12);
  background: rgba(0, 0, 0, 0.62);
}

.hint-line {
  min-height: 22px;
  margin: 6px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.game-title-block h2,
.status-strip strong {
  text-shadow: 0 0 18px rgba(69, 194, 244, 0.1);
}

.howto-grid {
  display: grid;
  gap: 14px;
}

.math-intro {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(95, 225, 170, 0.08), transparent 46%),
    linear-gradient(315deg, rgba(69, 194, 244, 0.07), transparent 42%),
    rgba(12, 17, 25, 0.82);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.math-intro p {
  margin: 0;
  color: var(--text);
  font-size: var(--guide-intro-size);
  font-weight: 650;
  line-height: var(--guide-intro-line-height);
}

.math-intro .math-lead {
  font-weight: 820;
  line-height: 1.22;
}

#screen-math .math-intro {
  align-items: center;
}

#screen-math .math-intro-copy {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.math-pulse-demo {
  --demo-cycle: 2400ms;
  display: grid;
  grid-template-columns: repeat(4, 24px);
  grid-auto-rows: 24px;
  gap: 5px;
  justify-self: center;
  width: max-content;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    rgba(17, 22, 31, 0.82);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24), 0 0 34px rgba(69, 194, 244, 0.08);
}

.math-pulse-demo span {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 10px rgba(255, 248, 239, 0.12);
  transform-origin: center;
}

.math-pulse-demo .demo-pulse {
  animation: mathPulseTile var(--demo-cycle) ease-in-out infinite;
}

.pattern-info-demo .demo-pulse::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid rgba(95, 225, 170, 0.96);
  border-radius: 11px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: patternInfoPatternBorder var(--demo-cycle) ease-in-out infinite;
}

.math-pulse-demo .demo-tap::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(255, 248, 239, 0.9);
  border-radius: 11px;
  opacity: 0;
  pointer-events: none;
  animation: mathPulseTap var(--demo-cycle) ease-in-out infinite;
}

#screen-howto .math-intro,
#screen-howto .equation-panel,
#screen-howto .math-grid.small article {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

#screen-howto .math-intro > div:last-child {
  display: grid;
  gap: 8px;
}

.howto-grid article {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
}

.math-grid {
  display: grid;
  gap: 14px;
}

.math-grid.small {
  margin-top: 14px;
}

.math-grid.small article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
}

.guide-list {
  display: grid;
  gap: 10px;
}

.guide-list p {
  margin: 0;
  color: var(--muted);
  font-size: var(--guide-body-size);
  line-height: var(--guide-line-height);
}

.guide-list strong {
  color: var(--text);
}

.guide-bullets {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: var(--guide-body-size);
  line-height: var(--guide-line-height);
}

.guide-bullets-spaced {
  gap: 10px;
}

.guide-bullets strong {
  color: var(--text);
}

.guide-term {
  font-weight: 900;
}

.guide-term-blue,
.guide-bullets strong.guide-term-blue {
  color: var(--blue);
}

.guide-term-green,
.guide-bullets strong.guide-term-green {
  color: var(--green);
}

.guide-term-orange,
.guide-bullets strong.guide-term-orange {
  color: var(--orange);
}

.guide-term-purple,
.guide-bullets strong.guide-term-purple {
  color: var(--purple);
}

.howto-grid h3,
.math-grid h3,
.equation-panel h3 {
  margin-bottom: 4px;
  font-size: var(--guide-heading-size);
}

.howto-grid p,
.math-grid p,
.equation-panel p,
.advanced-note p,
.symbol-list dd {
  font-size: var(--guide-body-size);
  line-height: var(--guide-line-height);
}

.howto-grid p,
.math-grid p,
.equation-panel p,
.advanced-note p {
  margin: 0;
  color: var(--muted);
  font-size: var(--guide-body-size);
}

.formula-card {
  min-width: 0;
  margin-top: 10px;
  padding: 10px;
  font-size: var(--guide-formula-size);
  overflow-x: auto;
  border: 1px solid rgba(95, 225, 170, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(95, 225, 170, 0.055), transparent 52%),
    rgba(7, 10, 14, 0.42);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-formula {
  margin-top: 0;
  border-color: rgba(69, 194, 244, 0.28);
  background:
    linear-gradient(135deg, rgba(69, 194, 244, 0.08), transparent 48%),
    rgba(7, 10, 14, 0.48);
}

.formula-card mjx-container {
  margin: 0 !important;
  min-width: max-content;
}

.formula-card mjx-container[jax="SVG"] {
  color: var(--text);
}

.equation-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(69, 194, 244, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(69, 194, 244, 0.075), transparent 48%),
    linear-gradient(315deg, rgba(255, 180, 90, 0.055), transparent 42%),
    rgba(12, 17, 25, 0.86);
}

.equation-stack {
  margin-top: 0;
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(3, 24px);
  grid-auto-rows: 24px;
  gap: 5px;
}

.mini-board span {
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: linear-gradient(145deg, #fffdf5, #dfe8f0);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 8px rgba(255, 248, 239, 0.12);
  color: #07110f;
  font-size: 0.74rem;
  font-weight: 920;
}

.mini-board .lit-blue {
  background: var(--blue);
  box-shadow: var(--shadow-blue);
}

.mini-board .lit-orange {
  background: var(--orange);
  box-shadow: var(--shadow-orange);
}

.mini-board .lit-purple {
  background: var(--purple);
  box-shadow: var(--shadow-purple);
}

.mini-board .lit-green {
  background: var(--green);
  box-shadow: var(--shadow-green);
}

.mini-board .preview {
  border-width: 3px;
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(95, 225, 170, 0.58), inset 0 0 0 999px rgba(2, 7, 12, 0.2), 0 0 12px rgba(95, 225, 170, 0.26);
}

.mini-board .locked {
  border-color: rgba(238, 240, 235, 0.3);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035));
}

.mini-board .is-gap {
  border-color: rgba(229, 236, 245, 0.18);
  border-style: dashed;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: none;
}

.mini-board .hinted {
  border-width: 3px;
  border-color: var(--danger);
  box-shadow: inset 0 0 0 2px rgba(255, 111, 130, 0.38), 0 0 12px rgba(255, 111, 130, 0.26);
}

.mini-board .numbered {
  color: #07110f;
}

.advanced-note {
  margin-top: 14px;
  color: var(--muted);
}

.advanced-note summary {
  color: var(--text);
  cursor: pointer;
  font-size: var(--guide-body-size);
  font-weight: 760;
}

.symbol-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.symbol-list div {
  display: grid;
  grid-template-columns: minmax(58px, auto) 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(229, 236, 245, 0.1);
}

.symbol-list dt {
  color: var(--green);
  font-size: var(--guide-heading-size);
  font-weight: 900;
}

.symbol-list dd {
  margin: 0;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
}

.modal[hidden] {
  display: none;
}

.modal-sheet {
  width: min(100%, 460px);
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(69, 194, 244, 0.055), transparent 42%),
    rgba(22, 26, 35, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48), 0 0 34px rgba(69, 194, 244, 0.09);
}

.modal-stars {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.modal-star-icons {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  width: max-content;
}

.modal-star-icons .star-icon {
  width: 34px;
  height: 34px;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.result-list div {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 13, 19, 0.76);
}

.result-list dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  text-transform: uppercase;
}

.result-list dd {
  margin: 4px 0 0;
  font-size: 1.25rem;
  font-weight: 950;
}

.modal-star-breakdown {
  margin-bottom: 16px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.pattern-info-modal {
  place-items: center;
}

.pattern-info-sheet {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(100%, 460px);
  padding-top: 58px;
}

.modal-back-button {
  position: absolute;
  left: 14px;
  top: 14px;
  min-width: 42px;
  min-height: 38px;
}

.pattern-info-sheet h2,
.pattern-info-sheet p {
  margin: 0;
}

.pattern-info-sheet p:not(.kicker) {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.52;
}

.pattern-info-demo {
  justify-self: center;
  margin: 2px 0 4px;
}

/* Restrained product design system */
.app-shell {
  background: var(--bg);
}

.ambient-grid {
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(190, 203, 220, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 203, 220, 0.10) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: none;
}

.ambient-grid::before,
.ambient-grid::after {
  display: none;
}

.screen {
  width: min(100%, 720px);
  padding: calc(24px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
}

.screen-main {
  width: min(100%, 920px);
  gap: 28px;
}

.screen-game {
  width: min(100%, 740px);
}

.brand-panel {
  gap: 12px;
  padding-top: 0;
}

.brand-mark,
.math-pulse-demo,
.chapter,
.daily-card,
.setup-group,
.settings-list,
.advanced-note,
.math-intro,
.howto-grid article,
.math-grid.small article,
.equation-panel,
.modal-sheet {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.brand-mark,
.math-pulse-demo {
  padding: 9px;
  box-shadow: var(--shadow-2);
}

.brand-mark span,
.brand-mark .splash-state-0,
.math-pulse-demo span {
  border-radius: var(--radius-sm);
  border-color: rgba(255, 255, 255, 0.54);
  background: #eef2f6;
  box-shadow: inset 0 -1px 0 rgba(12, 17, 24, 0.14);
}

.brand-mark .splash-state-1,
.tile.state-1,
.mini-board .lit-blue {
  background: linear-gradient(180deg, #65c5ef, #348ec4);
  border-color: rgba(139, 212, 255, 0.46);
  box-shadow: var(--shadow-blue);
}

.brand-mark .splash-state-2,
.tile.state-2,
.mini-board .lit-orange {
  background: linear-gradient(180deg, #e7b76f, #b67531);
  border-color: rgba(248, 205, 137, 0.48);
  box-shadow: var(--shadow-orange);
}

.brand-mark .splash-state-3,
.tile.state-3,
.mini-board .lit-purple {
  background: linear-gradient(180deg, #b7a2ec, #7459bd);
  border-color: rgba(210, 195, 255, 0.48);
  box-shadow: var(--shadow-purple);
}

.brand-mark .is-splash-tap {
  outline-color: rgba(244, 247, 251, 0.78);
}

.kicker {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

h1 {
  font-size: 2.7rem;
  line-height: 1.03;
  font-weight: 820;
  text-shadow: none;
}

h2 {
  font-size: var(--menu-title-size);
  line-height: 1.16;
}

h3 {
  font-size: var(--menu-small-size);
  line-height: 1.24;
}

.primary-action,
.menu-action,
.tool-button,
.icon-button,
.chip,
.daily-card,
.guide-size-button,
.campaign-group-tile,
.level-node {
  border-radius: var(--radius);
  box-shadow: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease, filter 120ms ease;
}

.menu-action,
.tool-button,
.icon-button,
.chip,
.daily-card {
  background: var(--surface);
  border-color: var(--line);
}

.section-header > .icon-button.icon-only {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: rgba(210, 218, 230, 0.64);
}

.section-header > .icon-button.icon-only:hover,
.section-header > .icon-button.icon-only:focus-visible {
  border-color: rgba(190, 203, 220, 0.14);
  background: rgba(31, 39, 54, 0.34);
  color: var(--text);
}

.section-header > .icon-button.icon-only .back-mark {
  width: 22px;
  height: 22px;
}

.section-header > .icon-button.icon-only .back-mark path {
  stroke-width: 2.15;
}

.menu-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 0 16px;
  text-align: left;
  font-size: var(--menu-control-size);
  font-weight: 780;
}

.screen-main .menu-action > span {
  min-width: 0;
}

.menu-action::after {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  opacity: 0.54;
  transform: rotate(45deg);
}

.screen-main .menu-action::after {
  content: none;
}

.screen-main .menu-icon {
  display: block;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  object-fit: contain;
  opacity: 0.9;
  pointer-events: none;
}

.primary-action {
  min-height: 52px;
  border-color: rgba(99, 212, 157, 0.58);
  background: var(--green);
  color: #07130f;
  font-weight: 820;
  box-shadow: var(--shadow-1);
}

.primary-action:hover {
  border-color: rgba(137, 232, 183, 0.78);
  background: #75dfad;
  box-shadow: var(--shadow-1);
}

.primary-action:active,
.menu-action:active,
.tool-button:active,
.icon-button:active,
.chip:active,
.daily-card:active,
.guide-size-button:active,
.campaign-group-tile:not([disabled]):active,
.level-node:not([disabled]):active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(1.08);
}

.primary-action:active {
  background: #69d3a4;
}

.menu-action:active,
.tool-button:active,
.icon-button:active,
.chip:active,
.daily-card:active,
.guide-size-button:active,
.campaign-group-tile:not([disabled]):active,
.level-node:not([disabled]):active {
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.level-node:not([disabled]):hover,
.campaign-group-tile:not([disabled]):hover,
.menu-action:hover,
.tool-button:hover,
.icon-button:hover,
.chip:hover,
.daily-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.campaign-group-tile.is-unlocked:not([disabled]):hover,
.campaign-group-tile.is-unlocked:not([disabled]):active {
  border-color: rgba(255, 255, 255, 0.94);
}

button:disabled,
.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.primary-action:focus-visible,
.menu-action:focus-visible,
.tool-button:focus-visible,
.icon-button:focus-visible,
.chip:focus-visible,
.daily-card:focus-visible,
.guide-size-button:focus-visible,
.campaign-group-tile:not([disabled]):focus-visible,
.level-node:not([disabled]):focus-visible,
.tile:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.screen-header,
.game-header {
  gap: 12px;
  margin-bottom: 20px;
}

.sticky-screen-header,
#screen-howto .guide-header,
#screen-math .guide-header {
  border-bottom-color: var(--line);
  background: rgba(12, 17, 24, 0.96);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.20);
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted-strong);
}

.icon-button.icon-only {
  width: 44px;
  padding: 0;
}

.settings-mark,
.back-mark {
  width: 21px;
  height: 21px;
}

.chapter-list {
  gap: 14px;
}

.chapter {
  padding: 14px;
}

.chapter h3 {
  margin-bottom: 12px;
}

.level-grid {
  gap: 8px;
}

.level-node {
  min-height: 68px;
  border-color: var(--line);
  background: var(--surface-2);
  box-shadow: none;
}

.level-node[disabled] {
  opacity: 0.50;
  background: rgba(21, 27, 36, 0.52);
}

.daily-list,
.setup-panel,
.toggle-list,
.settings-list {
  gap: 16px;
}

.daily-card {
  min-height: 78px;
  gap: 14px;
  padding: 14px 16px;
}

.daily-card.is-complete {
  border-color: rgba(99, 212, 157, 0.34);
}

.daily-card.daily-card-easy {
  border-color: rgba(99, 212, 157, 0.34);
  background: var(--surface);
}

.daily-card.daily-card-medium {
  border-color: rgba(88, 184, 232, 0.34);
  background: var(--surface);
}

.daily-card.daily-card-hard {
  border-color: rgba(220, 164, 88, 0.36);
  background: var(--surface);
}

.daily-card.daily-card-easy.is-complete {
  border-color: rgba(99, 212, 157, 0.48);
  background: rgba(23, 35, 33, 0.96);
}

.daily-card.daily-card-medium.is-complete {
  border-color: rgba(88, 184, 232, 0.48);
  background: rgba(22, 33, 42, 0.96);
}

.daily-card.daily-card-hard.is-complete {
  border-color: rgba(220, 164, 88, 0.50);
  background: rgba(38, 31, 25, 0.96);
}

.setup-group,
.settings-list,
.advanced-note {
  padding: 15px;
}

.chip-row {
  gap: 8px;
}

.chip {
  min-height: 44px;
  padding: 0 10px;
}

.chip.is-selected {
  border-color: rgba(88, 184, 232, 0.68);
  background: rgba(88, 184, 232, 0.16);
  box-shadow: inset 0 0 0 1px rgba(88, 184, 232, 0.10);
}

.chip-row.pattern-chip-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pattern-chip {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 7px 9px;
  text-align: left;
}

.pattern-chip-label {
  min-width: 0;
  color: inherit;
  font-size: var(--menu-body-size);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.pattern-choice-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
}

.pattern-choice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: 42px;
  height: 42px;
  padding: 4px;
  border: 1px solid rgba(190, 203, 220, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(7, 10, 14, 0.26);
}

.pattern-choice-cell {
  border-radius: 2px;
  background: rgba(244, 247, 251, 0.14);
}

.pattern-choice-cell.is-active {
  background: var(--blue);
}

.pattern-choice-cell.is-center {
  background: var(--green);
  box-shadow: inset 0 0 0 1px rgba(7, 19, 15, 0.42);
}

.pattern-choice-cell.is-mixed-a {
  background: var(--orange);
}

.pattern-choice-cell.is-mixed-b {
  background: var(--purple);
}

.pattern-choice-cell.is-mixed-c {
  background: var(--blue);
}

.pattern-chip.is-selected .pattern-choice-grid {
  border-color: rgba(139, 212, 255, 0.54);
  background: rgba(10, 22, 31, 0.52);
}

.custom-size input,
.select-field,
.toggle-row {
  border-color: var(--line);
  background: var(--surface);
}

.custom-size input:hover,
.select-field:hover,
.toggle-row:hover,
.setting-select-row:hover {
  border-color: var(--line-strong);
}

.toggle-row,
.setting-select-row {
  min-height: 50px;
  font-weight: 700;
}

.status-strip,
.pattern-strip,
.tool-strip {
  gap: 10px;
  margin-bottom: 10px;
}

.status-strip > div,
.pattern-card,
.personal-best-card,
.tool-button {
  border-color: var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.006)),
    var(--surface);
  box-shadow: var(--shadow-1);
}

.status-strip > div > span,
.pattern-strip span,
.result-list dt,
.star-breakdown strong {
  color: var(--muted);
  letter-spacing: 0;
}

.tool-button {
  color: var(--muted-strong);
}

.hint-tool {
  border-color: rgba(229, 111, 126, 0.38);
  background:
    linear-gradient(145deg, rgba(229, 111, 126, 0.13), rgba(229, 111, 126, 0.035)),
    var(--surface);
  box-shadow: none;
}

.board {
  border-color: var(--line-strong);
  background: #101821;
  box-shadow: var(--shadow-2);
}

.tile,
.hole {
  border-radius: var(--radius-sm);
}

.tile {
  border-color: rgba(244, 247, 251, 0.12);
  background: rgba(244, 247, 251, 0.05);
  box-shadow: none;
}

.tile::before {
  display: none;
}

.tile.state-0 {
  border-color: rgba(255, 255, 255, 0.66);
  background: linear-gradient(180deg, #f8fafc, #dde5ee);
  color: #101821;
  box-shadow: inset 0 -1px 0 rgba(12, 17, 24, 0.16);
}

.tile.state-4,
.mini-board .lit-green {
  background: linear-gradient(180deg, #77ddb0, #3c9f74);
  border-color: rgba(142, 234, 188, 0.48);
  box-shadow: var(--shadow-green);
}

.tile.preview {
  border-width: 3px;
  border-color: rgba(99, 212, 157, 0.96);
  box-shadow: inset 0 0 0 2px rgba(99, 212, 157, 0.46);
}

.tile.preview::before {
  display: block;
  inset: 0;
  border-radius: inherit;
  background: rgba(12, 17, 24, 0.24);
  opacity: 1;
  transform: none;
}

.tile.hint,
.tile.preview.hint {
  border-color: rgba(220, 164, 88, 0.96);
  box-shadow: inset 0 0 0 2px rgba(220, 164, 88, 0.38);
}

.tile.hint-affected,
.tile.hint-suggested,
.tile.hint-changed {
  border-color: rgba(229, 111, 126, 0.92);
  box-shadow: inset 0 0 0 2px rgba(229, 111, 126, 0.44);
}

.hole {
  border-color: rgba(190, 203, 220, 0.16);
  background: rgba(5, 8, 12, 0.58);
}

.math-intro,
.equation-panel {
  padding: 15px;
}

.formula-card,
.hero-formula {
  border-color: rgba(190, 203, 220, 0.18);
  background: rgba(8, 12, 18, 0.62);
  box-shadow: none;
}

.mini-board span {
  border-radius: var(--radius-sm);
  background: #eef2f6;
  box-shadow: inset 0 -1px 0 rgba(12, 17, 24, 0.14);
}

.mini-board .preview,
.mini-board .hinted {
  box-shadow: inset 0 0 0 2px currentColor;
}

.mini-board .preview {
  color: var(--green);
}

.mini-board .hinted {
  color: var(--danger);
}

.advanced-note summary {
  outline-offset: 4px;
}

.modal {
  background: rgba(4, 7, 11, 0.72);
}

.modal-sheet {
  background: var(--panel-strong);
  box-shadow: var(--shadow-2);
}

.result-list div,
.star-breakdown span {
  border-color: var(--line);
  background: rgba(12, 17, 24, 0.58);
}

.empty-state,
.error-state,
.loading-state {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow-1);
}

.empty-state h3,
.error-state h3,
.loading-state h3 {
  margin: 0;
  color: var(--text);
}

.empty-state p,
.error-state p,
.loading-state p {
  margin: 0;
}

.error-state {
  border-color: rgba(229, 111, 126, 0.42);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

@keyframes gridCurrent {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  to {
    background-position: 42px 42px, 18px 42px, 42px 18px, 240px 240px;
  }
}

@keyframes gridSweep {
  0%,
  100% {
    opacity: 0.1;
    transform: translate(-18%, -12%) rotate(0deg);
  }
  42% {
    opacity: 0.62;
  }
  55% {
    opacity: 0.5;
    transform: translate(18%, 14%) rotate(0deg);
  }
  78% {
    opacity: 0.18;
    transform: translate(8%, 20%) rotate(0deg);
  }
}

@keyframes gridPhase {
  from {
    background-position: 0 0, 0 0;
    transform: translate3d(0, 0, 0);
  }
  to {
    background-position: 180px 180px, -220px 220px;
    transform: translate3d(18px, -18px, 0);
  }
}

@keyframes tileBreath {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.14);
  }
}

@keyframes pulseTile {
  0% {
    transform: scale(0.94);
    filter: brightness(1.26);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes splashTilePulse {
  0% {
    transform: scale(0.9);
    filter: brightness(1.28);
  }
  65% {
    transform: scale(1.08);
    filter: brightness(1.16);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes mathPulseTile {
  0%,
  18%,
  80%,
  100% {
    background: linear-gradient(145deg, #fffdf5, #dfe8f0);
    border-color: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 10px rgba(255, 248, 239, 0.12);
    filter: brightness(1);
    transform: scale(1);
  }
  24% {
    background: linear-gradient(145deg, #fffdf5, #dfe8f0);
    border-color: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 10px rgba(255, 248, 239, 0.12);
    filter: brightness(1.28);
    transform: scale(0.9);
  }
  40% {
    background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(31, 95, 133, 0.94));
    border-color: rgba(162, 230, 255, 0.74);
    box-shadow: 0 0 17px rgba(69, 194, 244, 0.34);
    filter: brightness(1.16);
    transform: scale(1.08);
  }
  54%,
  68% {
    background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(31, 95, 133, 0.94));
    border-color: rgba(162, 230, 255, 0.74);
    box-shadow: 0 0 17px rgba(69, 194, 244, 0.34);
    filter: brightness(1);
    transform: scale(1);
  }
}

@keyframes mathPulseTap {
  0%,
  16%,
  72%,
  100% {
    opacity: 0;
  }
  24%,
  48% {
    opacity: 1;
  }
  62% {
    opacity: 0.18;
  }
}

@keyframes patternInfoPatternBorder {
  0%,
  14%,
  38%,
  100% {
    opacity: 0;
  }
  20%,
  30% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .math-pulse-demo .demo-pulse {
    animation: none;
    background: linear-gradient(145deg, rgba(69, 194, 244, 0.98), rgba(31, 95, 133, 0.94));
    border-color: rgba(162, 230, 255, 0.74);
    box-shadow: 0 0 17px rgba(69, 194, 244, 0.34);
  }

  .math-pulse-demo .demo-tap::after {
    animation: none;
    opacity: 0.85;
  }
}

@media (min-width: 560px) {
  .level-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .chip-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .howto-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .howto-grid article {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .icon-button {
    font-size: 0.82rem;
  }

  .status-strip strong {
    font-size: 1.54rem;
  }

  .pattern-strip strong {
    font-size: 1.22rem;
  }

  .tool-button {
    font-size: 1.16rem;
  }

  .guide-header {
    grid-template-columns: auto 1fr;
  }

  .section-header {
    grid-template-columns: 40px 42px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .section-header-icon {
    width: 42px;
    height: 42px;
  }

  .section-header h2 {
    font-size: var(--section-title-size-compact);
  }

  .guide-size-control {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .section-header .guide-size-control {
    grid-column: auto;
    justify-self: end;
    gap: 3px;
    padding: 3px;
    margin-bottom: 0;
  }

  .section-header .guide-size-button {
    width: 27px;
    height: 27px;
  }

  .star-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .howto-grid article {
    grid-template-columns: 80px 1fr;
    padding: 12px;
  }

  #screen-howto .math-intro,
  #screen-howto .equation-panel,
  #screen-howto .math-grid.small article {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .mini-board {
    grid-template-columns: repeat(3, 21px);
    grid-auto-rows: 21px;
  }
}

@media (min-width: 760px) {
  .screen-main.is-active {
    grid-template-columns: minmax(280px, 0.95fr) minmax(300px, 0.82fr);
    align-items: center;
    gap: 48px;
  }

  .brand-panel {
    justify-items: start;
    text-align: left;
  }

  .menu-stack {
    width: 100%;
    max-width: 420px;
    margin: 0;
  }

  h1 {
    font-size: 3.05rem;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 2.32rem;
  }

  .brand-mark {
    grid-template-columns: repeat(5, 23px);
    grid-auto-rows: 23px;
  }

  .menu-stack {
    gap: 10px;
  }

  .menu-action {
    min-height: 50px;
    font-size: 1.08rem;
  }
}

@media (max-height: 720px) {
  .screen-main {
    align-content: start;
    gap: 18px;
    padding-top: calc(14px + var(--safe-top));
    padding-bottom: calc(18px + var(--safe-bottom));
  }

  .screen-main .brand-panel {
    gap: 8px;
  }

  .screen-main .brand-mark {
    grid-template-columns: repeat(5, 22px);
    grid-auto-rows: 22px;
    gap: 4px;
    padding: 7px;
  }

  .screen-main .kicker {
    font-size: 0.68rem;
  }

  .screen-main h1 {
    font-size: 2.28rem;
  }

  .screen-main .menu-stack {
    gap: 8px;
  }

  .screen-main .menu-action {
    min-height: 44px;
    font-size: 1rem;
  }
}

@media (max-height: 620px) {
  .screen-main {
    gap: 12px;
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(14px + var(--safe-bottom));
  }

  .screen-main .brand-panel {
    gap: 6px;
  }

  .screen-main .brand-mark {
    grid-template-columns: repeat(5, 18px);
    grid-auto-rows: 18px;
    gap: 4px;
    padding: 6px;
  }

  .screen-main .kicker {
    font-size: 0.64rem;
  }

  .screen-main h1 {
    font-size: 2rem;
  }

  .screen-main .menu-stack {
    gap: 6px;
  }

  .screen-main .menu-action {
    min-height: 42px;
    font-size: 0.98rem;
  }
}

@media (max-height: 520px) {
  .screen-main {
    gap: 10px;
    padding-top: calc(10px + var(--safe-top));
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .screen-main .brand-panel {
    gap: 5px;
  }

  .screen-main .brand-mark {
    grid-template-columns: repeat(5, 16px);
    grid-auto-rows: 16px;
    gap: 3px;
    padding: 5px;
  }

  .screen-main h1 {
    font-size: 1.86rem;
  }

  .screen-main .menu-stack {
    gap: 5px;
  }

  .screen-main .menu-action {
    min-height: 40px;
    font-size: 0.94rem;
  }
}

@media (min-width: 760px) and (max-height: 720px) {
  .screen-main {
    align-content: center;
  }
}

/* Math guide layout pass: keep cards readable and contain long formulas. */
#screen-math {
  width: min(100%, 900px);
}

#screen-math .math-intro,
#screen-math .equation-panel,
#screen-math .howto-grid.math-grid article,
#screen-math .math-grid.small article,
#screen-math .advanced-note {
  overflow: hidden;
}

#screen-math .math-intro,
#screen-math .equation-panel {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
}

#screen-math .math-intro p {
  max-width: 76ch;
  font-weight: 620;
}

#screen-math .math-intro .math-lead {
  max-width: 34ch;
  color: var(--text);
  font-weight: 840;
}

#screen-math .equation-panel > div:first-child,
#screen-math .howto-grid.math-grid article > div {
  display: grid;
  align-content: start;
  gap: 10px;
}

#screen-math .math-model {
  border-color: rgba(95, 225, 170, 0.24);
  background:
    linear-gradient(135deg, rgba(95, 225, 170, 0.075), transparent 48%),
    linear-gradient(315deg, rgba(69, 194, 244, 0.055), transparent 42%),
    rgba(12, 17, 25, 0.86);
}

#screen-math .howto-grid.math-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

#screen-math .howto-grid.math-grid article {
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 16px;
}

#screen-math .howto-grid.math-grid .mini-board {
  margin-top: 2px;
}

#screen-math .math-grid.small {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
}

#screen-math .math-grid.small article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px;
}

#screen-math .howto-grid h3,
#screen-math .math-grid h3,
#screen-math .equation-panel h3 {
  margin: 0;
}

#screen-math .howto-grid p,
#screen-math .math-grid p,
#screen-math .equation-panel p,
#screen-math .advanced-note p,
#screen-math .symbol-list dd {
  min-width: 0;
  overflow-wrap: break-word;
}

#screen-math .formula-card {
  width: 100%;
  max-width: 100%;
  margin-top: 2px;
  padding: 10px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: min(var(--guide-formula-size), 1.08rem);
}

#screen-math .hero-formula {
  font-size: min(var(--guide-formula-size), 1.14rem);
}

#screen-math .formula-card mjx-container {
  display: block !important;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

#screen-math .formula-card mjx-container[jax="SVG"] > svg {
  max-width: 100%;
  height: auto;
}

#screen-math p mjx-container,
#screen-math li mjx-container,
#screen-math dd mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
}

#screen-math .symbol-list div {
  grid-template-columns: minmax(52px, max-content) minmax(0, 1fr);
}

@media (min-width: 780px) {
  #screen-math .math-intro {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
  }

  #screen-math .math-pulse-demo {
    justify-self: end;
  }

  #screen-math .equation-panel {
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    align-items: start;
  }

  #screen-math .math-grid.small {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.guide-size-large #screen-math .equation-panel,
body.guide-size-large #screen-math .math-grid.small {
  grid-template-columns: 1fr;
}

body.guide-size-large #screen-math .math-intro {
  grid-template-columns: 1fr;
}

body.guide-size-large #screen-math .math-pulse-demo {
  justify-self: center;
}

@media (max-width: 560px) {
  #screen-math .howto-grid.math-grid article {
    grid-template-columns: 1fr;
  }
}
