:root,
[data-theme="dark"] {
  --bg-top: #0d0d0e;
  --bg-mid: #151517;
  --bg-bottom: #111113;
  --bg-elevated: #1c1c1f;
  --bg-hover: #252529;
  --stage-glow: rgba(229, 50, 64, 0.1);
  --stage-wash: rgba(255, 255, 255, 0.025);
  --fg: #f5f5f5;
  --fg-muted: #9c9ca4;
  --fg-dim: #6f6f78;
  --rule: rgba(255, 255, 255, 0.11);
  --rule-strong: rgba(255, 255, 255, 0.24);
  --rule-dashed: rgba(255, 255, 255, 0.16);
  --red: #e53240;
  --red-hover: #f24452;
  --red-text: #ff5c68;
  --red-soft: rgba(229, 50, 64, 0.14);
  --red-border: rgba(229, 50, 64, 0.42);
  --red-glow: rgba(229, 50, 64, 0.34);
  --modal-bg: #171719;
  --backdrop: rgba(8, 8, 9, 0.8);
  --grain-opacity: 0.035;
}

[data-theme="light"] {
  --bg-top: #fafafa;
  --bg-mid: #f1f1f0;
  --bg-bottom: #eaeae8;
  --bg-elevated: #ffffff;
  --bg-hover: #e5e5e4;
  --stage-glow: rgba(217, 38, 56, 0.065);
  --stage-wash: rgba(0, 0, 0, 0.02);
  --fg: #111111;
  --fg-muted: #52525b;
  --fg-dim: #767680;
  --rule: rgba(0, 0, 0, 0.11);
  --rule-strong: rgba(0, 0, 0, 0.26);
  --rule-dashed: rgba(0, 0, 0, 0.18);
  --red: #d92638;
  --red-hover: #bd1b2b;
  --red-text: #c81e2f;
  --red-soft: rgba(217, 38, 56, 0.1);
  --red-border: rgba(217, 38, 56, 0.38);
  --red-glow: rgba(217, 38, 56, 0.24);
  --modal-bg: #ffffff;
  --backdrop: rgba(17, 17, 17, 0.48);
  --grain-opacity: 0.025;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg-mid);
  background-image:
    radial-gradient(ellipse 75% 42% at 50% 0%, var(--stage-glow), transparent 72%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  transition: color 0.2s ease, background-color 0.2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden {
  display: none !important;
}

button,
input,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---------- Persistent Top Navigation ---------- */

.site-nav {
  position: relative;
  z-index: 10;
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wave-emblem {
  color: var(--fg);
  flex-shrink: 0;
}

.brand-wordmark {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-sub {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red-text);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-actions,
.nav-room-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.room-code-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.room-code-tag strong {
  color: var(--fg);
}

.theme-btn {
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--rule);
  background: var(--stage-wash);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-btn:hover {
  border-color: var(--rule-strong);
  background: var(--bg-hover);
}

/* ---------- Buttons & Shared Controls ---------- */

.btn-primary {
  padding: 12px 22px;
  border-radius: 8px;
  background: var(--red);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--red-hover);
  box-shadow: 0 8px 24px var(--red-glow);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline {
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--rule);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-outline:hover {
  border-color: var(--rule-strong);
  background: var(--stage-wash);
}

.btn-ghost {
  padding: 7px 11px;
  border-radius: 7px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
  color: var(--fg);
  background: var(--stage-wash);
}

.btn-xs {
  padding: 6px 12px;
  font-size: 12px;
}

/* ---------- Shared Page Container ---------- */

.page-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

.chalk-rule {
  border: 0;
  border-top: 1px dashed var(--rule-dashed);
  margin: 28px 0;
}

.callout-strip {
  margin: 0;
  border-left: 2px solid var(--red);
  padding: 4px 0 4px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.callout-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  border-left: 2px solid var(--red);
  background: var(--red-soft);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg);
}

.banner-actions {
  display: flex;
  gap: 8px;
}

/* ---------- Landing / Join Screen ---------- */

.join-screen {
  max-width: 600px;
  padding-top: 48px;
}

.hero-block {
  width: 100%;
}

.hero-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin-bottom: 18px;
}

.hero-wave span {
  width: 3px;
  border-radius: 2px;
  background: var(--fg-dim);
  opacity: 0.45;
}

.hero-wave span:nth-child(1),
.hero-wave span:nth-child(13) { height: 6px; }
.hero-wave span:nth-child(2),
.hero-wave span:nth-child(12) { height: 12px; }
.hero-wave span:nth-child(3),
.hero-wave span:nth-child(11) { height: 18px; }
.hero-wave span:nth-child(4),
.hero-wave span:nth-child(10) { height: 10px; }
.hero-wave span:nth-child(5),
.hero-wave span:nth-child(9) { height: 22px; opacity: 0.7; }
.hero-wave span:nth-child(6),
.hero-wave span:nth-child(8) { height: 15px; opacity: 0.85; }
.hero-wave span:nth-child(7) {
  height: 28px;
  background: var(--red);
  opacity: 1;
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.underline-tabs {
  display: flex;
  gap: 24px;
  margin: 28px 0 22px;
  border-bottom: 1px solid var(--rule);
}

.underline-tab {
  padding: 10px 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.underline-tab:hover {
  color: var(--fg);
}

.underline-tab.active {
  color: var(--fg);
  border-bottom-color: var(--red);
}

.open-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

.open-field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.open-field input {
  width: 100%;
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  color: var(--fg);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}

.open-field input:focus {
  border-bottom-color: var(--red);
}

.code-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-line input {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cta-wrap {
  margin-top: 8px;
}

.btn-cta {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
}

.cta-whisper {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--fg-dim);
  text-align: center;
}

.chalk-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.chalk-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.step-num {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--red);
}

.chalk-step p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-muted);
}

/* ---------- Active Room Screen ---------- */

.room-screen {
  max-width: 820px;
  padding-top: 24px;
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.mode-tabs {
  display: flex;
  gap: 22px;
}

.tab-btn {
  padding: 10px 2px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--fg);
}

.tab-btn.active {
  color: var(--fg);
  border-bottom-color: var(--red);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
}

.badge.good {
  color: var(--fg);
  border-color: var(--rule-strong);
}

.badge.good .dot {
  background: var(--red);
}

.badge.warn {
  color: var(--fg-muted);
}

.badge.warn .dot {
  background: var(--fg-dim);
}

.badge.bad {
  color: var(--red-text);
  border-color: var(--red-border);
  background: var(--red-soft);
}

.badge.bad .dot {
  background: var(--red);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Open Sync Stage Hero ---------- */

.pulse-stage {
  padding: 20px 0 8px;
  background: radial-gradient(ellipse 70% 80% at 50% 35%, var(--stage-glow), transparent 72%);
  transition: filter 0.2s ease;
}

.pulse-stage.flash {
  background: radial-gradient(ellipse 80% 90% at 50% 35%, var(--red-soft), transparent 74%);
}

.sync-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 68px;
  margin-bottom: 24px;
}

.sync-wave span {
  width: 4px;
  border-radius: 999px;
  background: var(--fg);
  opacity: 0.25;
  transform-origin: center;
  animation: wave-idle 2.8s ease-in-out infinite;
  transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.sync-wave span:nth-child(1),
.sync-wave span:nth-child(21) { height: 12px; animation-delay: 0.0s; }
.sync-wave span:nth-child(2),
.sync-wave span:nth-child(20) { height: 20px; animation-delay: 0.15s; }
.sync-wave span:nth-child(3),
.sync-wave span:nth-child(19) { height: 32px; animation-delay: 0.3s; }
.sync-wave span:nth-child(4),
.sync-wave span:nth-child(18) { height: 18px; animation-delay: 0.45s; }
.sync-wave span:nth-child(5),
.sync-wave span:nth-child(17) { height: 42px; opacity: 0.45; animation-delay: 0.6s; }
.sync-wave span:nth-child(6),
.sync-wave span:nth-child(16) { height: 26px; opacity: 0.45; animation-delay: 0.75s; }
.sync-wave span:nth-child(7),
.sync-wave span:nth-child(15) { height: 50px; opacity: 0.65; animation-delay: 0.9s; }
.sync-wave span:nth-child(8),
.sync-wave span:nth-child(14) { height: 34px; opacity: 0.65; animation-delay: 1.05s; }
.sync-wave span:nth-child(9),
.sync-wave span:nth-child(13) { height: 56px; opacity: 0.85; animation-delay: 1.2s; }
.sync-wave span:nth-child(10),
.sync-wave span:nth-child(12) { height: 40px; opacity: 0.85; animation-delay: 1.35s; }
.sync-wave span.center-bar {
  height: 64px;
  width: 5px;
  background: var(--red);
  opacity: 1;
  animation-delay: 1.5s;
}

@keyframes wave-idle {
  0%, 100% { transform: scaleY(0.86); }
  50% { transform: scaleY(1.08); }
}

.sync-wave.pulsing span {
  background: var(--red);
  opacity: 1;
  transform: scaleY(1.22);
}

.sync-wave.live-audio span {
  animation: none;
  transition: height 0.05s linear, background 0.08s ease, opacity 0.08s ease;
}

.spectrum-canvas {
  display: block;
  width: 100%;
  height: 36px;
  margin-bottom: 14px;
}

.files-drop-zone {
  border: 1px dashed transparent;
  border-radius: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.files-drop-zone.dragover {
  border-color: var(--red);
  background: var(--red-soft);
  padding: 12px;
}

.track-bar {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.track-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.track-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  word-break: break-word;
}

.track-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.progress-rail {
  width: 100%;
  height: 2px;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: var(--red);
  transition: width 0.15s ease;
}

.transport-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.track-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
  min-width: 82px;
}

.seek-slider {
  flex: 1;
  min-width: 130px;
  margin: 0;
}

.telemetry-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.telemetry-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.t-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}

.t-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.engine-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
}

.chalk-whisper-note {
  margin: 14px 0 0;
  font-size: 13px;
  font-style: italic;
  color: var(--fg-dim);
  line-height: 1.5;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.panel-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.55;
}

.cast-controls,
.remote-bar,
.request-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.cast-status-line {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.inline-chalk-input {
  flex: 1;
  min-width: 180px;
  padding: 9px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.inline-chalk-input:focus {
  border-bottom-color: var(--red);
}

.remote-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: #000000;
}

.remote-player-wrap iframe,
.remote-player-wrap > div {
  width: 100%;
  height: 100%;
}

/* ---------- Open Song Requests ---------- */

.requests-list {
  display: flex;
  flex-direction: column;
}

.request-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.request-item:first-child {
  border-top: 1px solid var(--rule);
}

.request-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.upvote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  transition: all 0.15s ease;
}

.upvote-btn:hover {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.upvote-btn.voted {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red-text);
}

.request-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  word-break: break-word;
}

.request-by {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
}

.request-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.request-link {
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-decoration: none;
}

.request-link:hover {
  border-color: var(--red);
  color: var(--fg);
}

.bg-alert-text {
  color: var(--red-text);
  font-weight: 700;
}

/* ---------- Open Speaker Tuning ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-muted);
}

.offset-readout {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--red-text);
}

.chalk-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--rule-strong);
  border-radius: 999px;
  outline: none;
  margin: 10px 0 16px;
  cursor: pointer;
}

.chalk-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg-mid);
  box-shadow: 0 0 0 1px var(--red);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.chalk-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.chalk-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg-mid);
  box-shadow: 0 0 0 1px var(--red);
  cursor: pointer;
}

.nudge-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.nudge-btn {
  padding: 7px 4px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.nudge-btn:hover {
  border-color: var(--red);
  color: var(--fg);
}

.tuning-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  transition: all 0.15s ease;
}

.role-btn:hover {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.role-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.dsp-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dsp-toggle {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  transition: all 0.15s ease;
}

.dsp-toggle:hover {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.dsp-toggle.active {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red-text);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.volume-slider {
  width: 110px;
  margin: 0;
}

.vol-readout {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
  width: 38px;
  text-align: right;
}

/* ---------- Open Live Device Roster ---------- */

.roster-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.roster-list {
  display: flex;
  flex-direction: column;
}

.roster-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.roster-item:first-child {
  border-top: 1px solid var(--rule);
}

.roster-peer-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roster-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.tag {
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.tag.host {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red-text);
}

.tag.you {
  border-color: var(--rule-strong);
  color: var(--fg);
}

.roster-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.roster-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-select {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-strong);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  outline: none;
}

.role-select:focus {
  border-color: var(--red);
}

.stage-footer {
  margin-top: 28px;
  font-size: 12px;
  color: var(--fg-dim);
  text-align: center;
  line-height: 1.5;
}

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--modal-bg);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.qr-frame {
  width: 226px;
  height: 226px;
  margin: 0 auto 16px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.qr-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.modal-field {
  margin-bottom: 14px;
}

.modal-field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.modal-field input,
.modal-field select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--bg-mid);
  border: 1px solid var(--rule-strong);
  color: var(--fg);
  font-size: 13px;
  outline: none;
}

.modal-field input:focus,
.modal-field select:focus {
  border-color: var(--red);
}

.copy-row {
  display: flex;
  gap: 8px;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* ---------- Mobile Responsiveness ---------- */

@media (max-width: 640px) {
  .site-nav {
    padding: 12px 16px;
  }

  .brand-sub {
    display: none;
  }

  .page-wrap {
    padding: 24px 16px 44px;
  }

  .open-form-grid,
  .chalk-steps {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .telemetry-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .engine-tag {
    margin-left: 0;
    width: 100%;
  }

  .sync-wave {
    gap: 4px;
  }
}
