:root {
  --bg: #0b0d11;
  --panel: #141821;
  --panel-2: #1b202b;
  --line: #262c3a;
  --text: #eef1f6;
  --muted: #8b94a7;
  --accent: #ff8a3d;
  --good: #35d07f;
  --bad: #ff5d5d;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- speaker page ---------------- */

.host {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.pair {
  font-size: 14px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.card + .card {
  margin-top: 20px;
}

.card h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 600;
}

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

button.record {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #1a1200;
  font: inherit;
  font-weight: 650;
  font-size: 15px;
  padding: 12px 22px;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

button.record:hover:not(:disabled) {
  filter: brightness(1.08);
}

button.record:disabled {
  opacity: 0.5;
  cursor: default;
}

button.record.live {
  background: var(--bad);
  color: #fff;
}

.meter {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--good), var(--accent));
  transition: width 0.08s linear;
}

.state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.on {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(53, 208, 127, 0.15);
}

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

.transcript {
  min-height: 76px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
}

.transcript.english {
  color: var(--text);
  font-size: 19px;
}

.transcript .interim {
  opacity: 0.6;
}

.transcript.english div + div {
  margin-top: 8px;
}

.qr {
  text-align: center;
}

.qr img {
  width: 100%;
  max-width: 260px;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.qr .url {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.qr .viewers {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
}

.hint {
  margin-top: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.error {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 93, 93, 0.12);
  border: 1px solid rgba(255, 93, 93, 0.35);
  color: #ffb3b3;
  font-size: 13px;
  display: none;
}

/* ---------------- phone page ---------------- */

.view {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  background: #000;
  overflow: hidden;
}

.view .status {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c6472;
}

.lines {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lines p {
  margin: 0;
  font-size: clamp(26px, 6.4vw, 46px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  transition: opacity 0.3s ease;
}

.lines p.old {
  opacity: 0.32;
  font-size: clamp(20px, 4.4vw, 32px);
  font-weight: 500;
}

.lines p.interim {
  color: #cfd6e4;
}

.idle {
  color: #5c6472;
  font-size: 17px;
  font-weight: 400;
  text-align: center;
  margin: auto 0;
}
