/* ============================================================================
   SKEETLABS — SHARED STYLES  (the home page lives in home.css)

   BRAND PALETTE. Four colors; every other shade is a lighter or darker version
   of one of them, so nothing here is an arbitrary one-off:

     PINE   field green      #1D5C3E   page backgrounds, key caps, headers
     CLAY   target orange    #FF6B1A   the primary action, selected states, the logo X
     CREAM  paper            #F8EDD3   cards and light text
     SKY    open sky         #5EB8E6   the second accent, preview backdrops

   Rules the whole UI follows: solid fills only (no black boxes, no hairline
   borders — structure comes from color blocks and gaps); chunky rounded
   shapes; a solid "ledge" shadow under things you can press.
   ============================================================================ */

:root {
  --pine: #1D5C3E;
  --pine-deep: #144530;
  --pine-ink: #0C2A1C;       /* text on light surfaces */
  --pine-hover: #26704C;

  --clay: #FF6B1A;
  --clay-deep: #D94F08;
  --clay-hover: #FF8244;
  --clay-soft: #FFD9C2;

  --cream: #F8EDD3;
  --sand: #EDDCB0;           /* blocks sitting on a cream card */
  --sand-soft: #F2E6C4;
  --sand-deep: #DCC68F;      /* tracks, pressed states */

  --sky: #5EB8E6;
  --sky-deep: #2F8CBF;
  --sky-soft: #CFEBF8;

  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  color: var(--pine-ink);
  font-family: var(--font-ui);
}

canvas {
  display: block;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 4px solid var(--pine-ink);
  outline-offset: 3px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.menu-button {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--pine);
  color: var(--cream);
  font: 800 15px/1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--pine-deep);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.12s ease-out;
}

.menu-button:hover {
  background: var(--pine-hover);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--pine-deep);
}

.menu-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--pine-deep);
}

.menu-button.primary {
  background: var(--clay);
  color: var(--pine-ink);
  box-shadow: 0 5px 0 var(--clay-deep);
}

.menu-button.primary:hover {
  background: var(--clay-hover);
  box-shadow: 0 7px 0 var(--clay-deep);
}

.menu-button.primary:active {
  box-shadow: 0 1px 0 var(--clay-deep);
}

/* ============================================================================
   PAGES  (Settings, Controls, Customizer): their own full screens.
   A solid pine page, one cream card with a pine header, a scrolling body and a
   footer that stays put — so Back is always reachable, however long the list.
   ============================================================================ */

.page {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--pine);
}

.page-card {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: 100%;
  background: var(--cream);
  color: var(--pine-ink);
  border-radius: 28px;
  box-shadow: 0 10px 0 var(--pine-deep);
  overflow: hidden;
}

.page-card--wide {
  width: min(1080px, 100%);
}

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding: 16px 26px;
  background: var(--pine-deep);
  color: var(--cream);
}

.page-head h1 {
  font: 900 22px/1 var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 26px 12px;
  scrollbar-color: var(--sand-deep) transparent;
}

.page-foot {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
  padding: 16px 26px 22px;
  background: var(--cream);
  border-top: 4px solid var(--sand);
}

.page-foot .menu-button {
  flex: 1;
}

/* ============================================================================
   SETTINGS CONTROLS
   Every setting is a solid sand block on the cream card.
   ============================================================================ */

.setting-group,
.setting-row {
  margin-bottom: 12px;
  padding: 14px 16px 16px;
  background: var(--sand);
  border-radius: 18px;
  text-align: left;
}

.setting-label {
  margin-bottom: 12px;
  color: var(--pine);
  font: 800 12px/1 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.note {
  margin-top: 10px;
  color: var(--pine);
  font: 600 13px/1.45 var(--font-ui);
  text-align: left;
}

/* On/off rows render as a switch. The checkbox comes first in the markup, so the
   row is reversed to put the label on the left and the switch on the right. */
.setting-row {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  font: 700 16px/1.2 var(--font-ui);
  cursor: pointer;
}

.setting-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 54px;
  height: 32px;
  margin: 0;
  border-radius: 999px;
  background: var(--sand-deep);
  cursor: pointer;
  transition: background 0.14s ease-out;
}

.setting-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 2px 0 rgba(12, 42, 28, 0.28);
  transition: transform 0.14s ease-out;
}

.setting-row input[type="checkbox"]:checked {
  background: var(--clay);
}

.setting-row input[type="checkbox"]:checked::after {
  transform: translateX(22px);
}

.segmented-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--sand-deep);
  border-radius: 15px;
}

.segment-btn {
  flex: 1;
  padding: 11px 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--pine-ink);
  font: 800 14px/1 var(--font-ui);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.1s ease-out;
}

.segment-btn:hover {
  background: var(--sand);
}

.segment-btn.selected {
  background: var(--clay);
  box-shadow: 0 3px 0 var(--clay-deep);
}

/* Sliders: a sand track and a clay knob. */
.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 30px;
  background: transparent;
  cursor: pointer;
}

.settings-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: var(--sand-deep);
}

.settings-slider::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: var(--sand-deep);
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--clay);
  border: 5px solid var(--cream);
  box-shadow: 0 3px 0 var(--clay-deep);
}

.settings-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--clay);
  border: 5px solid var(--cream);
  box-shadow: 0 3px 0 var(--clay-deep);
}

/* Time of Day: the track shows the sky going from day to night, which is the
   preview the old see-through settings screen used to give. */
#time-of-day-slider::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--sky-soft), var(--sky) 38%, #2A5A8C 72%, #0F2347);
}

#time-of-day-slider::-moz-range-track {
  background: linear-gradient(90deg, var(--sky-soft), var(--sky) 38%, #2A5A8C 72%, #0F2347);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  color: var(--pine);
  font: 700 12px/1 var(--font-ui);
}

/* A setting that drops open beneath its parent (the Lead Guide under Shot Mode).
   Closed = no height, invisible, and not focusable. */
.sub-setting {
  overflow: hidden;
  max-height: 80px;
  margin-top: 10px;
  padding: 0 14px;
  background: var(--cream);
  border-radius: 14px;
  opacity: 1;
  visibility: visible;
  transition: max-height 0.2s ease-out, opacity 0.2s ease-out, margin-top 0.2s ease-out,
    visibility 0s linear 0s;
}

.sub-setting .setting-row {
  margin: 0;
  padding: 12px 0;
  background: transparent;
  border-radius: 0;
}

.sub-setting.collapsed {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.2s ease-out, opacity 0.2s ease-out, margin-top 0.2s ease-out,
    visibility 0s linear 0.2s;
}

/* ============================================================================
   SWATCHES
   ============================================================================ */

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 6px 8px;
}

.swatch {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(12, 42, 28, 0.22), 0 3px 0 rgba(12, 42, 28, 0.2);
  transition: transform 0.08s ease-out;
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch.selected {
  box-shadow: 0 0 0 3px var(--sand), 0 0 0 7px var(--pine-ink);
}

/* ============================================================================
   CUSTOMIZER
   ============================================================================ */

.customizer-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.customizer-tab {
  padding: 11px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--sand);
  color: var(--pine-ink);
  font: 800 14px/1 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s ease-out;
}

.customizer-tab:hover {
  background: var(--sand-deep);
}

.customizer-tab.selected {
  background: var(--clay);
  box-shadow: 0 4px 0 var(--clay-deep);
}

.customizer-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 8px;
}

.customizer-controls {
  flex: 1;
  min-width: 0;
}

/* The live preview sits on a solid sky panel (the preview canvas is transparent). */
.customizer-preview {
  position: sticky;
  top: 0;
  width: 440px;
  height: 460px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--sky-soft);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--sky-deep);
}

.customizer-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 920px) {
  .customizer-layout {
    flex-direction: column-reverse;
  }

  .customizer-preview {
    position: static;
    width: 100%;
    height: 320px;
  }
}

/* ============================================================================
   CONTROLS (key bindings)
   ============================================================================ */

.keybind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 8px 8px 8px 18px;
  background: var(--sand);
  border-radius: 15px;
  font: 700 15px/1.2 var(--font-ui);
  text-align: left;
}

.keybind-sub {
  margin-left: 20px;
  background: var(--sand-soft);
  font-size: 14px;
}

.keybind-subhead {
  margin: 14px 4px 8px;
  color: var(--pine);
  font: 800 11px/1 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: left;
}

.key-cap {
  min-width: 124px;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  background: var(--pine);
  color: var(--cream);
  font: 800 12px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--pine-deep);
  transition: transform 0.08s ease-out, background 0.1s ease-out;
}

.key-cap:hover {
  background: var(--pine-hover);
  transform: translateY(-1px);
}

.key-cap.listening {
  background: var(--clay);
  color: var(--pine-ink);
  box-shadow: 0 3px 0 var(--clay-deep);
  animation: key-pulse 0.9s ease-in-out infinite;
}

@keyframes key-pulse {
  50% {
    transform: translateY(-2px);
  }
}

.key-cap-static {
  background: var(--sand-deep);
  color: var(--pine-ink);
  box-shadow: none;
  cursor: default;
}

.key-cap-static:hover {
  background: var(--sand-deep);
  transform: none;
}

/* Feedback line ("Fire: RIGHT CLICK. Swapped with Aim Down Sights."). Reserves two
   lines so nothing below it jumps as the message changes. */
#keybind-status {
  min-height: 3.2em;
  margin: 10px 4px 6px;
}

/* ============================================================================
   IN-GAME OVERLAYS (paused, round complete): these sit OVER the field, under a
   pine veil, so the round is still visible behind the card.
   ============================================================================ */

.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 69, 48, 0.78);
}

.screen-panel {
  min-width: 320px;
  max-width: 420px;
  margin-top: 36px;
  padding: 0 34px 30px;
  background: var(--cream);
  color: var(--pine-ink);
  border-radius: 28px;
  box-shadow: 0 10px 0 var(--pine-deep);
  text-align: center;
}

.screen-panel.small {
  min-width: 240px;
  margin-top: 0;
  padding: 22px 30px 24px;
}

.screen-panel h1 {
  margin-bottom: 16px;
  color: var(--pine);
  font: 900 24px/1 var(--font-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.screen-panel p {
  font: 800 17px/1.3 var(--font-ui);
  color: var(--pine-ink);
}

.screen-panel .menu-button {
  margin-bottom: 14px;
}

.screen-panel .menu-button:last-child {
  margin-bottom: 0;
}

/* The brand mark pops out over the top edge of the card. */
.panel-mark {
  display: block;
  width: 76px;
  height: 76px;
  margin: -38px auto 14px;
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--pine-deep);
}

.score-line {
  color: var(--pine);
  font: 800 13px/1 var(--font-ui);
  letter-spacing: 0.24em;
}

.score-value {
  margin: 6px 0 24px;
  color: var(--clay-deep);
  font: 900 60px/1 var(--font-mono);
}

/* ============================================================================
   IN-GAME HUD
   ============================================================================ */

#hud {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 15;
  padding: 11px 20px 13px 26px;
  background: var(--pine);
  border-radius: 18px;
  box-shadow: inset 8px 0 0 var(--clay), 0 5px 0 var(--pine-deep);
  pointer-events: none;
}

.hud-line {
  color: var(--sand);
  font: 700 14px/1.65 var(--font-ui);
  white-space: nowrap;
}

.hud-line--primary {
  color: var(--cream);
  font: 900 17px/1.5 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-line--secondary {
  font-size: 14px;
}

#hit-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 22;
  transform: translate(-50%, -50%) scale(0.8);
  color: var(--clay);
  font: 900 22px/1 var(--font-ui); /* was 30px: a little smaller */
  letter-spacing: 0.14em;
  -webkit-text-stroke: 4.5px var(--pine-ink);
  paint-order: stroke fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out, transform 0.1s ease-out;
}

#hit-indicator.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ============================================================================
   ONE PLAYER OR TWO
   The picker that pops up over the home page, the player label in the HUD, the
   "Player 2's turn" pop-up, and the two-player results. Player 1 is clay orange,
   Player 2 is sky blue, everywhere.
   ============================================================================ */

.picker-panel {
  width: min(640px, 100%);
  min-width: 0;
  max-width: 640px;
  padding: 0 30px 30px;
}

.picker-mode {
  display: inline-block;
  margin-bottom: 12px;
  padding: 8px 20px 7px;
  border-radius: 999px;
  font: 900 13px/1 var(--font-ui);
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.picker-mode--skeet {
  background: var(--clay);
  color: var(--pine-ink);
  box-shadow: 0 4px 0 var(--clay-deep);
}

.picker-mode--trap {
  background: var(--pine);
  color: var(--cream);
  box-shadow: 0 4px 0 var(--pine-deep);
}

.picker-mode--practice {
  background: var(--sky);
  color: var(--pine-ink);
  box-shadow: 0 4px 0 var(--sky-deep);
}

.picker-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 6px 0 26px;
}

.choice {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px 22px;
  border: 0;
  border-radius: 26px;
  font-family: var(--font-ui);
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

.choice--one {
  background: var(--clay);
  color: var(--pine-ink);
  box-shadow: 0 8px 0 var(--clay-deep);
}

.choice--two {
  background: var(--pine);
  color: var(--cream);
  box-shadow: 0 8px 0 var(--pine-deep);
}

.choice:hover {
  transform: translateY(-4px);
}

.choice--one:hover {
  box-shadow: 0 12px 0 var(--clay-deep);
}

.choice--two:hover {
  box-shadow: 0 12px 0 var(--pine-deep);
}

.choice:active {
  transform: translateY(6px);
}

.choice--one:active {
  box-shadow: 0 2px 0 var(--clay-deep);
}

.choice--two:active {
  box-shadow: 0 2px 0 var(--pine-deep);
}

.choice-icon {
  display: block;
  width: 92px;
  height: auto;
}

.choice-name {
  font: 900 26px/1 var(--font-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.choice-sub {
  max-width: 21ch;
  font: 700 14px/1.35 var(--font-ui);
  text-wrap: balance;
}

@media (max-width: 560px) {
  .picker-choices {
    grid-template-columns: 1fr;
  }
}

/* In the HUD: whose turn it is, when there are two players. */
.hud-chip {
  display: inline-block;
  margin: 2px 0 6px;
  padding: 5px 14px 4px;
  border-radius: 999px;
  color: var(--pine-ink);
  font: 900 12px/1.2 var(--font-ui);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hud-chip[data-player="0"] {
  background: var(--clay);
}

.hud-chip[data-player="1"] {
  background: var(--sky);
}

.hud-chip[data-player="practice"] {
  background: var(--cream);
}

/* In practice: the keys that drive it (they follow whatever you've set in Controls). */
.hud-hints {
  margin-top: 8px;
}

.hud-line--hint {
  color: var(--sand);
  font: 700 12px/1.6 var(--font-ui);
  letter-spacing: 0.02em;
  opacity: 0.92;
}

/* The "Player 2's turn" pop-up: slides in near the top, never takes a click. */
#turn-banner {
  position: fixed;
  top: 15%;
  left: 50%;
  z-index: 24;
  transform: translate(-50%, -14px) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.22s cubic-bezier(0.2, 1.4, 0.4, 1);
}

#turn-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.turn-card {
  min-width: 300px;
  padding: 0 32px 20px;
  overflow: hidden;
  background: var(--cream);
  color: var(--pine-ink);
  border-radius: 26px;
  /* an outline as well as the ledge: the pop-up sits over the sky, and a sky-blue Player 2 header
     would otherwise melt into it */
  box-shadow: 0 0 0 4px var(--pine-deep), 0 9px 0 4px var(--pine-deep);
  text-align: center;
}

.turn-badge {
  margin: 0 -32px 14px;
  padding: 13px 0 12px;
  color: var(--pine-ink);
  font: 900 32px/1 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.turn-card[data-player="0"] .turn-badge {
  background: var(--clay);
}

.turn-card[data-player="1"] .turn-badge {
  background: var(--sky);
}

.turn-title {
  color: var(--pine);
  font: 900 14px/1 var(--font-ui);
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.turn-station {
  margin-top: 9px;
  font: 900 24px/1.1 var(--font-ui);
  letter-spacing: 0.06em;
}

.turn-sub {
  margin-top: 9px;
  color: var(--pine);
  font: 800 14px/1.3 var(--font-mono);
}

/* Two-player results. */
.final-headline {
  margin: 0 0 16px;
  color: var(--clay-deep);
  font: 900 28px/1.1 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.screen-panel.wide {
  min-width: 410px;
}

.final-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 26px;
}

.final-player {
  padding: 15px 10px 14px;
  background: var(--sand);
  border-radius: 18px;
}

.final-player.winner {
  background: var(--cream);
  box-shadow: 0 0 0 4px var(--clay);
}

.final-player-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--pine);
  font: 900 12px/1 var(--font-ui);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.final-player-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--pine-ink);
}

.final-player[data-player="0"] .final-player-dot {
  background: var(--clay);
}

.final-player[data-player="1"] .final-player-dot {
  background: var(--sky);
}

.final-player-score {
  margin-top: 10px;
  color: var(--clay-deep);
  font: 900 30px/1 var(--font-mono);
  white-space: nowrap;
}

/* ============================================================================
   LOADING + ERROR
   ============================================================================ */

#loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 24px;
  background: var(--sky);
}

#loading.hidden {
  display: none;
}

.loading-logo {
  width: min(806px, 82.5vw);
  height: auto;
  aspect-ratio: 1316 / 300;
}

.loading-track {
  width: min(340px, 64vw);
  height: 16px;
  overflow: hidden;
  background: var(--cream);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--pine-deep);
}

.loading-bar {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--clay);
  border-radius: 999px;
  animation: loading-slide 1.1s ease-in-out infinite;
}

@keyframes loading-slide {
  from {
    transform: translateX(-105%);
  }
  to {
    transform: translateX(270%);
  }
}

.loading-text {
  max-width: 440px;
  color: var(--pine-ink);
  font: 800 16px/1.4 var(--font-ui);
  text-align: center;
}

.noscript-note {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--sky);
  color: var(--pine-ink);
  font: 800 18px/1.4 var(--font-ui);
  text-align: center;
}

#fatal-error {
  position: fixed;
  inset: 0;
  z-index: 999;
  padding: 40px;
  overflow: auto;
  background: var(--cream);
  color: var(--pine-ink);
  font-family: var(--font-mono);
}

#fatal-error.hidden {
  display: none;
}

#fatal-error h2 {
  margin-bottom: 16px;
  color: var(--clay-deep);
  font: 900 26px/1.2 var(--font-ui);
}

#fatal-error pre {
  padding: 18px 20px;
  background: var(--sand);
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Respect "reduce motion": no animation, no sliding transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* ============================================================================
   COMPETITIVE MODE: the game pop-up, the setup page, the leaderboard
   ============================================================================ */

.picker-mode--competitive {
  background: var(--pine-ink);
  color: var(--cream);
  box-shadow: 0 4px 0 #061A10;
}

.hud-chip[data-player="competitive"] {
  background: var(--clay);
}

/* what is the same for everyone */
.comp-rules {
  margin-bottom: 12px;
  padding: 14px 16px 12px;
  background: var(--pine-ink);
  color: var(--cream);
  border-radius: 18px;
}

.comp-rules-title {
  margin-bottom: 8px;
  color: var(--clay);
  font: 900 12px/1 var(--font-ui);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.comp-rules ul {
  margin: 0;
  padding-left: 18px;
  font: 700 14px/1.55 var(--font-ui);
}

/* the leaderboard */
.lb-list {
  margin: 14px 0 6px;
  padding: 0;
  list-style: none;
  counter-reset: lb;
}

.lb-row {
  display: grid;
  grid-template-columns: 2.6em 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 10px 14px;
  background: var(--sand);
  border-radius: 14px;
  font: 800 15px/1.2 var(--font-ui);
}

.lb-row.mine {
  background: var(--clay-soft);
  box-shadow: inset 0 0 0 3px var(--clay);
}

.lb-rank {
  color: var(--pine);
  font: 900 15px/1 var(--font-mono);
}

.lb-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  color: var(--clay-deep);
  font: 900 17px/1 var(--font-mono);
}

.lb-empty {
  margin: 14px 0 6px;
  padding: 18px 14px;
  background: var(--sand);
  border-radius: 14px;
  text-align: center;
  font: 700 14px/1.4 var(--font-ui);
}

.lb-status {
  margin: 0 0 12px;
}

/* a name box with a Save button beside it */
.name-edit {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.name-edit .menu-button {
  width: auto;
  flex: 0 0 auto;
  padding-left: 22px;
  padding-right: 22px;
}

.name-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 3px solid var(--sand-deep);
  border-radius: 12px;
  background: var(--cream);
  color: var(--pine-ink);
  font: 800 16px/1 var(--font-ui);
}

.name-input:focus {
  outline: none;
  border-color: var(--clay);
}

/* on the results screen, under the score */
.final-competitive {
  margin: 0 0 18px;
  padding: 14px 14px 16px;
  background: var(--sand);
  border-radius: 18px;
  text-align: center;
}

.final-competitive .menu-button {
  margin-bottom: 0;
}

.final-competitive > .menu-button {
  margin-top: 12px;
}

.final-rank {
  margin-bottom: 4px;
  color: var(--pine);
  font: 900 18px/1.2 var(--font-ui);
}

.final-board-note {
  margin: 0 0 10px;
  min-height: 1.2em;
  color: var(--pine);
  font: 700 13px/1.3 var(--font-ui);
}

/* Leaderboard: This Week / All Time tabs sit above the game tabs */
.lb-period {
  margin-bottom: 10px;
}

.lb-reset {
  margin: 10px 0 0;
  text-align: center;
}

#sound-volume { margin-top: 12px; }

#wind-intensity { margin-top: 12px; }

/* ============================================================================
   TOUCH (phones and tablets) — see touch.js
   ============================================================================ */

body.touch-mode {
  touch-action: manipulation; /* no double-tap zoom on the menus */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.touch-mode #btn-keybinds,
.touch-mode #practiceHints { display: none !important; } /* keys mean nothing on a touch screen */

#touch-ui {
  position: fixed;
  inset: 0;
  z-index: 16;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#touch-ui.hidden { display: none; }
.touch-look { position: absolute; inset: 0; touch-action: none; }

.touch-btn {
  position: absolute;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--pine);
  color: var(--cream);
  box-shadow: 0 5px 0 var(--pine-deep);
  font: 900 15px/1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  touch-action: none;
  opacity: 0.93;
  -webkit-user-select: none;
  user-select: none;
}
.touch-btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--pine-deep); }

.touch-btn--fire {
  right: max(22px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 108px;
  height: 108px;
  font-size: 20px;
  background: var(--clay);
  box-shadow: 0 6px 0 var(--clay-deep);
}
.touch-btn--fire.pressed { box-shadow: 0 1px 0 var(--clay-deep); }
.touch-btn--pull {
  right: calc(max(22px, env(safe-area-inset-right)) + 128px);
  bottom: max(34px, env(safe-area-inset-bottom));
  width: 86px;
  height: 86px;
  font-size: 16px;
}
.touch-btn--ads {
  right: max(34px, env(safe-area-inset-right));
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 124px);
  width: 76px;
  height: 76px;
  font-size: 14px;
}
.touch-btn--ads.on { background: var(--sky); color: var(--pine-ink); box-shadow: 0 5px 0 var(--pine-deep); }

#touch-menu {
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  position: absolute;
}
.touch-btn--small { height: 44px; min-width: 72px; padding: 0 16px; font-size: 13px; white-space: nowrap; }

#touch-practice {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#touch-practice.hidden { display: none; }
.touch-group { display: flex; gap: 10px; }
.touch-group.hidden { display: none; }
#touch-practice .touch-btn { position: static; }

/* A round is landscape: in portrait, ask for a turn. */
#rotate-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--pine);
  color: var(--cream);
  font: 900 22px/1.4 var(--font-ui);
}
#rotate-prompt span { display: block; margin-top: 8px; font: 700 15px/1.4 var(--font-ui); color: var(--sand); }
@media (orientation: portrait) {
  body.touch-mode.in-round #rotate-prompt { display: flex; }
}

/* Short screens (a phone on its side): a smaller HUD so the field is not covered. */
@media (max-height: 520px) {
  #hud { top: 8px; left: 8px; padding: 6px 14px 8px 20px; border-radius: 14px; box-shadow: inset 6px 0 0 var(--clay), 0 4px 0 var(--pine-deep); }
  .hud-line { font-size: 12px; line-height: 1.45; }
  .hud-line--primary { font-size: 14px; }
}

/* Short screens (a phone on its side): the Settings / Leaderboard / Customizer cards use more of the height. */
@media (max-height: 520px) {
  .page { padding: 8px 12px; }
  .page-card { width: min(760px, 100%); border-radius: 18px; box-shadow: 0 5px 0 var(--pine-deep); }
  .page-card--wide { width: min(1080px, 100%); }
  .page-head { padding: 8px 18px; gap: 10px; }
  .page-mark { width: 28px; height: 28px; border-radius: 8px; }
  .page-head h1 { font-size: 17px; }
  .page-body { padding: 12px 18px 6px; }
  .page-foot { padding: 10px 18px 12px; }
}
@media (max-height: 520px) {
  .customizer-preview { height: 150px; }
}

/* The joystick (bottom left) and the practice buttons (a row along the top). */
.touch-stick {
  position: absolute;
  left: max(26px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(248, 237, 211, 0.38);
  box-shadow: inset 0 0 0 4px rgba(29, 92, 62, 0.55), 0 5px 0 rgba(20, 69, 48, 0.55);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.touch-stick.held { background: rgba(248, 237, 211, 0.5); }
.touch-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--clay);
  box-shadow: 0 4px 0 var(--clay-deep);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#touch-practice {
  left: auto;
  bottom: auto;
  top: max(12px, env(safe-area-inset-top));
  left: max(170px, calc(env(safe-area-inset-left) + 170px));
  right: max(120px, calc(env(safe-area-inset-right) + 120px));
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}
#touch-practice .touch-btn--small { height: 40px; min-width: 0; padding: 0 12px; }
