:root {
  --ink: #0b1220;
  --surface: #121b2d;
  --surface-2: #182338;
  --line: #263450;
  --paper: #eef1f7;
  --muted: #8a97b3;
  --signal: #35d0a3;
  --signal-dim: #1f6650;
  --pulse: #f2c14e;
  --radius: 14px;
  --serif: 'Fraunces', serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.035) 1px, transparent 0);
  background-size: 3px 3px;
}

.view { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- Landing ---------- */
.landing-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12vh 24px 60px;
  text-align: left;
}

.kicker {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--signal);
  margin: 0 0 18px;
}

.headline {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.04;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}
.headline em { font-style: italic; color: var(--signal); }

.sub {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  max-width: 46ch;
  margin: 0 0 48px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.card h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 8px;
}
.card p {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--signal); color: #06251c; width: 100%; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
}
.btn-text {
  background: none;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 13.5px;
}
.btn-text:hover { color: var(--paper); }

#form-join { display: flex; gap: 10px; }
.code-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  font-size: 15px;
  text-transform: uppercase;
}
.code-input:focus { outline: 2px solid var(--signal); outline-offset: 1px; }

.error {
  color: #f28b82;
  font-size: 13.5px;
  min-height: 18px;
  margin-top: 18px;
}

/* ---------- Room ---------- */
.room-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 0;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.room-id-block { display: flex; flex-direction: column; gap: 4px; }
.room-id-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.room-id {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--signal);
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pulse);
  display: inline-block;
}
.dot.ok { background: var(--signal); }
.listeners { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 30px 24px 60px;
}

.disc {
  position: relative;
  width: min(280px, 68vw);
  height: min(280px, 68vw);
  display: flex;
  align-items: center;
  justify-content: center;
}
#ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 4; }
.ring-progress {
  fill: none;
  stroke: var(--signal);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 578;
  stroke-dashoffset: 578;
  transition: stroke-dashoffset 0.15s linear;
}
.disc-center { text-align: center; padding: 0 20px; }
.track-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  word-break: break-word;
}
.time-label {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.host-controls {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.upload-drop:hover, .upload-drop.drag { border-color: var(--signal); color: var(--paper); }

.transport {
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-round {
  width: 52px; height: 52px;
  border-radius: 50%;
  font-size: 17px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
input[type="range"] {
  flex: 1;
  accent-color: var(--signal);
  height: 4px;
  background: var(--line);
}

.listener-note {
  max-width: 340px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.room-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px 26px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.latency-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .ring-progress { transition: none; }
  .btn { transition: none; }
}
