:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #fff;
  --sidebar: #f1f1f3;
  --text: #17181a;
  --muted: #6c7078;
  --line: #dedfe3;
  --accent: #202123;
  --blue: #246bfd;
  --danger: #c43d4b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; margin: 0; min-height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--text); }
body.app-active { position: fixed; inset: 0; }
button, input, textarea { min-width: 0; font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg, #111827, #354057); color: #fff; font-weight: 760; box-shadow: 0 9px 24px rgba(17, 24, 39, .18); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.brand-mark.large { width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 18px; font-size: 22px; }
.eyebrow { margin: 24px 0 8px; color: var(--blue); font-size: 12px; font-weight: 750; letter-spacing: .16em; }
h1 { margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -.04em; }
.muted { margin: 12px 0 0; color: var(--muted); line-height: 1.6; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 10%, rgba(36,107,253,.10), transparent 35%), radial-gradient(circle at 90% 85%, rgba(125,83,255,.08), transparent 35%), var(--bg); }
.login-card { width: min(100%, 420px); padding: 46px 42px 42px; border: 1px solid rgba(226,229,233,.9); border-radius: 28px; background: rgba(255,255,255,.95); box-shadow: 0 24px 80px rgba(31,39,52,.11); }
.login-form { display: grid; gap: 18px; margin-top: 34px; }
.login-form label { display: grid; gap: 8px; color: #4c5360; font-size: 13px; font-weight: 650; }
input { width: 100%; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: #fbfcfd; color: var(--text); }
input:focus { border-color: #8fb1fb; box-shadow: 0 0 0 4px rgba(36,107,253,.10); }
.form-error { min-height: 18px; margin: -5px 0 -3px; color: var(--danger); font-size: 13px; }
.primary { min-height: 46px; padding: 0 18px; border: 0; border-radius: 13px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 680; box-shadow: 0 8px 20px rgba(17,24,39,.15); }
.primary.wide { width: 100%; }
.primary:disabled { opacity: .55; cursor: wait; }

.app-shell { position: fixed; z-index: 1; top: var(--app-top, 0px); left: var(--app-left, 0px); width: var(--app-width, 100%); max-width: 100%; height: var(--app-height, 100dvh); display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; }
.sidebar { min-width: 0; height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; padding: 14px 12px 12px; border-right: 1px solid #e1e1e4; background: var(--sidebar); }
.sidebar-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 7px 8px; }
.brand-button { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; cursor: pointer; font-size: 14px; font-weight: 760; }
.new-chat-button { height: 44px; padding: 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid #d6d7dc; border-radius: 12px; background: #fff; cursor: pointer; text-align: left; font-weight: 650; }
.new-chat-button:hover { background: #fafafa; }
.sidebar-label { padding: 22px 10px 8px; color: #8a8e96; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.conversation-list { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 3px; scrollbar-width: thin; }
.conversation-item { width: 100%; min-width: 0; padding: 10px 11px; display: grid; gap: 4px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.conversation-item:hover, .conversation-item.active { background: #e3e3e7; }
.conversation-item strong, .conversation-item small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-item strong { font-size: 13px; font-weight: 580; }
.conversation-item small { color: #8c9098; font-size: 10px; }
.conversation-item.generating small { color: #246bfd; font-weight: 680; }
.conversation-item.generating small::before { content: "● "; font-size: 8px; }
.conversation-item.failed small { color: #b43a48; font-weight: 680; }
.conversation-item.failed small::before { content: "! "; }
.conversation-empty { padding: 16px 10px; color: #9498a0; font-size: 12px; }
.context-menu { position: fixed; z-index: 120; width: 168px; padding: 6px; border: 1px solid #dedfe3; border-radius: 12px; background: rgba(255,255,255,.98); box-shadow: 0 14px 42px rgba(20,25,35,.20); }
.context-menu button { width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650; touch-action: manipulation; }
.context-menu-danger { color: var(--danger); }
.context-menu-danger:hover, .context-menu-danger:focus-visible { outline: 0; background: #fff0f0; }
.sidebar-footer { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 12px 8px 3px; border-top: 1px solid #dedfe3; }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: #d8d9de; font-size: 12px; font-weight: 750; }
.account-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 650; }
.text-button { padding: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }

.chat-shell { position: relative; min-width: 0; height: 100%; display: grid; grid-template-rows: 58px minmax(0,1fr); overflow: hidden; }
.chat-topbar { position: relative; z-index: 30; min-width: 0; max-width: 100%; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; overflow: hidden; border-bottom: 1px solid rgba(222,223,227,.8); background: rgba(247,247,248,.94); backdrop-filter: blur(14px); }
.chat-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 680; }
.top-new-button { flex: 0 0 auto; min-height: 34px; padding: 0 12px; white-space: nowrap; border: 1px solid #d8d9de; border-radius: 10px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 650; }
.icon-button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 11px; background: transparent; cursor: pointer; touch-action: manipulation; font-size: 20px; }
.mobile-only { display: none; }

.messages { min-width: 0; min-height: 0; width: 100%; max-width: 100%; overflow-x: hidden; overflow-y: auto; padding: 42px max(24px, calc((100% - 820px) / 2)) 190px; scroll-behavior: smooth; }
.empty-chat { padding: clamp(75px, 16vh, 155px) 10px 40px; text-align: center; }
.empty-chat h1 { font-size: 30px; }
.empty-chat p { color: var(--muted); }
.message-row { width: 100%; max-width: 100%; min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 14px; margin-bottom: 34px; }
.message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: #e3e4e8; color: #4d5563; font-size: 13px; font-weight: 750; }
.message-row.assistant .message-avatar { background: var(--accent); color: #fff; }
.message-content { min-width: 0; width: 100%; max-width: 100%; overflow: hidden; padding-top: 2px; }
.message-label { margin-bottom: 8px; font-size: 13px; font-weight: 750; }
.message-text { width: 100%; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 16px; line-height: 1.75; }
.message-text a { color: #175dcc; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.rich-markdown { min-width: 0; white-space: normal; }
.rich-markdown > :first-child { margin-top: 0; }
.rich-markdown > :last-child { margin-bottom: 0; }
.rich-markdown p { margin: 0 0 15px; white-space: pre-wrap; }
.rich-markdown h2, .rich-markdown h3, .rich-markdown h4 { margin: 26px 0 10px; line-height: 1.35; letter-spacing: -.015em; }
.rich-markdown h2 { font-size: 21px; }
.rich-markdown h3 { font-size: 18px; }
.rich-markdown h4 { font-size: 16px; }
.rich-markdown ul, .rich-markdown ol { margin: 7px 0 17px; padding-left: 25px; }
.rich-markdown li { margin: 5px 0; padding-left: 2px; }
.rich-markdown blockquote { margin: 15px 0; padding: 9px 14px; border-left: 3px solid #aeb7c7; background: #f1f3f6; color: #535b67; white-space: pre-wrap; }
.rich-markdown hr { margin: 24px 0; border: 0; border-top: 1px solid #dfe1e5; }
.rich-markdown code { padding: 2px 5px; border-radius: 5px; background: #eceef1; font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rich-markdown pre { margin: 14px 0 18px; padding: 14px; overflow: auto; border-radius: 12px; background: #20242b; color: #f4f6f8; white-space: pre; line-height: 1.55; }
.rich-markdown pre code { padding: 0; background: transparent; color: inherit; }
.markdown-table-wrap { width: 100%; max-width: 100%; margin: 13px 0 20px; overflow-x: auto; border: 1px solid #dfe2e7; border-radius: 12px; background: #fff; -webkit-overflow-scrolling: touch; }
.markdown-table-wrap table { width: 100%; min-width: 430px; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.markdown-table-wrap th, .markdown-table-wrap td { padding: 10px 12px; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
.markdown-table-wrap th { background: #f0f2f5; font-weight: 720; }
.markdown-table-wrap tr:last-child td { border-bottom: 0; }
.markdown-table-wrap th:last-child, .markdown-table-wrap td:last-child { border-right: 0; }
.answer-image-grid { width: 100%; max-width: 100%; margin: 4px 0 20px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; overflow: hidden; }
.markdown-image { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #dfe2e7; border-radius: 13px; background: #eceef1; }
.markdown-image a { display: block; color: inherit; text-decoration: none; }
.markdown-image img { display: block; width: 100%; height: clamp(140px, 24vw, 240px); object-fit: cover; background: #e6e8eb; }
.markdown-image figcaption { padding: 7px 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #666e79; font-size: 10px; line-height: 1.35; }
.markdown-image.inline { display: inline-block; width: min(100%, 320px); vertical-align: top; }
.message-time { display: block; margin-top: 8px; color: #a0a5ae; font-size: 11px; }
.message-gallery { width: 100%; max-width: 100%; display: flex; flex-wrap: wrap; gap: 8px; overflow: hidden; margin: 0 0 12px; }
.message-image { width: 100%; max-width: 320px; max-height: 360px; object-fit: contain; border: 1px solid #dfe1e5; border-radius: 15px; background: #eee; cursor: zoom-in; }
.thinking-dot { display: inline-block; width: 7px; height: 7px; margin: 8px 4px 0 0; border-radius: 50%; background: #9299a5; animation: pulse 1.2s infinite ease-in-out; }
.thinking-dot:nth-child(2) { animation-delay: .15s; }
.thinking-dot:nth-child(3) { animation-delay: .3s; }
.pending-content { display: grid; gap: 11px; }
.thinking-status { min-width: 0; display: flex; align-items: center; gap: 7px; color: #747b86; font-size: 13px; }
.thinking-dots { flex: 0 0 auto; display: inline-flex; align-items: center; }
.thinking-dots .thinking-dot { margin-top: 0; }
.thinking-elapsed { flex: 0 0 auto; padding-left: 4px; color: #a0a5ae; font-size: 11px; }
.live-answer { overflow-wrap: anywhere; color: var(--text); }
.reasoning-summary { margin: 1px 0 3px; padding: 9px 11px; border: 1px solid #e1e3e7; border-radius: 11px; background: #f3f4f6; color: #5d6470; white-space: normal; font-size: 12px; line-height: 1.55; }
.reasoning-summary summary { cursor: pointer; color: #686f7a; font-weight: 680; }
.reasoning-body { margin-top: 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reasoning-summary.completed { margin-bottom: 13px; }
.generation-error { margin-top: 10px; padding: 9px 11px; border: 1px solid #f0c8cd; border-radius: 10px; background: #fff2f3; color: #a72e3b; font-size: 12px; line-height: 1.5; }
.message-sync-status { margin-top: 7px; color: #8a9099; font-size: 10px; }
.message-sync-status.failed, .message-sync-status.interrupted { color: #b43a48; }
@keyframes pulse { 0%,70%,100% { transform: translateY(0); opacity:.35; } 35% { transform: translateY(-5px); opacity:1; } }

.composer-wrap { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; overflow: hidden; padding: 20px max(18px, calc((100% - 820px) / 2)) max(14px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, rgba(247,247,248,0), var(--bg) 26%); }
.composer { width: 100%; max-width: 100%; min-width: 0; padding: 9px 9px 9px 11px; display: flex; align-items: flex-end; gap: 8px; border: 1px solid #d2d4d9; border-radius: 20px; background: #fff; box-shadow: 0 12px 42px rgba(31,39,52,.12); }
.composer textarea { flex: 1 1 0; width: 0; min-width: 0; min-height: 40px; max-height: 180px; padding: 8px 2px 5px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); line-height: 1.5; }
.attach-button, .send-button { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 13px; cursor: pointer; touch-action: manipulation; }
.attach-button { background: #eff0f2; color: #59606b; font-size: 24px; font-weight: 300; }
.send-button { background: var(--accent); color: #fff; font-size: 23px; }
.send-button:disabled, .search-button:disabled, .attach-button:disabled { opacity: .5; cursor: wait; }
.search-button { flex: 0 0 auto; min-width: 58px; height: 40px; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid #dedfe3; border-radius: 13px; background: #eff0f2; color: #626873; cursor: pointer; touch-action: manipulation; font-size: 12px; font-weight: 650; }
.search-button.active { border-color: #a9c4ff; background: #eaf2ff; color: #175dcc; }
.thinking-label { flex: 1 1 auto; min-width: 0; margin-left: 0; overflow-wrap: anywhere; color: #7f858e; font-size: 13px; }
.model-note { margin: 8px auto 0; color: #969ca6; text-align: center; font-size: 10px; }
.image-preview-list { width: 100%; max-width: 820px; margin: 0 auto 8px; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 7px; scrollbar-width: thin; }
.image-preview-card { position: relative; flex: 0 0 128px; min-width: 0; height: 92px; overflow: hidden; border: 1px solid #d7d9de; border-radius: 13px; background: #fff; box-shadow: 0 7px 20px rgba(31,39,52,.08); }
.image-preview-card img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 7px 5px; overflow: hidden; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; }
.image-preview-card button { position: absolute; right: 5px; top: 5px; width: 28px; height: 28px; border: 0; border-radius: 9px; background: rgba(20,24,30,.76); color: #fff; cursor: pointer; touch-action: manipulation; font-size: 18px; line-height: 1; }
.composer.dragging { border-color: #6e9bff; box-shadow: 0 0 0 4px rgba(36,107,253,.12), 0 12px 42px rgba(31,39,52,.12); }
.toast { position: fixed; z-index: 100; left: 50%; top: 18px; transform: translate(-50%,-18px); padding: 11px 16px; border-radius: 12px; background: #222936; color: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.2); font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.sidebar-overlay { display: none; }

/* The seven choices match web code. Light keeps the site's original colors. */
.theme-picker { width: min(100px, 32vw); min-width: 0; height: 32px; padding: 0 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 11px; cursor: pointer; }
.theme-picker:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sidebar-footer { grid-template-columns: 34px minmax(0,1fr) auto auto; gap: 6px; }


html:is([data-theme="dark"],[data-theme^="eye"]) .login-shell { background: var(--bg); }
html:is([data-theme="dark"],[data-theme^="eye"]) .login-card { border-color:var(--line); background:var(--surface); box-shadow:0 24px 80px var(--shadow-color); }
html:is([data-theme="dark"],[data-theme^="eye"]) .login-form label { color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) input::placeholder,
html:is([data-theme="dark"],[data-theme^="eye"]) .composer textarea::placeholder { color:var(--muted); opacity:1; }
html:is([data-theme="dark"],[data-theme^="eye"]) input { border-color:var(--line); background:var(--input-bg); color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) input:focus { border-color:var(--blue); box-shadow:0 0 0 4px var(--accent-soft); }
html:is([data-theme="dark"],[data-theme^="eye"]) .brand-mark { background:var(--accent); box-shadow:0 9px 24px var(--shadow-color); }
html:is([data-theme="dark"],[data-theme^="eye"]) .sidebar { border-color:var(--line); }
html:is([data-theme="dark"],[data-theme^="eye"]) .new-chat-button,
html:is([data-theme="dark"],[data-theme^="eye"]) .top-new-button { border-color:var(--line); background:var(--surface); }
html:is([data-theme="dark"],[data-theme^="eye"]) .new-chat-button:hover,
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-item:hover,
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-item.active,
html:is([data-theme="dark"],[data-theme^="eye"]) .icon-button:hover { background:var(--surface-hover); }
html:is([data-theme="dark"],[data-theme^="eye"]) .sidebar-label,
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-item small,
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-empty,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-time,
html:is([data-theme="dark"],[data-theme^="eye"]) .model-note,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-sync-status,
html:is([data-theme="dark"],[data-theme^="eye"]) .thinking-label,
html:is([data-theme="dark"],[data-theme^="eye"]) .thinking-status,
html:is([data-theme="dark"],[data-theme^="eye"]) .thinking-elapsed { color:var(--muted); }
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-item.generating small,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-text a { color:var(--blue); }
html:is([data-theme="dark"],[data-theme^="eye"]) .conversation-item.failed small,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-sync-status.failed,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-sync-status.interrupted { color:var(--danger); }
html:is([data-theme="dark"],[data-theme^="eye"]) .context-menu { border-color:var(--line); background:var(--surface); box-shadow:0 14px 42px var(--shadow-color); }
html:is([data-theme="dark"],[data-theme^="eye"]) .context-menu-danger:hover,
html:is([data-theme="dark"],[data-theme^="eye"]) .context-menu-danger:focus-visible { background:var(--error-bg); }
html:is([data-theme="dark"],[data-theme^="eye"]) .sidebar-footer,
html:is([data-theme="dark"],[data-theme^="eye"]) .chat-topbar { border-color:var(--line); }
html:is([data-theme="dark"],[data-theme^="eye"]) .chat-topbar { background:var(--bar-bg); }
html:is([data-theme="dark"],[data-theme^="eye"]) .user-avatar,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-avatar,
html:is([data-theme="dark"],[data-theme^="eye"]) .attach-button,
html:is([data-theme="dark"],[data-theme^="eye"]) .search-button { background:var(--surface-soft); color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) .message-row.assistant .message-avatar { background:var(--accent); color:#fff; }
html:is([data-theme="dark"],[data-theme^="eye"]) .rich-markdown blockquote { border-color:var(--accent); background:var(--quote-bg); color:var(--muted); }
html:is([data-theme="dark"],[data-theme^="eye"]) .rich-markdown hr { border-color:var(--line); }
html:is([data-theme="dark"],[data-theme^="eye"]) .rich-markdown code { background:var(--code-bg); }
html:is([data-theme="dark"],[data-theme^="eye"]) .rich-markdown pre { background:var(--sidebar); color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) .rich-markdown pre code { background:transparent; }
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-table-wrap,
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-image,
html:is([data-theme="dark"],[data-theme^="eye"]) .message-image,
html:is([data-theme="dark"],[data-theme^="eye"]) .image-preview-card { border-color:var(--line); background:var(--surface); }
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-table-wrap th,
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-table-wrap td { border-color:var(--line); }
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-table-wrap th { background:var(--surface-soft); }
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-image img { background:var(--surface-soft); }
html:is([data-theme="dark"],[data-theme^="eye"]) .markdown-image figcaption { color:var(--muted); }
html:is([data-theme="dark"],[data-theme^="eye"]) .reasoning-summary { border-color:var(--line); background:var(--quote-bg); color:var(--muted); }
html:is([data-theme="dark"],[data-theme^="eye"]) .reasoning-summary summary { color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) .generation-error { border-color:var(--danger); background:var(--error-bg); color:var(--danger); }
html:is([data-theme="dark"],[data-theme^="eye"]) .composer-wrap { background:linear-gradient(to bottom, transparent, var(--bg) 26%); }
html:is([data-theme="dark"],[data-theme^="eye"]) .composer { border-color:var(--line); background:var(--surface); box-shadow:0 12px 42px var(--shadow-color); }
html:is([data-theme="dark"],[data-theme^="eye"]) .search-button { border-color:var(--line); }
html:is([data-theme="dark"],[data-theme^="eye"]) .search-button.active { border-color:var(--accent); background:var(--accent-soft); color:var(--accent-ink); }
html:is([data-theme="dark"],[data-theme^="eye"]) .thinking-dot { background:var(--muted); }
html:is([data-theme="dark"],[data-theme^="eye"]) .theme-picker { border-color:var(--line); background:var(--surface); color:var(--text); }
html:is([data-theme="dark"],[data-theme^="eye"]) .toast { background:var(--surface-hover); color:var(--text); }

@media (min-width: 761px) and (max-width: 980px) {
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .login-shell { padding: 16px; }
  .login-card { padding: 34px 24px 30px; border-radius: 22px; }
  .app-shell { width: 100%; max-width: 100%; display: block; }
  .mobile-only { display: grid; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(86vw, 310px); height: 100%; padding-top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-102%); box-shadow: 16px 0 50px rgba(0,0,0,.16); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .conversation-item { min-height: 52px; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
  .context-menu { width: min(180px, calc(100vw - 16px)); }
  .sidebar-overlay { position: fixed; z-index: 35; inset: 0; background: rgba(0,0,0,.28); }
  .sidebar-overlay.show { display: block; }
  .chat-topbar { min-height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0; overflow: visible; }
  .chat-title { flex: 1; text-align: center; font-size: 13px; }
  .top-new-button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; overflow: hidden; touch-action: manipulation; color: transparent; font-size: 0; }
  .top-new-button::after { content: "+"; color: var(--text); font-size: 23px; }
  .chat-shell { width: 100%; max-width: 100%; height: 100%; grid-template-rows: calc(56px + env(safe-area-inset-top, 0px)) minmax(0,1fr); }
  .messages { padding: 26px 15px 174px; }
  .empty-chat { padding-top: 17vh; }
  .message-row { grid-template-columns: 32px minmax(0,1fr); gap: 10px; margin-bottom: 28px; }
  .message-avatar { width: 31px; height: 31px; border-radius: 10px; font-size: 11px; }
  .message-text { font-size: 15px; line-height: 1.7; }
  .rich-markdown h2 { font-size: 19px; }
  .rich-markdown h3 { font-size: 17px; }
  .answer-image-grid { gap: 6px; }
  .markdown-image img { height: 142px; }
  .markdown-table-wrap { border-radius: 10px; }
  .message-image { max-height: 300px; }
  .composer-wrap { padding: 14px 9px max(9px, env(safe-area-inset-bottom)); contain: layout; }
  .composer { border-radius: 18px; }
  .composer textarea, .login-form input { font-size: 16px; }
  .search-button { min-width: 54px; padding: 0 8px; }
  .image-preview-list { margin-inline: 2px; }
  .image-preview-card { flex-basis: 112px; height: 84px; }
}

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