:root {
  --bg: #f1f4f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e5e9f2;
  --line-2: #d8deea;
  --hover: #f4f6fb;
  --indigo: #4f46e5;
  --indigo-deep: #3730a3;
  --blue: #2563eb;
  --sky: #38bdf8;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(79, 70, 229, 0.16);
  --ok: #10b981;
  --warn: #f59e0b;
  --off: #cbd5e1;
  --danger: #ef4444;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", "Segoe UI Variable Display", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ── shell ────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 384px;
  gap: 12px;
  height: 100dvh;
  padding: 12px;
}

.sidebar,
.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

/* ── sidebar ──────────────────────────────────────────────────────── */

.sidebar {
  padding: 18px 14px 14px;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0f2ff 0%, #60a5fa 30%, #4f46e5 70%, #312e81 100%);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  color: var(--faint);
}

.nav-item:hover {
  background: var(--hover);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--indigo-deep);
}

.nav-item.active svg {
  color: var(--indigo);
}

.side-section h2 {
  margin: 0 6px 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-current {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.voice-current:hover {
  border-color: #c7cdfb;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.voice-current-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.voice-current-text b {
  font-weight: 600;
}

.voice-current-text small,
.current small {
  color: var(--muted);
  font-size: 12px;
}

.chev {
  color: var(--faint);
  width: 16px;
  height: 16px;
}

.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  background: var(--avatar, linear-gradient(135deg, #60a5fa, #4f46e5));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 3px 8px rgba(30, 41, 120, 0.18);
  text-shadow: 0 1px 2px rgba(15, 23, 80, 0.3);
}

.connections {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.connections li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--ink-2);
}

.connections em {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
}

.connections .on .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.connections .on em {
  color: #059669;
}

.connections .pending .dot {
  background: var(--warn);
}

.side-foot {
  margin: auto 6px 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

/* ── stage ────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 20px;
  overflow: hidden;
  color: var(--ink-2);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stage-top {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.live .dot {
  background: var(--off);
}

body:is([data-phase="listening"], [data-phase="hearing"], [data-phase="thinking"], [data-phase="speaking"]) .live .dot {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.45; }
}

.timer {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.orb-wrap {
  position: relative;
  width: min(300px, 46vh, 70%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  --level: 0;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(79, 70, 229, 0.14);
  transition: transform 0.12s linear, opacity 0.3s;
  pointer-events: none;
  will-change: transform; /* own layer: rippling rings don't repaint the stage */
}

.r1 {
  transform: scale(calc(1.05 + var(--level) * 0.08));
}

.r2 {
  transform: scale(calc(1.25 + var(--level) * 0.16));
  border-color: rgba(79, 70, 229, 0.09);
}

.r3 {
  transform: scale(calc(1.48 + var(--level) * 0.26));
  border-color: rgba(79, 70, 229, 0.05);
}

body:is([data-phase="listening"]) .ring {
  animation: breathe 3.2s ease-in-out infinite;
}

body:is([data-phase="listening"]) .r2 {
  animation-delay: 0.4s;
}

body:is([data-phase="listening"]) .r3 {
  animation-delay: 0.8s;
}

@keyframes breathe {
  50% { opacity: 0.45; }
}

.orb {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.orb:active {
  transform: scale(0.97);
}

.orb canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.orb canvas.fallback {
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #eaf6ff 0%, #60a5fa 28%, #4f46e5 62%, rgba(49, 46, 129, 0.4) 78%, transparent 80%);
}

#status {
  position: relative;
  margin: 26px 0 8px;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
}

body:is([data-phase="hearing"], [data-phase="speaking"]) #status {
  color: var(--indigo);
}

body[data-phase="thinking"] #status::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1.2s steps(4) infinite;
}

body[data-phase="error"] #status {
  color: var(--danger);
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  max-width: 420px;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.wave {
  position: relative;
  width: min(300px, 80%);
  height: 34px;
}

.call-controls {
  position: relative;
  display: flex;
  gap: 22px;
  margin-top: 26px;
}

.ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  color: var(--ink-2);
}

.ctl-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.ctl-icon svg {
  width: 22px;
  height: 22px;
}

.ctl:hover .ctl-icon {
  background: var(--hover);
}

.ctl:active .ctl-icon {
  transform: scale(0.94);
}

.ctl-label {
  font-size: 12px;
  font-weight: 500;
}

#mic .ctl-icon {
  background: linear-gradient(180deg, #3b82f6, #4f46e5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 99, 255, 0.35);
}

#mic.on .ctl-icon {
  animation: pulse 2s ease-out infinite;
}

#mic .icon-stop,
body:is([data-phase="speaking"], [data-phase="thinking"]) #mic .icon-mic {
  display: none;
}

body:is([data-phase="speaking"], [data-phase="thinking"]) #mic .icon-stop {
  display: block;
  fill: currentColor;
  stroke: none;
}

body:is([data-phase="speaking"], [data-phase="thinking"]) #mic .ctl-icon {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.ctl.end .ctl-icon {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.ctl.end:hover .ctl-icon {
  background: #dc2626;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55), 0 8px 24px rgba(59, 99, 255, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(96, 165, 250, 0), 0 8px 24px rgba(59, 99, 255, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0), 0 8px 24px rgba(59, 99, 255, 0.45); }
}

.keys {
  position: absolute;
  bottom: 14px;
  margin: 0;
  color: var(--faint);
  font-size: 12px;
}

/* ── right panel ──────────────────────────────────────────────────── */

.panel {
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 12px 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--hover);
}

.ptab {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-weight: 500;
}

.ptab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--line);
}

.transcript,
.abilities {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 14px 16px;
}

.transcript {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transcript li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 10px;
  row-gap: 4px;
  animation: rise 0.3s ease-out;
}

.transcript .who {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
}

.transcript .you .who {
  background: #e2e8f0;
  color: var(--ink-2);
}

.transcript .nova .who {
  background: radial-gradient(circle at 35% 30%, #e0f2ff 0%, #60a5fa 35%, #4f46e5 80%);
  color: transparent;
}

.transcript .name {
  align-self: center;
  font-weight: 600;
  font-size: 13px;
}

.transcript time {
  align-self: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.transcript p .cue {
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--indigo);
  font-size: 12px;
  font-style: italic;
}

.transcript p {
  grid-column: 2 / 4;
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.transcript .nova p {
  color: var(--ink);
}

.links {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.links a {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--indigo);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
}

.links a:hover {
  background: #e0e3ff;
}

.empty-state {
  margin: auto 0;
  text-align: center;
  color: var(--muted);
  display: block !important;
}

.empty-state .glyph {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0f2ff 0%, #93c5fd 35%, #6366f1 85%);
  opacity: 0.85;
}

.empty-state b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.empty-state span {
  font-size: 13px;
  line-height: 1.5;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.abilities h3 {
  margin: 4px 0 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.abilities h3:not(:first-child) {
  margin-top: 18px;
}

.try {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-2);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.try:hover {
  border-color: #c7cdfb;
  background: #fafbff;
  color: var(--ink);
}

.try svg {
  flex: none;
  color: var(--indigo);
  width: 16px;
  height: 16px;
}

.try.locked {
  opacity: 0.55;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.composer input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: none;
}

.composer input::placeholder {
  color: var(--faint);
}

.send {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #4f6bff, var(--indigo));
  color: #fff;
}

/* ── voice dialog ─────────────────────────────────────────────────── */

.voice-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(15, 23, 60, 0.35);
  overflow: hidden;
}

.voice-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: pop 0.2s ease-out;
}

.voice-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 8px;
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.dialog-tabs {
  display: flex;
  gap: 22px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.dtab {
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font-weight: 500;
}

.dtab.active {
  color: var(--ink);
  border-bottom-color: var(--indigo);
}

.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 22px 12px;
}

.filters select,
.speed select {
  appearance: none;
  padding: 9px 36px 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  color: var(--ink-2);
  min-width: 150px;
}

.search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  color: var(--faint);
}

.search:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
}

.voice-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-content: start;
  gap: 10px;
  padding: 2px 22px 18px;
}

.voice-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.voice-card:hover {
  border-color: #c7cdfb;
  box-shadow: 0 4px 14px rgba(30, 41, 120, 0.07);
}

.voice-card[aria-selected="true"] {
  border-color: var(--indigo);
  background: #f8f8ff;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.voice-card .avatar {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.voice-card .verified {
  position: absolute;
  left: 44px;
  top: 10px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid #fff;
  display: none;
}

.voice-card.recommended .verified {
  display: block;
}

.voice-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.voice-info > * {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-info b {
  font-weight: 500;
  font-size: 15px;
}

.voice-info span {
  color: var(--muted);
  font-size: 12.5px;
}

.voice-info code {
  color: var(--faint);
  font: 12px/1.35 var(--font);
}

.pick {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--indigo);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  vertical-align: 2px;
}

.pick.expressive {
  background: #e0f2fe;
  color: #0369a1;
}

.voice-card.unavailable .voice-info code {
  color: var(--warn);
}

.play {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
}

.play:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}

.play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}

.play.loading svg {
  animation: spin 0.9s linear infinite;
  fill: none;
  stroke: currentColor;
}

.play.playing {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.check {
  display: none;
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--indigo);
}

.voice-card[aria-selected="true"] .check {
  display: block;
}

.empty {
  margin: 0;
  padding: 30px 22px;
  text-align: center;
  color: var(--muted);
}

.custom-pane {
  align-items: center;
  justify-content: center;
  padding: 50px 24px 60px;
  text-align: center;
}

.custom-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #e0f2ff 0%, #60a5fa 35%, #4f46e5 75%, #312e81 100%);
  box-shadow: 0 16px 40px rgba(79, 70, 229, 0.3);
}

.custom-pane h3 {
  margin: 18px 0 6px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.custom-pane p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.custom-pane code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--hover);
  color: var(--ink-2);
  font-size: 13px;
}

.soon {
  margin-top: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--indigo);
  font-size: 12.5px;
  font-weight: 600;
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
}

.current {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.current > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.current b {
  font-weight: 500;
}

.speed {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.speed select {
  min-width: 0;
  padding: 7px 32px 7px 12px;
}

.btn {
  padding: 9px 20px;
  border-radius: 10px;
  font-weight: 500;
}

.btn.ghost {
  border: 1px solid var(--line-2);
  background: #fff;
}

.btn.ghost:hover {
  background: var(--hover);
}

.btn.dark {
  border: 0;
  background: var(--ink);
  color: #fff;
}

.btn.dark:hover {
  background: #1e293b;
}

/* ── responsive ───────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr) 330px;
  }
}

@media (max-width: 980px) {
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
  }
  .nav,
  .side-section h2,
  .side-section:has(.connections),
  .side-foot {
    display: none;
  }
  .side-section {
    margin-left: auto;
  }
  .voice-current {
    padding: 6px 8px;
  }
  .stage {
    min-height: 560px;
  }
  .panel {
    height: 520px;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 8px;
    gap: 8px;
  }
  .stage {
    min-height: 520px;
    padding: 16px;
  }
  .call-controls {
    gap: 16px;
  }
  .keys {
    display: none;
  }
  .voice-current-text small {
    display: none;
  }
  .dialog-foot {
    flex-wrap: wrap;
  }
  .current {
    flex-basis: 100%;
  }
  .speed span {
    display: none;
  }
  .dialog-foot .btn {
    flex: 1;
  }
  .filters select {
    flex: 1;
    min-width: 0;
  }
}

/* lite: no GPU (software rendering). Drop the layers that make every frame expensive to composite. */
.lite *,
.lite *::before,
.lite *::after {
  animation: none !important;
  transition: none !important;
}

.lite .ring {
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ── sign-in (shared server) ──────────────────────────────────────── */

.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}

.login[hidden] {
  display: none;
}

body.signed-out .app {
  visibility: hidden;
}

.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 28px 24px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-orb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #e0f2ff, #3b82f6 45%, #3730a3);
  box-shadow: 0 8px 24px rgba(59, 99, 255, 0.3);
}

.login-card h1 {
  margin: 4px 0 0;
  font: 600 22px/1.25 var(--display);
  color: var(--ink);
}

.login-sub {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.field[hidden] {
  display: none;
}

.field input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  font: 14px var(--font);
}

.field input:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-msg {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.login-msg.good {
  color: var(--ok);
}

.login-go {
  padding: 11px 20px;
  font-size: 14px;
}

.login-go:disabled {
  opacity: 0.6;
  cursor: wait;
}

.login-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--indigo);
  font: 500 13px var(--font);
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn[hidden] {
  display: none;
}

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

.account[hidden] {
  display: none;
}

.account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.account .link-btn {
  align-self: flex-start;
  font-size: 12px;
}

.side-foot p {
  margin: 0;
}

/* ── API view (keys, quick start, playground) ─────────────────────── */

[hidden] {
  display: none !important;
}

body.view-api .stage,
body.view-api .panel {
  display: none;
}

.api-view {
  grid-column: 2 / 4;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.api-head,
.api-card {
  padding: 22px 24px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.api-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.api-head h1 {
  margin: 0;
  font: 600 24px/1.2 var(--display);
  color: var(--ink);
}

.api-head p,
.api-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.base-url {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 12px;
  background: var(--hover);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  max-width: 100%;
}

.base-url code {
  color: var(--ink);
  font: 500 13px var(--mono);
  overflow-wrap: anywhere;
}

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

.api-card-head h2 {
  margin: 0;
  font: 600 16px/1.3 var(--display);
  color: var(--ink);
}

.api-view code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.api-card-head p code,
.api-facts code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--indigo-deep);
}

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

.key-create {
  display: flex;
  gap: 8px;
}

.key-create input {
  width: 210px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  font: 14px var(--font);
  color: var(--ink);
}

.key-create input:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.key-reveal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 13.5px;
}

.key-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.key-line code {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #a7f3d0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.api-note {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--hover);
  color: var(--ink-2);
  font-size: 13.5px;
}

.table-wrap {
  overflow-x: auto;
}

.keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.keys-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.keys-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

.keys-table td.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.keys-table td:last-child {
  text-align: right;
}

.link-btn.danger {
  color: var(--danger);
}

.keys-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.code-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--hover);
}

.ctab {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: 500 13px var(--font);
  cursor: pointer;
}

.ctab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.code-box {
  position: relative;
}

.code-box pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: auto;
  font: 12.5px/1.6 var(--mono);
}

.code-box .btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}

.api-facts {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.play-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.play-box h3 {
  margin: 0;
  font: 600 14px var(--display);
  color: var(--ink);
}

.play-box textarea {
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  font: 13.5px/1.5 var(--font);
}

.play-box textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

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

.play-row select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #fff;
  font: 13.5px var(--font);
  color: var(--ink);
}

.play-box audio {
  width: 100%;
}

.file-drop {
  display: block;
  padding: 18px 14px;
  border-radius: 10px;
  border: 1.5px dashed var(--line-2);
  background: #fff;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
}

.file-drop:hover {
  border-color: var(--indigo);
  color: var(--indigo-deep);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.play-msg {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 980px) {
  .nav {
    display: flex;
    flex-direction: row;
    gap: 2px;
  }
  .nav-item[data-nav="voices"],
  .nav-item[data-nav="abilities"] {
    display: none;
  }
  .nav-item {
    padding: 7px 10px;
  }
  .api-view {
    overflow: visible;
  }
  .key-create {
    width: 100%;
  }
  .key-create input {
    flex: 1;
    width: auto;
  }
}
