:root {
  color-scheme: dark;
  --bg: #101317;
  --panel: #171c22;
  --panel-2: #1d242c;
  --line: #2a333d;
  --text: #eef3f8;
  --muted: #8b98a7;
  --accent: #35c28b;
  --accent-2: #2aa978;
  --warn: #f0a33a;
  --danger: #e35d6a;
  --talk: #2b7fff;
  --talk-2: #1f66d6;
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 600px at 50% -10%, #1a2833 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

body {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(18px + var(--safe-bottom));
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}

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

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #35c28b, #2b7fff);
  color: #06110c;
  font: 700 12px/1 -apple-system, system-ui, sans-serif;
  letter-spacing: .04em;
}

.title { font-weight: 650; letter-spacing: .01em; }

.conn {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(139, 152, 167, .12);
}
.dot.online { background: var(--accent); box-shadow: 0 0 0 3px rgba(53, 194, 139, .16); }
.dot.connecting { background: var(--warn); box-shadow: 0 0 0 3px rgba(240, 163, 58, .16); }
.dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(227, 93, 106, .16); }

.banner {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1c242c, #171c22);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.banner.warn { border-color: rgba(240, 163, 58, .45); background: rgba(240, 163, 58, .08); }
.banner.error { border-color: rgba(227, 93, 106, .45); background: rgba(227, 93, 106, .08); }
.banner .action {
  margin-left: auto;
  border: 0;
  border-radius: 10px;
  padding: 7px 12px;
  background: var(--accent);
  color: #04120c;
  font-weight: 650;
  font-size: 12px;
}
.hidden { display: none !important; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 14px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(420px 220px at 50% 0%, rgba(43, 127, 255, .10), transparent 70%),
    var(--panel);
}

.talk {
  width: min(78vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background:
    radial-gradient(circle at 35% 28%, #6aa7ff 0%, transparent 42%),
    linear-gradient(160deg, var(--talk), var(--talk-2));
  box-shadow: 0 18px 40px rgba(31, 102, 214, .35), inset 0 0 0 1px rgba(255, 255, 255, .14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 650 20px/1.1 -apple-system, system-ui, sans-serif;
  touch-action: none;
  user-select: none;
  transition: transform .08s ease, box-shadow .16s ease, background .2s ease;
}
.talk:active, .talk.held { transform: scale(.97); box-shadow: 0 10px 24px rgba(31, 102, 214, .28), inset 0 0 0 1px rgba(255, 255, 255, .18); }
.talk small { font-size: 11px; font-weight: 500; opacity: .72; }
.talk.talking {
  background:
    radial-gradient(circle at 35% 28%, #ff9a9a 0%, transparent 42%),
    linear-gradient(160deg, #e35d6a, #b93b4b);
  box-shadow: 0 18px 44px rgba(227, 93, 106, .38), inset 0 0 0 1px rgba(255, 255, 255, .16);
  animation: pulse 1.8s ease-in-out infinite;
}
.talk.busy { background: linear-gradient(160deg, #3a424c, #2a3038); box-shadow: none; color: var(--muted); }
.talk.recording {
  background:
    radial-gradient(circle at 35% 28%, #ffc46b 0%, transparent 42%),
    linear-gradient(160deg, #f0a33a, #c47a16);
  color: #1a1204;
  box-shadow: 0 18px 44px rgba(240, 163, 58, .32);
}
.talk:disabled { opacity: .5; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 18px 44px rgba(227, 93, 106, .38), 0 0 0 0 rgba(227, 93, 106, .28); }
  50% { box-shadow: 0 18px 44px rgba(227, 93, 106, .38), 0 0 0 18px rgba(227, 93, 106, 0); }
}

.meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #10161c;
  overflow: hidden;
  border: 1px solid var(--line);
}
.meterFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8be3bd 55%, var(--warn));
  transition: width .06s linear;
}

.switches { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

.status {
  margin: 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

.panelHead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panelHead h2 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.queue li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 12px;
}
.queue .qmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.queue .qid { font: 500 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.queue .qmeta { color: var(--muted); font-size: 11px; }
.queue .qstate { margin-left: auto; color: var(--muted); font-size: 11px; }
.queue .qstate.failed { color: var(--danger); }
.queue button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 11px;
}

.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #10161c;
  color: var(--text);
  padding: 10px 12px;
  font: 15px/1.2 -apple-system, system-ui, sans-serif;
}

.links { display: flex; flex-wrap: wrap; gap: 12px; }
.link { color: #7fb3ff; font-size: 12px; text-decoration: none; }
.link:active { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 11px; line-height: 1.5; margin: 0; }

.foot {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px 8px;
  color: var(--muted);
  font-size: 11px;
}

@media (min-width: 560px) {
  body { padding-top: 26px; }
  .stage { padding: 26px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .talk.talking { animation: none; }
  .talk { transition: none; }
}