/* Last modified: 2026-08-19--2102
   Floodlit pitch. Deep turf, mown stripes, pitch-line white, and one warm
   sodium-amber accent that is only ever spent on "this is live". */

:root {
  --turf-deep: #0b2016;
  --turf: #12301f;
  --turf-raised: #173b27;
  --line: #e8f0e6;
  --line-dim: rgba(232, 240, 230, 0.42);
  --floodlight: #f2c14e;
  --fault: #e5484d;
  --ink: #0b2016;

  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1rem, 4vw, 1.75rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--turf-deep);
  color: var(--line);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  /* The stick is a drag surface; letting the page pan under the thumb makes
     the ball stutter every time you steer. */
  touch-action: manipulation;
}

/* Mown stripes: the groundskeeper's pass, not a gradient for decoration. */
.pitch {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(
      104deg,
      rgba(255, 255, 255, 0.022) 0 64px,
      rgba(0, 0, 0, 0.03) 64px 128px
    ),
    radial-gradient(120% 80% at 50% -10%, #1c4a30 0%, var(--turf-deep) 62%);
}

.console {
  max-width: 30rem;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter)
    max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Status strip ─────────────────────────────────────────────────────── */

.strip {
  border-bottom: 1px solid var(--line-dim);
  padding-bottom: 0.6rem;
}

.strip__eyebrow {
  margin: 0 0 0.3rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--line-dim);
}

.strip__readout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.strip__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strip__battery {
  color: var(--line-dim);
  font-variant-numeric: tabular-nums;
}

.lamp {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex: none;
  background: var(--line-dim);
}

.lamp[data-state="live"] {
  background: var(--floodlight);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.18), 0 0 12px rgba(242, 193, 78, 0.7);
}

.lamp[data-state="busy"] {
  background: var(--floodlight);
  animation: pulse 1s ease-in-out infinite;
}

.lamp[data-state="fault"] {
  background: var(--fault);
  box-shadow: 0 0 10px rgba(229, 72, 77, 0.6);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* ── Stage: the stick is the centre circle ────────────────────────────── */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.stage__demo[hidden] {
  display: none;
}

.stage__demo {
  width: 100%;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line-dim);
  border-radius: 4px;
  display: block;
}

.stick {
  position: relative;
  width: min(72vw, 17rem);
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  background: radial-gradient(circle at 50% 50%, rgba(232, 240, 230, 0.05), transparent 70%);
  transition: box-shadow 160ms ease;
}

.stick.is-active {
  cursor: grabbing;
  box-shadow: 0 0 0 1px var(--floodlight), 0 0 34px rgba(242, 193, 78, 0.28);
}

/* The halfway line runs through the centre circle, as it does on a pitch. */
.stick__halfway {
  position: absolute;
  top: 50%;
  left: -18%;
  width: 136%;
  height: 1px;
  background: var(--line-dim);
}

.stick__spot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--line-dim);
}

.stick__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5.2rem;
  height: 5.2rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #ffffff 0%, #dfe6dc 58%, #b9c4b6 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* The pentagon that makes it a ball rather than a dot. */
.stick__knob::after {
  content: "";
  position: absolute;
  inset: 34%;
  background: var(--ink);
  clip-path: polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%);
}

.stick:not(.is-active) .stick__knob {
  transition: transform 220ms cubic-bezier(0.22, 1.4, 0.4, 1);
}

@media (prefers-reduced-motion: reduce) {
  .stick:not(.is-active) .stick__knob {
    transition: none;
  }
  .lamp[data-state="busy"] {
    animation: none;
  }
}

.telemetry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: 100%;
  margin: 0;
  background: var(--line-dim);
  border: 1px solid var(--line-dim);
}

.telemetry__cell {
  background: var(--turf);
  padding: 0.5rem 0.65rem 0.6rem;
}

.telemetry dt {
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--line-dim);
}

.telemetry dd {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Notice ───────────────────────────────────────────────────────────── */

.notice {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--floodlight);
  background: rgba(242, 193, 78, 0.08);
  font-size: 0.92rem;
  line-height: 1.45;
}

.notice[data-tone="fault"] {
  border-left-color: var(--fault);
  background: rgba(229, 72, 77, 0.1);
}

/* ── Deck ─────────────────────────────────────────────────────────────── */

.deck {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.deck__actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.btn {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--line);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.btn:focus-visible {
  outline: 2px solid var(--floodlight);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--floodlight);
  border-color: var(--floodlight);
  color: var(--ink);
}

.btn--primary:not(:disabled):hover {
  background: #f7cf6d;
}

.btn--stop {
  border-color: var(--fault);
  color: var(--fault);
}

.btn--stop:not(:disabled):hover {
  background: var(--fault);
  color: var(--line);
}

.btn--ghost:not(:disabled):hover {
  background: rgba(232, 240, 230, 0.1);
}

.aim {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.aim .btn {
  flex: none;
  min-width: 7rem;
}

.aim__hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--line-dim);
}

.channel {
  display: grid;
  grid-template-columns: 6.5rem 1fr 3.2rem;
  align-items: center;
  gap: 0.7rem;
}

.channel__label {
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--line-dim);
}

.channel__value {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.channel__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2rem;
  background: transparent;
  cursor: pointer;
}

.channel__slider::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line-dim);
}

.channel__slider::-moz-range-track {
  height: 2px;
  background: var(--line-dim);
}

.channel__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.6rem;
  height: 1.6rem;
  margin-top: -0.79rem;
  border-radius: 50%;
  background: var(--line);
  border: none;
}

.channel__slider::-moz-range-thumb {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--line);
  border: none;
}

.channel__slider:focus-visible {
  outline: 2px solid var(--floodlight);
  outline-offset: 4px;
}

.channel--swatches {
  grid-template-columns: 6.5rem 1fr;
}

.swatches {
  display: flex;
  gap: 0.55rem;
}

.swatch {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid rgba(232, 240, 230, 0.3);
  cursor: pointer;
  padding: 0;
}

.swatch[aria-pressed="true"] {
  border-color: var(--line);
  box-shadow: 0 0 0 2px var(--turf-deep), 0 0 0 3px var(--line);
}

.swatch:focus-visible {
  outline: 2px solid var(--floodlight);
  outline-offset: 3px;
}

/* ── Log ──────────────────────────────────────────────────────────────── */

.log {
  border-top: 1px solid var(--line-dim);
  padding-top: 0.8rem;
}

.log__summary {
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--line-dim);
  cursor: pointer;
}

.log__controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--line-dim);
  cursor: pointer;
}

.toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--floodlight);
  flex: none;
}

.log__body {
  margin: 0;
  max-height: 13rem;
  overflow: auto;
  padding: 0.7rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--line-dim);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Wide screens: telemetry beside the stick ─────────────────────────── */

@media (min-width: 56rem) and (orientation: landscape) {
  .console {
    max-width: 62rem;
    display: grid;
    grid-template-columns: 1fr 22rem;
    grid-template-areas:
      "strip strip"
      "stage deck"
      "notice deck"
      "log log";
    align-items: start;
    column-gap: 2.5rem;
  }

  .strip {
    grid-area: strip;
  }
  .stage {
    grid-area: stage;
  }
  .notice {
    grid-area: notice;
  }
  .deck {
    grid-area: deck;
  }
  .log {
    grid-area: log;
  }

  /* Both the pitch and the stick want to be as big as the column. Left to
     themselves they push the telemetry off the bottom of a laptop screen. */
  .stage__demo {
    aspect-ratio: 16 / 9;
    max-height: 13rem;
  }

  .stick {
    width: min(38vw, 14rem);
  }
}
