:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-elevated: rgba(17, 24, 42, 0.76);
  --bg-solid: #11182a;
  --panel: rgba(24, 33, 56, 0.72);
  --panel-strong: rgba(31, 42, 70, 0.92);
  --text: #f5f7ff;
  --muted: #94a0b8;
  --line: rgba(203, 214, 255, 0.12);
  --line-strong: rgba(203, 214, 255, 0.22);
  --accent: #7c8cff;
  --accent-strong: #6274ff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --green: #5fe0ab;
  --yellow: #ffd477;
  --red: #ff6f7d;
  --blue: #66a3ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  --cell-size: 38px;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2fb;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --bg-solid: #ffffff;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --text: #152039;
  --muted: #66728a;
  --line: rgba(31, 47, 80, 0.1);
  --line-strong: rgba(31, 47, 80, 0.18);
  --accent: #5368ee;
  --accent-strong: #3f55dd;
  --accent-soft: rgba(83, 104, 238, 0.12);
  --shadow: 0 28px 80px rgba(50, 67, 108, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(91, 112, 255, 0.16), transparent 34%),
    radial-gradient(circle at 90% 40%, rgba(54, 217, 172, 0.1), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(124, 140, 255, 0.45);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  left: -120px;
  background: #6374ff;
}

.ambient-two {
  right: -220px;
  bottom: -120px;
  background: #2fd7a8;
}

.site-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 64px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(124, 140, 255, 0.32);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(124, 140, 255, 0.26), rgba(124, 140, 255, 0.08));
  color: #aeb8ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 20px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  padding: 9px 13px;
  border: 1px solid rgba(95, 224, 171, 0.2);
  border-radius: 999px;
  background: rgba(95, 224, 171, 0.08);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.mode-badge i,
.generation-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px rgba(95, 224, 171, 0.8);
}

.icon-button,
.ghost-button,
.back-button,
.secondary-button,
.primary-button {
  border-radius: 14px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover,
.ghost-button:hover,
.back-button:hover,
.secondary-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.screen {
  padding: clamp(50px, 8vw, 108px) 0 72px;
}

.start-screen {
  animation: screen-in 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-copy {
  max-width: 820px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 16px 0 22px;
  font-size: clamp(48px, 7vw, 90px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-description {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.8;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: clamp(44px, 6vw, 72px);
}

.difficulty-card {
  position: relative;
  display: flex;
  min-height: 196px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.difficulty-card::after {
  position: absolute;
  width: 180px;
  height: 180px;
  right: -72px;
  bottom: -94px;
  border-radius: 50%;
  background: var(--card-glow, rgba(124, 140, 255, 0.22));
  filter: blur(12px);
  content: "";
  transition: transform 240ms ease;
}

.difficulty-card:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.difficulty-card:hover::after {
  transform: scale(1.18);
}

.intermediate-card {
  --card-glow: rgba(95, 224, 171, 0.2);
}

.expert-card {
  --card-glow: rgba(255, 111, 125, 0.2);
}

.difficulty-index {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.difficulty-copy strong,
.difficulty-copy small {
  display: block;
}

.difficulty-copy strong {
  font-size: 28px;
}

.difficulty-copy small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.difficulty-arrow {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.glass-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.custom-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(520px, 1.2fr);
  gap: 42px;
  align-items: center;
  margin-top: 18px;
  padding: clamp(26px, 4vw, 42px);
  border-radius: var(--radius-lg);
}

.custom-card h2 {
  margin: 10px 0;
  font-size: 24px;
}

.custom-card p:not(.section-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.custom-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr)) minmax(170px, 1.45fr);
  gap: 12px;
  align-items: end;
}

.custom-form label {
  display: grid;
  gap: 8px;
}

.custom-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.custom-form input,
.setting-row select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-elevated);
  color: var(--text);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 20px;
}

.primary-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 14px 34px rgba(83, 104, 238, 0.3);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--text);
}

.principles-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 68px;
}

.principles-row article {
  padding: 0 4px;
}

.principles-row article > span {
  display: inline-grid;
  min-width: 48px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.principles-row h3 {
  margin: 16px 0 8px;
  font-size: 17px;
}

.principles-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.game-screen {
  padding-top: 38px;
  animation: screen-in 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 24px;
}

.back-button,
.ghost-button {
  width: max-content;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.ghost-button {
  justify-self: end;
}

.game-identity {
  text-align: center;
}

.game-identity span,
.game-identity strong {
  display: block;
}

.game-identity span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.game-identity strong {
  margin-top: 5px;
  font-size: 20px;
}

.game-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-sidebar > section {
  border-radius: var(--radius-md);
}

.metrics-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 22px 12px;
}

.metrics-card > div {
  text-align: center;
}

.metrics-card > div + div {
  border-left: 1px solid var(--line);
}

.metrics-card span,
.metrics-card strong {
  display: block;
}

.metrics-card span {
  color: var(--muted);
  font-size: 11px;
}

.metrics-card strong {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px;
}

.metrics-card strong small {
  margin-left: 3px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.mode-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
}

.mode-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.mode-button.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(83, 104, 238, 0.28);
}

.generation-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px;
}

.generation-card strong,
.generation-card small {
  display: block;
}

.generation-card strong {
  font-size: 12px;
}

.generation-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.help-card {
  flex: 1;
  padding: 18px;
}

.help-card ul {
  display: grid;
  gap: 11px;
  margin: 14px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  list-style: none;
}

.help-card li {
  position: relative;
  padding-left: 14px;
}

.help-card li::before {
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.board-panel {
  position: relative;
  display: grid;
  min-height: 560px;
  overflow: hidden;
  place-items: center;
  border-radius: var(--radius-lg);
}

.board-scroll,
.review-board-scroll {
  width: 100%;
  overflow: auto;
  padding: clamp(14px, 3vw, 34px);
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
}

.board {
  display: grid;
  width: max-content;
  margin: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(7, 11, 20, 0.34);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.2);
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
}

:root[data-theme="light"] .board {
  background: rgba(219, 226, 241, 0.72);
}

.cell {
  display: grid;
  width: var(--cell-size);
  height: var(--cell-size);
  place-items: center;
  padding: 0;
  border: 1px solid rgba(136, 155, 197, 0.26);
  border-radius: 0;
  background: linear-gradient(145deg, rgba(58, 74, 112, 0.96), rgba(38, 50, 80, 0.98));
  color: var(--text);
  cursor: pointer;
  font-size: calc(var(--cell-size) * 0.46);
  font-weight: 900;
  line-height: 1;
  transition: filter 100ms ease, transform 100ms ease, background 140ms ease;
}

:root[data-theme="light"] .cell {
  border-color: rgba(84, 105, 150, 0.24);
  background: linear-gradient(145deg, #e7edf8, #cdd8eb);
}

.cell:hover:not(.is-open) {
  filter: brightness(1.13);
}

.cell:active:not(.is-open) {
  transform: scale(0.93);
}

.cell.is-open {
  border-color: rgba(136, 155, 197, 0.16);
  background: rgba(15, 22, 38, 0.76);
  cursor: default;
}

:root[data-theme="light"] .cell.is-open {
  background: rgba(250, 252, 255, 0.94);
}

.cell.is-open.has-number {
  cursor: pointer;
}

.cell.is-flagged {
  background: linear-gradient(145deg, rgba(255, 212, 119, 0.25), rgba(131, 99, 38, 0.2));
  color: var(--yellow);
}

.cell.is-mine {
  color: #d5dced;
}

.cell.is-exploded {
  border-color: rgba(255, 255, 255, 0.35);
  background: var(--red);
  color: #fff;
  animation: explode 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cell.is-wrong-flag {
  background: rgba(255, 111, 125, 0.22);
  color: var(--red);
}

.number-1 { color: #6ca7ff; }
.number-2 { color: #5fe0ab; }
.number-3 { color: #ff7380; }
.number-4 { color: #a491ff; }
.number-5 { color: #ff9f68; }
.number-6 { color: #55d5de; }
.number-7 { color: #d9dff0; }
.number-8 { color: #95a0b6; }

.generating-overlay {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  background: rgba(8, 12, 22, 0.82);
  backdrop-filter: blur(18px);
}

:root[data-theme="light"] .generating-overlay {
  background: rgba(244, 247, 253, 0.88);
}

.generating-overlay strong {
  margin-top: 6px;
  font-size: 15px;
}

.generating-overlay small {
  color: var(--muted);
  font-size: 11px;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 18px;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
}

.result-panel h2 {
  margin: 8px 0 5px;
  font-size: 25px;
}

.result-panel p:not(.section-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.result-actions {
  display: flex;
  flex: none;
  gap: 10px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.modal {
  width: min(600px, calc(100% - 28px));
  max-height: min(820px, calc(100vh - 28px));
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(32px);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.modal[open] {
  animation: modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-shell {
  margin: 0;
  padding: 28px;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.modal-heading h2 {
  margin: 8px 0 0;
  font-size: 26px;
}

.modal-close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
}

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

.record-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 0.8fr);
  align-items: center;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.record-row strong {
  font-size: 13px;
}

.record-row span {
  text-align: right;
}

.record-row span b,
.record-row span small {
  display: block;
}

.record-row span b {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.record-row span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.text-danger-button {
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
  border: 1px solid rgba(255, 111, 125, 0.24);
  border-radius: 13px;
  background: rgba(255, 111, 125, 0.08);
  color: var(--red);
  cursor: pointer;
  font-weight: 750;
}

.setting-row {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.setting-row span strong,
.setting-row span small {
  display: block;
}

.setting-row span strong {
  font-size: 14px;
}

.setting-row span small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.setting-row select {
  width: 132px;
  min-height: 40px;
}

.toggle {
  width: 44px;
  height: 24px;
  accent-color: var(--accent);
}

.setting-note {
  margin: 20px 0;
  padding: 14px;
  border: 1px solid rgba(124, 140, 255, 0.2);
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.full-button {
  width: 100%;
}

.review-modal {
  width: min(860px, calc(100% - 28px));
}

.review-summary {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--bg-elevated);
}

.review-summary strong,
.review-summary p {
  display: block;
}

.review-summary strong {
  font-size: 15px;
}

.review-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 18px 0 4px;
  color: var(--muted);
  font-size: 10px;
}

.review-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.review-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-source { background: var(--blue); }
.legend-safe { background: var(--green); }
.legend-wrong { background: var(--red); }

.review-board-scroll {
  max-height: 430px;
  margin: 0 -10px;
  padding: 16px 10px 20px;
}

.review-board {
  --cell-size: 30px;
}

.review-board .cell {
  cursor: default;
}

.review-board .is-review-source {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 3px var(--blue);
}

.review-board .is-review-safe {
  position: relative;
  z-index: 2;
  box-shadow: inset 0 0 0 3px var(--green), 0 0 14px rgba(95, 224, 171, 0.42);
}

.review-board .is-review-wrong {
  position: relative;
  z-index: 3;
  box-shadow: inset 0 0 0 3px var(--red), 0 0 14px rgba(255, 111, 125, 0.45);
}

.review-footnote {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100% - 30px));
  padding: 12px 17px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  text-align: center;
  backdrop-filter: blur(20px);
}

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

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes explode {
  0% { transform: scale(0.7); }
  55% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

@media (max-width: 980px) {
  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-card {
    min-height: 150px;
  }

  .custom-card {
    grid-template-columns: 1fr;
  }

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

  .game-sidebar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .help-card {
    display: none;
  }

  .board-panel {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .site-shell {
    padding: 0 14px;
  }

  .site-header {
    min-height: 76px;
  }

  .mode-badge {
    display: none;
  }

  .icon-button {
    min-height: 38px;
    padding: 0 11px;
  }

  .screen {
    padding-top: 52px;
  }

  .hero-copy h1 {
    font-size: clamp(44px, 14vw, 66px);
  }

  .difficulty-grid {
    margin-top: 38px;
  }

  .custom-form {
    grid-template-columns: repeat(3, 1fr);
  }

  .custom-form .primary-button {
    grid-column: 1 / -1;
  }

  .principles-row {
    grid-template-columns: 1fr;
    gap: 34px;
    margin-top: 52px;
  }

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

  .back-button,
  .ghost-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .game-identity strong {
    font-size: 16px;
  }

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

  .generation-card {
    grid-column: 1 / -1;
  }

  .board-panel {
    min-height: 480px;
    border-radius: 18px;
  }

  .board-scroll {
    padding: 13px;
  }

  .result-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .result-actions .primary-button:only-child {
    grid-column: 1 / -1;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }

  .modal-shell {
    padding: 21px;
  }

  .record-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .record-row > strong {
    grid-column: 1 / -1;
  }

  .record-row span:last-child {
    display: none;
  }

  .review-board {
    --cell-size: 27px;
  }
}

@media (max-width: 440px) {
  .brand strong {
    font-size: 14px;
  }

  .brand small {
    display: none;
  }

  .difficulty-card {
    min-height: 142px;
  }

  .custom-card {
    padding: 22px 18px;
  }

  .game-screen {
    padding-top: 24px;
  }

  .game-toolbar {
    margin-bottom: 15px;
  }

  .game-identity span {
    display: none;
  }

  .game-sidebar {
    gap: 8px;
  }

  .metrics-card {
    padding: 16px 6px;
  }

  .mode-card {
    padding: 5px;
  }

  .generation-card {
    padding: 13px;
  }

  .board-panel {
    min-height: 420px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .setting-row {
    gap: 12px;
  }

  .setting-row span small {
    max-width: 190px;
  }
}

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

:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
