:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  --night: #09091c;
  --panel: #141a33;
  --panel-edge: #3d3a6e;
  --gold: #ffcf5c;
  --gold-deep: #e0a53a;
  --ink: #0d1024;
  --cream: #fff3cf;
}

* { box-sizing: border-box; }

html { background: #070712; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding:
    calc(8px + env(safe-area-inset-top))
    calc(10px + env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
  color: var(--cream);
  background:
    radial-gradient(ellipse 70% 50% at 80% 0%, #2a2258 0%, transparent 60%),
    radial-gradient(ellipse 80% 55% at 15% 15%, #1b2b4d 0%, transparent 55%),
    linear-gradient(#080818, #0b0d20 55%, #070713);
  overflow-x: hidden;
}

header { text-align: center; line-height: 1; }

h1 {
  margin: 2px 0 0;
  font-size: clamp(1.5rem, 4.4vw, 2.35rem);
  letter-spacing: .22em;
  color: #ffe6a3;
  text-shadow: 0 0 10px #ffb43c88, 0 0 30px #ff8a2a55, 0 2px 0 #2a1c00;
}

.tagline {
  margin: 5px 0 0;
  font-size: .76rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: #a7b7e9;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 780px);
  min-height: 38px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border: 1px solid #373663;
  border-radius: 999px;
  background: #131833cc;
  color: #c9d4f7;
  font-size: .72rem;
  letter-spacing: .09em;
  white-space: nowrap;
}

.pill b { color: #fff; font-size: .82rem; }

.destination { border-color: #6b5730; background: #1d1a2acc; }
.destination b { color: #ffd66b; letter-spacing: .08em; }
.destination span { color: #b9c5ea; }

.hearts {
  color: #ff6b7a;
  font-size: .95rem;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #ff446688;
  min-width: 74px;
  justify-content: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #4c4a7d;
  border-radius: 50%;
  background: #1a2040;
  color: #ffe6a3;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover { background: #262d55; }
.icon-button:active { transform: translateY(1px); }

.game-shell {
  position: relative;
  width: min(100%, 780px);
  height: min(calc(100svh - 232px), 820px);
  border: 1px solid #34315f;
  border-radius: 22px;
  overflow: hidden;
  background: #08081a;
  box-shadow: 0 18px 50px #0009, 0 0 0 1px #0008 inset, 0 0 40px #2a226022;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 9px;
  padding: 22px 20px;
  overflow: auto;
  text-align: center;
  background:
    radial-gradient(ellipse at center, #151a3ce8, #050611f5 78%);
  backdrop-filter: blur(2px);
}

.overlay[hidden] { display: none; }

.overlay h2 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.5rem);
  letter-spacing: .04em;
  color: #ffe6a3;
  text-shadow: 0 0 18px #ffae3a66;
}

.overlay p {
  margin: 0;
  max-width: 34em;
  line-height: 1.45;
  color: #d9e2ff;
  font-size: clamp(.86rem, 2.5vw, 1.02rem);
}

.overlay .eyebrow {
  margin: 0;
  font-size: .68rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #9db0e8;
}

.overlay .small {
  font-size: .78rem;
  color: #aebbe3;
  line-height: 1.6;
}

.overlay .end-score {
  margin: 4px 0;
  font-size: 1.25rem;
  color: #ffd76b;
  font-weight: 700;
  letter-spacing: .05em;
}

.overlay .end-score output { font-size: 1.6rem; }

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 5px;
  border: 1px solid #5b5b92;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #1d2447;
  color: #fff;
  font: inherit;
  font-size: .82em;
}

button.primary {
  margin-top: 6px;
  min-height: 50px;
  padding: 10px 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(#ffe28c, #f5b53c);
  color: #2a1904;
  font: 800 1.08rem "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 5px 0 #9c6714, 0 10px 24px #0007;
}

button.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 #9c6714; }

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(100%, 780px);
}

.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 62px;
  padding: 8px 16px;
  border: 1px solid #4b4982;
  border-radius: 16px;
  background: linear-gradient(#1a2144, #12172f);
  color: #cdd8ff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 #060611;
}

.choice:not(:disabled):hover { border-color: #ffcf5c99; background: linear-gradient(#232c58, #171d3b); }
.choice:not(:disabled):active { transform: translateY(2px); box-shadow: 0 2px 0 #060611; }

.choice:disabled { opacity: .46; cursor: default; }

.choice-track {
  font-size: .7rem;
  letter-spacing: .12em;
  white-space: nowrap;
}

.choice-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: #ffd66b;
  text-shadow: 0 0 12px #ffb32c66;
}

.choice:disabled .choice-number { color: #8f96b8; text-shadow: none; }

.ride-message {
  position: absolute;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 4;
  margin: 0;
  transform: translateX(-50%);
  width: min(92%, 560px);
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  color: #ffe6a3;
  text-shadow: 0 2px 6px #000, 0 0 14px #000;
  pointer-events: none;
  transition: opacity .2s;
}

.ride-message:empty { opacity: 0; }

.hint {
  margin: 0;
  max-width: 46em;
  text-align: center;
  font-size: .75rem;
  line-height: 1.4;
  color: #7f8bb6;
}

button:focus-visible,
#game:focus-visible {
  outline: 3px solid #ffd66b;
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .hint { display: none; }
  .game-shell { height: min(calc(100svh - 268px), 820px); }
}

@media (max-height: 620px) and (orientation: landscape) {
  body { gap: 4px; padding-top: calc(4px + env(safe-area-inset-top)); }
  .tagline { display: none; }
  h1 { font-size: 1.15rem; }
  .hud { min-height: 28px; gap: 4px; }
  .pill { padding: 2px 8px; font-size: .62rem; }
  .pill b { font-size: .7rem; }
  .hearts { font-size: .8rem; }
  .icon-button { width: 30px; height: 30px; font-size: .9rem; }
  .game-shell { width: min(100%, 980px); height: calc(100svh - 148px); border-radius: 14px; }
  .choices { width: min(100%, 980px); gap: 8px; }
  .choice { min-height: 44px; padding: 4px 12px; border-radius: 12px; }
  .choice-number { font-size: 1.2rem; }
  .choice-track { font-size: .6rem; }
  .hint { display: none; }
  .overlay { padding: 10px; gap: 4px; }
  .overlay h2 { font-size: 1.4rem; }
  .overlay p { font-size: .76rem; }
  .overlay .small { font-size: .66rem; }
  button.primary { min-height: 38px; padding: 6px 20px; font-size: .9rem; }
  .ride-message { bottom: 4px; font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
