:root {
  color-scheme: dark;
  --bg: #090c10; --panel: #10151b; --panel-2: #151c24; --line: #2b3540;
  --ink: #f5f7f8; --muted: #93a1ad; --cyan: #63d8e7; --cyan-ink: #061317;
  --coral: #fa646b; --good: #65d69a; --warn: #f5c45f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); padding: 9px 14px; cursor: pointer; }
button:hover { border-color: #536272; }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { border-color: var(--cyan); background: var(--cyan); color: var(--cyan-ink); font-weight: 800; }
.secondary { border-color: var(--cyan); color: var(--cyan); }
.app { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 0 max(30px, env(safe-area-inset-bottom)); }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 22px; }
.brand small { margin-top: 3px; color: var(--muted); }
.mark { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid var(--cyan); transform: rotate(45deg); color: var(--cyan); font-weight: 900; }
.mark::first-letter { transform: rotate(-45deg); }
.service { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 12px ui-monospace, monospace; }
.signal { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.signal.good { background: var(--good); }
.signal.bad { background: var(--coral); }
.version { border: 1px solid var(--line); padding: 3px 6px; border-radius: 4px; }
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { min-width: 110px; border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -3px var(--cyan); }
.view { padding: 30px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-head h1 { margin: 0; font-size: 34px; letter-spacing: 0; }
.section-head h2 { margin: 0; }
.section-head p:not(.eyebrow) { max-width: 700px; margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font: 800 11px ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.account-band { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.account-band div { padding: 16px; }
.account-band div + div { border-left: 1px solid var(--line); }
.account-band span, .account-band strong { display: block; }
.account-band span { color: var(--muted); font-size: 12px; }
.account-band strong { margin-top: 5px; font-size: 20px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.plan { min-width: 0; border: 1px solid var(--line); background: var(--panel); padding: 18px; }
.plan.current { border-color: var(--cyan); box-shadow: inset 0 3px var(--cyan); }
.plan h2 { margin: 0; font-size: 19px; }
.plan .price { min-height: 42px; margin: 10px 0 13px; font: 800 27px ui-monospace, monospace; }
.plan .price small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.plan ul { min-height: 130px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; line-height: 1.9; }
.plan button { width: 100%; margin-top: 13px; }
.policy-band { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 24px; }
.policy-band h2 { font-size: 20px; }
.policy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.policy-grid p { margin: 0; }
.policy-grid strong, .policy-grid span { display: block; }
.policy-grid span { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.new-key { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(0, 1.6fr) 46px; align-items: center; gap: 12px; border: 1px solid var(--cyan); background: rgba(99,216,231,.08); padding: 14px; }
.new-key div { display: grid; }
.new-key span { color: var(--muted); font-size: 12px; }
.new-key code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cyan); }
.icon-button { width: 42px; padding: 0; font-size: 22px; }
.table { margin-top: 18px; border-block: 1px solid var(--line); }
.table-row { display: grid; grid-template-columns: minmax(140px, 1.5fr) minmax(120px, 1fr) minmax(140px, 1fr) auto; align-items: center; gap: 12px; min-height: 58px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.table-row:last-child { border-bottom: 0; }
.table-row strong, .table-row span, .table-row small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-row span, .table-row small { color: var(--muted); }
.empty { color: var(--muted); }
.playground-layout { display: grid; grid-template-columns: minmax(270px, 320px) minmax(0, 1fr); border: 1px solid var(--line); background: var(--panel); }
.setup-panel { display: grid; align-content: start; gap: 12px; border-right: 1px solid var(--line); padding: 18px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 5px; background: #0c1116; color: var(--ink); padding: 9px 11px; }
textarea { resize: vertical; line-height: 1.45; }
.voice-stage { --voice-level: 0; position: relative; min-height: 610px; display: grid; grid-template-rows: auto minmax(360px, 1fr) auto auto auto; align-items: center; gap: 14px; overflow: hidden; padding: 16px 24px 22px; background: #0b1117; }
.stage-bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.live-label { display: inline-flex; align-items: center; gap: 8px; }
.live-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(101,214,154,.1); }
.stage-avatar-name { color: #d8e0e5; font-weight: 750; }
.avatar-viewport { position: relative; width: min(100%, 720px); height: clamp(360px, 48vw, 460px); align-self: stretch; justify-self: center; overflow: hidden; border: 1px solid #26313c; border-radius: 8px; background: #0d151d; isolation: isolate; }
.avatar-viewport::before, .avatar-viewport::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.avatar-viewport::before { inset: 14% 12%; border: 1px solid rgba(99,216,231,.13); border-radius: 50%; transform: scale(calc(.94 + var(--voice-level) * .05)); opacity: calc(.42 + var(--voice-level) * .45); }
.avatar-viewport::after { left: 10%; right: 10%; bottom: 9%; height: 1px; background: rgba(99,216,231,.18); box-shadow: 0 -84px rgba(99,216,231,.06), 0 -168px rgba(99,216,231,.04); }
.avatar-character { position: absolute; inset: 3% 4% 0; display: flex; align-items: flex-end; justify-content: center; transform-origin: 54% 82%; animation: avatar-breathe 5.8s ease-in-out infinite; will-change: transform, filter; }
.avatar-character img { width: min(84%, 440px); height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 22px 24px rgba(0,0,0,.42)); user-select: none; pointer-events: none; }
.signal-field { position: absolute; inset: 0; pointer-events: none; }
.signal-field span { position: absolute; right: 12%; top: 28%; width: 26px; height: 52px; border-right: 2px solid rgba(99,216,231,.32); border-radius: 0 50% 50% 0; opacity: .28; transform: scale(calc(.72 + var(--voice-level) * .45)); }
.signal-field span:nth-child(2) { width: 44px; height: 78px; right: 8%; top: 25%; opacity: .18; }
.signal-field span:nth-child(3) { width: 62px; height: 104px; right: 4%; top: 22%; opacity: .1; }
.state-chip { position: absolute; left: 16px; bottom: 14px; min-width: 82px; border: 1px solid #334150; border-radius: 999px; background: rgba(9,14,19,.88); padding: 7px 11px; color: #dbe4e8; text-align: center; font-size: 12px; font-weight: 750; }
.voice-meter { position: absolute; right: 17px; bottom: 17px; height: 26px; display: flex; align-items: center; gap: 3px; opacity: .34; }
.voice-meter span { width: 3px; height: calc(4px + var(--voice-level) * 20px); border-radius: 3px; background: var(--cyan); transition: height 45ms linear; }
.voice-meter span:nth-child(2), .voice-meter span:nth-child(6) { height: calc(7px + var(--voice-level) * 12px); }
.voice-meter span:nth-child(3), .voice-meter span:nth-child(5) { height: calc(10px + var(--voice-level) * 16px); }
.voice-stage[data-state="listening"] .avatar-character { animation-duration: 2.4s; filter: drop-shadow(0 0 12px rgba(99,216,231,.14)); }
.voice-stage[data-state="listening"] .state-chip { border-color: var(--cyan); color: var(--cyan); }
.voice-stage[data-state="thinking"] .avatar-character { animation: avatar-think 2.8s ease-in-out infinite; }
.voice-stage[data-state="thinking"] .state-chip { border-color: var(--warn); color: var(--warn); }
.voice-stage[data-state="speaking"] .avatar-character { animation: none; transform: translateY(calc(var(--voice-level) * -5px)) scale(calc(1 + var(--voice-level) * .016)); }
.voice-stage[data-state="speaking"] .voice-meter { opacity: .9; }
.voice-stage[data-state="speaking"] .state-chip { border-color: var(--coral); color: #ff969b; }
@keyframes avatar-breathe { 0%, 100% { transform: translateY(0) rotate(-.15deg); } 50% { transform: translateY(-5px) rotate(.2deg); } }
@keyframes avatar-think { 0%, 100% { transform: translateX(0) rotate(-.2deg); } 50% { transform: translateX(5px) rotate(.6deg); } }
.voice-state { display: grid; justify-items: center; text-align: center; }
.voice-state span { margin-top: 3px; color: var(--muted); }
.transport { display: grid; grid-template-columns: minmax(180px, 280px) 104px; gap: 9px; }
.talk, .stop-control { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.talk { background: var(--coral); border-color: var(--coral); color: #180709; font-weight: 850; }
.mic-symbol { position: relative; width: 12px; height: 17px; border: 2px solid currentColor; border-radius: 8px; }
.mic-symbol::before { content: ""; position: absolute; left: 50%; top: 13px; width: 10px; height: 7px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; transform: translateX(-50%); }
.stop-control > span { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.transcript { max-width: 660px; min-height: 48px; margin: 0; color: #dce4e9; text-align: center; line-height: 1.55; }
.quickstart { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 15px; }
.quickstart summary { color: var(--cyan); cursor: pointer; }
.quickstart pre { overflow: auto; border: 1px solid var(--line); background: #07090c; padding: 15px; color: #c8e8ec; white-space: pre-wrap; }
.usage-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.usage-bars div { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 14px 0; }
progress { width: 100%; accent-color: var(--cyan); }
.cap-field { grid-template-columns: auto 100px auto; align-items: center; }
.cap-field input { min-width: 0; }
.usage-settings { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.toggle-field { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.toggle-field input { width: 18px; height: 18px; }
.status { min-height: 22px; margin: 8px 0 0; color: var(--muted); font: 12px ui-monospace, monospace; }
.status.error { color: var(--coral); }
dialog { width: min(460px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-body { display: grid; gap: 15px; padding: 22px; }
.dialog-body h2 { margin: 0; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
@media (max-width: 820px) {
  .account-band { grid-template-columns: 1fr 1fr; }
  .account-band div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .account-band div:nth-child(4) { border-top: 1px solid var(--line); }
  .plan-grid, .policy-grid { grid-template-columns: 1fr 1fr; }
  .playground-layout { grid-template-columns: 1fr; }
  .setup-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .voice-stage { order: -1; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .app { width: min(100% - 24px, 1220px); }
  .topbar { align-items: flex-start; flex-direction: column; padding-bottom: 14px; }
  .tabs button { min-width: 96px; padding-inline: 10px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head h1 { font-size: 29px; }
  .account-band, .plan-grid, .policy-grid, .usage-bars { grid-template-columns: 1fr; }
  .account-band div + div { border-left: 0; border-top: 1px solid var(--line); }
  .plan ul { min-height: 0; }
  .new-key { grid-template-columns: minmax(0, 1fr) 44px; }
  .new-key div { grid-column: 1 / -1; }
  .table-row { grid-template-columns: minmax(0, 1fr) auto; }
  .table-row span, .table-row small { grid-column: 1; }
  .table-row button { grid-column: 2; grid-row: 1 / 3; }
  .voice-stage { min-height: 570px; grid-template-rows: auto minmax(330px, 1fr) auto auto auto; padding: 14px 12px 18px; }
  .avatar-viewport { height: 350px; }
  .avatar-character { inset-inline: 0; }
  .avatar-character img { width: min(92%, 390px); }
  .transport { grid-template-columns: minmax(0, 1fr) 90px; width: 100%; }
  .cap-field { grid-template-columns: 1fr 100px; }
  .cap-field button { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-character { animation: none !important; }
  .voice-stage[data-state="speaking"] .avatar-character { transform: none; }
}
