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

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface2: #eeeeee;
  --border: #d8d8d8;
  --text: #111111;
  --text-muted: #777777;
  --accent: #111111;
  --accent-hover: #333333;
  --green: #2a2a2a;
  --red: #c0392b;
  --yellow: #555555;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 60px;
}

/* ── Shared buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s, transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover:not(:disabled) { background: var(--surface2); border-color: #bbb; }

.btn--danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn--danger:hover:not(:disabled) { background: #a93226; }

.btn--muted { background: var(--red); color: #fff; border-color: var(--red); }
.btn--muted:hover:not(:disabled) { background: #a93226; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); font-weight: 500; }
.btn--ghost:hover { color: var(--text); }

/* ── Landing page ────────────────────────────────────────────── */

.landing {
  max-width: 480px;
  width: 100%;
  padding-top: 20px;
}

.landing-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 48px;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.landing-logo-icon {
  width: 36px; height: 36px;
  background: var(--text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.landing-hero h1 {
  font-size: 34px; font-weight: 800; line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.landing-sub {
  font-size: 15px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 28px;
}

.btn--xl { padding: 14px 32px; font-size: 16px; width: 100%; }

.features {
  margin: 32px 0;
  display: flex; flex-direction: column; gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.feature-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.feature-item:last-child { border-bottom: none; }
.feature-glyph { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; margin-top: 1px; }
.feature-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.feature-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 13px;
  margin: 24px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s;
}
.join-row input:focus { border-color: var(--accent); }
.join-row input::placeholder { color: var(--text-muted); }

/* ── App logo (shared) ───────────────────────────────────────── */

.app-logo-link {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text); cursor: pointer;
}
.app-logo-link:hover { opacity: 0.75; }
.app-logo-icon {
  width: 44px; height: 44px; background: var(--text);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.app-logo-name { font-size: 20px; font-weight: 800; line-height: 1.2; display: block; }
.app-logo-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; display: block; }

/* ── Room page ───────────────────────────────────────────────── */

.room { max-width: 640px; width: 100%; }

.room-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.room-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.room-id {
  font-size: 12px; color: var(--text-muted);
  background: var(--surface2);
  padding: 3px 10px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.peers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.peer {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.peer.connected { border-color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.peer-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.peer-icon { font-size: 28px; margin-bottom: 10px; }
.peer-status { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.peer.connected .peer-status { color: var(--text); font-weight: 500; }

.spectrum-canvas { display: block; width: 100%; height: 60px; border-radius: 6px; background: #0d0d0d; }

.invite-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.invite-box p { font-size: 12px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-box .btn { white-space: nowrap; flex-shrink: 0; }

.controls { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 20px; }

.btn--record {
  background: var(--accent); color: #fff; border-color: var(--accent);
  padding: 15px 40px; font-size: 16px;
  border-radius: 50px; width: 100%;
}
.btn--record:hover:not(:disabled) { background: var(--accent-hover); }

.btn--stop {
  background: var(--surface); color: var(--red); border: 1.5px solid var(--red);
  padding: 15px 40px; font-size: 16px;
  border-radius: 50px; width: 100%;
}
.btn--stop:hover:not(:disabled) { background: #fdf0f0; }

.timer {
  font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; color: var(--text);
}

.status-text { font-size: 14px; color: var(--text-muted); text-align: center; }
.status-text.recording { color: var(--red); }
.status-text.uploading { color: var(--yellow); }
.status-text.done { color: var(--text); font-weight: 500; }

.track-status {
  font-size: 12px; color: var(--text-muted); text-align: center;
  margin-top: 6px; padding: 6px 12px;
  background: var(--surface2); border-radius: 6px; line-height: 1.8;
  white-space: pre-line;
}

.solo-info {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  margin-bottom: 8px;
}
.solo-info-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.solo-info strong { color: var(--text); }

.rec-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--red); border-radius: 50%;
  animation: blink 1s step-start infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Downloads ───────────────────────────────────────────────── */

.downloads {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.downloads h3 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }

.download-btn {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: border-color 0.12s, background 0.12s;
}
.download-btn:hover { border-color: var(--text); background: var(--bg); }
.download-btn .track-label { color: var(--text-muted); font-size: 11px; }

.master-section { margin-bottom: 2px; }

.jingle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
@media (max-width: 420px) { .jingle-row { grid-template-columns: 1fr; } }

.jingle-slot {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface);
}
.jingle-slot--filled { border-color: var(--accent); }

.jingle-slot__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-bottom: 6px;
}
.jingle-slot__title { font-size: 12px; font-weight: 700; color: var(--text); }

.jingle-remove {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 13px; line-height: 1;
  padding: 2px 4px; border-radius: 6px;
}
.jingle-remove:hover { color: var(--red); background: var(--surface2); }

.jingle-pick {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 12px; color: var(--accent);
  padding: 6px 8px; border: 1px dashed var(--border); border-radius: 8px;
}
.jingle-pick:hover { border-color: var(--accent); background: var(--surface2); }
.jingle-pick__text { font-weight: 600; }
.jingle-slot--filled .jingle-pick { border-style: solid; }

.btn--master {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius);
  border-color: var(--accent);
  font-size: 14px;
}
.btn--master:hover:not(:disabled) { background: var(--accent-hover); }

.master-info { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 6px; }

.room-header-right { display: flex; align-items: center; gap: 10px; }
.room-login { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.room-login:hover { color: var(--accent); }
.room-switch {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1;
  padding: 3px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text); text-decoration: none;
}
.room-switch:hover { border-color: var(--accent); }
.room-switch__sub { font-size: 9px; color: var(--text-muted); font-weight: 400; }

.sn-publish { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.sn-publish .btn { width: 100%; }
.sn-publish .master-info a { color: var(--accent); }
.sn-publish__pitch { font-size: 14px; margin: 0 0 10px; }

.jingle-lib { margin: 10px 0 2px; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.jingle-lib__head { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.jingle-lib__hint { font-weight: 400; color: var(--text-muted); }
.jingle-lib__row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--surface2); font-size: 13px; }
.jingle-lib__row:first-child { border-top: none; }
.jingle-lib__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jingle-lib__dur { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.jingle-lib__btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 6px;
  font-size: 11px; padding: 3px 8px; cursor: pointer; white-space: nowrap;
}
.jingle-lib__btn:hover { border-color: var(--accent); }
.jingle-lib__btn.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.jingle-save { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin: 8px 0 0; cursor: pointer; }

.btn--leave { padding: 6px 14px; font-size: 13px; }

.sn-copy-under { width: 100%; margin: -6px 0 14px; }

.speed-row { margin: 10px 0 12px; }
.speed-row__label { display: block; font-size: 13px; margin-bottom: 4px; }
.speed-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.speed-row__hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.download-btn--accent { border-color: var(--text); }
.download-btn--accent:hover { background: var(--bg); }

.downloads-raw { display: flex; flex-direction: column; gap: 8px; }
.downloads-raw-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-top: 2px; margin-bottom: 2px;
}

/* ── Share row ───────────────────────────────────────────────── */

.share-row { display: flex; gap: 10px; }
.share-row .btn { flex: 1; }

/* ── Transcription ───────────────────────────────────────────── */

.transcribe-section { margin-top: 6px; }

.btn--transcribe {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  width: 100%;
  padding: 13px;
  border-radius: var(--radius);
  font-size: 14px;
}
.btn--transcribe:hover:not(:disabled) { background: var(--bg); border-color: var(--text); }

/* ── Cover art ───────────────────────────────────────────────── */

.cover-section { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.cover-picker-row { display: flex; align-items: center; gap: 10px; }
.cover-picker-label { font-size: 13px; color: var(--text); flex: 1; }
.cover-color-input {
  width: 44px; height: 32px; padding: 2px 3px;
  border: 1.5px solid var(--border); border-radius: 6px;
  cursor: pointer; background: none;
}
.cover-text-row { display: flex; align-items: center; gap: 8px; }
.cover-text-input {
  flex: 1; padding: 8px 10px; font-size: 13px;
  background: var(--surface2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 6px;
  outline: none;
}
.cover-text-input:focus { border-color: var(--accent); }
.cover-text-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.btn--cover {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  width: 100%; padding: 13px;
  border-radius: var(--radius); font-size: 14px;
}
.btn--cover:hover:not(:disabled) { background: var(--bg); border-color: var(--text); }
.cover-preview { display: flex; flex-direction: column; gap: 8px; }
.cover-img {
  width: 100%; border-radius: 8px; aspect-ratio: 1 / 1;
  object-fit: cover; display: block;
}

.shownotes-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-top: 12px;
}

.sn-block { display: flex; flex-direction: column; gap: 4px; }
.sn-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 6px; }
.sn-copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 2px; cursor: pointer;
  color: var(--text-muted); opacity: 0.5; border-radius: 4px;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.sn-copy-btn:hover { opacity: 1; color: var(--text); }
.sn-copy-btn.copied { color: #4caf50; opacity: 1; }
.sn-title { font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--text); }
.sn-text { font-size: 14px; line-height: 1.6; color: var(--text); }

.sn-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.sn-list li { font-size: 14px; display: flex; align-items: flex-start; gap: 8px; }
.sn-list li::before { content: '—'; color: var(--text-muted); flex-shrink: 0; }

.sn-chapters, .sn-quotes { display: flex; flex-direction: column; gap: 6px; }

.sn-row {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 14px; line-height: 1.4;
}
.sn-time {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-muted); flex-shrink: 0; width: 38px;
}

.sn-transcript-wrap {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.sn-transcript-wrap summary {
  font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.sn-transcript-wrap summary:hover { color: var(--text); }
.sn-transcript {
  margin-top: 10px;
  font-size: 13px; line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface2);
  border-radius: 6px; padding: 12px;
  max-height: 320px; overflow-y: auto;
  font-family: inherit;
}

/* ── Listen page ─────────────────────────────────────────────── */

.listen-page { max-width: 540px; width: 100%; }

.listen-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
}
.listen-icon {
  font-size: 22px; width: 48px; height: 48px;
  background: var(--text);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.listen-title { font-size: 20px; font-weight: 700; }
.listen-room { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.player-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.waveform-wrap {
  position: relative; height: 72px;
  background: var(--surface2);
  border-radius: 8px; overflow: hidden;
}
.waveform { width: 100%; height: 100%; display: block; }
.waveform-playhead {
  position: absolute; top: 0; bottom: 0; left: 0%;
  width: 2px; background: var(--text);
  pointer-events: none;
  transform: translateX(-1px);
}
.waveform-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  background: var(--surface2);
}

.player-controls { display: flex; align-items: center; gap: 16px; }
.btn--play {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-size: 16px; flex-shrink: 0; padding: 0;
}
.btn--play:hover:not(:disabled) { background: var(--accent-hover); }

.player-progress { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.progress-track {
  height: 3px; background: var(--border); border-radius: 2px;
  position: relative; cursor: pointer; transition: height 0.1s;
}
.progress-track:hover { height: 5px; }
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--text); border-radius: 2px; pointer-events: none;
}
.progress-head {
  position: absolute; top: 50%; left: 0%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: var(--text); border-radius: 50%;
  pointer-events: none; opacity: 0; transition: opacity 0.15s;
}
.progress-track:hover .progress-head { opacity: 1; }
.player-time {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}

.player-actions { display: flex; gap: 10px; }
.player-actions .btn { flex: 1; }

.listen-back { margin-top: 20px; text-align: center; }

/* ── Shared utilities ────────────────────────────────────────── */

.hidden { display: none !important; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.spinner--dark {
  border-color: var(--border);
  border-top-color: var(--text);
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: #fdf0f0;
  border: 1.5px solid #e0b0b0;
  border-radius: 8px; padding: 12px 16px;
  color: var(--red); font-size: 13px;
  margin-bottom: 16px;
}
