:root {
  color-scheme: dark;
  --bg: #061520;
  --panel: rgba(12, 35, 52, .78);
  --panel-strong: #0d293d;
  --line: rgba(157, 213, 235, .16);
  --text: #f5fbff;
  --muted: #8ba9b9;
  --cyan: #51dbe7;
  --blue: #4d91ff;
  --green: #39e09e;
  --red: #ff6b79;
  --orange: #ffb257;
  --state: var(--cyan);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Noto Sans Thai", "Leelawadee UI", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-width: 300px; min-height: 100dvh; color: var(--text); background: radial-gradient(circle at 50% -20%, #123b55 0, var(--bg) 48%, #041018 100%); overflow-x: hidden; }
body.assistant-active { width: 100%; height: 100dvh; min-height: 0; overflow: hidden; overscroll-behavior: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ambient { position: fixed; border-radius: 50%; pointer-events: none; filter: blur(18px); opacity: .28; }
.ambient-one { width: 280px; height: 280px; background: #1f87b5; top: -150px; right: -130px; }
.ambient-two { width: 250px; height: 250px; background: #4a4bd8; bottom: -160px; left: -120px; }
.ambient-three { width: 300px; height: 300px; background: #196b8b; top: 22%; left: 50%; transform: translateX(-50%); opacity: .16; }

.network-banner { position: fixed; z-index: 100; top: 0; left: 0; right: 0; padding: calc(8px + var(--safe-top)) 16px 8px; text-align: center; color: #2b1800; background: var(--orange); font-size: 13px; font-weight: 700; }

.login-view { position: relative; isolation: isolate; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: calc(24px + var(--safe-top)) 22px calc(18px + var(--safe-bottom)); overflow: hidden; }
.login-brand { display: flex; align-items: center; gap: 12px; width: min(100%, 420px); margin: 0 auto; }
.login-brand img { border-radius: 14px; box-shadow: 0 8px 30px rgba(26, 181, 219, .18); }
.login-brand div, .app-brand div { display: grid; }
.login-brand strong { font-size: 15px; letter-spacing: .12em; }
.login-brand span { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.login-card { align-self: center; width: min(100%, 420px); margin: 28px auto; padding: 30px 24px 24px; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(145deg, rgba(17, 47, 68, .92), rgba(8, 28, 43, .88)); box-shadow: 0 28px 90px rgba(0, 0, 0, .38); backdrop-filter: blur(18px); }
.login-symbol { display: grid; place-items: center; width: 64px; height: 64px; margin: -64px auto 18px; border: 1px solid rgba(91, 227, 233, .42); border-radius: 22px; background: linear-gradient(145deg, #123e57, #0b273b); color: var(--cyan); box-shadow: 0 12px 32px rgba(44, 197, 221, .22); font-size: 27px; }
.eyebrow { margin: 0 0 6px; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.login-card h1 { margin: 0; font-size: 30px; line-height: 1.25; text-align: center; }
.login-card > .eyebrow, .login-copy { text-align: center; }
.login-copy { margin: 7px 0 26px; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 8px; margin: 15px 0; color: #bfd3dd; font-size: 12px; font-weight: 650; }
.field input { width: 100%; border: 1px solid rgba(157, 213, 235, .2); border-radius: 15px; outline: none; color: var(--text); background: rgba(2, 16, 25, .6); transition: border-color .2s, box-shadow .2s, background .2s; }
.field input { height: 51px; padding: 0 15px; }
.field input:focus { border-color: var(--cyan); background: rgba(5, 25, 37, .92); box-shadow: 0 0 0 4px rgba(81, 219, 231, .1); }
.remember-account { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0 0; color: #bfd3dd; font-size: 13px; cursor: pointer; }
.remember-account input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--cyan); cursor: pointer; }
.remember-account input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.remember-account input:disabled { cursor: wait; }
.remember-hint { margin: 0 0 8px 30px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.form-error { min-height: 20px; margin: 4px 0 8px; color: #ff9099; font-size: 12px; text-align: center; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px; border: 0; border-radius: 16px; color: #02202b; background: linear-gradient(135deg, #58e1dd, #64a8ff); box-shadow: 0 12px 28px rgba(53, 171, 215, .22); font-weight: 800; cursor: pointer; transition: transform .16s, filter .16s, opacity .16s; }
.primary-button i { font-size: 20px; font-style: normal; }
.primary-button:active { transform: scale(.985); }
.primary-button:disabled { cursor: wait; filter: grayscale(.4); opacity: .65; }
.security-note { margin: 18px 0 0; color: #7794a4; font-size: 11px; line-height: 1.6; text-align: center; }
.login-footer { align-self: end; color: #557181; font-size: 10px; letter-spacing: .06em; text-align: center; }

.assistant-view { --state: var(--cyan); position: relative; isolation: isolate; display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100dvh; min-height: 0; padding: calc(12px + var(--safe-top)) 18px calc(12px + var(--safe-bottom)); overflow: hidden; }
.assistant-view[data-state="listening"] { --state: #54d9f0; }
.assistant-view[data-state="thinking"] { --state: var(--green); }
.assistant-view[data-state="preparing"] { --state: var(--green); }
.assistant-view[data-state="speaking"] { --state: var(--blue); }
.assistant-view[data-state="error"] { --state: var(--red); }
.assistant-view[data-state="offline"] { --state: var(--orange); }
.app-header { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; width: min(100%, 680px); margin: 0 auto; }
.app-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.app-brand img { border-radius: 12px; }
.app-brand strong { font-size: 15px; letter-spacing: .12em; }
.app-brand span { max-width: 210px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; gap: 8px; }
.header-button, .close-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; color: #b8d0db; background: rgba(9, 31, 46, .72); cursor: pointer; }
.header-button:active, .close-button:active { background: #153a50; transform: scale(.96); }
.header-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logout-button { color: #d5e7ee; }
.logout-button:hover, .logout-button:focus-visible { border-color: rgba(255, 107, 121, .42); color: #ff9aa4; background: rgba(114, 28, 43, .18); }

.voice-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: clamp(18px, 5vh, 54px) 0 calc(88px + var(--safe-bottom)); text-align: center; overflow: hidden; }
.state-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 5px 12px; border: 1px solid color-mix(in srgb, var(--state) 32%, transparent); border-radius: 999px; color: color-mix(in srgb, var(--state) 84%, white); background: color-mix(in srgb, var(--state) 9%, transparent); font-size: 11px; font-weight: 700; transition: .25s; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--state); box-shadow: 0 0 12px var(--state); }
.voice-orb { position: relative; display: grid; place-items: center; width: clamp(156px, 25vh, 208px); aspect-ratio: 1; margin: clamp(22px, 5vh, 38px) 0 clamp(22px, 4vh, 32px); padding: 0; border: 0; border-radius: 50%; outline: none; background: transparent; cursor: pointer; touch-action: manipulation; }
.voice-orb:focus-visible { outline: 3px solid #fff; outline-offset: 8px; }
.voice-orb:disabled { cursor: wait; }
.orb-halo { position: absolute; inset: 0; border: 1px solid color-mix(in srgb, var(--state) 42%, transparent); border-radius: 50%; opacity: .48; transition: border-color .3s; }
.halo-one { inset: 3px; }
.halo-two { inset: -22px; opacity: .2; }
.orb-surface { position: relative; z-index: 2; display: grid; place-items: center; width: 72%; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--state) 66%, white 8%); border-radius: 50%; background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--state) 44%, white), color-mix(in srgb, var(--state) 24%, #0b2639) 44%, #091d2c 78%); box-shadow: inset 0 0 35px rgba(255, 255, 255, .1), 0 0 38px color-mix(in srgb, var(--state) 32%, transparent), 0 24px 60px rgba(0, 0, 0, .32); transition: background .3s, border-color .3s, box-shadow .3s, transform .2s; }
.voice-orb:active .orb-surface { transform: scale(.96); }
.mic-icon svg { width: 56px; height: 56px; overflow: visible; }
.mic-icon rect { fill: color-mix(in srgb, var(--state) 80%, white); }
.mic-icon path { fill: none; stroke: #eafaff; stroke-width: 4; stroke-linecap: round; }
.thinking-icon, .speaking-icon { display: none; align-items: center; justify-content: center; gap: 7px; }
.thinking-icon i { width: 10px; height: 10px; border-radius: 50%; background: #eafff6; animation: thinking-dot 1.15s ease-in-out infinite; }
.thinking-icon i:nth-child(2) { animation-delay: .15s; }
.thinking-icon i:nth-child(3) { animation-delay: .3s; }
.speaking-icon i { width: 6px; height: 32px; border-radius: 999px; background: #eef7ff; animation: speaking-bar .7s ease-in-out infinite alternate; }
.speaking-icon i:nth-child(2), .speaking-icon i:nth-child(4) { animation-delay: .18s; height: 48px; }
.speaking-icon i:nth-child(3) { animation-delay: .32s; height: 60px; }
.assistant-view[data-state="thinking"] .mic-icon, .assistant-view[data-state="preparing"] .mic-icon, .assistant-view[data-state="speaking"] .mic-icon { display: none; }
.assistant-view[data-state="thinking"] .thinking-icon, .assistant-view[data-state="preparing"] .thinking-icon { display: flex; }
.assistant-view[data-state="speaking"] .speaking-icon { display: flex; }
.assistant-view[data-state="listening"] .halo-one { animation: listen-pulse 1.35s ease-out infinite; }
.assistant-view[data-state="listening"] .halo-two { animation: listen-pulse 1.35s .35s ease-out infinite; }
.assistant-view[data-state="thinking"] .orb-surface, .assistant-view[data-state="preparing"] .orb-surface { animation: think-glow 1.7s ease-in-out infinite; }
.assistant-view[data-state="speaking"] .halo-one { animation: speak-ring 1s ease-in-out infinite; }
.assistant-view[data-state="speaking"] .halo-two { animation: speak-ring 1s .22s ease-in-out infinite; }
.voice-stage h1 { margin: 0; font-size: clamp(22px, 6vw, 30px); line-height: 1.35; }
.voice-stage > p { max-width: 360px; min-height: 44px; margin: 8px 20px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.bottom-controls { position: fixed; z-index: 20; left: 50%; bottom: calc(16px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4, 64px); gap: 7px; transform: translateX(-50%); padding: 8px; border: 1px solid var(--line); border-radius: 22px; background: rgba(6, 25, 38, .88); box-shadow: 0 18px 50px rgba(0, 0, 0, .4); backdrop-filter: blur(22px); }
.control-button { position: relative; display: grid; place-items: center; gap: 1px; min-height: 54px; border: 0; border-radius: 15px; color: #9bb5c2; background: transparent; cursor: pointer; }
.control-button span { font-size: 21px; line-height: 1; }
.control-button .control-icon { display: grid; place-items: center; width: 22px; height: 22px; }
.control-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.control-button small { font-size: 9px; }
.control-button:active { color: #fff; background: #15384c; }
.control-button:disabled { opacity: .32; cursor: default; }
.control-badge { position: absolute; top: 4px; right: 8px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; color: #04212c; background: var(--cyan); font-size: 9px; line-height: 1; }

.keyboard-sheet { position: fixed; z-index: 80; top: var(--chat-viewport-top, 0px); left: 0; right: 0; display: grid; align-items: end; height: var(--chat-viewport-height, 100dvh); overflow: hidden; }
.sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0, 8, 14, .72); backdrop-filter: blur(7px); }
.sheet-panel { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(100%, 760px); height: min(92dvh, 820px); max-height: calc(var(--chat-viewport-height, 100dvh) - var(--safe-top) - 10px); margin: 0 auto; padding: 10px 18px calc(16px + var(--safe-bottom)); border: 1px solid rgba(157, 213, 235, .2); border-bottom: 0; border-radius: 28px 28px 0 0; background: linear-gradient(160deg, #102e42 0%, #081c2b 68%); box-shadow: 0 -24px 70px rgba(0, 0, 0, .42); overflow: hidden; animation: sheet-in .22s ease-out; }
.sheet-handle { width: 42px; height: 4px; margin: 2px auto 12px; border-radius: 99px; background: #355566; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 16px; border-bottom: 1px solid var(--line); }
.chat-heading-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-avatar { flex: 0 0 auto; border-radius: 14px; box-shadow: 0 4px 18px rgba(35, 180, 214, .12); }
.sheet-heading .eyebrow { margin-bottom: 2px; font-size: .6875rem; }
.sheet-heading h2 { margin: 0; font-size: 1.5rem; line-height: 1.45; }
.sheet-heading .close-button { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; font-size: 1.375rem; }
.sheet-heading .close-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.chat-messages { min-height: 0; min-width: 0; margin: 14px -4px 16px; padding: 4px 4px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #47788e transparent; }
.chat-empty { display: grid; place-items: center; align-content: center; min-height: 100%; padding: 28px 16px; color: #a4c1ce; text-align: center; }
.chat-empty > span { display: grid; place-items: center; width: 80px; height: 80px; margin-bottom: 20px; border: 1px solid rgba(81, 219, 231, .22); border-radius: 26px; background: radial-gradient(circle at 40% 25%, rgba(81, 219, 231, .14), rgba(81, 219, 231, .025)); box-shadow: 0 10px 40px rgba(28, 174, 208, .08); }
.chat-empty img { display: block; border-radius: 19px; }
.chat-empty strong { color: #e9f5fb; font-size: 1.25rem; font-weight: 650; }
.chat-empty p { max-width: 300px; margin: 10px 0 0; font-size: .9375rem; line-height: 1.75; white-space: pre-line; }
.chat-message { display: grid; width: min(94%, 620px); min-width: 0; margin: 20px 0; }
.chat-message.user { justify-items: end; margin-left: auto; }
.chat-message.assistant { justify-items: start; margin-right: auto; }
.chat-message-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; max-width: 100%; margin: 0 6px 7px; color: #9dbbc9; font-size: .75rem; line-height: 1.5; font-weight: 500; }
.chat-message-header span:first-child { color: #c7dce7; font-weight: 700; }
.chat-message-header span:last-child { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.chat-bubble { min-width: 0; max-width: 100%; margin: 0; padding: 14px 16px; border: 1px solid rgba(143, 201, 224, .18); border-radius: 20px 20px 20px 6px; color: #eff8fc; background: rgba(20, 52, 73, .84); box-shadow: 0 4px 16px rgba(0, 8, 14, .08); font-size: 1rem; font-weight: 400; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.user { width: min(88%, 560px); }
.chat-message.user .chat-bubble { border-color: rgba(81, 219, 231, .28); border-radius: 20px 20px 6px 20px; background: linear-gradient(135deg, rgba(40, 147, 171, .34), rgba(29, 89, 127, .38)); }
.chat-message.pending .chat-bubble { display: flex; align-items: center; gap: 5px; color: #a9c6d3; }
.chat-message.pending i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: thinking-dot 1.15s ease-in-out infinite; }
.chat-message.pending i:nth-child(2) { animation-delay: .15s; }
.chat-message.pending i:nth-child(3) { animation-delay: .3s; }
.chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: end; gap: 8px 12px; padding: 12px; border: 1px solid rgba(157, 213, 235, .25); border-radius: 22px; background: rgba(3, 19, 30, .85); box-shadow: 0 8px 26px rgba(0, 0, 0, .12); transition: border-color .2s, box-shadow .2s; }
.chat-compose:focus-within { border-color: rgba(81, 219, 231, .66); box-shadow: 0 0 0 3px rgba(81, 219, 231, .08), 0 8px 26px rgba(0, 0, 0, .12); }
.text-field { display: block; min-width: 0; margin: 0; }
.text-field textarea { display: block; width: 100%; min-height: 52px; max-height: min(160px, 24dvh); padding: 12px 2px; border: 0; border-radius: 4px; outline: none; color: var(--text); background: transparent; font-size: 1rem; font-weight: 400; resize: none; overflow-y: auto; line-height: 1.65; scrollbar-width: thin; scrollbar-color: #47788e transparent; }
.text-field textarea::placeholder { color: #9db6c4; opacity: 1; }
.compose-meta { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; padding: 0 2px; color: #9bb7c6; }
.compose-meta small { font-size: .75rem; line-height: 1.5; }
.compose-hint { display: none; margin-right: auto; }
#characterLimit { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.text-field textarea:disabled { opacity: .55; cursor: wait; }
.chat-send-button { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; color: #03212d; background: linear-gradient(135deg, #58e1dd, #64a8ff); box-shadow: 0 6px 18px rgba(53, 171, 215, .16); cursor: pointer; transition: opacity .2s, transform .16s, box-shadow .2s; }
.chat-send-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-send-button:not(:disabled):hover { box-shadow: 0 6px 24px rgba(53, 171, 215, .3); }
.chat-send-button:not(:disabled):active { transform: scale(.96); }
.chat-send-button:focus-visible { outline: 2px solid #b4f5ff; outline-offset: 3px; }
.chat-send-button:disabled { cursor: default; box-shadow: none; opacity: .36; }

.camera-sheet { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; height: 100dvh; padding: calc(14px + var(--safe-top)) 14px calc(14px + var(--safe-bottom)); overflow: hidden; }
.camera-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0, 8, 14, .82); backdrop-filter: blur(10px); }
.camera-panel { position: relative; width: min(100%, 480px); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 28px); padding: 18px; border: 1px solid rgba(157, 213, 235, .2); border-radius: 26px; background: linear-gradient(155deg, #102f43, #071b29); box-shadow: 0 28px 90px rgba(0, 0, 0, .56); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #315b70 transparent; animation: confirm-in .2s ease-out; }
.camera-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.camera-heading h2 { margin: 0; font-size: 22px; }
.camera-preview { position: relative; width: 100%; aspect-ratio: 4 / 3; border: 1px solid rgba(104, 206, 234, .25); border-radius: 21px; background: #031019; box-shadow: inset 0 0 42px rgba(0, 0, 0, .5); overflow: hidden; }
.camera-preview video { display: block; width: 100%; height: 100%; object-fit: cover; background: #031019; }
.camera-loading { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; color: #c9dde6; background: radial-gradient(circle at center, rgba(20, 69, 91, .9), rgba(3, 16, 25, .96)); font-size: 12px; }
.camera-loading span { width: 28px; height: 28px; border: 2px solid rgba(81, 219, 231, .2); border-top-color: var(--cyan); border-radius: 50%; animation: camera-spin .8s linear infinite; }
.camera-preview[data-state="ready"] .camera-loading { display: none; }
.camera-preview[data-state="error"] .camera-loading span { border: 0; border-radius: 0; animation: none; }
.camera-guide { position: absolute; inset: 12%; pointer-events: none; opacity: .64; }
.camera-guide i { position: absolute; width: 26px; height: 26px; border-color: rgba(214, 250, 255, .78); border-style: solid; }
.camera-guide i:nth-child(1) { top: 0; left: 0; border-width: 2px 0 0 2px; border-radius: 8px 0 0; }
.camera-guide i:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; border-radius: 0 8px 0 0; }
.camera-guide i:nth-child(3) { right: 0; bottom: 0; border-width: 0 2px 2px 0; border-radius: 0 0 8px; }
.camera-guide i:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 8px; }
.camera-prompt { display: grid; gap: 7px; margin: 14px 0 10px; color: #bfd3dd; font-size: 11px; font-weight: 700; }
.camera-prompt textarea { width: 100%; min-height: 62px; max-height: 100px; padding: 11px 13px; resize: none; border: 1px solid rgba(157, 213, 235, .2); border-radius: 14px; outline: none; color: var(--text); background: rgba(2, 16, 25, .58); font-size: 12px; line-height: 1.5; }
.camera-prompt textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(81, 219, 231, .1); }
.camera-privacy { display: flex; align-items: center; gap: 8px; margin: 0 2px 13px; color: #7899a9; font-size: 10px; line-height: 1.45; }
.camera-privacy svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: var(--green); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.camera-actions { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: 9px; }
.camera-action { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; border: 1px solid transparent; border-radius: 15px; font-size: 11px; font-weight: 800; cursor: pointer; }
.camera-action svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.camera-action.secondary { border-color: var(--line); color: #b8d0dc; background: rgba(255, 255, 255, .035); }
.camera-action.primary { color: #03212d; background: linear-gradient(135deg, #58e1dd, #64a8ff); box-shadow: 0 10px 24px rgba(53, 171, 215, .18); }
.camera-action:active { transform: scale(.985); }
.camera-action:disabled { cursor: wait; filter: grayscale(.45); opacity: .45; }

.confirm-dialog { position: fixed; z-index: 110; inset: 0; display: grid; place-items: center; height: 100dvh; padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom)); overflow: hidden; }
.confirm-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0, 8, 14, .76); backdrop-filter: blur(9px); }
.confirm-panel { position: relative; width: min(100%, 370px); padding: 27px 24px 22px; border: 1px solid rgba(157, 213, 235, .18); border-radius: 25px; background: linear-gradient(145deg, #102f43, #091e2d); box-shadow: 0 28px 80px rgba(0, 0, 0, .52); text-align: center; animation: confirm-in .2s ease-out; }
.confirm-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: -58px auto 18px; border: 1px solid rgba(255, 107, 121, .4); border-radius: 21px; color: #ff8d98; background: linear-gradient(145deg, #3a2431, #152738); box-shadow: 0 13px 34px rgba(255, 75, 94, .14); }
.confirm-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.confirm-panel > .eyebrow { margin-bottom: 7px; color: #ff98a2; }
.confirm-panel h2 { margin: 0; font-size: 24px; }
.confirm-panel > p:not(.eyebrow) { max-width: 290px; margin: 9px auto 22px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; border: 1px solid transparent; border-radius: 15px; font-weight: 750; cursor: pointer; transition: transform .16s, background .16s, border-color .16s, opacity .16s; }
.confirm-button:active { transform: scale(.98); }
.confirm-button.secondary { border-color: var(--line); color: #bad0db; background: rgba(255, 255, 255, .035); }
.confirm-button.secondary:hover, .confirm-button.secondary:focus-visible { border-color: rgba(81, 219, 231, .34); color: #f1fbff; background: rgba(81, 219, 231, .08); }
.confirm-button.danger { border-color: rgba(255, 107, 121, .28); color: #fff; background: linear-gradient(135deg, #db5362, #b93652); box-shadow: 0 10px 25px rgba(185, 54, 82, .2); }
.confirm-button.danger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.confirm-button:disabled { cursor: wait; opacity: .55; }

.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(92px + var(--safe-bottom)); width: max-content; max-width: calc(100vw - 36px); transform: translateX(-50%); padding: 11px 15px; border: 1px solid rgba(132, 207, 233, .24); border-radius: 14px; color: #eaf8ff; background: rgba(11, 38, 55, .96); box-shadow: 0 14px 40px rgba(0, 0, 0, .36); font-size: 12px; text-align: center; }
.toast.error { border-color: rgba(255, 107, 121, .4); color: #ffd9dc; }
#keyboardSheet:not([hidden]) ~ .toast { top: calc(16px + var(--safe-top)); bottom: auto; }

.profile-dialog { position: fixed; z-index: 115; inset: 0; display: grid; place-items: center; height: 100dvh; padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom)); }
.profile-panel { position: relative; width: min(100%, 490px); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 22px; border: 1px solid var(--line); border-radius: 25px; background: linear-gradient(150deg, #102f43, #071b29); box-shadow: 0 30px 90px #0008; }
.profile-panel .camera-heading { position: sticky; top: -22px; z-index: 2; margin: -22px -22px 12px; padding: 20px 22px 14px; background: #102f43; border-bottom: 1px solid var(--line); }
.profile-status { color: #9cb9c7; font-size: 12px; min-height: 1.5em; }
.profile-score { display: grid; gap: 4px; padding: 15px 17px; margin-bottom: 18px; border: 1px solid #4bdfdb33; border-radius: 16px; background: #4bdfdb08; }
.profile-score strong { color: #77e7e5; font-size: 20px; }
.profile-score span { font-size: 13px; }
.profile-score small, .profile-field small, .profile-toggle small { color: #8eaab9; font-size: 11px; font-weight: 400; line-height: 1.6; }
.profile-field { display: grid; gap: 7px; margin: 14px 0; color: #d8e9f1; font-size: 13px; }
.profile-field input, .profile-field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: #effbff; background: #071a29; font: inherit; }
.profile-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 14px 0; font-size: 13px; }
.profile-toggle input { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; accent-color: #4bdfdb; }
.profile-toggle span, .profile-toggle small { display: block; }
.profile-toggle small { margin-top: 5px; }
.profile-actions { display: grid; gap: 10px; margin-top: 20px; }
.profile-actions .primary-button { min-height: 46px; justify-content: center; }
.profile-task { padding: 14px; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; font-size: 12px; }
.profile-task p, #profileResetConfirm p { overflow-wrap: anywhere; color: #a3bdcb; line-height: 1.6; }
.profile-field input:focus-visible, .profile-field select:focus-visible { outline: 2px solid #4bdfdb; outline-offset: 2px; }
.profile-panel button:disabled, .profile-field select:disabled { opacity: .5; cursor: wait; }

@keyframes listen-pulse { 0% { transform: scale(.76); opacity: .7; } 100% { transform: scale(1.36); opacity: 0; } }
@keyframes speak-ring { 0%,100% { transform: scale(.92); opacity: .16; } 50% { transform: scale(1.08); opacity: .52; } }
@keyframes think-glow { 0%,100% { transform: scale(.98); box-shadow: 0 0 28px color-mix(in srgb, var(--state) 26%, transparent); } 50% { transform: scale(1.025); box-shadow: 0 0 58px color-mix(in srgb, var(--state) 46%, transparent); } }
@keyframes thinking-dot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-9px); opacity: 1; } }
@keyframes speaking-bar { from { transform: scaleY(.42); opacity: .72; } to { transform: scaleY(1); opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(30px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
@keyframes confirm-in { from { transform: translateY(12px) scale(.97); opacity: .35; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes camera-spin { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .assistant-view { padding-left: 30px; padding-right: 30px; }
  .voice-orb { width: clamp(190px, 27vh, 244px); }
  .keyboard-sheet { align-items: center; padding: 24px; }
  .sheet-panel { grid-template-rows: auto minmax(0, 1fr) auto; height: min(84dvh, 820px); max-height: calc(var(--chat-viewport-height, 100dvh) - 48px); padding: 18px 26px 22px; border-bottom: 1px solid rgba(157, 213, 235, .2); border-radius: 28px; }
  .sheet-handle { display: none; }
  .sheet-heading { padding-top: 0; }
  .chat-bubble { padding: 16px 18px; font-size: 1.0625rem; }
  .compose-hint { display: block; }
}

@media (max-height: 700px) and (orientation: landscape) {
  .voice-stage { padding-top: 8px; padding-bottom: calc(68px + var(--safe-bottom)); }
  .voice-orb { width: 132px; margin: 12px 0 10px; }
  .mic-icon svg { width: 42px; height: 42px; }
  .voice-stage > p { min-height: 0; margin-top: 4px; }
  .bottom-controls { bottom: calc(8px + var(--safe-bottom)); }
  .sheet-panel { height: calc(var(--chat-viewport-height, 100dvh) - var(--safe-top) - 10px); max-width: 760px; }
  .sheet-heading { padding-bottom: 10px; }
  .chat-messages { margin-top: 8px; margin-bottom: 8px; }
  .chat-empty { padding: 12px; }
  .chat-empty > span { width: 56px; height: 56px; margin-bottom: 10px; border-radius: 18px; }
  .chat-empty img { width: 44px; height: 44px; border-radius: 13px; }
  .chat-compose { padding: 8px 12px; }
  .camera-panel { width: min(92vw, 720px); }
  .camera-preview { aspect-ratio: 16 / 7; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (pointer: coarse) {
  .compose-hint { display: none; }
}
.dataset-login-note { margin: 8px 0 0; color: #a7c3d0; font-size: 12px; line-height: 1.6; text-align: center; }
.dataset-login-note a, .dataset-chat-note { color: #78deea; }
.dataset-chat-note { display: block; font-size: 12px; line-height: 1.5; margin-top: 4px; }
.dataset-chat-note[hidden] { display: none; }
