
:root {
  color-scheme: light;
  --canvas: #f5f5f5;
  --paper: #ffffff;
  --surface: #fafafa;
  --ink: #0a0a0a;
  --muted: #737373;
  --line: #e5e5e5;
  --hover: #ebebeb;
  --primary-hover: #2d2d2d;
  --on-primary: #fafafa;
  --connected: #24835b;
  --pending: #a46b14;
  --error: #be3d48;
  --offline: #858e9b;
  --backdrop: #14151b30;
  --shadow: 0 1px 3px #00000004;
  --radius: 24px;
  --control-radius: 8px;
  font-family: 'Geist', 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 400;
  font-feature-settings: 'ss01' on, 'cv11' on;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --canvas: #111113;
  --paper: #1b1b1e;
  --surface: #222225;
  --ink: #f0f0f2;
  --muted: #a2a2aa;
  --line: #323237;
  --hover: #2b2b30;
  --primary-hover: #d5d5dc;
  --on-primary: #161618;
  --connected: #72bf97;
  --pending: #d7aa61;
  --error: #f08a94;
  --offline: #8893a3;
  --backdrop: #00000088;
  --shadow: 0 2px 12px #00000012;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
body, .voice-surface, .audio-dialog, button, input, select, .session-content {
  transition: background-color .28s ease, color .28s ease, border-color .28s ease, box-shadow .28s ease;
}
button, input, select { font: inherit; color: inherit; border-radius: var(--control-radius); }
button { background: none; cursor: pointer; touch-action: manipulation; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .52; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 4px;
}
[hidden] { display: none !important; }
.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; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100%, 1440px); min-height: 100svh; padding: 28px 48px 24px; margin: 0 auto; display: flex; flex-direction: column; }
.topbar { min-height: 48px; display: flex; justify-content: flex-end; align-items: center; flex-shrink: 0; }
.topbar-actions { display: flex; align-items: center; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; }
.icon-button:hover { background: var(--hover); }
.theme-toggle { color: var(--muted); }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .icon { width: 19px; height: 19px; }
.theme-toggle .sun { display: none; }
[data-theme='dark'] .theme-toggle .sun { display: block; }
[data-theme='dark'] .theme-toggle .moon { display: none; }
.workspace { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-width: 0; min-height: 600px; }
/* Float's original width, card silhouette, spacing, and control hierarchy. */
.voice-surface {
  width: min(456px, 100%); min-width: 0; padding: 27px 28px 30px; margin: 28px 0;
  display: flex; flex-direction: column; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--shadow);
}
.surface-heading { width: 100%; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.surface-heading .icon-button { width: 36px; height: 36px; color: var(--muted); margin-right: -6px; }
.surface-heading .icon-button:hover { color: var(--ink); }
.surface-heading .icon { width: 19px; height: 19px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.status-dot { position: relative; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--offline); transition: background-color .65s ease; }
.status-dot::after { content: ''; position: absolute; inset: -4px; border: 1px solid currentColor; border-radius: 50%; opacity: 0; }
.status[data-state='connected'], .status[data-state='muted'] { color: var(--ink); }
.status[data-state='connected'] .status-dot, .status[data-state='muted'] .status-dot { background: var(--connected); }
.status[data-state='connecting'], .status[data-state='reconnecting'], .status[data-state='mic'] { color: var(--pending); }
.status[data-state='connecting'] .status-dot, .status[data-state='reconnecting'] .status-dot, .status[data-state='mic'] .status-dot { background: var(--pending); }
.status[data-state='connecting'] .status-dot::after, .status[data-state='reconnecting'] .status-dot::after, .status[data-state='mic'] .status-dot::after { animation: status-breathe 2s ease-in-out infinite; }
.status[data-state='error'] { color: var(--error); }
.status[data-state='error'] .status-dot { background: var(--error); }
.orb-stage { width: 318px; max-width: 100%; aspect-ratio: 1; position: relative; margin: 3px 0 0; flex-shrink: 0; }
.orb-wrap, #voice-orb { position: absolute; inset: 0; width: 100%; height: 100%; }
#voice-orb { display: block; }
/* State-aware, layered fallback, also used while a graphics context is lost. */
.orb-fallback { display: none; position: absolute; inset: 15.8%; border-radius: 50%; overflow: hidden; isolation: isolate; background: #29292c; box-shadow: 0 0 0 1px #9da4b32b; }
.orb-wrap[data-fallback='true'] .orb-fallback { display: block; }
.orb-fallback > span { position: absolute; inset: 0; border-radius: inherit; transition: opacity .85s ease; }
.fallback-smoke { background: radial-gradient(ellipse at 32% 67%, #b8b9bd 0%, #626469 25%, #333438 49%, #17171a 77%, #55575d 100%); }
.fallback-idle { background: radial-gradient(ellipse at 34% 67%, #c4ccd6 0%, #8994a5 26%, #566171 51%, #353e4e 78%, #a7b6ca 100%); opacity: 0; }
.fallback-warm { background: radial-gradient(ellipse at 32% 65%, #efcf98 0%, #a7834e 25%, #64503b 52%, #362b25 80%, #e6b666 100%); opacity: 0; }
.fallback-error { background: radial-gradient(ellipse at 32% 65%, #e8b1b8 0%, #bd6e7c 25%, #803e50 52%, #41212d 80%, #c46d7d 100%); opacity: 0; }
.fallback-muted { background: radial-gradient(ellipse at 32% 65%, #96989c, #606167 32%, #323237 78%); opacity: 0; }
.orb-wrap[data-state='idle'] .fallback-idle { opacity: 1; }
.orb-wrap[data-state='connecting'] .fallback-warm, .orb-wrap[data-state='reconnecting'] .fallback-warm, .orb-wrap[data-state='mic'] .fallback-warm { opacity: 1; }
.orb-wrap[data-state='error'] .fallback-error, .orb-wrap[data-state='muted'] .fallback-muted { opacity: 1; }
.orb-fallback::before, .orb-fallback::after { content: ''; position: absolute; pointer-events: none; border-radius: 50%; z-index: 2; }
.orb-fallback::before { inset: 1px; border: 1px solid #e4eafab8; box-shadow: inset 0 0 3px 1px #b4bcd36b, inset 0 -5px 14px #d9e2fa55; }
.orb-fallback::after { inset: 5px; border: 1px solid #c5d1e365; box-shadow: 0 0 0 2px #20243038; }
.orb-fallback .fallback-orbit { z-index: 3; inset: 2px; opacity: 0; background: conic-gradient(from 0deg, transparent 0deg 230deg, #f4d29a 315deg, transparent 350deg); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: rim-orbit 4s linear infinite; animation-play-state: paused; }
.orb-wrap[data-state='connecting'] .fallback-orbit, .orb-wrap[data-state='reconnecting'] .fallback-orbit, .orb-wrap[data-state='mic'] .fallback-orbit { opacity: 1; animation-play-state: running; }
/* Two overlapping panels crossfade instead of abruptly replacing controls. */
.session-content { width: 100%; border-top: 1px solid var(--line); padding-top: 23px; }
.session-deck { position: relative; width: 100%; height: 93px; transition: height .4s cubic-bezier(.22, 1, .36, 1); }
body[data-state='idle'] .session-deck, body[data-state='error'] .session-deck, body[data-state='connecting'] .session-deck, body[data-state='mic'] .session-deck { height: 148px; }
.session-panel { position: absolute; inset: 0; opacity: 0; visibility: hidden; transform: translateY(4px); pointer-events: none; transition: opacity .22s ease, transform .3s ease, visibility 0s linear .22s; }
.session-panel.is-visible { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
.control-row { display: flex; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px; padding: 0 20px; border: 1px solid transparent; font-size: 14px; font-weight: 500; }
.button .icon { width: 18px; height: 18px; }
.primary { color: var(--on-primary); background: var(--ink); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.secondary { color: var(--ink); background: var(--canvas); }
.secondary:hover:not(:disabled) { background: var(--hover); }
.mute-button { flex: 1; }
.leave-button { width: 100px; }
.mute-button .mic-off { display: none; }
.mute-button[aria-pressed='true'] .mic-on { display: none; }
.mute-button[aria-pressed='true'] .mic-off { display: block; }
.device-shortcut { display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; margin: 14px auto 0; padding: 7px 10px; color: var(--muted); border: 0; font-size: 12px; }
.device-shortcut:hover { color: var(--ink); background: var(--surface); }
.device-shortcut span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-shortcut .icon { width: 14px; height: 14px; }
.pair-row { display: flex; flex-direction: column; gap: 8px; }
.pair-row input { width: 100%; height: 46px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.pair-row input[aria-invalid='true'] { border-color: var(--error); }
input::placeholder { color: var(--muted); opacity: 1; }
.pair-note, .error { font-size: 12px; line-height: 1.5; text-align: center; margin: 10px 0 0; }
.pair-note { color: var(--muted); }
.error { color: var(--error); }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 36px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.footer-context { display: inline-flex; align-items: center; gap: 7px; }
.footer-context .icon { width: 14px; height: 14px; }
.preview-control { display: inline-flex; align-items: center; gap: 10px; }
.preview-control label { font-size: 12px; }
.preview-select { position: relative; }
.preview-select select { appearance: none; border: 1px solid transparent; background: transparent; padding: 9px 26px 9px 10px; font-size: 12px; max-width: 156px; cursor: pointer; }
.preview-select select:hover { background: var(--hover); }
.preview-select .icon { position: absolute; top: 11px; right: 7px; width: 14px; height: 14px; pointer-events: none; }
select option { color: var(--ink); background: var(--paper); }
.audio-dialog { width: min(380px, calc(100% - 32px)); max-height: calc(100svh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); box-shadow: 0 20px 80px #00000022; overscroll-behavior: contain; }
.audio-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(5px); }
.audio-dialog[open] { animation: dialog-enter .18s ease-out; }
.audio-panel { padding: 28px; }
.audio-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 28px; }
h2 { font-size: 23px; font-weight: 500; letter-spacing: -.7px; margin: 0; }
.audio-heading .icon-button { margin: -7px -10px -7px 0; color: var(--muted); }
.preference-label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 12px; }
.appearance-field { padding: 0 0 26px; margin: 0 0 24px; border: 0; border-bottom: 1px solid var(--line); min-width: 0; }
.appearance-field legend { padding: 0; }
.theme-options { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.theme-options button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-width: 0; padding: 8px 5px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); font-size: 12px; }
.theme-options button[aria-pressed='true'] { background: var(--paper); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px #00000008; }
.theme-options button:hover { color: var(--ink); }
.theme-options .icon { width: 14px; height: 14px; }
.audio-field { margin-bottom: 24px; }
.audio-field label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.audio-field output { color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; width: 100%; border: 1px solid var(--line); background: var(--surface); height: 44px; padding: 0 32px 0 14px; font-size: 13px; text-overflow: ellipsis; }
.select-wrap .icon { position: absolute; right: 13px; top: 14px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
input[type='range'] { appearance: none; display: block; width: 100%; height: 4px; background: var(--line); border: 0; padding: 0; margin: 15px 0 8px; accent-color: var(--ink); }
input[type='range']::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); cursor: ew-resize; box-shadow: 0 0 0 3px var(--paper); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); cursor: ew-resize; box-shadow: 0 0 0 3px var(--paper); }
.range-endpoints { display: flex; justify-content: space-between; margin-top: 13px; color: var(--muted); font-size: 11px; }
.input-level { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 21px 0 17px; }
.meter-line { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
#level-label { color: var(--muted); }
.meter { height: 4px; margin-top: 15px; overflow: hidden; border-radius: 2px; background: var(--line); }
.meter span { display: block; width: 0; height: 100%; background: var(--ink); border-radius: inherit; transition: width .1s linear; }
.signal-history { height: 36px; display: flex; justify-content: space-between; align-items: center; gap: 3px; margin-top: 12px; }
.signal-history i { flex: 1; height: 2px; min-width: 2px; max-width: 4px; border-radius: 1px; background: var(--line); transition: height .1s linear; }
.signal-history i:nth-last-child(-n+10) { background: var(--muted); }
.test-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; }
.test-row .button { height: 38px; font-size: 12px; padding: 0 13px; }
.test-row .icon { width: 15px; height: 15px; }
.test-hint { color: var(--muted); font-size: 11px; }
.audio-note { margin: 15px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
#preview-error { text-align: left; margin-top: 14px; }
@keyframes status-breathe { 0%, 100% { opacity: .1; transform: scale(.7); } 50% { opacity: .4; transform: scale(1); } }
@keyframes rim-orbit { to { transform: rotate(360deg); } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .shell { padding: 18px 20px 20px; }
  .topbar { min-height: 40px; }
  .workspace { min-height: 540px; }
  .footer { gap: 12px; }
}
@media (max-width: 440px) {
  .shell { padding: 12px 16px 16px; }
  .voice-surface { padding: 23px 22px 25px; margin: 20px 0; }
  .orb-stage { width: 296px; }
  .workspace { min-height: 0; }
  .footer { margin-top: 10px; font-size: 11px; }
  .preview-control { gap: 0; }
  .preview-control label { display: none; }
  .preview-select select { font-size: 11px; max-width: 140px; }
  .audio-dialog { max-height: calc(100svh - 24px); }
  .audio-panel { padding: 24px; }
  .leave-button { width: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
