
:root {
  color-scheme: light;
  --ink: #282129;
  --muted: #807782;
  --paper: #f8f5f2;
  --paper-2: #fffdfb;
  --plum: #2a202b;
  --plum-2: #3a2b3b;
  --rose: #c9868f;
  --rose-dark: #a75d6c;
  --copper: #d4a17f;
  --line: #e8e0dc;
  --bubble-user: #f0e5e2;
  --shadow: 0 24px 80px rgba(29, 17, 29, .16);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--plum); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(201, 134, 143, .55); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell {
  display: flex; flex-direction: column; width: min(100% - 52px, 1020px); min-height: min(920px, 100dvh - 52px);
  margin: 26px auto; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 26px;
  background: var(--paper); box-shadow: var(--shadow);
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 30px; color: #fff9f7; background: var(--plum); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-copy { display: grid; gap: 0; }
.brand-copy strong { font: 800 21px/1 'Segoe UI', system-ui, sans-serif; letter-spacing: -.06em; }
.brand-copy small { margin-top: 4px; color: #c1b4c1; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { position: relative; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #e1b098, #bd7180); }
.brand-mark::before, .brand-mark::after { position: absolute; content: ''; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; }
.brand-mark::before { inset: 5px; }.brand-mark::after { inset: 10px; border-color: rgba(255,255,255,.7); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.connection-status { display: flex; align-items: center; gap: 7px; color: #c6b9c5; font-size: 11px; }
.connection-status i { width: 6px; height: 6px; border-radius: 50%; background: #87b99b; box-shadow: 0 0 10px rgba(135,185,155,.55); }
.connection-status.offline i { background: #d9a16b; box-shadow: none; }
.icon-button { display: grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; color: #f5e8e5; background: transparent; transition: .18s ease; }
.icon-button:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.08); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.conversation { display: flex; flex: 1; flex-direction: column; min-height: 440px; padding: 42px clamp(22px, 8vw, 84px) 25px; }
.conversation-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 27px; }
.eyebrow { margin: 0 0 8px; color: var(--rose-dark); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: break-word; }
h1, h2 { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
h1 { font-size: clamp(23px, 3vw, 30px); font-weight: 600; letter-spacing: -.045em; }
.today-pill { padding: 7px 11px; border: 1px solid var(--line); border-radius: 20px; color: #8e828b; font-size: 10px; white-space: nowrap; }
.welcome-card { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; min-height: 330px; padding: 28px 0; text-align: center; }
.welcome-orbit { position: relative; display: grid; width: 82px; height: 82px; margin-bottom: 22px; place-items: center; border: 1px solid rgba(201,134,143,.25); border-radius: 50%; color: #fffaf8; background: radial-gradient(circle at 32% 30%, #d5a293, #a85e70 70%); box-shadow: 0 12px 30px rgba(167,93,108,.19); font: 600 26px 'Segoe UI', system-ui, sans-serif; }
.welcome-orbit::before, .welcome-orbit::after { position: absolute; inset: -9px; border: 1px solid rgba(201,134,143,.18); border-radius: 50%; content: ''; }
.welcome-orbit::after { inset: -18px; border-color: rgba(201,134,143,.11); }
.welcome-kicker { margin: 0 0 7px; color: var(--rose-dark); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.welcome-card h2 { font-size: 24px; font-weight: 600; letter-spacing: -.04em; }
.welcome-copy { max-width: 340px; margin: 10px 0 21px; color: #827984; font-size: 14px; line-height: 1.6; }
.prompt-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.prompt-chip { min-height: 36px; padding: 8px 12px; border: 1px solid #e7d8d5; border-radius: 20px; color: #745e67; background: #fffaf8; font-size: 11px; transition: .18s ease; }
.prompt-chip:hover { border-color: var(--rose); color: #603e49; background: #f7eceb; transform: translateY(-1px); }

.messages { display: flex; flex-direction: column; gap: 18px; }
.message { display: flex; flex-direction: column; max-width: min(77%, 620px); animation: rise .2s ease both; }
.message.user { align-self: flex-end; align-items: flex-end; }
.message.assistant { align-self: flex-start; align-items: flex-start; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 8px 6px; color: #968b94; font-size: 10px; }
.message-model { color: #786c76; }
.message-model-reserve { padding: 1px 5px; border-radius: 8px; color: #85616a; background: #f3e8e7; font-size: 9px; }
.message-bubble { padding: 13px 16px; border-radius: 17px 17px 17px 5px; color: #352c35; background: var(--paper-2); box-shadow: 0 2px 10px rgba(36,25,35,.04); font-size: 14px; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-bubble { border-radius: 17px 17px 5px 17px; background: var(--bubble-user); }
.message-tools { display: flex; align-items: center; gap: 8px; margin: 6px 8px 0; }
.audio-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #e8ddda; border-radius: 16px; color: #85616a; background: transparent; font-size: 10px; }
.audio-button:hover { background: #f5e9e7; }
.audio-button svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.audio-player { max-width: 250px; height: 34px; margin: 7px 8px 0; }
.typing-indicator { display: flex; align-items: center; gap: 4px; align-self: flex-start; margin: 18px 8px 0; color: #9a8e97; }
.typing-indicator span { width: 5px; height: 5px; border-radius: 50%; background: var(--rose); animation: pulse 1.1s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: .15s; }.typing-indicator span:nth-child(3) { animation-delay: .3s; }
.typing-indicator em { margin-left: 5px; font-size: 10px; font-style: normal; }
.error-banner { margin-top: 14px; padding: 10px 13px; border: 1px solid #edc7bf; border-radius: 12px; color: #82483e; background: #fff2ee; font-size: 12px; line-height: 1.5; }

.composer-wrap { padding: 12px clamp(18px, 8vw, 84px) 23px; }
.composer { padding: 13px 14px 10px 17px; border: 1px solid #e5dbd7; border-radius: 18px; background: var(--paper-2); box-shadow: 0 9px 28px rgba(57, 34, 49, .045); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: #d5a0a4; box-shadow: 0 0 0 3px rgba(201,134,143,.12); }
.composer textarea { display: block; width: 100%; min-height: 28px; max-height: 150px; padding: 4px 1px; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; line-height: 1.5; }
.composer textarea::placeholder { color: #aa9fa7; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 8px; }
.composer-hint { color: #aaa0a8; font-size: 9px; }
.send-button { display: inline-flex; min-height: 37px; align-items: center; gap: 8px; padding: 0 13px; border: 0; border-radius: 12px; color: #fff9f7; background: var(--plum-2); font-size: 11px; transition: .18s ease; }
.send-button:hover { background: #5a4058; transform: translateY(-1px); }.send-button:disabled { cursor: wait; opacity: .5; transform: none; }
.send-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note { margin: 9px 4px 0; color: #a49ba1; font-size: 9px; line-height: 1.45; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

.settings-backdrop { position: fixed; z-index: 5; inset: 0; background: rgba(23,15,24,.38); backdrop-filter: blur(2px); }
.settings-panel { position: fixed; z-index: 6; top: 0; right: 0; display: flex; width: min(430px, 100%); height: 100dvh; flex-direction: column; padding: 26px 28px; overflow: auto; background: #fcf9f6; box-shadow: -20px 0 65px rgba(20,13,20,.18); transform: translateX(104%); transition: transform .25s cubic-bezier(.2,.75,.2,1); }
.settings-panel.open { transform: translateX(0); }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.settings-header h2 { font-size: 25px; font-weight: 600; letter-spacing: -.04em; }
.close-button { width: 34px; height: 34px; border-color: var(--line); color: #766a75; font-size: 22px; line-height: 1; }
.close-button:hover { border-color: #d9c7c7; background: #f2e9e6; }
.settings-form { display: flex; flex-direction: column; padding: 19px 0 32px; }
.field-label { margin: 14px 0 7px; color: #524751; font-size: 11px; font-weight: 700; }
.settings-form input:not([type=range]):not([type=checkbox]), .settings-form textarea, .settings-form select, .login-form input { width: 100%; padding: 10px 11px; border: 1px solid #e5dbd7; border-radius: 10px; outline: 0; color: #342d36; background: #fffdfb; font-size: 12px; line-height: 1.5; }
.settings-form textarea { resize: vertical; }.settings-form input:focus, .settings-form textarea:focus, .settings-form select:focus { border-color: #cf949b; box-shadow: 0 0 0 3px rgba(201,134,143,.1); }
.field-hint { margin: 6px 1px 1px; color: #968b94; font-size: 10px; line-height: 1.5; }
.section-rule { height: 1px; margin: 20px 0 15px; background: var(--line); }
.section-label { margin: 0 0 1px; color: var(--rose-dark); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 19px 0 1px; cursor: pointer; }
.switch-row span { display: grid; gap: 4px; }.switch-row strong { color: #514650; font-size: 11px; }.switch-row small { color: #988d96; font-size: 9px; line-height: 1.35; }
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }.switch-row i { position: relative; width: 37px; height: 21px; flex: 0 0 auto; border-radius: 12px; background: #d8cfd3; transition: .2s; }
.switch-row i::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0002; content: ''; transition: .2s; }
.switch-row input:checked + i { background: #a96677; }.switch-row input:checked + i::after { transform: translateX(16px); }.switch-row input:focus-visible + i { outline: 3px solid rgba(201,134,143,.55); outline-offset: 2px; }
.switch-row input:disabled + i { opacity: .45; }
.range-row { display: flex; align-items: center; gap: 11px; }.range-row input { width: 100%; accent-color: #a96677; }.range-row output { min-width: 45px; color: #776972; font-size: 10px; text-align: right; }
.router-status { margin: 22px 0 7px; padding: 11px 12px; border: 1px solid #eadbd6; border-radius: 11px; color: #786a74; background: #f8f0ed; font-size: 10px; line-height: 1.55; }
.router-status.ready { border-color: #d7e4da; color: #54745f; background: #f1f7f1; }
.primary-button { width: 100%; min-height: 43px; padding: 11px 14px; border: 0; border-radius: 12px; color: #fff9f7; background: var(--plum-2); font-size: 12px; font-weight: 600; transition: .18s ease; }
.primary-button:hover:not(:disabled) { background: #5a4058; }.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.save-settings { margin-top: 13px; }.text-button { width: fit-content; align-self: center; margin-top: 17px; padding: 7px; border: 0; background: transparent; font-size: 10px; }.danger-text { color: #a15d62; }.danger-text:hover { text-decoration: underline; }
.settings-notice { margin: 10px 0 0; color: #58765f; font-size: 11px; text-align: center; }

.age-dialog { width: min(420px, calc(100% - 34px)); padding: 31px; border: 1px solid #e8dedb; border-radius: 20px; color: var(--ink); background: var(--paper-2); box-shadow: var(--shadow); }
.age-dialog::backdrop { background: rgba(24,15,25,.63); backdrop-filter: blur(4px); }
.age-mark { display: grid; width: 47px; height: 47px; margin-bottom: 20px; place-items: center; border-radius: 50%; color: #fff9f7; background: linear-gradient(145deg, #d3a08e, #ae6474); font: 700 12px 'Manrope', sans-serif; }
.age-dialog h2 { font-size: 23px; font-weight: 600; letter-spacing: -.04em; }.age-dialog > p:not(.eyebrow) { margin: 11px 0 19px; color: #7f747e; font-size: 12px; line-height: 1.65; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 0 0 20px; color: #5d515c; font-size: 11px; cursor: pointer; }.check-row input { width: 16px; height: 16px; accent-color: #9e6370; }
.login-form { margin-top: 17px; }.login-form .field-label { display: block; }.login-form .primary-button { margin-top: 13px; }.login-error { color: #a34c4c; font-size: 11px; }
.toast { position: fixed; z-index: 10; bottom: 22px; left: 50%; max-width: calc(100% - 30px); padding: 11px 15px; border-radius: 12px; color: #fff9f7; background: #362b37; box-shadow: 0 9px 28px #0003; font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
  body { background: var(--paper); }
  .app-shell { width: 100%; min-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: max(14px, env(safe-area-inset-top)) 18px 14px; }
  .conversation { min-height: 0; padding: 27px 19px 16px; }
  .conversation-heading { align-items: center; margin-bottom: 14px; }
  .today-pill { padding: 6px 8px; font-size: 9px; }
  .welcome-card { min-height: 280px; padding: 16px 0 24px; }
  .welcome-orbit { width: 68px; height: 68px; margin-bottom: 19px; font-size: 22px; }
  .welcome-copy { max-width: 280px; font-size: 13px; }
  .prompt-chips { gap: 7px; }.prompt-chip { min-height: 34px; padding: 7px 10px; font-size: 10px; }
  .message { max-width: 88%; }.message-bubble { padding: 11px 13px; font-size: 13px; }
  .composer-wrap { position: sticky; bottom: 0; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(248,245,242,.92), #f8f5f2 18%); }
  .composer { padding: 11px 11px 9px 13px; border-radius: 15px; }
  .composer-hint { max-width: 52%; font-size: 8px; line-height: 1.4; }
  .send-button { min-height: 35px; padding: 0 11px; font-size: 10px; }
  .privacy-note { margin-top: 7px; font-size: 8px; }
  .settings-panel { padding: max(20px, env(safe-area-inset-top)) 21px calc(24px + env(safe-area-inset-bottom)); }
  .audio-player { max-width: 210px; }
}
@media (max-width: 360px) {
  .connection-status { font-size: 9px; }.topbar-actions { gap: 10px; }
  .conversation-heading { align-items: flex-start; }.today-pill { margin-top: 3px; }
  .composer-hint { max-width: 47%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
