/* Tailgate Audio — built to be readable in direct sunlight in a parking lot.
   High contrast, huge hit target, no thin type. */

:root {
  --bg: #0e0f12;
  --fg: #ffffff;
  --muted: #9aa1ad;
  --accent: #ff7a1a;
  --live: #34d17a;
  --warn: #ffc23d;
  --err: #ff5c5c;
  --hit: min(62vw, 260px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 600 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  text-align: center;
}

.head h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
.head .sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 500;
}

/* The button. Deliberately enormous — this gets tapped with a thumb,
   possibly with gloves on, without looking at the screen. */
.play {
  width: var(--hit);
  height: var(--hit);
  border-radius: 50%;
  border: 6px solid var(--accent);
  background: transparent;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}
.play:active { transform: scale(0.96); }
.play:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }

.glyph {
  width: 45%;
  height: 45%;
  fill: currentColor;
}
.glyph-stop { display: none; }

/* playing / connecting states swap the glyph */
body.on .glyph-play { display: none; }
body.on .glyph-stop { display: block; }

body.live .play {
  background: rgba(52, 209, 122, 0.12);
  border-color: var(--live);
  color: var(--live);
}
body.connecting .play,
body.stalled .play {
  border-color: var(--warn);
  color: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}
body.error .play {
  border-color: var(--err);
  color: var(--err);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .play { animation: none !important; transition: none; }
}

.state {
  margin: 0;
  font-size: 1.15rem;
  min-height: 1.4em;
}
body.live .state { color: var(--live); }
body.connecting .state,
body.stalled .state { color: var(--warn); }
body.error .state { color: var(--err); }

.listeners {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  min-height: 1.4em;
}

/* ---- Party sync ------------------------------------------------------
   Only surfaced when several speakers are playing in the same space.
   Deliberately quiet: a remote listener should never notice it exists. */

.sync {
  width: min(100%, 380px);
  margin-top: -0.5rem;
}

.synclink {
  display: block;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.synclink:active { color: var(--fg); }

.syncpanel {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid #23262d;
  border-radius: 14px;
  background: #14161a;
  text-align: left;
}

.synchelp {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
}

.syncrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
.syncrow output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}

/* Big track + big thumb — this gets dragged with a thumb, outdoors. */
.slider {
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.slider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 5px;
  background: #2a2e37;
}
.slider::-moz-range-track {
  height: 10px;
  border-radius: 5px;
  background: #2a2e37;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #14161a;
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #14161a;
  cursor: pointer;
}

.nudge {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.nbtn {
  flex: 1;
  padding: 0.85rem 0.4rem;
  border-radius: 10px;
  border: 1px solid #2a2e37;
  background: #1b1e24;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  touch-action: manipulation;
}
.nbtn:active { background: #262a32; }

.syncnote {
  margin: 0.85rem 0 0;
  color: var(--warn);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
  min-height: 1em;
}
