:root {
  color-scheme: light dark;
  --background: #f7f8fb;
  --foreground: #15161a;
  --card: rgba(255, 255, 255, 0.86);
  --card-foreground: #15161a;
  --popover: #ffffff;
  --popover-foreground: #15161a;
  --primary: #7068c7;
  --primary-foreground: #ffffff;
  --secondary: #f0f1f5;
  --secondary-foreground: #25262b;
  --muted: #f0f1f5;
  --muted-foreground: #737680;
  --accent: #eff1f5;
  --accent-foreground: #17181c;
  --destructive: #dc384d;
  --border: rgba(76, 79, 100, 0.08);
  --input: rgba(76, 79, 100, 0.1);
  --ring: rgba(118, 109, 207, 0.28);
  --radius: 0.95rem;
  --sidebar: rgba(250, 250, 252, 0.82);
  --sidebar-foreground: #25262b;
  --sidebar-primary: #7068c7;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(255, 255, 255, 0.9);
  --sidebar-accent-foreground: #17181c;
  --sidebar-border: rgba(31, 33, 40, 0.08);
  --sidebar-ring: rgba(107, 118, 255, 0.42);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  --radius-sm: calc(var(--radius) - 5px);
  --radius-md: calc(var(--radius) - 3px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 7px);
  --font-sans: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: #f5f6fa;
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-shell { position: relative; height: 100svh; overflow: hidden; background: #f8f9fc; }
.site-shell [data-slot="sidebar-wrapper"] { --sidebar-width: 14.125rem !important; }
.site-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 5%, rgba(255,255,255,.9), transparent 40%),
    linear-gradient(135deg, rgba(255, 221, 234, .18), transparent 35%, rgba(207, 224, 255, .2));
}
.ambient { position: fixed; z-index: 0; border-radius: 999px; filter: blur(95px); opacity: .28; pointer-events: none; }
.ambient-a { width: 360px; height: 360px; right: -150px; top: -190px; background: linear-gradient(135deg, #ffc6dc, #b8c7ff); }
.ambient-b { width: 300px; height: 300px; left: 24%; bottom: -250px; background: linear-gradient(135deg, #f4d8ff, #c6eaff); }

.chat-inset { z-index: 1; height: 100svh; min-width: 0; overflow: hidden; background: rgba(250, 251, 253, .78); backdrop-filter: blur(24px); }
.site-shell [data-slot="sidebar-gap"] { width: 0 !important; }
.app-sidebar[data-slot="sidebar-container"] { border: 0 !important; transition-duration: 60ms !important; transition-timing-function: cubic-bezier(.16,1,.3,1) !important; }
.app-sidebar [data-sidebar="sidebar"] { position: relative; overflow: hidden; border: 0 !important; border-radius: 20px !important; background: #fff; box-shadow: 0 18px 52px rgba(45,48,66,.12), 0 2px 8px rgba(45,48,66,.04) !important; backdrop-filter: none; }
.sidebar-head { display: block; padding: 10px 10px 7px; }
.drawer-bar { display: flex; height: 38px; align-items: center; justify-content: space-between; padding: 0 2px 0 7px; }
.drawer-heading { display: flex; align-items: center; gap: 7px; }
.drawer-heading strong { color: #2f3036; font-size: 13px; font-weight: 680; letter-spacing: -.02em; }
.drawer-heading span { display: grid; min-width: 18px; height: 18px; place-items: center; border-radius: 7px; color: #94969f; background: #f1f1f5; font-size: 8px; }
.drawer-actions { display: flex; align-items: center; gap: 2px; }
.drawer-new, .sidebar-close { display: grid; width: 29px; height: 29px; flex: none; place-items: center; color: #858791; border: 0; border-radius: 9px; background: transparent; cursor: pointer; transition: color 70ms ease, background 70ms ease, transform 70ms ease; }
.drawer-new:hover, .sidebar-close:hover { color: #5d579b; background: #f0eff7; }
.drawer-new:hover { transform: rotate(8deg); }
.drawer-new:disabled { color: #c4c5ca; background: transparent; cursor: default; transform: none; }
.drawer-new svg, .sidebar-close svg { width: 14px; }
.app-sidebar [data-slot="sidebar-content"] { padding: 0 8px; }
.app-sidebar [data-slot="sidebar-group"] { padding: 8px 0; }
.history-label { height: 24px; padding: 0 9px; color: #aaaab2; font-size: 9px; font-weight: 650; letter-spacing: .08em; }
.history-list { gap: 3px; }
.history-item { position: relative; }
.history-button { position: relative; height: 34px !important; padding: 0 31px 0 20px !important; border: 0; border-radius: 10px !important; color: #747680; font-size: 10px; transition: color 70ms ease, background 70ms ease !important; }
.history-button::before { content: ""; position: absolute; left: 9px; width: 4px; height: 4px; border-radius: 99px; background: #c7c8ce; transition: 70ms ease; }
.history-button:hover { color: #4f515b !important; background: #f5f5f7 !important; }
.history-button[data-active="true"] { color: #3f3b55 !important; background: #eeedf6 !important; box-shadow: none; }
.history-button[data-active="true"]::before { height: 13px; background: #847bc8; }
.delete-chat { position: absolute; z-index: 1; top: 5px; right: 5px; display: grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 8px; opacity: 0; color: #a0a2aa; background: transparent; cursor: pointer; transition: color 70ms ease, background 70ms ease, opacity 70ms ease; }
.history-item:hover .delete-chat, .delete-chat:focus-visible, .history-button[data-active="true"] + .delete-chat { opacity: .72; }
.delete-chat:hover { color: #d44455; background: #fff0f2; }
.delete-chat svg { width: 13px; }
.sidebar-foot { padding: 9px 17px 13px; }
.local-note { display: flex; align-items: center; gap: 6px; padding: 0; color: #adaeb5; border: 0; background: transparent; font-size: 8px; line-height: 1.4; }
.local-note svg { width: 11px; }

.topbar { position: relative; z-index: 40; display: flex; height: 66px; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid rgba(83,86,105,.055); background: rgba(251,251,253,.72); backdrop-filter: blur(20px); }
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.mobile-menu { display: inline-flex; margin-left: -8px; border: 0; border-radius: 11px; color: #747681; background: rgba(255,255,255,.58); transition: 75ms ease; }
.mobile-menu:hover { color: #5d579e; background: rgba(255,255,255,.94); transform: translateX(1px); }
.mobile-menu.is-active { color: #625ca2; background: rgba(237,235,248,.9); }
.model-title span, .model-title small { display: block; }
.model-title span { color: #1c1d21; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.model-title small { display: flex; align-items: center; gap: 5px; max-width: 58vw; margin-top: 3px; overflow: hidden; color: #989aa2; font-family: var(--font-mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.model-title small i { width: 5px; height: 5px; flex: none; border-radius: 99px; background: #41c38a; box-shadow: 0 0 0 3px rgba(65,195,138,.12); }
.model-title small b { margin-left: 3px; padding-left: 7px; border-left: 1px solid rgba(78,81,95,.1); font-family: var(--font-sans); font-size: 8px; font-weight: 600; }
.language-toggle { display: inline-flex; height: 36px; align-items: center; gap: 4px; padding: 0 9px; border: 0; border-radius: 11px; color: #747681; background: rgba(255,255,255,.58); font-size: 9px; font-weight: 700; box-shadow: 0 4px 14px rgba(50,53,70,.035); }
.language-toggle svg { width: 13px; }
.language-toggle:hover { color: #5e58a4; background: #fff; }
.settings-trigger { border: 0; border-radius: 11px; color: #71747f; background: rgba(255,255,255,.68); box-shadow: 0 4px 14px rgba(50,53,70,.04); transition-duration: 120ms; }
.settings-trigger:hover { color: #5e58a4; background: #fff; transform: rotate(6deg); }

.chat-main { position: relative; display: flex; height: calc(100svh - 66px); flex-direction: column; overflow: hidden; }
.message-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(60,63,72,.16) transparent; }
.empty-state { display: flex; min-height: 100%; align-items: center; flex-direction: column; justify-content: center; padding: 30px 24px 155px; text-align: center; animation: rise-in .24s ease-out both; }
.simple-mark { display: grid; width: 40px; height: 40px; place-items: center; margin-bottom: 18px; border: 0; border-radius: 13px; color: #746bc2; background: linear-gradient(135deg, rgba(249,229,241,.92), rgba(232,237,255,.96)); box-shadow: 0 6px 20px rgba(75,78,104,.055); }
.simple-mark svg { width: 18px; }
.empty-state h1 { margin: 0; font-size: clamp(29px, 3.4vw, 39px); font-weight: 620; letter-spacing: -.045em; }
.empty-state > p { display: flex; align-items: center; gap: 8px; margin: 11px 0 24px; color: #8b8e97; font-size: 11px; }
.empty-state > p i { width: 3px; height: 3px; border-radius: 99px; background: #b0b2b9; }
.setup-callout { display: flex; align-items: center; gap: 11px; min-width: 270px; margin-top: 3px; padding: 10px 12px; text-align: left; border: 0; border-radius: 14px; color: #4b4d58; background: rgba(255,255,255,.7); box-shadow: 0 6px 20px rgba(83,86,126,.045); cursor: pointer; transition: .11s ease; }
.setup-callout:hover { transform: translateY(-2px); box-shadow: 0 15px 36px rgba(83,86,126,.11); }
.setup-callout > svg:first-child { width: 17px; }
.setup-callout > svg:last-child { width: 16px; margin-left: auto; color: #9396a2; }
.setup-callout strong, .setup-callout small { display: block; }
.setup-callout strong { font-size: 12px; }
.setup-callout small { margin-top: 2px; color: #858893; font-size: 9px; }

.messages { width: min(850px, calc(100% - 40px)); margin: 0 auto; padding: 43px 0 190px; }
.load-earlier { display: block; min-height: 38px; margin: 0 auto 31px; padding: 0 15px; color: #777985; border: 0; border-radius: 12px; background: rgba(255,255,255,.65); font-size: 10px; cursor: pointer; box-shadow: 0 5px 16px rgba(52,55,74,.04); }
.load-earlier:hover { color: #5e58a4; background: rgba(255,255,255,.95); }
.message { display: grid; grid-template-columns: 31px minmax(0,1fr); gap: 13px; margin-bottom: 34px; animation: message-in .14s ease-out both; }
.message.user { grid-template-columns: minmax(0,1fr) 31px; }
.message.user .avatar { grid-column: 2; color: #625aac; background: #eceafa; }
.message.user .message-body { grid-row: 1; justify-self: end; max-width: min(78%, 620px); }
.message.user .message-label { text-align: right; }
.message.user .markdown { padding: 11px 15px; border: 0; border-radius: 17px 5px 17px 17px; background: rgba(255,255,255,.84); box-shadow: 0 6px 20px rgba(52,55,74,.04); }
.avatar { display: grid; width: 31px; height: 31px; place-items: center; border: 0; border-radius: 10px; color: #6f7280; background: rgba(255,255,255,.78); box-shadow: 0 4px 14px rgba(52,55,74,.04); }
.avatar svg { width: 15px; }
.message-body { min-width: 0; }
.message.assistant .message-body { max-width: 770px; padding: 15px 18px 17px; border-radius: 18px; background: rgba(255,255,255,.58); box-shadow: 0 8px 28px rgba(54,57,77,.04); }
.message-label { margin: 2px 0 10px; color: #92949d; font-size: 10px; font-weight: 650; letter-spacing: .035em; }
.message.error .markdown { color: #a52d3d; padding: 12px 14px; border: 1px solid rgba(220,56,77,.12); border-radius: 13px; background: rgba(255,238,241,.72); }
.message.interrupted .message-body { opacity: .82; }
.markdown { color: #24252b; font-size: 14px; line-height: 1.78; overflow-wrap: anywhere; }
.markdown p { margin: 0 0 12px; white-space: pre-wrap; }
.markdown p:last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3 { margin: 20px 0 8px; color: #17181c; font-weight: 690; line-height: 1.35; letter-spacing: -.025em; }
.markdown h1:first-child, .markdown h2:first-child, .markdown h3:first-child { margin-top: 0; }
.markdown h1 { font-size: 19px; } .markdown h2 { font-size: 16px; } .markdown h3 { font-size: 14px; }
.markdown ul, .markdown ol { margin: 8px 0 14px; padding-left: 21px; }
.markdown li { margin: 3px 0; padding-left: 3px; }
.markdown li::marker { color: #8178c6; font-weight: 650; }
.markdown .task-item { display: flex; align-items: flex-start; gap: 7px; margin-left: -18px; list-style: none; }
.markdown .task-item input { width: 14px; height: 14px; flex: none; margin-top: 6px; accent-color: #7c73c5; }
.markdown strong { color: #17181c; font-weight: 700; }
.markdown em { color: #4f515a; }
.markdown del { color: #8b8d96; text-decoration-color: #aaa4ca; }
.markdown a { color: #6c62d9; text-decoration: underline; text-underline-offset: 3px; }
.markdown :not(pre) > code { padding: 2px 5px; border: 1px solid rgba(42,44,53,.08); border-radius: 5px; color: #584f9f; background: rgba(108,98,217,.07); font-family: var(--font-mono); font-size: .9em; }
.markdown blockquote { margin: 12px 0; padding: 8px 13px; border-left: 2px solid #aaa2df; border-radius: 0 9px 9px 0; color: #62646e; background: rgba(242,241,249,.72); }
.markdown hr { height: 1px; margin: 20px 0; border: 0; background: linear-gradient(90deg, rgba(92,87,156,.18), transparent); }
.markdown-table-wrap { max-width: 100%; margin: 14px 0; overflow-x: auto; border: 1px solid rgba(42,44,53,.08); border-radius: 12px; }
.markdown table { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 12px; }
.markdown th, .markdown td { padding: 9px 11px; text-align: left; border-bottom: 1px solid rgba(42,44,53,.07); border-right: 1px solid rgba(42,44,53,.06); }
.markdown th:last-child, .markdown td:last-child { border-right: 0; }
.markdown tr:last-child td { border-bottom: 0; }
.markdown th { color: #3c3e47; background: rgba(242,241,249,.78); font-weight: 680; }
.code-block { overflow: hidden; margin: 14px 0; border: 0; border-radius: 13px; background: #25262d; box-shadow: 0 8px 22px rgba(31,32,40,.09); }
.code-label { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 7px 4px 12px; color: #aeb0bb; border-bottom: 1px solid rgba(255,255,255,.07); background: #2b2c34; font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; }
.code-label > span { display: flex; align-items: center; gap: 6px; }
.code-label svg { width: 12px; }
.copy-code { display: flex; min-height: 26px; align-items: center; gap: 5px; padding: 0 7px; color: #aeb0bb; border: 0; border-radius: 7px; background: transparent; font: 8px var(--font-sans); text-transform: none; cursor: pointer; }
.copy-code:hover { color: #fff; background: rgba(255,255,255,.08); }
.code-block pre { margin: 0; padding: 15px; overflow-x: auto; color: #ececf1; font: 12px/1.65 var(--font-mono); }

.thinking { max-width: 700px; margin: 0 0 12px; border-left: 1px solid rgba(64,67,78,.14); }
.thinking button { display: flex; height: 30px; align-items: center; gap: 7px; padding: 0 9px; color: #8d9099; border: 0; background: transparent; font-size: 10px; cursor: pointer; }
.thinking button > svg:first-child { width: 12px; }
.thinking-chevron { width: 12px; }
.thinking-pulse { width: 5px; height: 5px; border-radius: 99px; background: #a49bdd; animation: pulse 1.1s ease infinite; }
.thinking-copy { max-height: 300px; padding: 3px 11px 8px; overflow-y: auto; color: #898c95; font-size: 12px; line-height: 1.72; white-space: pre-wrap; animation: reveal .25s ease both; }
.streaming-copy { color: #24252b; font-size: 14px; line-height: 1.82; white-space: pre-wrap; overflow-wrap: anywhere; }
.rainbow-tail { color: transparent; background: linear-gradient(90deg, #ef9aaa, #c29adc, #829be7, #70afd0); -webkit-background-clip: text; background-clip: text; animation: hue-flow 1.4s linear infinite; }
.stream-caret { display: inline-block; width: 5px; height: 14px; margin-left: 3px; vertical-align: -2px; border-radius: 99px; background: linear-gradient(#b3a0dd,#84a6e7); animation: caret 1s ease infinite; }
.context-compacting { display: flex; min-height: 30px; align-items: center; gap: 8px; color: #858893; font-size: 12px; }
.context-compacting svg { width: 14px; color: #948ad0; animation: pulse 1.1s ease infinite; }
.back-to-bottom { position: absolute; z-index: 8; right: 50%; bottom: 165px; display: flex; min-height: 36px; align-items: center; gap: 6px; padding: 0 12px; color: #686b75; border: 0; border-radius: 13px; background: rgba(255,255,255,.94); font-size: 9px; box-shadow: 0 9px 26px rgba(49,52,70,.12); cursor: pointer; transform: translateX(50%); }
.back-to-bottom:hover { color: #5b559f; transform: translateX(50%) translateY(-1px); }
.back-to-bottom svg { width: 13px; }

.composer-wrap { position: absolute; z-index: 6; right: 0; bottom: 0; left: 0; padding: 22px 28px max(17px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(247,248,251,1) 30%, rgba(247,248,251,.94) 70%, rgba(247,248,251,0)); pointer-events: none; }
.composer { position: relative; width: min(820px, 100%); min-height: 104px; margin: 0 auto; padding: 14px 14px 11px; border: 0; border-radius: 22px; background: rgba(255,255,255,.92); box-shadow: 0 16px 45px rgba(55,58,78,.085); backdrop-filter: blur(20px); pointer-events: auto; transition: .13s ease; }
.composer:focus-within { box-shadow: 0 18px 50px rgba(65,67,92,.1), 0 0 0 3px rgba(120,115,204,.04); transform: translateY(-1px); }
.composer textarea { min-height: 43px; max-height: 150px; padding: 2px 4px; resize: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 14px; line-height: 1.6; }
.composer textarea:focus-visible { border: 0; box-shadow: none; }
.composer textarea::placeholder { color: #a3a5ac; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; }
.reasoning-control { display: flex; width: auto; height: 36px; align-items: center; gap: 2px; padding: 3px; border: 0; border-radius: 12px; background: #f2f1f8; }
.reasoning-icon { width: 14px; height: 14px; margin: 0 5px 0 6px; color: #9388cf; }
.reasoning-option { position: relative; display: grid; height: 30px; min-width: 45px; place-items: center; padding: 0 9px; border: 0; border-radius: 9px; color: #8a8798; font-size: 10px; font-weight: 650; cursor: pointer; transition: color 75ms ease, background 75ms ease, box-shadow 75ms ease; }
.reasoning-option:hover { color: #5b5670; }
.reasoning-option:has([data-state="checked"]) { color: #56509a; background: rgba(255,255,255,.96); box-shadow: 0 2px 7px rgba(79,75,124,.08); }
.reasoning-option:has(.reasoning-radio:focus-visible) { box-shadow: 0 0 0 2px rgba(118,109,207,.14); }
.reasoning-radio { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.send-button { width: 34px; height: 34px; border: 0; border-radius: 11px; background: linear-gradient(135deg, #827ad6, #6f78ce); box-shadow: 0 7px 16px rgba(100,95,184,.18); transition: .12s ease; }
.send-button:hover { background: linear-gradient(135deg, #756dcc, #626cc2); transform: translateY(-1px); }
.send-button:disabled { opacity: .22; }
.send-button.stop { color: #fff; background: #8c8e9b; }
.composer-hint { margin: 8px auto 0; color: #a2a4ab; font-size: 9px; line-height: 1.5; text-align: center; pointer-events: auto; }
.composer-hint.has-error { color: #c64a5a; }

.settings-dialog { width: min(500px, calc(100% - 28px)) !important; max-width: 500px !important; max-height: min(700px, calc(100svh - 28px)); grid-template-rows: auto minmax(0, 1fr) auto; gap: 0 !important; overflow: hidden; padding: 0 !important; border: 0 !important; border-radius: 24px !important; background: rgba(252,252,254,.97); box-shadow: 0 24px 70px rgba(67,69,91,.16); backdrop-filter: blur(28px); animation-duration: 140ms !important; }
.settings-dialog:focus { outline: none; }
[data-slot="dialog-overlay"] { background: rgba(113,116,137,.1); backdrop-filter: blur(7px); animation-duration: 120ms !important; }
[data-slot="sheet-overlay"] { background: rgba(113,116,137,.055) !important; backdrop-filter: blur(2px); animation-duration: 40ms !important; animation-timing-function: cubic-bezier(.16,1,.3,1) !important; }
[data-slot="sheet-content"][data-sidebar="sidebar"] { top: 70px !important; bottom: auto !important; left: 10px !important; width: min(78vw, 260px) !important; height: min(70svh, 520px) !important; overflow: hidden; border: 0 !important; border-radius: 20px !important; background: #fff !important; box-shadow: 0 18px 48px rgba(45,48,66,.13) !important; animation-duration: 52ms !important; animation-timing-function: cubic-bezier(.16,1,.3,1) !important; }
.settings-header { display: flex; flex-direction: row; gap: 12px; padding: 27px 25px 21px; border-bottom: 1px solid rgba(32,34,41,.07); }
.settings-header > div:last-child { min-width: 0; }
.settings-header [data-slot="dialog-title"] { font-size: 17px; }
.settings-header [data-slot="dialog-description"] { margin-top: 4px; color: #8b8d96; font-size: 11px; }
.settings-icon { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 12px; color: #685fb7; background: linear-gradient(135deg, #f8e8f1, #e8ecff); box-shadow: 0 6px 16px rgba(92,87,156,.07); }
.settings-icon svg { width: 16px; }
.settings-body { min-height: 0; overflow-y: auto; padding: 20px 24px; }
.settings-section { padding: 17px; border: 0; border-radius: 17px; background: rgba(255,255,255,.76); box-shadow: 0 6px 22px rgba(63,65,84,.035); }
.settings-section + .settings-section, .settings-section + .export-button { margin-top: 13px; }
.section-heading { display: flex; align-items: center; gap: 10px; }
.section-heading > svg { width: 16px; color: #777a85; }
.section-heading strong, .section-heading span { display: block; }
.section-heading strong { color: #32343b; font-size: 11px; }
.section-heading span { margin-top: 2px; color: #999ba4; font-size: 9px; }
.language-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; padding: 4px; border-radius: 12px; background: #f3f3f7; }
.language-option { min-height: 34px; color: #898b95; border: 0; border-radius: 9px; background: transparent; font-size: 10px; font-weight: 650; cursor: pointer; }
.language-option:hover { color: #5e58a4; }
.language-option.is-active { color: #57509a; background: #fff; box-shadow: 0 2px 8px rgba(70,67,111,.08); }
.key-field { position: relative; margin-top: 14px; }
.key-field input { height: 41px; border: 0; border-radius: 12px; background: #f3f3f7; font-family: var(--font-mono); font-size: 11px; box-shadow: inset 0 0 0 1px transparent; }
.key-field input:focus-visible, .system-prompt:focus-visible { border: 0; box-shadow: inset 0 0 0 1px rgba(118,109,207,.2), 0 0 0 3px rgba(118,109,207,.06); }
.get-key { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; color: #736ac4; font-size: 10px; font-weight: 600; text-decoration: none; }
.get-key:hover { text-decoration: underline; }
.get-key svg { width: 11px; }
.system-prompt { min-height: 126px; margin-top: 14px; resize: vertical; border: 0; border-radius: 12px; background: #f3f3f7; font-size: 11px; line-height: 1.65; box-shadow: none; }
.system-prompt-preview { position: relative; display: block; width: 100%; max-height: 78px; margin-top: 14px; padding: 12px 13px 22px; overflow: hidden; text-align: left; white-space: pre-wrap; color: #777984; border: 0; border-radius: 12px; background: #f3f3f7; font-size: 10px; line-height: 1.65; cursor: pointer; mask-image: linear-gradient(to bottom, #000 38%, transparent 100%); -webkit-mask-image: linear-gradient(to bottom, #000 38%, transparent 100%); }
.system-prompt-preview:hover { color: #656873; background: #f0f0f6; }
.prompt-actions { display: flex; align-items: center; gap: 2px; margin-top: 3px; }
.prompt-actions > span { flex: 1; }
.prompt-actions button { height: 29px; padding: 0 7px; color: #898b95; border: 0; background: transparent; font-size: 9px; box-shadow: none; }
.prompt-actions button:hover { color: #5f5a9f; background: rgba(239,237,249,.8); }
.prompt-actions svg { width: 11px; transition: transform 90ms ease; }
.prompt-actions svg.is-open { transform: rotate(180deg); }
.export-button { width: 100%; height: 42px; border: 0; border-radius: 13px; color: #656872; background: rgba(255,255,255,.7); font-size: 10px; box-shadow: none; }
.export-button:hover { color: #554f9e; background: #efedf9; }
.settings-footer { padding: 16px 24px 20px; border-top: 1px solid rgba(32,34,41,.07); background: rgba(251,251,253,.92); }
.settings-service-note { margin: 9px 0 0; color: #a2a4ab; font-size: 9px; line-height: 1.5; text-align: center; }
.save-button { width: 100%; height: 43px; border: 0; border-radius: 13px; background: linear-gradient(135deg, #827ad6, #6e77ca); box-shadow: 0 8px 20px rgba(100,95,184,.16); transition-duration: 120ms; }
.save-button:hover { background: linear-gradient(135deg, #756dcc, #626cc2); transform: translateY(-1px); }
.save-button.saved { background: #2e8d68; }

.boot-screen { display: grid; height: 100svh; place-items: center; background: #f7f8fb; }
.boot-orb { width: 30px; height: 30px; border: 3px solid rgba(75,77,88,.12); border-top-color: #565968; border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes message-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.75); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-3px); } }
@keyframes caret { 50% { opacity: .25; } }
@keyframes hue-flow { to { filter: hue-rotate(45deg); } }

@media (max-width: 767px) {
  .topbar { height: 62px; padding: 0 14px; }
  .chat-main { height: calc(100svh - 62px); }
  .model-title span { font-size: 13px; }
  .model-title small { max-width: 54vw; }
  .settings-trigger { width: 36px; height: 36px; }
  .language-toggle { width: 36px; padding: 0; justify-content: center; }
  .language-toggle span { display: none; }
  .empty-state { justify-content: flex-start; padding: clamp(70px, 15vh, 125px) 18px 165px; }
  .empty-state h1 { font-size: 29px; }
  .empty-state > p { max-width: 280px; font-size: 12px; line-height: 1.6; }
  .setup-callout { width: 100%; max-width: 350px; }
  .messages { width: calc(100% - 28px); padding: 28px 0 176px; }
  .message { grid-template-columns: 28px minmax(0,1fr); gap: 10px; margin-bottom: 29px; }
  .message.user { grid-template-columns: minmax(0,1fr) 28px; }
  .avatar { width: 28px; height: 28px; border-radius: 9px; }
  .message.user .message-body { max-width: 88%; }
  .message.assistant .message-body { padding: 13px 14px 15px; border-radius: 16px; }
  .markdown, .streaming-copy { font-size: 13px; line-height: 1.78; }
  .thinking-copy { max-height: 220px; font-size: 11px; }
  .back-to-bottom { bottom: 153px; min-height: 38px; font-size: 10px; }
  .composer-wrap { padding: 18px 11px max(10px, env(safe-area-inset-bottom)); }
  .composer { min-height: 99px; padding: 12px 12px 10px; border-radius: 20px; }
  .composer textarea { font-size: 14px; }
  .composer-hint, .settings-service-note { font-size: 8px; }
  .settings-dialog { width: calc(100% - 24px) !important; max-width: 510px !important; border-radius: 21px !important; }
  .settings-header { padding: 23px 20px 18px; }
  .settings-body { padding: 18px 17px; }
  .settings-footer { padding-right: 17px; padding-left: 17px; }
}

@media (min-width: 768px) {
  .app-sidebar[data-slot="sidebar-container"] { z-index: 30; top: 78px !important; bottom: auto !important; left: 14px !important; width: 14.125rem !important; height: min(480px, calc(100svh - 102px)) !important; padding: 0 !important; opacity: 1; transform: translateX(0) scale(1); transform-origin: left top; transition-property: transform, opacity !important; }
  [data-slot="sidebar"][data-state="collapsed"] > .app-sidebar[data-slot="sidebar-container"] { left: 14px !important; opacity: 0; pointer-events: none; transform: translateX(calc(-100% - 24px)) scale(.985); }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #111218;
    --foreground: #ececf1;
    --card: #1b1c23;
    --card-foreground: #ececf1;
    --popover: #1d1e25;
    --popover-foreground: #ececf1;
    --primary: #938be3;
    --primary-foreground: #ffffff;
    --secondary: #24252d;
    --secondary-foreground: #ececf1;
    --muted: #24252d;
    --muted-foreground: #999ba6;
    --accent: #292a34;
    --accent-foreground: #f2f2f5;
    --destructive: #f06372;
    --border: rgba(255,255,255,.08);
    --input: rgba(255,255,255,.1);
    --ring: rgba(160,151,235,.38);
    --sidebar: #1b1c22;
    --sidebar-foreground: #e8e8ed;
    --sidebar-primary: #9b93e7;
    --sidebar-primary-foreground: #ffffff;
    --sidebar-accent: #292a33;
    --sidebar-accent-foreground: #ffffff;
    --sidebar-border: rgba(255,255,255,.08);
    --sidebar-ring: rgba(160,151,235,.42);
  }

  body,
  .site-shell { background: #111218; }

  .site-shell::before {
    background:
      radial-gradient(circle at 50% 3%, rgba(79, 75, 122, .16), transparent 43%),
      linear-gradient(135deg, rgba(86, 48, 71, .09), transparent 36%, rgba(47, 63, 98, .12));
  }

  .ambient { opacity: .09; filter: blur(110px); }
  .ambient-a { background: linear-gradient(135deg, #8f4f72, #596bb5); }
  .ambient-b { background: linear-gradient(135deg, #7d5791, #4b7c96); }
  .chat-inset { background: rgba(17,18,24,.84); }

  .app-sidebar [data-sidebar="sidebar"] {
    background: #1b1c22;
    box-shadow: 0 20px 58px rgba(0,0,0,.38), 0 0 0 1px rgba(255,255,255,.045) !important;
  }

  .drawer-heading strong { color: #eeeeF2; }
  .drawer-heading span { color: #a2a4ae; background: #282930; }
  .drawer-new,
  .sidebar-close { color: #a3a5ae; }
  .drawer-new:hover,
  .sidebar-close:hover { color: #c2bdf5; background: #2a2937; }
  .drawer-new:disabled { color: #555761; background: transparent; }
  .history-label { color: #777984; }
  .history-button { color: #a2a4ae; }
  .history-button::before { background: #5a5c66; }
  .history-button:hover { color: #e1e1e6 !important; background: #24252c !important; }
  .history-button[data-active="true"] { color: #e8e6f8 !important; background: #2c2b3b !important; }
  .history-button[data-active="true"]::before { background: #9b92e2; }
  .delete-chat { color: #888a94; }
  .delete-chat:hover { color: #ff8491; background: rgba(190,52,73,.15); }
  .local-note { color: #6f717b; }

  .topbar {
    border-bottom-color: rgba(255,255,255,.055);
    background: rgba(18,19,25,.82);
  }

  .mobile-menu,
  .language-toggle,
  .settings-trigger {
    color: #a0a2ad;
    background: rgba(38,39,48,.8);
    box-shadow: 0 4px 16px rgba(0,0,0,.13);
  }

  .mobile-menu:hover,
  .language-toggle:hover,
  .settings-trigger:hover { color: #c3bdf3; background: #2b2c35; }
  .mobile-menu.is-active { color: #cbc7f6; background: #302e42; }
  .model-title span { color: #efeff2; }
  .model-title small { color: #8b8d98; }
  .model-title small i { box-shadow: 0 0 0 3px rgba(65,195,138,.14); }
  .model-title small b { border-left-color: rgba(255,255,255,.1); }
  .message-scroll { scrollbar-color: rgba(255,255,255,.14) transparent; }

  .simple-mark {
    color: #aaa3ed;
    background: linear-gradient(135deg, #2e2730, #252a3c);
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
  }

  .empty-state h1 { color: #f0f0f3; }
  .empty-state > p { color: #9395a0; }
  .empty-state > p i { background: #62646e; }
  .setup-callout {
    color: #d6d6dc;
    background: #1d1e25;
    box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 1px rgba(255,255,255,.04);
  }
  .setup-callout:hover { box-shadow: 0 16px 38px rgba(0,0,0,.28), 0 0 0 1px rgba(157,148,230,.1); }
  .setup-callout > svg:last-child { color: #777985; }
  .setup-callout small { color: #898b96; }

  .message.user .avatar { color: #b4acf2; background: #2c2a3d; }
  .message.user .markdown {
    background: #202128;
    box-shadow: 0 7px 22px rgba(0,0,0,.16);
  }
  .avatar {
    color: #a4a6b1;
    background: #202128;
    box-shadow: 0 5px 16px rgba(0,0,0,.15);
  }
  .message.assistant .message-body {
    background: rgba(29,30,37,.86);
    box-shadow: 0 9px 30px rgba(0,0,0,.15);
  }
  .message-label { color: #888a95; }
  .message.error .markdown {
    color: #ff9ba5;
    border-color: rgba(240,96,114,.16);
    background: rgba(105,33,45,.22);
  }
  .load-earlier,
  .back-to-bottom { color: #a0a2ad; background: #24252d; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
  .load-earlier:hover,
  .back-to-bottom:hover { color: #c7c2f4; background: #2b2c35; }

  .markdown,
  .streaming-copy { color: #e2e2e7; }
  .markdown h1,
  .markdown h2,
  .markdown h3,
  .markdown strong { color: #f3f3f5; }
  .markdown em { color: #c0c1c8; }
  .markdown del { color: #858792; text-decoration-color: #69657f; }
  .markdown a { color: #aaa3ee; }
  .markdown :not(pre) > code {
    color: #c3bdf7;
    border-color: rgba(190,183,247,.1);
    background: rgba(145,136,224,.12);
  }
  .markdown blockquote {
    color: #adafb9;
    border-left-color: #7972b2;
    background: rgba(50,49,65,.55);
  }
  .markdown hr { background: linear-gradient(90deg, rgba(166,157,232,.22), transparent); }
  .markdown-table-wrap { border-color: rgba(255,255,255,.08); }
  .markdown th, .markdown td { border-color: rgba(255,255,255,.07); }
  .markdown th { color: #e6e6eb; background: #292a32; }
  .code-block { background: #202127; box-shadow: 0 9px 24px rgba(0,0,0,.23); }
  .code-label { color: #adafba; background: #292a31; }

  .thinking { border-left-color: rgba(255,255,255,.1); }
  .thinking button { color: #92949e; }
  .thinking button:hover { color: #b9b4df; }
  .thinking-copy { color: #989aa4; }
  .thinking-pulse { background: #a49de2; }
  .context-compacting { color: #999ba6; }

  .composer-wrap {
    background: linear-gradient(0deg, #111218 30%, rgba(17,18,24,.95) 70%, rgba(17,18,24,0));
  }
  .composer {
    background: rgba(28,29,36,.96);
    box-shadow: 0 18px 50px rgba(0,0,0,.32), 0 0 0 1px rgba(255,255,255,.045);
  }
  .composer:focus-within { box-shadow: 0 20px 54px rgba(0,0,0,.4), 0 0 0 3px rgba(155,147,231,.08); }
  .composer textarea { color: #f0f0f3; }
  .composer textarea::placeholder { color: #797b85; }
  .reasoning-control { background: #25262e; }
  .reasoning-icon { color: #a199df; }
  .reasoning-option { color: #9698a2; }
  .reasoning-option:hover { color: #cac6e8; }
  .reasoning-option:has([data-state="checked"]) {
    color: #d4d0fb;
    background: #353641;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
  }
  .composer-hint { color: #747680; }

  [data-slot="dialog-overlay"] { background: rgba(3,4,7,.6); }
  [data-slot="sheet-overlay"] { background: rgba(3,4,7,.48) !important; }
  [data-slot="sheet-content"][data-sidebar="sidebar"] {
    background: #1b1c22 !important;
    box-shadow: 0 20px 58px rgba(0,0,0,.44), 0 0 0 1px rgba(255,255,255,.045) !important;
  }
  .settings-dialog {
    background: rgba(25,26,32,.98);
    box-shadow: 0 28px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
  }
  .settings-dialog [data-slot="dialog-close"] { color: #999ba5; }
  .settings-dialog [data-slot="dialog-close"]:hover { color: #ececf1; background: #292a32; }
  .settings-header { border-bottom-color: rgba(255,255,255,.07); }
  .settings-header [data-slot="dialog-title"] { color: #f0f0f3; }
  .settings-header [data-slot="dialog-description"] { color: #92949f; }
  .settings-icon {
    color: #b4adf0;
    background: linear-gradient(135deg, #332935, #292e45);
    box-shadow: 0 7px 18px rgba(0,0,0,.18);
  }
  .settings-section {
    background: #202128;
    box-shadow: 0 7px 24px rgba(0,0,0,.14), 0 0 0 1px rgba(255,255,255,.025);
  }
  .section-heading > svg { color: #a0a2ad; }
  .section-heading strong { color: #e3e3e8; }
  .section-heading span { color: #898b96; }
  .language-options { background: #282931; }
  .language-option { color: #999ba5; }
  .language-option:hover { color: #c9c4f4; }
  .language-option.is-active { color: #d3cff8; background: #353641; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .key-field input,
  .system-prompt,
  .system-prompt-preview { color: #e7e7eb; background: #282931; }
  .key-field input::placeholder,
  .system-prompt::placeholder { color: #73757f; }
  .key-field input:focus-visible,
  .system-prompt:focus-visible { box-shadow: inset 0 0 0 1px rgba(165,156,235,.3), 0 0 0 3px rgba(145,136,224,.08); }
  .get-key { color: #aca5ed; }
  .system-prompt-preview:hover { color: #d1d1d7; background: #2c2d36; }
  .prompt-actions button { color: #9597a1; }
  .prompt-actions button:hover { color: #c5bff5; background: #2c2b3b; }
  .export-button { color: #b1b2bb; background: #22232a; }
  .export-button:hover { color: #cbc6f6; background: #2c2b3b; }
  .settings-footer {
    border-top-color: rgba(255,255,255,.07);
    background: rgba(27,28,34,.96);
  }
  .settings-service-note { color: #767883; }
  .composer-hint.has-error { color: #ff8c99; }

  .boot-screen { background: #111218; }
  .boot-orb { border-color: rgba(255,255,255,.11); border-top-color: #aaa7b5; }
}

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

/* Native HTML/CSS/JavaScript runtime compatibility. */
button { appearance: none; -webkit-appearance: none; color: inherit; border: 0; }
button, input, textarea { outline: none; }
input, textarea { width: 100%; color: inherit; }
.hidden { display: none !important; }
.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; padding: 0; border: 0; cursor: pointer; }
.icon-button svg { width: 16px; height: 16px; }
.chat-inset { position: absolute; inset: 0; display: block; width: 100%; }
.app-sidebar { position: fixed; z-index: 50; top: 78px; left: 14px; width: 14.125rem; height: min(480px, calc(100svh - 102px)); opacity: 1; transform: translateX(0) scale(1); transform-origin: left top; transition: transform 60ms cubic-bezier(.16,1,.3,1), opacity 60ms cubic-bezier(.16,1,.3,1); }
.app-sidebar.closed { opacity: 0; pointer-events: none; transform: translateX(calc(-100% - 24px)) scale(.985); }
.app-sidebar > [data-sidebar="sidebar"] { display: flex; height: 100%; flex-direction: column; }
.sidebar-content { min-height: 0; flex: 1; overflow-y: auto; padding: 0 8px; }
.sidebar-group { padding: 8px 0; }
.history-list { display: flex; flex-direction: column; gap: 3px; }
.history-button { display: block; width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.sidebar-overlay { position: fixed; z-index: 45; inset: 0; display: none; background: rgba(113,116,137,.055); backdrop-filter: blur(2px); }
.sidebar-overlay.is-open { display: block; }
.dialog-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 14px; background: rgba(113,116,137,.1); backdrop-filter: blur(7px); }
.settings-dialog { position: relative; display: grid; }
.dialog-close { position: absolute; z-index: 2; top: 14px; right: 14px; border-radius: 10px; background: transparent; }
.dialog-close:hover { background: rgba(120,120,130,.08); }
.settings-header h2, .settings-header p { margin: 0; }
.settings-header h2 { font-size: 17px; }
.settings-header p { margin-top: 4px; color: #8b8d96; font-size: 11px; }
.settings-body button, .settings-footer button, .setup-callout, .load-earlier, .back-to-bottom { cursor: pointer; }
.prompt-actions button, .export-button, .save-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; }
.export-button svg { width: 14px; }
.reasoning-option[data-state="checked"] { color: #56509a; background: rgba(255,255,255,.96); box-shadow: 0 2px 7px rgba(79,75,124,.08); }
.reasoning-radio:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 5px; border-radius: 4px; }
.thinking-copy[hidden] { display: none; }
.thinking.is-pending { border-left-color: rgba(124,116,194,.18); }
.thinking-pending { color: #a0a2ab; font-style: italic; }
.composer textarea { display: block; width: 100%; }
.send-button { display: grid; place-items: center; color: #fff; cursor: pointer; }
.send-button svg { width: 16px; }

@media (max-width: 767px) {
  .app-sidebar { top: 70px; left: 10px; width: min(78vw,260px); height: min(70svh,520px); transition-duration: 52ms; }
  .app-sidebar.closed { transform: translateX(calc(-100% - 20px)) scale(.985); }
}

@media (min-width: 768px) {
  .sidebar-overlay { background: transparent; backdrop-filter: none; pointer-events: none; }
}

@media (prefers-color-scheme: dark) {
  .reasoning-option[data-state="checked"] { color: #d4d0fb; background: #353641; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .dialog-close { color: #999ba5; }
  .dialog-close:hover { color: #ececf1; background: #292a32; }
  .settings-header h2 { color: #f0f0f3; }
  .settings-header p { color: #92949f; }
  .dialog-overlay { background: rgba(3,4,7,.6); }
  .thinking.is-pending { border-left-color: rgba(166,157,232,.2); }
  .thinking-pending { color: #858792; }
}
