:root {
  --bg: #f5f1e8;
  --bg-soft: rgba(255, 255, 255, 0.6);
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.84);
  --border: rgba(34, 39, 37, 0.12);
  --text: #141715;
  --muted: #667068;
  --accent: #1e564a;
  --accent-soft: rgba(30, 86, 74, 0.12);
  --shadow: 0 24px 70px rgba(20, 23, 21, 0.08);
  --theme-chip: rgba(255, 255, 255, 0.72);
  --grid-line: rgba(20, 23, 21, 0.03);
  --game-sky-top: #fff8ef;
  --game-sky-bottom: #f3ece1;
  --game-sun: #e4a95d;
  --game-ground: #cbd8cf;
  --game-ground-line: #8ca89c;
  --game-runner: #1d433c;
  --game-runner-alt: #25584e;
  --game-runner-skin: #d9a77f;
  --game-runner-shoe: #17322d;
  --game-obstacle: #275449;
  --game-cloud: rgba(255, 255, 255, 0.72);
  --game-hill: rgba(30, 86, 74, 0.12);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101417;
  --bg-soft: rgba(20, 25, 30, 0.66);
  --surface: rgba(24, 31, 37, 0.8);
  --surface-strong: rgba(30, 37, 45, 0.9);
  --border: rgba(231, 238, 242, 0.12);
  --text: #edf1f4;
  --muted: #a2adb5;
  --accent: #8fd4be;
  --accent-soft: rgba(143, 212, 190, 0.12);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  --theme-chip: rgba(255, 255, 255, 0.08);
  --grid-line: rgba(237, 241, 244, 0.05);
  --game-sky-top: #162028;
  --game-sky-bottom: #0e1418;
  --game-sun: #8fd4be;
  --game-ground: #233038;
  --game-ground-line: #4f6d67;
  --game-runner: #f2f6f8;
  --game-runner-alt: #b7cfd6;
  --game-runner-skin: #d6a383;
  --game-runner-shoe: #dceef1;
  --game-obstacle: #8fd4be;
  --game-cloud: rgba(255, 255, 255, 0.1);
  --game-hill: rgba(143, 212, 190, 0.12);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(239, 218, 185, 0.9), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(170, 211, 197, 0.72), transparent 26%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(184, 111, 68, 0.22), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(46, 106, 93, 0.32), transparent 24%),
    linear-gradient(180deg, #0c1013 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 75%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.06));
  opacity: 0.55;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 1.5rem;
}

.brand,
.top-link,
.button {
  text-decoration: none;
}

.brand {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.top-link {
  color: var(--muted);
  font-size: 0.95rem;
}

.top-link:hover,
.button-secondary:hover {
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  width: 5.2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-chip) 70%, transparent);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(30, 86, 74, 0.14);
}

.theme-track {
  position: relative;
  display: block;
  width: 4.3rem;
  height: 2.1rem;
}

.theme-marker,
.theme-icon {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-marker {
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  transform: translateY(-50%);
  transition:
    opacity 180ms ease,
    color 180ms ease;
}

.theme-marker i,
.theme-icon i {
  font-size: 0.82rem;
  line-height: 1;
}

.theme-marker-sun {
  left: 0.45rem;
  opacity: 0.65;
  color: #a56a35;
}

.theme-marker-moon {
  right: 0.45rem;
  opacity: 0.42;
  color: var(--muted);
}

.theme-thumb {
  position: absolute;
  top: 0.1rem;
  left: 0.1rem;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-strong) 92%, white 8%);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(20, 23, 21, 0.12);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.theme-icon {
  width: 1rem;
  height: 1rem;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    color 180ms ease;
}

.theme-icon-sun {
  opacity: 1;
  color: #b46f3a;
}

.theme-icon-moon {
  opacity: 0;
  transform: scale(0.82);
  color: #8fd4be;
}

:root[data-theme="dark"] .theme-marker-sun {
  opacity: 0.35;
}

:root[data-theme="dark"] .theme-marker-moon {
  opacity: 1;
  color: #8fd4be;
}

:root[data-theme="dark"] .theme-thumb {
  transform: translateX(2.2rem);
  background: color-mix(in srgb, var(--surface-strong) 90%, #081012 10%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: scale(0.82);
}

:root[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.page-layout {
  display: block;
}

.game-panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--surface-strong), var(--bg-soft));
  box-shadow: var(--shadow);
}

.game-panel {
  padding: clamp(1.4rem, 3vw, 2rem);
}

.panel-copy {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}

.eyebrow,
.section-label,
.overlay-kicker,
.stat-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  max-width: 11ch;
  margin-bottom: 0;
  font-family: "Instrument Serif", serif;
  font-size: clamp(3.2rem, 7vw, 5.8rem);
  line-height: 0.94;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.overlay-copy {
  max-width: 44rem;
  color: var(--muted);
  line-height: 1.75;
}

.game-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18));
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 8% 12%, rgba(255, 255, 255, 0.35), transparent 24%);
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.stat-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.stat-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
  line-height: 1;
}

.game-stage-wrap {
  position: relative;
  padding: 0 1rem 1rem;
}

.game-stage {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--game-sky-top), var(--game-sky-bottom));
}

.game-overlay {
  position: absolute;
  inset: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.85rem;
  padding: clamp(1.3rem, 4vw, 2rem);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(13, 17, 18, 0.08), rgba(13, 17, 18, 0.18));
  backdrop-filter: blur(6px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

:root[data-theme="dark"] .game-overlay {
  background: linear-gradient(135deg, rgba(7, 10, 12, 0.34), rgba(7, 10, 12, 0.52));
}

.game-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-title {
  margin-bottom: 0;
  font-family: "Instrument Serif", serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 0.95;
  font-weight: 400;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  padding: 0 1rem 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.game-controls span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

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

.button-primary {
  background: var(--accent);
  color: #f3f0ea;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.34);
  border-color: var(--border);
  color: var(--text);
}

:root[data-theme="dark"] .button-primary {
  color: #0d1114;
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 1rem, 1160px);
  }

  .topbar,
  .topbar-actions {
    align-items: flex-start;
  }

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

  .game-panel,
  .game-shell,
  .game-stage,
  .game-overlay {
    border-radius: 22px;
  }

  .game-stage-wrap {
    padding: 0 0.85rem 0.85rem;
  }

  .game-overlay {
    inset: 0 0.85rem 0.85rem;
  }
}

@media (max-width: 560px) {
  h1 {
    max-width: none;
  }

  .top-link {
    font-size: 0.88rem;
  }

  .game-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .button,
  .topbar-actions {
    width: 100%;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .theme-toggle {
    width: 5.2rem;
  }
}
