:root {
  color-scheme: dark;
  --bg: #111614;
  --bg-soft: #1d2923;
  --ink: #f7fbff;
  --muted: #b5c8d6;
  --line: rgba(255, 255, 255, 0.18);
  --blue: #1d9bf0;
  --yellow: #ffd84d;
  --danger: #ff5b6d;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

html.is-game-playing,
body.is-game-playing {
  height: 100%;
  overflow: hidden;
}

html.is-game-overlay,
body.is-game-overlay {
  overflow-y: auto;
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
  touch-action: none;
  background: linear-gradient(180deg, #14231d 0%, #111614 48%, #0d1110 100%);
}

.game-shell.is-overlay {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
  touch-action: pan-y;
}

#flykey-game {
  display: block;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: max(22px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  background: linear-gradient(180deg, rgba(17, 22, 20, 0.93), rgba(17, 22, 20, 0.76));
}

.game-shell.is-overlay #flykey-game {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.game-shell.is-overlay .screen {
  position: relative;
  inset: auto;
  z-index: 1;
  min-height: 100dvh;
  overflow: visible;
}

.screen.is-visible {
  display: flex;
}

.screen-menu {
  justify-content: flex-start;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 28px));
}

.screen-menu.is-visible {
  display: block;
}

.screen-menu > * {
  margin-right: auto;
  margin-left: auto;
}

.screen-menu > * + * {
  margin-top: 12px;
}

.menu-mascot {
  width: min(31vw, 128px);
  max-height: 156px;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px var(--shadow));
}

.menu-copy {
  display: grid;
  gap: 6px;
  max-width: 430px;
}

.eyebrow {
  margin: 0;
  color: var(--yellow);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
.lede {
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 16vw, 4.6rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(2rem, 12vw, 3.7rem);
  line-height: 0.95;
}

.lede {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.language-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  width: min(100%, 420px);
  margin: 0;
  padding: 0;
  border: 0;
}

.language-picker legend {
  margin: 0 auto 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.language-picker label {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 750;
}

.language-picker label:has(input:checked) {
  border-color: rgba(255, 216, 77, 0.92);
    background: rgba(255, 216, 77, 0.16);
}

.language-picker input {
  accent-color: var(--yellow);
}

.primary-action,
.cta-link,
.desktop-link {
  width: min(100%, 420px);
  min-height: 50px;
  border-radius: 8px;
  font-weight: 850;
  text-decoration: none;
}

.primary-action {
  border: 0;
  background: var(--yellow);
  color: #18202a;
  box-shadow: 0 12px 26px rgba(255, 216, 77, 0.22);
}

.cta-link,
.desktop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.screen-over {
  background: linear-gradient(180deg, rgba(17, 22, 20, 0.82), rgba(17, 22, 20, 0.92));
}

.screen-desktop {
  background: linear-gradient(180deg, rgba(17, 22, 20, 0.94), rgba(17, 22, 20, 0.82));
}

.score-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 420px);
  margin: 0;
}

.score-card div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.score-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score-card dd {
  margin: 4px 0 0;
  font-size: 2.05rem;
  font-weight: 900;
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: none;
  justify-content: space-between;
  pointer-events: none;
  color: var(--ink);
  font-weight: 850;
  text-shadow: 0 2px 8px var(--shadow);
}

.hud.is-visible {
  display: flex;
}

@media (min-width: 720px) {
  .game-shell {
    width: min(100vw, 480px);
    height: min(100dvh, 860px);
    margin: 0 auto;
    border-inline: 1px solid rgba(255, 255, 255, 0.1);
  }
}
