:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #141a22;
  --surface-2: #1b232e;
  --border: #283340;
  --text: #eef3f8;
  --muted: #96a3b3;
  --accent: #6ee7b7;
  --accent-strong: #34d399;
  --danger: #fb7185;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(52, 211, 153, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: min(100% - 32px, 720px);
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(110, 231, 183, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.28);
  color: var(--accent);
}
.brand-mark svg { width: 19px; height: 19px; }

.tag {
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
}

main { flex: 1; }

/* Setup */
.panel {
  background: linear-gradient(180deg, var(--surface), #111720);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 44px);
  box-shadow: var(--shadow);
}

.intro { margin-bottom: 30px; }

h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.16;
  letter-spacing: -0.035em;
  font-weight: 680;
}

.intro p {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 15px;
}

form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }

label {
  font-size: 13px;
  font-weight: 560;
  color: #cbd5e1;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e141b;
  color: var(--text);
  font: inherit;
  letter-spacing: 0.01em;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder { color: #617083; }
input:focus-visible {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.room-row { display: flex; gap: 10px; }
.room-row input { text-transform: uppercase; letter-spacing: 0.08em; }
.room-row .ghost { flex: 0 0 48px; width: 48px; height: 48px; padding: 0; }

.field-hint { margin: 0; color: var(--muted); font-size: 12px; }

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.10);
  border: 1px solid rgba(251, 113, 133, 0.28);
  color: #fda4af;
  font-size: 13px;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  transition: transform 120ms ease, background-color 150ms ease, border-color 150ms ease;
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.primary {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  background: var(--accent-strong);
  color: #06231a;
  font-weight: 650;
}
.primary:hover:not(:disabled) { background: var(--accent); }
.primary svg { width: 19px; height: 19px; }

.ghost {
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #cbd5e1;
  padding: 0 14px;
}
.ghost:hover { border-color: #3d4c5d; color: #fff; }
.ghost svg { width: 19px; height: 19px; }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

/* Call */
.call { display: grid; gap: 18px; }

.call-panel {
  background: linear-gradient(180deg, var(--surface), #10161e);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 44px);
  box-shadow: var(--shadow);
  text-align: center;
}

.call-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid var(--border);
}
.badge.connected { color: var(--accent); background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.3); }
.badge.failed { color: #fda4af; background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.3); }

.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 34px;
  font-weight: 600;
  text-transform: uppercase;
}

.call-panel h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.02em; }
.call-hint { margin: 0; color: var(--muted); font-size: 13px; }

.share {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  justify-items: center;
}
.share-label { color: var(--muted); font-size: 12px; }
.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.share-row code {
  font: 600 15px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
  padding: 11px 14px;
  border-radius: 10px;
  background: #0e141b;
  border: 1px solid var(--border);
}

.controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.control {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 560;
}
.control:hover { border-color: #3d4c5d; }
.control svg { width: 20px; height: 20px; }
.control.danger { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.34); color: #fda4af; }
.control.danger:hover { background: rgba(251, 113, 133, 0.2); }
.control .icon-muted { display: none; }
.control[aria-pressed="true"] { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
.control[aria-pressed="true"] .icon-muted { display: block; }
.control[aria-pressed="true"] .icon-mic { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Transcription */
.transcript {
  background: linear-gradient(180deg, var(--surface), #10161e);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.transcript-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.transcript-head h3 { margin: 0 0 3px; font-size: 15px; letter-spacing: -0.01em; }
.transcript-head p { margin: 0; color: var(--muted); font-size: 12px; }
.transcript-actions { display: flex; align-items: center; gap: 8px; }

select {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.transcript-actions .ghost { min-height: 36px; font-size: 13px; }

.transcript-warning {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.10);
  border: 1px solid rgba(251, 191, 36, 0.26);
  color: #fcd34d;
  font-size: 12px;
}

.transcript-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  overscroll-behavior: contain;
}

.transcript-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

.entry { display: grid; gap: 3px; animation: entry-in 180ms ease-out; }
.entry-meta { display: flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--muted); }
.entry-speaker { font-weight: 650; color: var(--accent); }
.entry.remote .entry-speaker { color: #93c5fd; }
.entry p { margin: 0; font-size: 14px; line-height: 1.5; }
.entry.interim p { color: var(--muted); font-style: italic; }

@keyframes entry-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 28px;
  color: #5f6d7d;
  font-size: 12px;
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--muted); }

@media (max-width: 480px) {
  .app { width: min(100% - 20px, 720px); }
  .topbar { padding: 18px 0 24px; }
  .tag { display: none; }
  .panel, .call-panel { padding: 22px 18px; border-radius: 20px; }
  .control { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
