:root {
  color-scheme: dark;
  font: 16px/1.5 "Inter", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --page: #11121b;
  --surface: #191b27;
  --stage: #151724;
  --line: #2e3041;
  --text: #f0eef9;
  --quiet: #a6a7bd;
  --accent: #c3adff;
  --mint: #85e3cd;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; color: var(--text); background: radial-gradient(ellipse at 42% 3%, #1c1d32, transparent 53%), var(--page); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
.topbar { height: 74px; padding: 0 max(5vw, 22px); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ffffff0f; }
.brand, .connection, .stage-label, .voice-monitor, .controls, button { display: flex; align-items: center; }
.brand { gap: 12px; font-size: 19px; font-weight: 680; letter-spacing: -.025em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; background: #2b2548; color: #d7c7ff; font-size: 24px; }
.connection { gap: 9px; color: var(--quiet); font-size: 14px; }
.connection i, .camera-caption i { display: block; width: 7px; height: 7px; background: #777a94; border-radius: 50%; }
.connection[data-state="active"] { color: var(--mint); }
.connection[data-state="active"] i, .camera-caption i { background: var(--mint); box-shadow: 0 0 9px #85e3cd70; }
.connection[data-state="connecting"] i { background: #ecd39e; }
.connection[data-state="offline"] i { background: #ec9ca9; }
main { max-width: 1330px; margin: auto; padding: clamp(29px, 6vw, 70px) clamp(17px, 5vw, 65px) 35px; }
.intro { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 27px; }
h1 { margin: 0; font-size: clamp(29px, 4vw, 48px); line-height: 1.15; font-weight: 710; letter-spacing: -.055em; }
.intro p { color: var(--quiet); margin: 13px 0 0; }
.model { border: 1px solid #51466d; color: #d5c6fd; background: #2b2540; border-radius: 50px; padding: 5px 12px; font-size: 14px; white-space: nowrap; }
.room { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(251px, 1fr); gap: 19px; align-items: stretch; }
.call, .transcript { border: 1px solid var(--line); background: var(--surface); border-radius: 21px; min-width: 0; overflow: hidden; box-shadow: 0 16px 42px #05050d38; }
.stage { isolation: isolate; min-height: clamp(300px, 39vw, 460px); position: relative; display: grid; place-items: center; background: radial-gradient(ellipse at 48% 49%, #262343, transparent 57%), var(--stage); }
.stage::before { content: ""; z-index: -1; position: absolute; inset: 0; opacity: .23; background-image: radial-gradient(#8b83b5 1px, transparent 1px); background-size: 25px 25px; mask-image: radial-gradient(ellipse, black, transparent 80%); }
.stage-top { position: absolute; top: 20px; inset-inline: 21px; display: flex; align-items: center; justify-content: space-between; color: var(--quiet); }
.stage-label { gap: 8px; color: #ded8ef; font-size: 14px; font-weight: 560; }
.stage-label span { color: var(--accent); font-size: 18px; }
time { font-size: 14px; font-variant-numeric: tabular-nums; }
.stage-center { text-align: center; display: grid; justify-items: center; align-content: center; padding-bottom: 18px; }
.orb-frame { position: relative; display: grid; place-items: center; width: clamp(125px, 21vw, 215px); aspect-ratio: 1; }
.orbit { position: absolute; inset: 0; border: 1px solid #9a8be837; border-radius: 50%; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: -10px; border: 1px solid #9a8be819; border-radius: 50%; }
.orbit::after { inset: -24px; border-color: #9a8be812; }
.orb { width: 72%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(ellipse at 33% 24%, #f6defb 0, transparent 36%), radial-gradient(ellipse at 84% 75%, #76d9cb 0, transparent 50%), radial-gradient(ellipse at 23% 94%, #524691 0, transparent 54%), linear-gradient(145deg, #ac88ed, #8671e3 54%, #30205d); box-shadow: inset 0 0 22px #ecceff42, 0 0 45px #a887ed51; transition: transform .24s, box-shadow .22s; }
.orb[data-speaking="true"] { transform: scale(1.11); box-shadow: inset 0 0 22px #eee0ff70, 0 0 77px #b3a5ff86; animation: breathe 1.6s ease-in-out infinite alternate; }
@keyframes breathe { to { transform: scale(1.04); } }
.stage-message { margin: 20px 0 0; color: #e2dcea; font-size: 15px; }
.camera-tile { position: absolute; right: 17px; bottom: 17px; width: clamp(95px, 15vw, 160px); aspect-ratio: 4/3; overflow: hidden; border: 1px solid #ffffff23; border-radius: 12px; background: #222333; }
.camera-off { display: grid; place-content: center; justify-items: center; gap: 9px; height: 100%; color: var(--quiet); font-size: 12px; }
.camera-off .icon { width: 19px; }
video { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera-caption { display: flex; align-items: center; gap: 5px; background: #11121be8; position: absolute; left: 5px; bottom: 5px; font-size: 11px; border-radius: 5px; padding: 2px 6px; }
.camera-caption i { width: 5px; height: 5px; }
.call-footer { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.voice-monitor { font-size: 13px; white-space: nowrap; gap: 8px; color: var(--quiet); }
.bars { display: flex; align-items: center; gap: 2px; height: 18px; }
.bars i { width: 2px; height: 6px; border-radius: 4px; background: var(--mint); opacity: .28; transition: height .12s, opacity .12s; }
.bars i:nth-child(2), .bars i:nth-child(4) { height: 10px; }
.bars i:nth-child(3) { height: 15px; }
.bars[data-active="true"] i { opacity: 1; }
.bars[data-active="true"] i:nth-child(odd) { height: 12px; }
.controls { gap: 8px; flex-wrap: wrap; }
button { justify-content: center; gap: 8px; border-radius: 11px; min-height: 42px; padding: 7px 12px; border: 1px solid transparent; font-size: 14px; color: var(--text); white-space: nowrap; }
.utility { background: #252737; border-color: #393b4e; }
.utility:hover:not(:disabled), .utility[aria-pressed="true"] { background: #36304e; border-color: #6a5a91; }
.primary { background: var(--accent); color: #1b142c; font-weight: 690; padding-inline: 15px; }
.primary:hover:not(:disabled) { background: #d3c3ff; }
.primary[data-active="true"] { background: #542f4a; color: #ffd3e6; border-color: #7d4a65; }
.play-icon { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; }
[data-active="true"] .play-icon { width: 8px; height: 8px; border: 0; border-radius: 2px; background: currentColor; }
.icon { display: inline-block; flex: none; position: relative; width: 17px; height: 17px; color: inherit; }
.mic-icon::before { content: ""; position: absolute; width: 6px; height: 10px; border: 1.4px solid currentColor; border-radius: 5px; left: 5px; top: 1px; }
.mic-icon::after { content: ""; position: absolute; width: 12px; height: 9px; border: 1.4px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; left: 2px; top: 6px; }
.camera-icon::before { content: ""; position: absolute; width: 11px; height: 9px; border: 1.4px solid currentColor; border-radius: 2px; top: 4px; left: 0; }
.camera-icon::after { content: ""; position: absolute; width: 6px; height: 8px; border: 1.4px solid currentColor; border-radius: 1px; transform: skewY(-20deg); top: 4px; right: 0; }
.feedback { padding: 10px 17px; border-top: 1px solid var(--line); background: #2c2538; color: #f2d6e5; font-size: 14px; }
.transcript { display: flex; flex-direction: column; max-height: 545px; min-height: 230px; }
.transcript-heading { padding: 17px 19px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 0; font-size: 17px; font-weight: 640; }
.caption-icon { border: 1px solid #655984; color: #c5b7df; border-radius: 5px; font-size: 12px; padding: 0 4px; font-weight: 650; }
.transcript-body { padding: 16px; overflow: auto; flex: 1; scrollbar-color: #494463 transparent; }
.transcript-empty { min-height: 210px; height: 100%; display: grid; justify-items: center; align-content: center; color: var(--quiet); text-align: center; font-size: 14px; }
.transcript-empty p { max-width: 170px; }
.speech-icon { border-radius: 11px; border: 1px solid #4c4765; width: 36px; height: 29px; line-height: 22px; background: #242135; color: var(--accent); font-size: 22px; letter-spacing: 1px; }
.caption { margin: 0 0 13px; padding: 9px 11px; border-radius: 9px; background: #252636; overflow-wrap: anywhere; }
.caption[data-role="model"] { background: #2c2543; }
.caption strong { color: #d9c8ff; font-weight: 610; font-size: 13px; }
.caption p { margin: 3px 0 0; white-space: pre-wrap; font-size: 15px; }
dialog { width: min(390px, calc(100vw - 32px)); padding: 23px; border: 1px solid #4f4967; border-radius: 17px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #090912b5; }
dialog h2 { font-size: 22px; }
dialog p { color: var(--quiet); margin: 8px 0 15px; }
dialog label { display: block; font-size: 14px; margin-bottom: 5px; }
dialog input { color: var(--text); background: #10111a; border: 1px solid #55536a; border-radius: 9px; padding: 9px 10px; width: 100%; }
.dialog-actions { margin-top: 18px; display: flex; justify-content: end; gap: 8px; }
@media (max-width: 805px) {
  .room { grid-template-columns: 1fr; }
  .transcript { max-height: 320px; }
  .transcript-empty { min-height: 110px; }
}
@media (max-width: 520px) {
  .topbar { height: 61px; }
  .intro { flex-wrap: wrap; margin-bottom: 18px; }
  .intro p { font-size: 15px; }
  .stage { min-height: 315px; }
  .orb-frame { width: 132px; }
  .stage-center { padding-bottom: 48px; }
  .camera-tile { right: 11px; bottom: 12px; width: 90px; }
  .stage-top { inset-inline: 15px; }
  .call-footer { flex-wrap: wrap; padding: 12px; }
  .controls { width: 100%; display: grid; grid-template-columns: auto auto 1fr; gap: 6px; }
  button { padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.top-actions, .stage-metrics, .modes, .composer, .settings-heading, .settings-footer, .setting-row { display: flex; align-items: center; gap: 10px; }
.modes { gap: 3px; padding: 3px; background: #1c1d2b; border: 1px solid #39364b; border-radius: 13px; }
.modes button { min-height: 34px; border-radius: 9px; color: var(--quiet); background: transparent; }
.modes button[aria-pressed="true"] { color: #f2eaff; background: #3a3156; }
.stage-label #model-name { color: #e7e0f4; font-size: 14px; }
.stage-metrics { font-size: 13px; font-variant-numeric: tabular-nums; }
.stage-metrics output { color: #bce5e3; white-space: nowrap; padding-right: 9px; border-right: 1px solid #53506c; }
.camera-tile[data-mode="screen"] video, .camera-tile[data-mode="rear"] video { transform: none; }
.composer { border-top: 1px solid var(--line); padding: 11px; margin-top: auto; gap: 7px; }
.composer input, dialog textarea, dialog select, dialog input { min-width: 0; border: 1px solid #504863; background: #11121c; color: var(--text); border-radius: 9px; padding: 9px 10px; }
.composer input { width: 100%; font-size: 16px; }
.composer button { white-space: nowrap; flex: none; }
.settings-panel { width: min(548px, calc(100% - 32px)); max-height: min(88dvh, 800px); padding: 0; border-radius: 22px; }
.settings-panel form { display: flex; flex-direction: column; max-height: min(88dvh, 800px); }
.settings-heading, .settings-footer { flex: none; justify-content: space-between; padding: 13px 17px; }
.settings-heading { border-bottom: 1px solid var(--line); }
.settings-footer { justify-content: end; border-top: 1px solid var(--line); }
.settings-footer button { min-width: 125px; }
.settings-body { padding: 10px 17px 18px; overflow: auto; overscroll-behavior: contain; }
.settings-body textarea, .settings-body select, #tool-output { resize: vertical; display: block; width: 100%; font: inherit; margin-top: 6px; }
.settings-body input, .settings-body select, .settings-body textarea { font-size: 16px; }
.settings-body label { display: block; margin: 12px 0 7px; }
.settings-body .setting-row { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.settings-body input[role="switch"] { appearance: none; position: relative; width: 41px; height: 24px; margin: 0; padding: 0; border: 1px solid #655b78; border-radius: 20px; background: #312d40; cursor: pointer; }
.settings-body input[role="switch"]::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 4px; border-radius: 50%; background: #b6afc6; transition: transform .15s; }
.settings-body input[role="switch"]:checked { background: #a78cf0; border-color: #bb9eff; }
.settings-body input[role="switch"]:checked::after { transform: translateX(15px); background: #1d1731; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-body details { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 9px; }
.settings-body summary { cursor: pointer; padding: 5px 0; color: #d9cbfc; }
.settings-body .setting-note { color: var(--quiet); font-size: 13px; margin: 0; }
.settings-error, #tool-error { color: #ffafd0; font-size: 13px; }
.source-menu { display: grid; gap: 8px; margin: 14px 0 6px; }
.source-menu button { justify-content: flex-start; }
#drive-form button { margin-top: 8px; }
#tool-args { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 150px; overflow: auto; color: var(--quiet); }
.caption a { color: #d1b9ff; }
@media (max-width: 805px) {
  .intro { align-items: center; }
  .intro h1 { font-size: clamp(28px, 7.5vw, 43px); }
}
@media (max-width: 520px) {
  main { padding-top: 22px; }
  .intro { gap: 12px; }
  .intro h1 { font-size: 29px; }
  .modes button { font-size: 13px; padding: 3px 7px; min-height: 29px; }
  .top-actions { gap: 9px; }
  .top-actions button { min-height: 36px; }
  .connection { font-size: 13px; }
  .controls { grid-template-columns: auto auto auto minmax(105px, 1fr); }
  .controls .source-button { min-width: 37px; padding: 5px; }
  body[data-mode="translate"] .controls { grid-template-columns: auto auto minmax(105px, 1fr); }
  .stage { min-height: 286px; }
  .stage-top { top: 13px; }
  .stage-metrics { gap: 6px; }
  .settings-panel { position: fixed; inset: auto 0 0; width: 100%; max-width: none; border-radius: 20px 20px 0 0; margin: 0; }
  .settings-footer { padding-bottom: max(13px, env(safe-area-inset-bottom)); }
  .transcript-empty { min-height: 90px; }
}
