:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8e9ec;
  background: #141619;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 320px; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid #c1cde0; outline-offset: 3px; }
[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; }

.app { position: relative; display: flex; flex-direction: column; height: 100dvh; min-height: 360px; overflow: hidden; background: #141619; }
.scene-bg { position: absolute; z-index: 0; inset: 0; pointer-events: none; background: radial-gradient(780px 370px at 49% -12%, rgba(92,113,157,.29), transparent 72%), radial-gradient(380px 240px at 12% 8%, rgba(91,96,133,.11), transparent 85%), radial-gradient(620px 220px at 50% 108%, rgba(72,89,130,.15), transparent 80%), #141619; }
.aurora-layer { position: absolute; z-index: 0; inset: 0; pointer-events: none; opacity: .46; -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 37%, transparent 92%); mask-image: linear-gradient(to bottom, #000 0%, #000 37%, transparent 92%); }
.glass { background: rgba(26,30,40,.72); border: 1px solid rgba(235,242,255,.15); box-shadow: 0 18px 40px rgba(0,0,0,.22); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

.header { position: absolute; z-index: 20; top: max(17px, env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; justify-content: space-between; width: min(880px, calc(100% - 36px)); min-height: 64px; padding: 8px 10px 8px 24px; border: 1px solid rgba(227,235,252,.12); border-radius: 999px; transform: translateX(-50%); background: rgba(26,30,40,.43); box-shadow: 0 12px 30px rgba(0,0,0,.13); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.header > .brand, .header > .model-picker, .header > .header-actions { z-index: 1; }
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; color: #f7f8fb; font-size: 17px; font-weight: 690; letter-spacing: -.045em; text-decoration: none; text-shadow: 0 1px 6px rgba(0,0,0,.18); }
.brand-logo { display: block; width: 27px; height: 27px; flex: 0 0 auto; }
.model-picker { position: absolute; left: 50%; display: flex; justify-content: center; max-width: calc(100% - 190px); transform: translateX(-50%); }
.model-button { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: rgba(240,244,252,.78); font-size: 12px; font-weight: 550; white-space: nowrap; transition: background .2s ease, color .2s ease; }
.model-button:hover, .model-button[aria-expanded="true"] { background: rgba(232,239,255,.13); color: #fff; }
.model-button:disabled { opacity: .55; cursor: default; }
.model-button span { overflow: hidden; text-overflow: ellipsis; }
.model-button svg { flex: 0 0 auto; width: 13px; height: 13px; opacity: .7; transition: transform .2s ease; }
.model-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.model-menu { position: absolute; z-index: 30; top: calc(100% + 14px); left: 50%; width: 236px; padding: 6px; border-radius: 18px; transform: translateX(-50%); }
.model-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 5px 9px; border: 0; border-radius: 12px; background: transparent; color: #e7eaf0; font-size: 12px; text-align: left; white-space: nowrap; }
.model-option:hover, .model-option:focus-visible { background: rgba(230,238,255,.11); }
.model-option-logo { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #eef0f4; }
.model-option-logo img { display: block; width: 17px; height: 17px; object-fit: contain; }
.deepseek-option-logo { background: rgba(78,107,243,.14); }
.deepseek-option-logo img { width: 23px; height: 23px; }
.model-check { width: 16px; height: 16px; margin-left: auto; color: #c9dcff; opacity: 0; }
.model-option[aria-current="true"] .model-check { opacity: 1; }
.header-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.history-picker { position: relative; }
.nav-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: #f2f4f9; font-size: 12px; font-weight: 570; white-space: nowrap; }
.nav-action:hover, .nav-action[aria-expanded="true"] { background: rgba(232,239,255,.13); }
.nav-action:disabled { opacity: .5; cursor: default; }
.nav-action svg { width: 17px; height: 17px; }
.history-menu { position: absolute; z-index: 30; top: calc(100% + 14px); right: 0; width: min(300px, calc(100vw - 24px)); max-height: min(480px, calc(100dvh - 100px)); display: flex; flex-direction: column; padding: 10px; border-radius: 18px; }
.history-heading { padding: 8px 10px 10px; color: #eef1f7; font-size: 13px; font-weight: 650; }
.history-list { min-height: 44px; overflow-y: auto; scrollbar-color: #555965 transparent; }
.history-empty { margin: 0; padding: 16px 10px; color: #a6abb4; font-size: 12px; }
.history-item { display: block; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: #d9dce3; text-align: left; }
.history-item:hover, .history-item:focus-visible, .history-item[aria-current="true"] { background: rgba(230,238,255,.1); }
.history-item-title { display: block; overflow: hidden; font-size: 12px; font-weight: 570; text-overflow: ellipsis; white-space: nowrap; }
.history-item-date { display: block; margin-top: 3px; color: #9ca3b1; font-size: 10px; }
.history-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; margin-top: 8px; padding: 10px 8px 2px; border-top: 1px solid rgba(227,235,252,.12); }
.history-account span { overflow: hidden; color: #a9afbb; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.history-account button { flex: 0 0 auto; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: #e8ebf2; font-size: 11px; }
.history-account button:hover { background: rgba(230,238,255,.1); }
.new-chat { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: #f2f4f9; font-size: 12px; font-weight: 570; white-space: nowrap; transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.new-chat:hover { background: rgba(232,239,255,.13); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.new-chat:active { transform: scale(.97); }
.new-chat:disabled { opacity: .5; cursor: default; }
.new-chat svg { width: 17px; height: 17px; }

.main { position: relative; z-index: 1; display: flex; flex: 1; flex-direction: column; min-height: 0; user-select: text; }
.chat-scroll { display: flex; flex: 1; flex-direction: column; overflow-y: auto; padding-top: 101px; scrollbar-color: #35373a transparent; }
.empty-state { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.openai-avatar, .deepseek-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #f0f1f3; }
.openai-avatar img, .deepseek-avatar img { display: block; width: 22px; height: 22px; object-fit: contain; }
.deepseek-avatar { background: rgba(83,111,248,.12); }
.deepseek-avatar img { width: 31px; height: 31px; }
.empty-avatar { width: 48px; height: 48px; margin-bottom: 19px; box-shadow: 0 8px 25px rgba(0,0,0,.16); }
.empty-avatar img { width: 31px; height: 31px; }
.empty-avatar.deepseek-avatar img { width: 43px; height: 43px; }
.empty-state h1 { margin: 0; color: #f0f1f3; font-size: clamp(23px, 4vw, 30px); font-weight: 600; letter-spacing: -.045em; }
.empty-state p { margin: 8px 0 0; color: #a2a7af; font-size: 14px; }
.messages { width: min(100% - 48px, 720px); margin: 0 auto; padding: 29px 0 50px; }
.messages:empty { display: none; }
.message { padding: 24px 0; border-bottom: 1px solid rgba(221,226,237,.1); }
.message:first-child { padding-top: 0; }
.message-role { display: flex; align-items: center; gap: 10px; min-height: 34px; margin: 0 0 12px; color: #e9eaed; font-size: 12px; font-weight: 650; }
.message-content { color: #c5c7ca; font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-content { color: #e6e7e8; }
.message.pending .message-content { color: #8f9297; }
.message.unsaved .message-content { color: #e8e2cb; }

.composer { position: relative; z-index: 20; display: flex; flex: 0 0 auto; align-items: flex-end; gap: 10px; width: min(720px, calc(100% - 48px)); min-height: 58px; margin: 0 auto 20px; padding: 10px 10px 10px 19px; border: 1px solid rgba(227,235,252,.12); border-radius: 24px; background: rgba(26,30,40,.43); box-shadow: 0 12px 30px rgba(0,0,0,.13); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.composer textarea { position: relative; z-index: 1; display: block; flex: 1; align-self: center; min-width: 0; min-height: 24px; max-height: 180px; padding: 1px 0 0; resize: none; border: 0; outline: 0; background: transparent; color: #f3f3f4; font-size: 14px; line-height: 1.55; }
.composer textarea::placeholder { color: #b5bbc9; }
.send { position: relative; z-index: 1; display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: #becae2; color: #182235; transition: background .2s ease, transform .2s ease, opacity .2s ease; }
.send:hover { background: #e2e9f7; }
.send:active { transform: scale(.95); }
.send:disabled { cursor: default; background: rgba(142,158,190,.22); color: #a3adbf; }
.send svg { width: 20px; height: 20px; }
.status { position: absolute; z-index: 2; right: 0; bottom: calc(100% + 10px); left: 0; margin: 0; color: #e2b8b5; font-size: 11px; text-align: center; }
.status:empty { display: none; }
.retry-save { position: absolute; z-index: 3; right: 12px; bottom: calc(100% + 38px); padding: 8px 12px; border: 1px solid rgba(227,235,252,.17); border-radius: 10px; background: #303b32; color: #ddf1db; font-size: 11px; }
.retry-save:hover { background: #3d4d3f; }
.retry-save:disabled { opacity: .6; cursor: default; }

.auth-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(12,14,18,.9); -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px); }
.auth-card { width: min(100%, 380px); padding: 30px; border: 1px solid rgba(227,235,252,.13); border-radius: 24px; background: #1c2027; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.auth-logo { display: block; width: 42px; height: 42px; margin: 0 auto 15px; }
.auth-card h1 { margin: 0; color: #f2f4f7; font-size: 24px; font-weight: 630; letter-spacing: -.04em; text-align: center; }
.auth-card > p:first-of-type { margin: 9px 0 24px; color: #aeb4bf; font-size: 13px; line-height: 1.5; text-align: center; }
.google-sign-in, .auth-submit { width: 100%; min-height: 43px; border: 0; border-radius: 12px; font-size: 13px; font-weight: 630; }
.google-sign-in { display: flex; align-items: center; justify-content: center; gap: 10px; background: #f3f5f7; color: #20252c; }
.google-sign-in:hover { background: #fff; }
.google-mark { font-size: 19px; font-weight: 750; color: #4285f4; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 17px 0; color: #8f97a4; font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: rgba(227,235,252,.13); }
.auth-form { display: flex; flex-direction: column; }
.auth-form label { margin: 0 0 6px; color: #cbd0da; font-size: 11px; font-weight: 570; }
.auth-form input { width: 100%; height: 42px; margin: 0 0 14px; padding: 0 12px; border: 1px solid rgba(227,235,252,.16); border-radius: 10px; outline: 0; background: #15191f; color: #f1f2f4; font-size: 13px; }
.auth-form input:focus { border-color: #9fca9c; }
.auth-submit { margin-top: 2px; background: #a7d3a2; color: #17331f; }
.auth-submit:hover { background: #c0e5b6; }
.auth-form button:disabled, .google-sign-in:disabled, .verify-controls button:disabled { opacity: .55; cursor: default; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.auth-links button, .verify-controls > button:not(.auth-submit) { padding: 5px 0; border: 0; background: transparent; color: #c5d9c3; font-size: 12px; }
.auth-links button:hover, .verify-controls > button:not(.auth-submit):hover { color: #e1f3de; text-decoration: underline; }
.verify-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-status { min-height: 18px; margin: 14px 0 0; color: #e4aaa5; font-size: 12px; line-height: 1.45; text-align: center; }
.auth-status:empty { display: none; }

@supports not (backdrop-filter: blur(1px)) { .glass { background: rgba(48,53,68,.94); } }
@media (prefers-reduced-transparency: reduce) { .glass { background: rgba(38,43,57,.96); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (prefers-reduced-motion: reduce) { .aurora-layer { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 600px) {
  .header { top: max(11px, env(safe-area-inset-top)); width: calc(100% - 24px); min-height: 56px; padding: 6px 7px 6px 18px; }
  .brand { font-size: 16px; }
  .brand-logo { width: 25px; height: 25px; }
  .new-chat span { display: none; }
  .nav-action span { display: none; }
  .nav-action { width: 36px; padding: 0; }
  .model-picker { max-width: calc(100% - 125px); }
  .model-button { padding: 0 5px; font-size: 11px; }
  .model-menu { left: 50%; }
  .new-chat { width: 42px; padding: 0; }
  .chat-scroll { padding-top: 82px; }
  .messages { width: min(100% - 36px, 720px); padding-top: 28px; }
  .composer { width: calc(100% - 24px); margin-bottom: 12px; padding-left: 15px; }
}
