/* Race controls are centered in the scene and stay put through every attempt. */
html { scroll-padding-top: 10px; }
body { padding-bottom: env(safe-area-inset-bottom); background: #edf3f6; overflow-anchor: none; }
.shell { position: relative; }
.masthead { height: 68px; }
.intro { padding: 20px 0 22px; }
h1 { font-size: clamp(30px, 4vw, 44px); margin: 9px 0; }
.game { box-shadow: 0 12px 40px #183d3820; border-color: #c4d5d0; }
.scene { scroll-margin-top: 10px; height: clamp(320px, calc(100svh - 250px), 520px); }
.start-landscape { object-position: center 48%; }
.scene-tools { display: flex; align-items: center; gap: 10px; }
.scene-top { z-index: 10; }
.scene-top .icon-button { pointer-events: auto; width: 42px; height: 42px; border-color: #ffffffd9; background: #f8fcffe8; box-shadow: 0 2px 10px #24433220; }
.scene-top .icon-button[aria-pressed=true] { background: #dcefdc; border-color: #8cba96; }
.skier-wrap { height: 220px; width: calc(220px * var(--frame-aspect)); bottom: 142px; }
.ski-shadow { bottom: 158px; }
.snow-burst { bottom: 146px; }
.signal-display { top: 105px; right: calc(50% - 206px); }
.race-controls { position: absolute; z-index: 9; left: 50%; bottom: 34px; transform: translateX(-50%); width: min(360px, calc(100% - 48px)); display: flex; flex-direction: column; align-items: center; gap: 9px; pointer-events: none; }
.race-controls__label { max-width: 100%; border-radius: 30px; background: #ffffffec; color: #315748; box-shadow: 0 2px 8px #22463615; padding: 7px 14px; font-size: 12px; font-weight: 700; text-align: center; }
.race-controls .action { height: 60px; width: 100%; pointer-events: auto; box-shadow: 0 4px 0 #104e34, 0 6px 24px #132e3540; border: 1px solid #ffffff6b; }
.race-controls .action:disabled { opacity: .88; }
.game-controls { padding: 14px 22px 8px; }
.status-row { min-height: 42px; margin-bottom: 0; }
.status-row h2 { font-size: 16px; }
.status-row p { font-size: 11px; }
.result-overlay { background: #edf5f0cc; backdrop-filter: blur(2px); padding: 40px 14px 130px; }
.result-caption { text-align: center; }
.game[data-state=waiting] .race-controls__label { color: #9c3d2c; }
.game[data-state=go] .race-controls__label { color: #08733b; }
.game[data-state=launching] #action-arrow { display: none; }
.stats { padding: 18px 0; }
.toast { bottom: max(22px, env(safe-area-inset-bottom)); z-index: 40; }
.sponsor-banner { margin: 8px 0 18px; }
@media (min-width: 1280px) {
  .advertising--top { grid-row: 1; }
  .intro { grid-row: 2; }
  .game, .sponsor-rails { grid-row: 3; }
  .stats { grid-row: 4; }
  .how-it-works { grid-row: 5; }
  .sponsor-banner { grid-row: 6; }
}
@media (max-width: 640px) {
  .shell { padding: 0 12px; }
  .masthead { height: 56px; }
  .intro { padding: 16px 0 18px; }
  h1 { font-size: 28px; margin: 7px 0; }
  .intro p { font-size: 10px; }
  .eyebrow { font-size: 8px; }
  .scene { height: clamp(280px, calc(100svh - 250px), 520px); }
  .scene-top { top: 12px; left: 12px; right: 12px; }
  .scene-label { font-size: 7px; padding: 7px 8px; }
  .scene-tools { gap: 6px; }
  .round-label { font-size: 6px; padding: 6px; }
  .scene-top .icon-button { width: 36px; height: 36px; }
  .skier-wrap { height: clamp(138px, 27svh, 204px); width: calc(clamp(138px, 27svh, 204px) * var(--frame-aspect)); bottom: 130px; }
  .ski-shadow { bottom: 144px; }
  .snow-burst { bottom: 134px; }
  .signal-display { right: 10px; top: 85px; }
  .race-controls { bottom: 30px; width: min(300px, calc(100% - 44px)); gap: 7px; }
  .race-controls .action { height: 54px; font-size: 18px; }
  .race-controls__label { font-size: 10px; padding: 6px 11px; }
  .game-controls { padding: 12px 14px 6px; }
  .status-row { min-height: 42px; }
  .status-row h2 { font-size: 14px; }
  .status-row p { font-size: 10px; }
  .control-hint { min-height: 30px; }
  .result-overlay { padding-bottom: 126px; padding-top: 54px; }
  #result-value { font-size: 78px; }
  .result-caption { font-size: 12px; }
  .scene-bottom { bottom: 10px; }
  .stats { padding: 16px 0; }
}
@media (max-height: 660px) and (max-width: 640px) {
  .scene { min-height: 280px; }
  .skier-wrap { height: 128px; width: calc(128px * var(--frame-aspect)); bottom: 102px; }
  .ski-shadow { bottom: 112px; }
  .snow-burst { bottom: 106px; }
  .race-controls { bottom: 24px; gap: 5px; }
  .race-controls .action { height: 48px; font-size: 16px; }
  .race-controls__label { font-size: 9px; padding: 4px 10px; }
  .signal-display { top: 68px; right: 6px; }
  .signal { gap: 7px; padding: 7px; }
  .lamp { height: 16px; width: 16px; }
  .result-overlay { padding-top: 40px; padding-bottom: 108px; }
  #result-value { font-size: 64px; }
  .game[data-state=early] #result-value, .game[data-state=slow] #result-value, .game[data-state=paused] #result-value { font-size: 42px; }
}
@media (max-height: 520px) and (min-width: 641px) {
  .scene { height: calc(100svh - 24px); min-height: 280px; }
  .skier-wrap { height: 145px; width: calc(145px * var(--frame-aspect)); bottom: 115px; }
  .ski-shadow { bottom: 128px; }
  .snow-burst { bottom: 118px; }
  .signal-display { top: 66px; }
  .race-controls { bottom: 26px; }
  .race-controls .action { height: 48px; }
  .race-controls__label { font-size: 10px; padding: 5px 10px; }
}
/* Anchor the independent racer to the doorway in each background composition. */
.skier-wrap { height: 40%; width: auto; aspect-ratio: .75; bottom: 32%; }
.ski-shadow { bottom: 33%; }
.snow-burst { bottom: 32%; }
@media (max-width: 640px) {
  .skier-wrap { height: 29%; width: auto; aspect-ratio: .75; bottom: 40%; }
  .ski-shadow { bottom: 41%; width: 65px; }
  .snow-burst { bottom: 40%; }
}

/* One server total for every player; personal records above remain local. */
.community-counter { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 15px 0 0; padding: 16px 20px; border: 1px solid #cbded5; border-radius: 14px; background: #e4eee9; }
.community-counter__label { font: 800 14px/1.4 var(--display); }
.community-counter p { margin: 4px 0 0; font-size: 10px; line-height: 1.5; color: #667c70; }
.community-counter strong { flex-shrink: 0; font: 800 28px/1 var(--display); color: #146541; font-variant-numeric: tabular-nums; }
@media (min-width: 1280px) {
  .community-counter { grid-row: 5; }
  .how-it-works { grid-row: 6; }
  .sponsor-banner { grid-row: 7; }
  .sponsor-partner { grid-row: 8; }
  .advertising--bottom { grid-row: 9; }
}
@media (max-width: 640px) {
  .community-counter { padding: 13px 14px; gap: 12px; }
  .community-counter__label { font-size: 12px; }
  .community-counter p { font-size: 9px; }
  .community-counter strong { font-size: 25px; }
}

/* A labelled sound switch makes race audio easy to find and mute. */
.scene-top .sound-toggle { display: flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-width: 116px; padding: 0 12px; border-radius: 24px; }
.sound-toggle span { font-size: 10px; font-weight: 700; white-space: nowrap; }
.sound-toggle svg { flex: 0 0 18px; }
@media (max-width: 640px) {
  .scene-tools .round-label { display: none; }
  .scene-top .sound-toggle { min-width: 108px; padding: 0 10px; }
  .sound-toggle span { font-size: 9px; }
}
