:root {
  color-scheme: dark;
  --bg: #071018;
  --bg-soft: #0b1621;
  --panel: #101c28;
  --panel-2: #142231;
  --line: #26384a;
  --text: #d8e4ef;
  --muted: #8fa4b7;
  --faint: #64798b;
  --accent: #55c7e8;
  --accent-2: #2e83d6;
  --live: #ef4444;
  --warn: #f4b04f;
  --ok: #35c98f;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

body {
  min-width: 0;
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(46, 131, 214, .18), transparent 34rem),
    linear-gradient(180deg, #08131d 0%, #050b11 100%);
  color: var(--text);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 38px;
}

.status-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.topbar,
.panel {
  background: rgba(16, 28, 40, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.status-panel {
  width: min(620px, 100%);
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 17px;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
}

.badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0b1621;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.badge.live {
  border-color: rgba(239, 68, 68, .55);
  background: rgba(239, 68, 68, .16);
  color: #ffd6d6;
}

.badge.live::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--live);
  box-shadow: 0 0 14px rgba(239, 68, 68, .9);
}

.badge.starting {
  border-color: rgba(244, 176, 79, .52);
  background: rgba(244, 176, 79, .14);
  color: #ffe0aa;
}

.badge.paused,
.badge.idle {
  color: #b7c5d4;
}

.badge.connected {
  border-color: rgba(53, 201, 143, .4);
  color: #bff7df;
}

.badge.error {
  border-color: rgba(244, 176, 79, .5);
  background: rgba(244, 176, 79, .13);
  color: #ffe0aa;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.controls,
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row {
  justify-content: space-between;
}

button {
  min-height: 42px;
  border: 1px solid rgba(85, 199, 232, .45);
  border-radius: 7px;
  background: linear-gradient(180deg, #2185ba, #16618c);
  color: #f4fbff;
  padding: 0 15px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: #122335;
  color: var(--text);
  border-color: var(--line);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.small button {
  min-height: 34px;
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #0a1420;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.segmented button.active {
  background: #1e8fc3;
  color: #f7fcff;
}

a {
  max-width: 100%;
  color: #7bd9ff;
  word-break: break-word;
  display: inline-block;
  margin-bottom: 10px;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: #bfd0df;
  font-weight: 800;
}

textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #07111b;
  color: var(--text);
  padding: 11px;
  font: inherit;
  resize: vertical;
}

.note,
.audience-note {
  color: var(--muted);
  line-height: 1.45;
}

.notice {
  color: #cfe8f6;
  background: rgba(46, 131, 214, .14);
  border: 1px solid rgba(85, 199, 232, .28);
  border-radius: 7px;
  padding: 10px;
  margin-bottom: 0;
}

.notice.compact {
  margin-top: 10px;
  font-size: 14px;
}

.app-status {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(85, 199, 232, .32);
  border-radius: 7px;
  background: rgba(46, 131, 214, .13);
  color: #cfe8f6;
  font-size: 14px;
  line-height: 1.35;
}

.app-status.ok {
  border-color: rgba(53, 201, 143, .35);
  background: rgba(53, 201, 143, .11);
  color: #c8f5df;
}

.app-status.error {
  border-color: rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .14);
  color: #ffd2d2;
}

.app-status[hidden] {
  display: none;
}

.countdown-wrap {
  min-height: 0;
  margin-top: 14px;
}

.countdown {
  width: 118px;
  height: 88px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 176, 79, .5);
  border-radius: 8px;
  background: rgba(244, 176, 79, .12);
  color: #ffd28a;
  font-size: 58px;
  line-height: 1;
  font-weight: 900;
}

.countdown[hidden],
.countdown-text[hidden] {
  display: none;
}

.countdown-text {
  margin: 8px 0 0;
  color: #ffe0aa;
  font-size: 18px;
  font-weight: 800;
}

.current p {
  min-height: 82px;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.25;
  margin-bottom: 0;
}

body[data-page="audience"] .shell {
  width: min(1050px, calc(100% - 28px));
}

body[data-page="audience"] .current p {
  min-height: 110px;
  font-size: clamp(28px, 5.8vw, 56px);
}

.transcript {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.transcript li {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(38, 56, 74, .72);
  line-height: 1.55;
}

.transcript-text {
  margin: 0 0 8px;
  color: #cfdbe6;
  white-space: pre-wrap;
}

.time {
  color: var(--faint);
  font-size: 13px;
  margin-bottom: 4px;
}

canvas {
  display: block;
  width: min(420px, 100%);
  height: auto;
  margin: 14px 0;
  border: 10px solid #fff;
  border-radius: 8px;
  background: #fff;
}

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

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    display: block;
    padding: 15px;
  }

  .panel {
    padding: 15px;
  }

  .topbar-tools {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .controls,
  .row {
    align-items: stretch;
  }

  .controls > button,
  .small > button {
    flex: 1 1 auto;
  }

  .row {
    display: block;
  }

  .row .controls {
    margin-top: 10px;
  }

  .current p,
  body[data-page="audience"] .current p {
    min-height: 76px;
    font-size: 28px;
  }

  .countdown {
    width: 100%;
    height: 84px;
  }
}
