:root {
  color-scheme: dark;
  --bg: #050b16;
  --panel: rgba(11, 24, 42, 0.9);
  --surface: #111f35;
  --line: #263b59;
  --text: #eef4ff;
  --muted: #8d9bb1;
  --violet: #9185ff;
  --pink: #e58ec6;
  --green: #99d47d;
  --red: #ff837d;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 70% -10%, #24396d 0, transparent 42%), radial-gradient(circle at 5% 95%, #34214b 0, transparent 38%); }
button, textarea, input, select { font: inherit; }
button { color: inherit; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 80px #0009; backdrop-filter: blur(25px); }
.pair-screen { position: relative; min-height: 100%; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.pair-card { width: min(440px, 100%); border-radius: 28px; padding: 34px; text-align: center; }
.seris-mark, .brand-mark { display: inline-grid; place-items: center; background: linear-gradient(145deg, #7465ed, #d07ab9); box-shadow: 0 0 32px #8e78f477; font-family: Georgia, serif; }
.seris-mark { width: 72px; height: 72px; border-radius: 24px; font-size: 35px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 19px; }
.eyebrow { margin: 18px 0 4px; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; color: var(--muted); }
h1 { margin: 0; font-size: clamp(22px, 5vw, 30px); }
.muted { color: var(--muted); line-height: 1.5; }
label { display: grid; gap: 7px; text-align: left; color: #b5c0d2; margin: 15px 0; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #081426; color: var(--text); outline: none; padding: 13px; }
input:focus, select:focus, textarea:focus { border-color: #776de2; box-shadow: 0 0 0 3px #776de222; }
.primary, .send { border: 0; background: linear-gradient(135deg, #7f70e9, #596fce); cursor: pointer; }
.primary { width: 100%; border-radius: 13px; padding: 13px; font-weight: 650; }
.pair-code-panel { margin-top: 22px; padding: 20px; border-radius: 17px; background: #0a1729; border: 1px solid #334d70; }
.pair-code-panel > * { display: block; }
.pair-code-panel strong { margin: 9px 0; font: 700 34px "Cascadia Code", monospace; letter-spacing: .12em; color: #e8d6ff; }
.error { min-height: 20px; color: var(--red); }
.app { position: relative; z-index: 1; width: 100%; height: 100%; padding: 12px; display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 12px; }
.sidebar, .chat { min-height: 0; border-radius: 22px; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; }
.brand-row, .chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand-row { padding: 16px; }
.brand-row > div { display: flex; align-items: center; gap: 10px; font: 24px Georgia, serif; }
.icon-button, .quiet { border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 38px; height: 38px; border-radius: 12px; color: #cdd7e8; font-size: 20px; }
.icon-button:hover { background: var(--surface); }
.device-state { display: flex; align-items: center; gap: 8px; padding: 12px 17px; color: var(--muted); font-size: 12px; }
#connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
#connection-dot.online { background: var(--green); box-shadow: 0 0 12px var(--green); }
#conversation-list { flex: 1; min-height: 0; overflow: auto; padding: 6px 9px; }
.conversation { width: 100%; display: block; border: 0; border-radius: 12px; background: transparent; color: #cdd7e8; text-align: left; padding: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation:hover, .conversation.active { background: #192c4b; color: #fff; }
.sidebar footer { padding: 12px; border-top: 1px solid var(--line); }
.quiet { width: 100%; padding: 9px; color: var(--muted); }
.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.chat-header { padding: 14px 19px; }
.chat-header .eyebrow { margin: 0 0 3px; }
.chat-header h1 { font-size: 18px; }
.turn-state { border-radius: 12px; padding: 7px 10px; background: #14243d; color: #a8b7ce; font-size: 11px; }
.turn-state.busy { color: #d9d3ff; background: #28234c; }
.messages { min-height: 0; overflow: auto; padding: 24px clamp(14px, 4vw, 58px); scroll-behavior: smooth; }
.message { max-width: 820px; margin: 0 auto 15px; display: flex; }
.message.user { justify-content: flex-end; }
.bubble { max-width: min(78%, 700px); border: 1px solid var(--line); border-radius: 17px; padding: 12px 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .bubble { background: #203c63; border-bottom-right-radius: 5px; }
.message.assistant .bubble { background: #101d31; border-bottom-left-radius: 5px; }
.empty { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px; }
.pending { max-width: 820px; width: calc(100% - 28px); margin: 0 auto 8px; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.pending[hidden] { display: none; }
.pending i { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); animation: bounce .9s infinite alternate; }
.pending i:nth-child(2) { animation-delay: .15s; }.pending i:nth-child(3) { animation-delay: .3s; margin-right: 5px; }
@keyframes bounce { to { transform: translateY(-5px); opacity: .45; } }
.composer { margin: 8px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) 43px 46px; align-items: end; gap: 8px; padding: 9px; border: 1px solid #344a69; border-radius: 20px; background: #111f35; }
.composer textarea { max-height: 150px; resize: none; border: 0; padding: 8px; background: transparent; box-shadow: none; }
.send, .voice-send { width: 43px; height: 43px; border-radius: 50%; font-size: 22px; }
.voice-send { border: 1px solid #354d70; background: #182b48; color: #b8c8e1; cursor: pointer; font-size: 15px; transition: .15s; }
.voice-send.recording { border-color: #ff8a85; background: #5a252b; color: #ffd6d3; box-shadow: 0 0 0 5px #ff777722; animation: record-pulse .8s infinite alternate; }
.send:disabled, .voice-send:disabled { opacity: .4; cursor: default; }
@keyframes record-pulse { to { box-shadow: 0 0 0 8px #ff77770d; } }
.install-app { margin-top: 8px; border: 1px solid #334b6e; border-radius: 11px; background: #102039; color: #cbd7eb; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 30px); max-width: calc(100% - 30px); padding: 11px 15px; border: 1px solid #48607e; border-radius: 12px; background: #172841; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-only, .scrim { display: none; }
@media (max-width: 720px) {
  .app { padding: 0; display: block; }
  .chat { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .sidebar { position: fixed; z-index: 10; left: 9px; top: 9px; bottom: 9px; width: min(310px, calc(100vw - 55px)); transform: translateX(-110%); transition: transform .2s; }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; }
  .scrim { position: fixed; z-index: 9; inset: 0; width: 100%; border: 0; background: #020710aa; }
  .app.sidebar-open .scrim { display: block; }
  .messages { padding: 16px 11px; }
  .bubble { max-width: 88%; }
  .turn-state { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 260px), (max-height: 330px) {
  body::before { background: radial-gradient(circle at 50% 0, #273567, transparent 60%); }
  .app { padding: 0; }
  .chat-header { min-height: 48px; padding: 7px 9px; }
  .chat-header .eyebrow, .turn-state, .mobile-only { display: none; }
  .chat-header h1 { font-size: 14px; }
  .messages { padding: 8px 5px; }
  .message { margin-bottom: 7px; }
  .bubble { max-width: 94%; padding: 7px 9px; border-radius: 12px; font-size: 12px; line-height: 1.35; }
  .pending { margin-bottom: 2px; font-size: 9px; }
  .composer { margin: 3px 4px max(4px, env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) 32px 34px; gap: 3px; padding: 4px; border-radius: 14px; }
  .composer textarea { max-height: 52px; padding: 5px; font-size: 11px; }
  .send, .voice-send { width: 32px; height: 32px; font-size: 17px; }
  .voice-send { font-size: 11px; }
  .pair-card { padding: 14px; border-radius: 0; border: 0; min-height: 100vh; }
  .seris-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; }
  .pair-card .eyebrow, .pair-card > .muted { display: none; }
  .pair-card h1 { font-size: 15px; margin: 8px; }
  label { margin: 7px 0; font-size: 10px; }
  input, select, .primary { padding: 7px; font-size: 10px; }
  .pair-code-panel { margin-top: 8px; padding: 8px; }
  .pair-code-panel strong { margin: 3px 0; font-size: 18px; }
}
