:root {
  --bg: #eef6ff;
  --surface: #ffffff;
  --surface-soft: #f5f9ff;
  --surface-line: #d8e7fb;
  --ink: #0e2543;
  --muted: #617a99;
  --accent: #2488ff;
  --accent-strong: #006eff;
  --viewer-bg: #091726;
  --viewer-top: #0d1d31;
  --shadow: 0 24px 60px rgba(12, 49, 102, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
}

.shell {
  display: grid;
  grid-template-columns: clamp(320px, 20vw, 420px) minmax(0, 1fr);
  width: 100vw;
  min-height: 100vh;
}

.side-panel {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
  border-right: 1px solid var(--surface-line);
}

.settings-card {
  display: grid;
  gap: 0;
  min-height: calc(100vh - 48px);
  padding: 10px 0;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-section {
  padding: 18px 18px 20px;
  border-top: 1px solid var(--surface-line);
}

.settings-section:first-child {
  border-top: 0;
  padding-top: 16px;
}

.brand-block h1,
.stage-copy h2 {
  margin: 0;
  letter-spacing: -0.05em;
}

.brand-block h1 {
  font-size: clamp(2.15rem, 3.2vw, 3rem);
  line-height: 0.95;
}

.lede,
.section-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 18px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #dcebff;
  color: var(--accent-strong);
  border: 1px solid #c1dbff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.field:first-child {
  margin-top: 0;
}

.field-label,
.diag-label,
.state-label,
.status-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field-input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.action {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    background 140ms ease;
}

.action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action.primary {
  background: var(--accent);
  color: #ffffff;
}

.action.secondary {
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--surface-line);
}

.action.compact {
  padding: 11px 13px;
  font-size: 0.92rem;
}

.talkback-head,
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.compact-state-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.state-item {
  padding: 12px 13px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--surface-line);
}

.state-item strong {
  display: block;
  margin-top: 6px;
  font-size: 0.98rem;
}

.mini-meta {
  display: grid;
  gap: 10px;
}

.meta-row strong {
  max-width: 58%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden-meta {
  display: none;
}

.remote-audio-canvas {
  display: block;
  width: 100%;
  height: 68px;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  background: #0d1828;
  border: 1px solid #17355e;
}

.remote-audio-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.remote-audio-footer strong {
  margin-right: auto;
}

.stage-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--viewer-top) 0%, var(--viewer-bg) 100%);
}

.stage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(187, 214, 255, 0.12);
}

.stage-copy h2 {
  color: #f3f8ff;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.95;
}

.stage-copy .eyebrow {
  color: #8dc0ff;
}

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

.stage-actions .action.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(185, 214, 255, 0.16);
  color: #eaf3ff;
}

.video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #020913;
}

#remoteVideo {
  display: block;
  width: 100%;
  height: 100%;
  background: #020913;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 36px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(3, 12, 23, 0.54);
  text-align: center;
}

.video-placeholder[hidden] {
  display: none !important;
}

.video-frame:fullscreen {
  width: 100%;
  height: 100vh;
  border-radius: 0;
}

.video-frame:fullscreen #remoteVideo,
.video-frame:fullscreen .video-placeholder {
  border-radius: 0;
}

@media (min-width: 1800px) {
  .shell {
    grid-template-columns: 420px minmax(0, 1fr);
  }

  .settings-card {
    min-height: calc(100vh - 56px);
  }

  .side-panel {
    padding: 28px;
  }

  .stage-topbar {
    padding: 22px 28px;
  }
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    min-height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--surface-line);
  }

  .settings-card {
    min-height: auto;
  }

  .stage-shell {
    min-height: auto;
  }
}

@media (max-width: 860px) {
  .compact-state-list,
  .control-row {
    grid-template-columns: 1fr;
  }

  .stage-topbar {
    align-items: start;
    flex-direction: column;
  }

  .stage-actions {
    width: 100%;
  }
}
