:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  color: #fff2e5;
  background: #161b37;
  --gold: #ffd68c;
  --edge: clamp(16px, 4.2vw, 68px);
  --heading: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
button:disabled { cursor: wait; opacity: .67; }

#game { position: relative; width: 100%; height: 100%; height: 100dvh; isolation: isolate; }
.backdrop, #scene, .vignette, .overlay { position: absolute; inset: 0; }
.backdrop {
  background: #847798 url('art/winter-wide.webp') center 40% / cover no-repeat;
}
#scene { opacity: 1; transition: opacity .45s ease; }
#scene canvas { display: block; width: 100%; height: 100%; }
#game[data-state='welcome'] #scene { opacity: 0; }
.vignette {
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 48%, #1a1c3c32), linear-gradient(0deg, #12162b67, transparent 29%);
}
#game[data-state='welcome'] .vignette {
  background: linear-gradient(90deg, #151730ea 0%, #1b1d36ad 32%, #2224400d 75%), linear-gradient(0deg, #17193190, transparent 32%);
}
.overlay { display: grid; padding: max(18px, env(safe-area-inset-top)) var(--edge) max(22px, env(safe-area-inset-bottom)); overflow: auto; }
.welcome { align-items: center; }
.hero { width: min(100%, 650px); margin-top: min(8vh, 55px); }
.eyebrow { margin: 0 0 15px; color: #ffe4b1; font-size: .71rem; font-weight: 700; letter-spacing: .23em; text-transform: uppercase; }
.eyebrow span { margin-right: .45em; color: var(--gold); }
h1, h2 { margin: 0; font-family: var(--heading); font-weight: 500; line-height: .96; letter-spacing: -.052em; text-wrap: balance; }
h1 { font-size: clamp(3.2rem, 8.1vw, 8.25rem); text-shadow: 0 3px 30px #17192f80; }
.subtitle { max-width: 346px; font-size: clamp(.95rem, 1.7vw, 1.13rem); color: #fff0e2; margin: 25px 0; text-wrap: pretty; }
.pill {
  border: 1px solid #ffffd0b5;
  border-radius: 100px;
  padding: 12px 23px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #33223b;
  background: linear-gradient(155deg, #ffefd4, #edb879);
  box-shadow: 0 5px 22px #23153165, inset 0 0 9px #fff4df7a;
  font-size: .9rem;
  font-weight: 730;
  transition: background .2s, translate .2s;
}
.pill:hover:not(:disabled) { background: #ffe9bd; translate: 0 -2px; }
.pill span { font-size: 1.12em; }
.instructions { font-size: .79rem; color: #f9e8de; margin: 14px 0 0; }
#loading-error { font-size: .85rem; max-width: 27em; padding: 12px; background: #211b33dd; border-radius: 12px; }

#hud { position: absolute; top: max(17px, env(safe-area-inset-top)); left: var(--edge); right: var(--edge); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.scoreboard, .round, .flight-hint {
  background: #222747c7;
  border: 1px solid #fff4de4a;
  box-shadow: 0 5px 25px #24244230;
}
.scoreboard { display: flex; padding: 8px 15px 9px; border-radius: 19px; }
.scoreboard div { display: grid; min-width: 69px; }
.scoreboard div + div { border-left: 1px solid #fff4de45; margin-left: 10px; padding-left: 15px; }
.scoreboard span { color: #fff1d7; font-weight: 650; font-size: 1.18rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.scoreboard small { color: #ffe5ba; font-size: .64rem; }
.hud-actions { display: flex; gap: 8px; }
.round { pointer-events: auto; display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; }
.round:hover { background: #474465b5; }
.sound-off, #sound[aria-pressed='true'] .sound-on { display: none; }
#sound[aria-pressed='true'] .sound-off { display: block; }

#flight-tools { position: absolute; left: var(--edge); bottom: max(18px, env(safe-area-inset-bottom)); }
.flight-hint { margin: 0; padding: 6px 10px; color: #ffebd3; border-radius: 100px; font-size: .73rem; }
.flight-hint span { margin-left: 7px; }
kbd { font: inherit; font-weight: 650; padding: 0 4px; }
#stick {
  width: 106px;
  height: 106px;
  border: 1px solid #fff6e898;
  border-radius: 50%;
  background: radial-gradient(circle, #a39abd56, #282d5378);
  box-shadow: inset 0 0 14px #fff2e029, 0 6px 24px #13173375;
  position: relative;
  touch-action: none;
  user-select: none;
  margin-inline: auto;
}
.stick-dot { display: block; position: absolute; left: 50%; top: 50%; width: 45px; height: 45px; border-radius: 50%; border: 1px solid #ffefdccc; background: #f8ddb284; box-shadow: 0 2px 12px #18173385; translate: -50% -50%; transform: translate(var(--stick-x, 0px), var(--stick-y, 0px)); pointer-events: none; }
.touch-only { display: none; }
.touch-label { margin-top: 7px; text-align: center; }
#gift-action { position: absolute; left: 50%; bottom: max(38px, calc(env(safe-area-inset-bottom) + 12px)); translate: -50%; display: grid; justify-items: center; white-space: nowrap; gap: 5px; }
#gift-action small { color: #fff1dc; text-shadow: 0 1px 6px #120e2d; }

.modal { place-items: center; background: #16173185; backdrop-filter: blur(7px); }
.panel { width: min(100%, 480px); padding: clamp(22px, 6vw, 52px); text-align: center; border: 1px solid #fbe3b67c; border-radius: 25px; background: radial-gradient(ellipse at 50% 0%, #5c466d, #272541 76%); box-shadow: 0 16px 55px #151129a8, inset 0 0 22px #ffe2b910; }
.panel h2 { font-size: clamp(2.45rem, 7vw, 4.5rem); }
.panel .pill { margin-top: 22px; }
.reward { place-items: end center; background: linear-gradient(0deg, #15172fe8 0%, #15172f5e 23%, transparent 50%); }
.reward-panel { padding: clamp(14px, 2.5vh, 26px) clamp(16px, 4vw, 35px); }
.reward-panel h2 { font-size: clamp(1.75rem, 5vw, 2.8rem); }
.reward-panel .pill { margin-top: 12px; }
.result { margin: 9px 0 0; color: #ffeabd; font-weight: 700; font-variant-numeric: tabular-nums; }
.reward-note { margin: 3px 0 0; color: #f9e8de; font-size: .9rem; }
@media (max-height: 480px) and (min-width: 600px) {
  .reward { place-items: center end; background: linear-gradient(270deg, #15172fc7, transparent 55%); }
  .reward-panel { width: min(46%, 350px); }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 650px) and (orientation: portrait) {
  .backdrop { background-image: url('art/winter-tall.webp'); background-position: center; }
  #game[data-state='welcome'] .vignette { background: linear-gradient(0deg, #141630fa, #1b1d3677 49%, #22244008 87%); }
  .welcome { align-items: end; }
  .hero { margin: 0 0 min(6vh, 38px); }
  h1 { font-size: clamp(3.45rem, 12vw, 5.45rem); }
  .subtitle { margin: 17px 0 19px; }
}
@media (pointer: coarse), (max-width: 760px) {
  .touch-only { display: block; }
  .desktop-only { display: none !important; }
  #gift-action { left: auto; right: var(--edge); translate: none; bottom: max(28px, calc(env(safe-area-inset-bottom) + 12px)); }
}
@media (max-height: 430px) {
  .hero { margin: 0; }
  h1 { font-size: clamp(2.9rem, 8vw, 4.5rem); }
  .subtitle { margin: 11px 0 14px; }
  #stick { width: 86px; height: 86px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
