:root {
  color-scheme: dark;
  --bg: #090d18;
  --surface: #111827;
  --surface-raised: #172235;
  --line: rgba(191, 211, 242, .12);
  --text: #eef3fb;
  --muted: #8998ad;
  --accent: #8ce4ff;
  --accent-blue: #448eff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100dvh; margin: 0; padding-bottom: calc(150px + env(safe-area-inset-bottom)); color: var(--text); background: radial-gradient(ellipse 70% 54% at 50% 42%, rgba(31, 57, 91, .27), transparent 72%), var(--bg); }
button, textarea { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(140, 228, 255, .5); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { position: sticky; top: 0; z-index: 2; width: min(100%, 860px); min-height: 68px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 22px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(191, 211, 242, .07); background: rgba(9, 13, 24, .78); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { border-radius: 12px; }
.brand-name { font-size: 13px; font-weight: 750; letter-spacing: .2em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.local-badge { min-height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 20px; color: #a9b6c9; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.local-badge span { width: 6px; height: 6px; border-radius: 50%; background: #70d7b0; box-shadow: 0 0 9px rgba(112, 215, 176, .5); }
.voice-toggle { min-height: 38px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 12px; color: var(--accent); background: rgba(140, 228, 255, .07); font-size: 11px; font-weight: 650; cursor: pointer; }
.voice-toggle:hover { background: rgba(140, 228, 255, .13); }
.voice-toggle svg { width: 17px; height: 17px; }
.voice-toggle .volume-off { display: none; }
.voice-toggle[aria-pressed="false"] { color: var(--muted); background: transparent; }
.voice-toggle[aria-pressed="false"] .volume-on { display: none; }
.voice-toggle[aria-pressed="false"] .volume-off { display: block; }
.clear-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }
.clear-button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.clear-button svg { width: 19px; height: 19px; }

main { width: min(100% - 36px, 720px); min-height: calc(100dvh - 235px); margin: 0 auto; padding: 12px 0 18px; }
.voice-stage { min-height: clamp(425px, 62dvh, 620px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.eyebrow { min-height: 18px; margin: 0 0 14px; display: inline-flex; align-items: center; gap: 8px; color: #9dacc1; font-size: 10px; font-weight: 750; letter-spacing: .19em; }
.status-light { width: 6px; height: 6px; border-radius: 50%; background: #70d7b0; box-shadow: 0 0 10px rgba(112, 215, 176, .5); transition: background .2s ease, box-shadow .2s ease; }
body.is-listening .status-light { background: #8ce4ff; box-shadow: 0 0 13px rgba(140, 228, 255, .9); }
body.is-speaking .status-light { background: #8ce4ff; box-shadow: 0 0 13px rgba(140, 228, 255, .9); animation: speaking-light 1s ease-in-out infinite alternate; }
@keyframes speaking-light { to { opacity: .45; } }
h1 { margin: 0; font-size: clamp(27px, 6vw, 37px); font-weight: 550; line-height: 1.15; letter-spacing: -.035em; }
.stage-caption { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.wave-wrap { width: min(100%, 590px); height: clamp(145px, 24vw, 205px); margin: 14px 0 3px; position: relative; }
.wave-wrap::before { content: ""; position: absolute; inset: 20% 10%; border-radius: 50%; background: radial-gradient(ellipse, rgba(69, 152, 255, .095), transparent 66%); filter: blur(24px); pointer-events: none; }
#voice-wave { position: relative; width: 100%; height: 100%; display: block; }
.suggestions { min-height: 38px; margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.suggestions button { min-height: 36px; padding: 7px 12px; border: 1px solid rgba(191, 211, 242, .1); border-radius: 18px; color: #a9b8cc; background: rgba(17, 24, 39, .56); font-size: 12px; cursor: pointer; transition: color .18s ease, border-color .18s ease, background .18s ease; }
.suggestions button:hover { border-color: rgba(140, 228, 255, .3); color: var(--text); background: rgba(23, 34, 53, .9); }
body.has-messages .voice-stage { min-height: 275px; }
body.has-messages .wave-wrap { height: 98px; margin: 4px 0; }
body.has-messages .stage-caption { display: none; }
body.has-messages .eyebrow { margin-bottom: 9px; }
body.has-messages h1 { font-size: 25px; }

.conversation { width: min(100%, 620px); margin: 0 auto; display: grid; gap: 12px; padding: 0 2px 14px; }
.message { max-width: min(92%, 560px); padding: 13px 15px; border: 1px solid var(--line); border-radius: 17px; background: rgba(17, 24, 39, .87); animation: message-in .2s ease-out; }
.message.user { justify-self: end; border-color: rgba(68, 142, 255, .2); border-bottom-right-radius: 6px; background: linear-gradient(145deg, rgba(30, 56, 91, .92), rgba(18, 34, 57, .94)); }
.message.assistant { justify-self: start; border-bottom-left-radius: 6px; }
.message-label { display: block; margin-bottom: 5px; color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.message p { margin: 0; color: #dce5f2; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.message-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.message-actions a, .message-actions button { min-height: 39px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(140, 228, 255, .2); border-radius: 11px; color: var(--accent); background: rgba(140, 228, 255, .07); font-size: 12px; font-weight: 650; text-decoration: none; cursor: pointer; }
.message-actions a:hover, .message-actions button:hover { background: rgba(140, 228, 255, .14); }
.message-tools { margin-top: 7px; display: flex; }
.message-tools button { min-height: 36px; padding: 5px 8px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.message-tools button:hover { color: var(--text); background: rgba(255,255,255,.05); }
@keyframes message-in { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.connection-note { width: min(100%, 620px); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #7f8da3; font-size: 11px; line-height: 1.4; text-align: center; }
.connection-note p { margin: 0; }
.connection-note p span { padding: 0 3px; color: #536178; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #f3bd71; }

.composer-wrap { position: fixed; z-index: 3; right: 0; bottom: 0; left: 0; padding: 9px max(17px, calc((100vw - 650px) / 2)) calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(191, 211, 242, .08); background: rgba(9, 13, 24, .88); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.voice-hint { width: min(100%, 650px); min-height: 15px; margin: 0 auto 7px; color: #8e9cb0; font-size: 11px; line-height: 1.4; text-align: center; }
.composer { width: min(100%, 650px); min-height: 56px; margin: 0 auto; padding: 5px; display: flex; align-items: flex-end; gap: 4px; border: 1px solid rgba(191, 211, 242, .13); border-radius: 17px; background: linear-gradient(145deg, rgba(22, 32, 49, .96), rgba(15, 23, 37, .98)); box-shadow: 0 12px 38px rgba(0, 0, 0, .22); }
.composer:focus-within { border-color: rgba(140, 228, 255, .38); }
.composer textarea { width: 100%; min-width: 0; max-height: 130px; min-height: 44px; padding: 12px 10px 9px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; line-height: 1.4; resize: none; }
.composer textarea::placeholder { color: #718098; }
.mic-button, .send-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; border-radius: 13px; cursor: pointer; transition: background .18s ease, color .18s ease, transform .18s ease; }
.mic-button { color: #b9cbe0; background: rgba(255, 255, 255, .045); }
.mic-button:hover { color: var(--accent); background: rgba(140, 228, 255, .1); }
.mic-button.listening { color: #fff; background: #bf4d65; box-shadow: 0 0 0 5px rgba(191, 77, 101, .13); }
.send-button { color: #07111c; background: linear-gradient(145deg, #a0edff, #70baff); }
.send-button:hover { transform: translateY(-1px); }
.mic-button svg, .send-button svg { width: 21px; height: 21px; }
.privacy-note { width: min(100%, 650px); margin: 7px auto 0; color: #64738a; font-size: 10px; line-height: 1.4; text-align: center; }

@media (max-height: 680px) {
  main { padding-top: 0; }
  .voice-stage { min-height: 360px; }
  .wave-wrap { height: 135px; }
  body.has-messages .voice-stage { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
