:root {
  --bg: #f7f7f8;
  --sidebar-bg: #ffffff;
  --panel: #ffffff;
  --line: #e6e6e8;
  --text: #1f1f23;
  --muted: #6a6c76;
  --accent: #10a37f;
  --accent-weak: #e8f7f3;
  --danger: #cc3d3d;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --chat-content-max-width: 1280px;
  --chat-message-max-width: 1200px;
  --floating-panels-top: 84px;
}

body[data-theme="mint"] {
  --bg: #f7f7f8;
  --sidebar-bg: #ffffff;
  --panel: #ffffff;
  --line: #e6e6e8;
  --text: #1f1f23;
  --muted: #6a6c76;
  --accent: #10a37f;
  --accent-weak: #e8f7f3;
}

body[data-theme="ocean"] {
  --bg: #eef4ff;
  --sidebar-bg: #f8fbff;
  --panel: #ffffff;
  --line: #d7e3f6;
  --text: #172335;
  --muted: #5c6f88;
  --accent: #2f62c7;
  --accent-weak: #e8efff;
}

body[data-theme="graphite"] {
  --bg: #1d1f24;
  --sidebar-bg: #22262e;
  --panel: #292d35;
  --line: #373d49;
  --text: #eceff4;
  --muted: #aab3c2;
  --accent: #7bb6ff;
  --accent-weak: #24344a;
}

body[data-theme="rose"] {
  --bg: #fff4f7;
  --sidebar-bg: #fff9fb;
  --panel: #ffffff;
  --line: #f0d8e2;
  --text: #3a2430;
  --muted: #8b6273;
  --accent: #d14f83;
  --accent-weak: #ffe8f1;
}

body[data-theme="forest"] {
  --bg: #eef7f1;
  --sidebar-bg: #f6fbf8;
  --panel: #ffffff;
  --line: #d8e9df;
  --text: #1f3329;
  --muted: #5f7b6d;
  --accent: #2f9d62;
  --accent-weak: #e4f6ec;
}

body[data-theme="sunset"] {
  --bg: #fff4ec;
  --sidebar-bg: #fffaf6;
  --panel: #ffffff;
  --line: #f0ded0;
  --text: #33261f;
  --muted: #8a6a55;
  --accent: #e06a3f;
  --accent-weak: #ffe9df;
}

body[data-theme="aqua"] {
  --bg: #020024;
  --sidebar-bg: #06133a;
  --panel: #0b1a4f;
  --line: #174489;
  --text: #ebf8ff;
  --muted: #9ec8e2;
  --accent: #00d4ff;
  --accent-weak: #113c72;
}

body[data-theme="violet"] {
  --bg: #050505;
  --sidebar-bg: #11061f;
  --panel: #190a2e;
  --line: #3a0ca3;
  --text: #f3ecff;
  --muted: #baabd6;
  --accent: #8b5cf6;
  --accent-weak: #2a0c6b;
}

body[data-theme="neon"] {
  --bg: #0a0b14;
  --sidebar-bg: #111327;
  --panel: #171a32;
  --line: #2b2f58;
  --text: #eef1ff;
  --muted: #aab0d8;
  --accent: #6ee7ff;
  --accent-weak: #202a54;
}

body[data-theme="cosmos"] {
  --bg: #090d1f;
  --sidebar-bg: #111734;
  --panel: #182143;
  --line: #2c3d70;
  --text: #eef2ff;
  --muted: #aab8de;
  --accent: #8fc1ff;
  --accent-weak: #222f5f;
}

body[data-theme="pixel"] {
  --bg: #0e1324;
  --sidebar-bg: #141b31;
  --panel: #1a233f;
  --line: #2f416d;
  --text: #eaf1ff;
  --muted: #a7b8da;
  --accent: #7cd6ff;
  --accent-weak: #1c315a;
}

body[data-theme="bio"] {
  --bg: #05070a;
  --sidebar-bg: rgba(8, 13, 21, 0.9);
  --panel: rgba(10, 15, 25, 0.92);
  --line: rgba(0, 255, 204, 0.24);
  --text: #f5fffc;
  --muted: #8baca4;
  --accent: #00ffcc;
  --accent-weak: rgba(0, 255, 204, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  background: var(--bg);
  overflow: hidden;
  font-size: 16px;
}

body[data-theme="pixel"] {
  font-family: "Manrope", "JetBrains Mono", system-ui, sans-serif;
  font-size: 16px;
  background:
    radial-gradient(1000px 560px at 18% -8%, rgba(132, 201, 255, .22), transparent 62%),
    radial-gradient(1100px 700px at 82% 110%, rgba(142, 188, 255, .18), transparent 66%),
    linear-gradient(180deg, #0f1730 0%, #0b1122 100%),
    var(--bg);
  position: relative;
}

body[data-theme="pixel"]::before,
body[data-theme="pixel"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body[data-theme="pixel"]::before {
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,.78) 45%, transparent 46%),
    radial-gradient(1.5px 1.5px at 80px 120px, rgba(224,240,255,.72) 45%, transparent 46%),
    radial-gradient(2px 2px at 140px 50px, rgba(255,255,255,.62) 45%, transparent 46%),
    radial-gradient(1.2px 1.2px at 210px 170px, rgba(216,236,255,.68) 45%, transparent 46%);
  background-size: 260px 260px, 320px 320px, 380px 380px, 440px 440px;
  animation: snow-fall 34s linear infinite;
  opacity: .6;
}

body[data-theme="pixel"]::after {
  z-index: 0;
  background: linear-gradient(90deg, rgba(124,214,255,.06), rgba(196,224,255,.03) 50%, rgba(124,214,255,.06));
  mix-blend-mode: screen;
  animation: aurora-shift 14s ease-in-out infinite alternate;
  opacity: .45;
}

@keyframes snow-fall {
  0% { transform: translateY(-12px); }
  100% { transform: translateY(100vh); }
}

@keyframes aurora-shift {
  0% { transform: translateX(-3%); opacity: .25; }
  100% { transform: translateX(3%); opacity: .5; }
}

body[data-theme="pixel"] .btn,
body[data-theme="pixel"] .input,
body[data-theme="pixel"] #input,
body[data-theme="pixel"] .history-item,
body[data-theme="pixel"] .account,
body[data-theme="pixel"] .msg,
body[data-theme="pixel"] .msg-audio-card {
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(6, 10, 20, .22);
}

body[data-theme="pixel"] .brand-name {
  color: #9fe4ff;
  background: none;
  -webkit-text-fill-color: initial;
  animation: none;
}

body[data-theme="pixel"] .app-shell {
  position: relative;
}

body[data-theme="pixel"] .msg {
  backdrop-filter: blur(2px);
}

body[data-theme="pixel"] .sidebar {
  background: rgba(20, 27, 49, 0.88);
  backdrop-filter: blur(4px);
}

body[data-theme="pixel"] .chat {
  background:
    radial-gradient(1000px 600px at 50% -10%, rgba(170, 203, 255, 0.08) 0%, rgba(14, 19, 36, 0) 60%),
    rgba(8, 14, 30, 0.42);
  position: relative;
  overflow: hidden;
}

body[data-theme="pixel"] .chat::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 40px 20px, rgba(255,255,255,.8) 45%, transparent 46%),
    radial-gradient(2px 2px at 140px 120px, rgba(222,238,255,.75) 45%, transparent 46%),
    radial-gradient(1.5px 1.5px at 220px 60px, rgba(255,255,255,.65) 45%, transparent 46%),
    radial-gradient(1.3px 1.3px at 320px 180px, rgba(210,230,255,.7) 45%, transparent 46%);
  background-size: 260px 260px, 340px 340px, 420px 420px, 500px 500px;
  animation: snow-fall 22s linear infinite;
  opacity: .65;
}

body[data-theme="pixel"] .chat > * {
  position: relative;
  z-index: 1;
}

body[data-theme="bio"] {
  background:
    radial-gradient(820px 620px at 22% -14%, rgba(0, 255, 204, 0.11), transparent 66%),
    radial-gradient(980px 600px at 82% 114%, rgba(0, 255, 204, 0.07), transparent 70%),
    linear-gradient(180deg, #05070a 0%, #020406 100%),
    var(--bg);
  position: relative;
  font-family: "JetBrains Mono", "Manrope", system-ui, sans-serif;
}

body[data-theme="bio"]::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(90deg, rgba(0, 255, 204, 0.15) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 255, 204, 0.16) 1px, transparent 1px);
  background-size: 68px 100%, 100% 68px;
  mask-image: radial-gradient(ellipse at 50% 80%, black 48%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 80%, black 48%, transparent 100%);
  opacity: .76;
  animation: bio-grid-flow 4.8s linear infinite;
}

body[data-theme="bio"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 54%, rgba(0, 255, 204, 0.22) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 2px,
      transparent 4px
    );
  opacity: .72;
}

@keyframes bio-grid-flow {
  from { transform: translateY(0); }
  to { transform: translateY(68px); }
}

body[data-theme="bio"] .app-shell {
  position: relative;
}

body[data-theme="bio"] .sidebar {
  background: rgba(8, 13, 21, 0.86);
  border-right-color: rgba(0, 255, 204, 0.2);
  backdrop-filter: blur(8px);
}

body[data-theme="bio"] .chat {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(0, 255, 204, 0.08) 0%, rgba(0, 0, 0, 0) 62%),
    rgba(4, 8, 13, 0.5);
}

body[data-theme="bio"] .floating-account,
body[data-theme="bio"] .floating-help {
  backdrop-filter: blur(4px);
}

body[data-theme="bio"] .brand-name {
  background: none;
  color: #c7fff5;
  -webkit-text-fill-color: #c7fff5;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  text-shadow: 0 0 8px rgba(0, 255, 204, 0.28);
  animation: none;
}

body[data-theme="bio"] .chat-header,
body[data-theme="bio"] .composer,
body[data-theme="bio"] .header-account-wrap,
body[data-theme="bio"] .floating-help {
  background: rgba(10, 15, 25, 0.86);
  border-color: rgba(0, 255, 204, 0.2);
  box-shadow: 0 0 24px rgba(0, 255, 204, 0.08);
}

body[data-theme="bio"] .history-item,
body[data-theme="bio"] .account,
body[data-theme="bio"] .style-panel,
body[data-theme="bio"] .limit-row,
body[data-theme="bio"] .msg.assistant,
body[data-theme="bio"] .msg-audio-card {
  background: rgba(8, 13, 21, 0.72);
  border-color: rgba(0, 255, 204, 0.2);
}

body[data-theme="bio"] .msg.user {
  background: color-mix(in srgb, rgba(8, 13, 21, 0.78) 84%, var(--accent) 16%);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line) 68%);
}

body[data-theme="bio"] .history-item.active,
body[data-theme="bio"] .theme-btn.active,
body[data-theme="bio"] .history-mode-box .btn.active,
body[data-theme="bio"] .panel-toggle-btn.active {
  background: color-mix(in srgb, var(--accent-weak) 76%, rgba(8, 13, 21, 0.24) 24%);
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line) 36%);
  color: color-mix(in srgb, var(--accent) 84%, var(--text) 16%);
}

body[data-theme="bio"] .btn-primary {
  border-color: #00c9a4;
  background: #00d9b1;
  color: #042019;
}

body[data-theme="bio"] .btn-primary:hover {
  background: #00c9a4;
}

body[data-theme="bio"] #input:focus,
body[data-theme="bio"] .input:focus,
body[data-theme="bio"] .style-input:focus {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line) 36%);
  box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.16);
}

body[data-theme="neon"] {
  background:
    radial-gradient(980px 560px at 12% -6%, rgba(110, 231, 255, 0.18), transparent 65%),
    radial-gradient(900px 540px at 86% 112%, rgba(181, 125, 255, 0.16), transparent 68%),
    linear-gradient(180deg, #090b14 0%, #060711 100%),
    var(--bg);
  position: relative;
}

body[data-theme="neon"]::before,
body[data-theme="neon"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body[data-theme="neon"]::before {
  background:
    radial-gradient(2px 2px at 24px 26px, rgba(255,255,255,.55) 45%, transparent 46%),
    radial-gradient(1.5px 1.5px at 90px 118px, rgba(225,235,255,.5) 45%, transparent 46%);
  background-size: 260px 260px, 340px 340px;
  opacity: .35;
  animation: snow-fall 34s linear infinite;
}

body[data-theme="neon"]::after {
  background: linear-gradient(90deg, rgba(110, 231, 255, .06), rgba(181, 125, 255, .08), rgba(110, 231, 255, .06));
  mix-blend-mode: screen;
  opacity: .4;
  animation: aurora-shift 16s ease-in-out infinite alternate;
}

body[data-theme="neon"] .sidebar {
  background: rgba(14, 17, 36, 0.88);
  backdrop-filter: blur(6px);
  border-right-color: rgba(110, 231, 255, 0.18);
}

body[data-theme="neon"] .chat {
  background:
    radial-gradient(1000px 560px at 50% -12%, rgba(110, 231, 255, 0.08), transparent 62%),
    rgba(8, 10, 22, 0.5);
}

body[data-theme="neon"] .chat-header,
body[data-theme="neon"] .composer,
body[data-theme="neon"] .floating-account,
body[data-theme="neon"] .floating-help {
  background: rgba(19, 24, 48, 0.86);
  border-color: rgba(110, 231, 255, 0.2);
}

body[data-theme="neon"] .msg.assistant,
body[data-theme="neon"] .msg-audio-card,
body[data-theme="neon"] .history-item,
body[data-theme="neon"] .account,
body[data-theme="neon"] .style-panel,
body[data-theme="neon"] .limit-row {
  background: rgba(14, 18, 38, 0.76);
  border-color: rgba(110, 231, 255, 0.2);
}

body[data-theme="neon"] .msg.user {
  background: color-mix(in srgb, rgba(14, 18, 38, 0.78) 82%, var(--accent) 18%);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line) 62%);
}

body[data-theme="neon"] .history-item.active,
body[data-theme="neon"] .theme-btn.active,
body[data-theme="neon"] .history-mode-box .btn.active,
body[data-theme="neon"] .panel-toggle-btn.active {
  background: color-mix(in srgb, var(--accent-weak) 78%, rgba(20, 24, 44, 0.22) 22%);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line) 40%);
  color: color-mix(in srgb, var(--accent) 88%, var(--text) 12%);
}

body[data-theme="neon"] .brand-name {
  background: linear-gradient(90deg, #93e8ff, #86c5ff, #b57dff, #93e8ff);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-shimmer 2.3s linear infinite, brand-float 1.8s ease-in-out infinite;
}

body[data-theme="cosmos"] {
  background:
    radial-gradient(1300px 720px at 50% -20%, rgba(143, 193, 255, 0.18), transparent 66%),
    radial-gradient(1000px 640px at 92% 120%, rgba(255, 163, 214, 0.16), transparent 68%),
    linear-gradient(180deg, #0b1026 0%, #070a19 100%),
    var(--bg);
  position: relative;
}

body[data-theme="cosmos"]::before,
body[data-theme="cosmos"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body[data-theme="cosmos"]::before {
  background-image:
    radial-gradient(2px 2px at 24px 40px, rgba(255,255,255,.78) 45%, transparent 46%),
    radial-gradient(1.5px 1.5px at 120px 90px, rgba(223,236,255,.72) 45%, transparent 46%),
    radial-gradient(2px 2px at 230px 170px, rgba(255,255,255,.62) 45%, transparent 46%),
    radial-gradient(1.4px 1.4px at 320px 44px, rgba(220,230,255,.6) 45%, transparent 46%),
    radial-gradient(1.2px 1.2px at 460px 140px, rgba(255,255,255,.58) 45%, transparent 46%);
  background-size: 280px 280px, 360px 360px, 440px 440px, 520px 520px, 620px 620px;
  opacity: .55;
  animation: cosmos-stars 24s ease-in-out infinite alternate;
}

body[data-theme="cosmos"]::after {
  background:
    radial-gradient(circle at 12% 84%, rgba(126, 164, 255, .22) 0 90px, transparent 95px),
    radial-gradient(circle at 84% 16%, rgba(255, 174, 215, .2) 0 72px, transparent 78px),
    radial-gradient(circle at 72% 78%, rgba(145, 228, 255, .13) 0 46px, transparent 52px);
  filter: blur(0.2px);
  opacity: .8;
  animation: cosmos-planets 18s ease-in-out infinite alternate;
}

@keyframes cosmos-stars {
  0% { transform: translateY(0) scale(1); opacity: .45; }
  100% { transform: translateY(6px) scale(1.02); opacity: .62; }
}

@keyframes cosmos-planets {
  0% { transform: translateY(0) translateX(0); }
  100% { transform: translateY(-4px) translateX(2px); }
}

body[data-theme="cosmos"] .sidebar {
  background: rgba(16, 22, 48, 0.86);
  backdrop-filter: blur(6px);
  border-right-color: rgba(143, 193, 255, 0.22);
}

body[data-theme="cosmos"] .chat {
  background:
    radial-gradient(1100px 620px at 50% -16%, rgba(143, 193, 255, 0.09), transparent 64%),
    rgba(8, 12, 30, 0.5);
}

body[data-theme="cosmos"] .chat-header,
body[data-theme="cosmos"] .composer,
body[data-theme="cosmos"] .floating-account,
body[data-theme="cosmos"] .floating-help {
  background: rgba(24, 33, 67, 0.84);
  border-color: rgba(143, 193, 255, 0.24);
}

body[data-theme="cosmos"] .msg.assistant,
body[data-theme="cosmos"] .msg-audio-card,
body[data-theme="cosmos"] .history-item,
body[data-theme="cosmos"] .account,
body[data-theme="cosmos"] .style-panel,
body[data-theme="cosmos"] .limit-row {
  background: rgba(16, 24, 52, 0.76);
  border-color: rgba(143, 193, 255, 0.22);
}

body[data-theme="cosmos"] .msg.user {
  background: color-mix(in srgb, rgba(16, 24, 52, 0.78) 82%, var(--accent) 18%);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line) 62%);
}

body[data-theme="cosmos"] .history-item.active,
body[data-theme="cosmos"] .theme-btn.active,
body[data-theme="cosmos"] .history-mode-box .btn.active,
body[data-theme="cosmos"] .panel-toggle-btn.active {
  background: color-mix(in srgb, var(--accent-weak) 78%, rgba(20, 28, 58, 0.22) 22%);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line) 40%);
  color: color-mix(in srgb, var(--accent) 86%, var(--text) 14%);
}

body[data-theme="cosmos"] .brand-name {
  background: linear-gradient(90deg, #b9d7ff, #a8beff, #ffd3ef, #b9d7ff);
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-shimmer 2.6s linear infinite;
}

body[data-theme="aqua"] {
  background:
    radial-gradient(1200px 700px at 50% -22%, rgba(0, 212, 255, 0.24), transparent 68%),
    radial-gradient(900px 560px at 90% 112%, rgba(0, 212, 255, 0.16), transparent 72%),
    linear-gradient(180deg, #040432 0%, #020024 100%),
    var(--bg);
  position: relative;
}

body[data-theme="aqua"]::before,
body[data-theme="aqua"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body[data-theme="aqua"]::before {
  background-image:
    radial-gradient(2px 2px at 30px 40px, rgba(255,255,255,.72) 45%, transparent 46%),
    radial-gradient(1.4px 1.4px at 90px 120px, rgba(190, 235, 255, .6) 45%, transparent 46%),
    radial-gradient(1.8px 1.8px at 210px 70px, rgba(255,255,255,.6) 45%, transparent 46%);
  background-size: 260px 260px, 340px 340px, 420px 420px;
  opacity: .45;
}

body[data-theme="aqua"]::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 62%, rgba(0, 212, 255, 0.12) 100%);
  opacity: .7;
}

body[data-theme="aqua"] .sidebar {
  background: rgba(6, 19, 58, 0.88);
  border-right-color: rgba(0, 212, 255, 0.26);
  backdrop-filter: blur(6px);
}

body[data-theme="aqua"] .chat {
  background:
    radial-gradient(980px 620px at 50% -14%, rgba(0, 212, 255, 0.11), transparent 64%),
    rgba(4, 10, 36, 0.5);
}

body[data-theme="aqua"] .chat-header,
body[data-theme="aqua"] .composer,
body[data-theme="aqua"] .floating-account,
body[data-theme="aqua"] .floating-help {
  background: rgba(11, 26, 79, 0.86);
  border-color: rgba(0, 212, 255, 0.24);
}

body[data-theme="aqua"] .msg.assistant,
body[data-theme="aqua"] .msg-audio-card,
body[data-theme="aqua"] .history-item,
body[data-theme="aqua"] .account,
body[data-theme="aqua"] .style-panel,
body[data-theme="aqua"] .limit-row {
  background: rgba(8, 20, 63, 0.78);
  border-color: rgba(0, 212, 255, 0.22);
}

body[data-theme="aqua"] .msg.user {
  background: color-mix(in srgb, rgba(8, 20, 63, 0.78) 78%, var(--accent) 22%);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line) 56%);
}

body[data-theme="aqua"] .history-item.active,
body[data-theme="aqua"] .theme-btn.active,
body[data-theme="aqua"] .history-mode-box .btn.active,
body[data-theme="aqua"] .panel-toggle-btn.active {
  background: color-mix(in srgb, var(--accent-weak) 74%, rgba(11, 26, 79, 0.26) 26%);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line) 42%);
  color: color-mix(in srgb, var(--accent) 88%, var(--text) 12%);
}

body[data-theme="aqua"] .brand-name {
  background: linear-gradient(90deg, #8de9ff, #00d4ff, #8de9ff);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-shimmer 2.8s linear infinite;
}

body[data-theme="violet"] {
  background:
    radial-gradient(1000px 620px at 50% -18%, rgba(58, 12, 163, 0.34), transparent 66%),
    radial-gradient(900px 560px at 90% 112%, rgba(58, 12, 163, 0.2), transparent 70%),
    linear-gradient(180deg, #0a070f 0%, #050505 100%),
    var(--bg);
  position: relative;
}

body[data-theme="violet"]::before,
body[data-theme="violet"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body[data-theme="violet"]::before {
  background-image:
    radial-gradient(2px 2px at 24px 34px, rgba(255,255,255,.56) 45%, transparent 46%),
    radial-gradient(1.4px 1.4px at 140px 110px, rgba(224,206,255,.52) 45%, transparent 46%),
    radial-gradient(1.6px 1.6px at 260px 82px, rgba(255,255,255,.48) 45%, transparent 46%);
  background-size: 320px 320px, 420px 420px, 520px 520px;
  opacity: .38;
}

body[data-theme="violet"]::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(58, 12, 163, 0.2) 100%);
  opacity: .75;
}

body[data-theme="violet"] .sidebar {
  background: rgba(17, 6, 31, 0.9);
  border-right-color: rgba(58, 12, 163, 0.35);
  backdrop-filter: blur(6px);
}

body[data-theme="violet"] .chat {
  background:
    radial-gradient(980px 600px at 50% -12%, rgba(58, 12, 163, 0.18), transparent 62%),
    rgba(11, 7, 18, 0.52);
}

body[data-theme="violet"] .chat-header,
body[data-theme="violet"] .composer,
body[data-theme="violet"] .floating-account,
body[data-theme="violet"] .floating-help {
  background: rgba(25, 10, 46, 0.88);
  border-color: rgba(58, 12, 163, 0.36);
}

body[data-theme="violet"] .msg.assistant,
body[data-theme="violet"] .msg-audio-card,
body[data-theme="violet"] .history-item,
body[data-theme="violet"] .account,
body[data-theme="violet"] .style-panel,
body[data-theme="violet"] .limit-row {
  background: rgba(22, 8, 40, 0.8);
  border-color: rgba(58, 12, 163, 0.3);
}

body[data-theme="violet"] .msg.user {
  background: color-mix(in srgb, rgba(22, 8, 40, 0.8) 76%, #5e26cf 24%);
  border-color: color-mix(in srgb, #7f4df0 46%, var(--line) 54%);
}

body[data-theme="violet"] .history-item.active,
body[data-theme="violet"] .theme-btn.active,
body[data-theme="violet"] .history-mode-box .btn.active,
body[data-theme="violet"] .panel-toggle-btn.active {
  background: color-mix(in srgb, var(--accent-weak) 70%, rgba(20, 9, 35, 0.3) 30%);
  border-color: color-mix(in srgb, #7f4df0 58%, var(--line) 42%);
  color: #d8c4ff;
}

body[data-theme="violet"] .brand-name {
  background: linear-gradient(90deg, #dac8ff, #a875ff, #dac8ff);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-shimmer 3s linear infinite;
}

body[data-theme="pixel"] .btn:hover {
  background: color-mix(in srgb, var(--accent-weak) 72%, var(--panel) 28%);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line) 48%);
  color: var(--text);
  transform: translateY(-1px);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

body[data-theme="pixel"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 85%, #0c1328 15%);
  border-color: color-mix(in srgb, var(--line) 75%, #0c1328 25%);
  color: var(--muted);
  opacity: 0.9;
}

.app-shell {
  display: grid;
  grid-template-columns: 520px 1fr;
  height: 100vh;
}

body.sidebar-hidden .app-shell {
  grid-template-columns: 1fr;
}

body.sidebar-hidden .sidebar {
  display: none;
}

body.account-hidden .floating-account {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  overflow: hidden;
  overscroll-behavior: contain;
}

.sidebar-content {
  min-height: 0;
  display: grid;
  gap: 12px;
  transition: max-height .22s ease, opacity .22s ease, transform .22s ease;
  max-height: calc(100vh - 88px);
  opacity: 1;
  transform: translateY(0);
}

.sidebar.collapsed .sidebar-content {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  pointer-events: none;
}

.sidebar-columns {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  overflow: hidden;
}

.sidebar-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
}

.brand-name {
  font-weight: 800;
  font-size: 21px;
  line-height: 1;
  position: relative;
  display: inline-block;
  background: linear-gradient(90deg, #0f1a2a, #10a37f, #2f62c7, #0f1a2a);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-shimmer 2.2s linear infinite, brand-float 1.8s ease-in-out infinite;
  will-change: transform, background-position;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.brand-links {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.2;
}

.brand-links a {
  color: color-mix(in srgb, var(--accent) 75%, var(--text) 25%);
  text-decoration: none;
}

.brand-links a:hover {
  text-decoration: underline;
}

.brand-links-sep {
  color: var(--muted);
}

.panel-mini-toggle {
  width: 34px;
  height: 30px;
  padding: 0;
  line-height: 1;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sidebar-collapsed-hint {
  display: none;
  margin: 2px 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 86%, var(--line) 14%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-collapsed-hint {
  display: block;
}

@keyframes brand-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes brand-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

.label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  min-height: 46px;
  overflow: auto;
}

.history-empty {
  border: 1px dashed #d9dde5;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  color: #7a8392;
  background: #fafbfc;
}

.history-item {
  border: 1px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  border-color: #d9dbdf;
  background: color-mix(in srgb, var(--panel) 86%, var(--line) 14%);
}

.history-item.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line) 58%);
  background: color-mix(in srgb, var(--accent-weak) 84%, var(--panel) 16%);
}

.chat-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}

.chat-edit-btn,
.chat-del-btn {
  border: 1px solid #d8dde5;
  border-radius: 10px;
  background: #ffffff;
  color: #445063;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-weight: 800;
}

body[data-theme="graphite"] .chat-edit-btn,
body[data-theme="graphite"] .chat-del-btn,
body[data-theme="bio"] .chat-edit-btn,
body[data-theme="bio"] .chat-del-btn,
body[data-theme="pixel"] .chat-edit-btn,
body[data-theme="pixel"] .chat-del-btn {
  background: color-mix(in srgb, var(--panel) 86%, var(--line) 14%);
  border-color: color-mix(in srgb, var(--line) 74%, var(--accent) 26%);
  color: var(--text);
}

body[data-theme="graphite"] .chat-edit-btn:hover,
body[data-theme="graphite"] .chat-del-btn:hover,
body[data-theme="bio"] .chat-edit-btn:hover,
body[data-theme="bio"] .chat-del-btn:hover,
body[data-theme="pixel"] .chat-edit-btn:hover,
body[data-theme="pixel"] .chat-del-btn:hover {
  background: color-mix(in srgb, var(--accent-weak) 72%, var(--panel) 28%);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line) 48%);
  color: var(--text);
}

.chat-edit-btn:hover {
  background: #f2f7ff;
  border-color: #b9c9e5;
}

.chat-del-btn:hover {
  background: #fff1f3;
  border-color: #e4b1b8;
  color: #9a2433;
}

.account {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  display: grid;
  gap: 4px;
  background: var(--panel);
}

.account-copy-row {
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--panel) 86%, var(--line) 14%);
  color: var(--text);
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.account-copy-row:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line) 52%);
  background: color-mix(in srgb, var(--panel) 78%, var(--accent-weak) 22%);
}

.account-copy-row.copied {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line) 28%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent 80%);
}

.account-copy-row .k {
  font-size: 13px;
  color: var(--muted);
  flex: 0 0 auto;
}

.account-copy-row .v {
  font-size: 14px;
  font-weight: 700;
  white-space: normal;
  word-break: break-all;
  text-align: right;
}

.account-copy-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.limits-box {
  gap: 8px;
}

.limits-grid {
  display: grid;
  gap: 6px;
}

.limit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
}

.limit-label {
  font-size: 13px;
  font-weight: 600;
}

.limit-value {
  font-size: 12px;
  color: var(--text);
  justify-self: end;
}

.limit-left {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}

.limit-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--accent);
}

.limit-row.exhausted {
  border-color: color-mix(in srgb, #ff5b6a 60%, var(--line) 40%);
}

.limit-row.exhausted .limit-left {
  color: #ff7a88;
}

.tg-link {
  display: grid;
  gap: 10px;
}

.history-mode-box {
  display: grid;
  gap: 8px;
}

.style-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--line) 6%);
  display: grid;
  gap: 8px;
}

.style-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.style-panel-head .label {
  margin-top: 0;
}

.style-panel-body {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  transition: max-height .22s ease, opacity .22s ease, transform .22s ease;
}

.style-panel.collapsed .style-panel-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  pointer-events: none;
}

.style-input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  font-family: inherit;
}

.style-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line) 44%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent 80%);
}

.style-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.history-mode-box .btn.active {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line) 30%);
  color: color-mix(in srgb, var(--accent) 85%, var(--text) 15%);
  background: color-mix(in srgb, var(--panel) 80%, var(--accent) 20%);
}

.tg-link-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 24px;
  height: 100vh;
  min-height: 0;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--panel) 92%, white 8%) 0%, var(--bg) 60%, color-mix(in srgb, var(--bg) 85%, #cfd5de 15%) 100%);
}

.chat-header {
  width: min(var(--chat-content-max-width), 100%);
  margin: 0 auto;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 14px 6px;
  background: var(--panel);
  gap: 12px;
}

.header-account-wrap {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
  display: grid;
  gap: 8px;
}

.account-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-panel-head .label {
  margin-top: 0;
}

.account-panel-body {
  display: grid;
  gap: 8px;
  max-height: 72vh;
  overflow: auto;
  transition: max-height .22s ease, opacity .22s ease, transform .22s ease;
}

.header-account-wrap .label {
  margin-top: 0;
}

.floating-account {
  position: fixed;
  top: var(--floating-panels-top);
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  z-index: 20;
}

.floating-account .header-account-wrap {
  box-shadow: 0 10px 28px rgba(8, 16, 32, 0.24);
  backdrop-filter: blur(6px);
}

.floating-account.collapsed .account-panel-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  pointer-events: none;
}

.chat-header-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
}

.chat-header-right {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
  min-width: 0;
  width: min(360px, 100%);
}

.header-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
  transition: max-height .22s ease, opacity .22s ease, transform .22s ease;
}

.panel-toggle-btn {
  padding: 7px 11px;
  font-size: 13px;
  min-width: 88px;
}

.panel-toggle-btn.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line) 38%);
  background: color-mix(in srgb, var(--accent-weak) 80%, var(--panel) 20%);
  color: color-mix(in srgb, var(--accent) 80%, var(--text) 20%);
}

.top-model-wrap {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 8px;
  align-items: stretch;
  transition: max-height .2s ease, opacity .2s ease, transform .2s ease;
  max-height: 220px;
  overflow: hidden;
}

.top-model-wrap.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.model-select-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.top-model-select {
  width: 100%;
  height: 50px;
  min-height: 50px;
  padding: 0 40px 0 14px;
  line-height: 1.3;
  min-width: 0;
}

.top-model-hint {
  max-height: none;
  overflow: visible;
  line-height: 1.3;
  font-size: 13px;
  padding: 6px 8px;
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.sidebar-model-wrap .top-model-hint {
  overflow-wrap: anywhere;
}

.panel-state-hint {
  display: none;
  width: 100%;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.panel-state-hint.visible {
  display: block;
}

.model-panel-toggle {
  display: none;
}

.header-tools-collapse-btn {
  display: none;
}

.title {
  font-size: 20px;
  font-weight: 700;
}

.status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  position: relative;
  padding-bottom: 10px;
}

.status.ok {
  color: var(--accent);
}

.status.thinking {
  color: color-mix(in srgb, var(--accent) 85%, var(--text) 15%);
}

.status.thinking::before {
  content: "...";
  display: inline-block;
  margin-right: 6px;
  letter-spacing: 1px;
  animation: thinking-dots 1.1s ease-in-out infinite;
}

.status.thinking::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 35%, #7bd4ff 55%, transparent 100%);
  background-size: 220% 100%;
  animation: thinking-bar 1.2s linear infinite;
  opacity: 0.95;
}

@keyframes thinking-bar {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes thinking-dots {
  0%, 100% { opacity: .45; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-1px); }
}

.messages {
  width: min(var(--chat-content-max-width), 100%);
  margin: 0 auto;
  overflow: auto;
  padding: 24px 4px 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.msg {
  max-width: min(var(--chat-message-max-width), 100%);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(27, 39, 56, 0.04);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.msg.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
  border: 1px solid color-mix(in srgb, var(--line) 90%, var(--accent) 10%);
  flex-direction: row-reverse;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
}

.msg.has-audio {
  width: min(var(--chat-message-max-width), 100%);
}

.msg.has-audio .msg-main {
  width: 100%;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.msg.user .msg-avatar {
  background: var(--accent);
  color: #ffffff;
}

.msg-main {
  min-width: 0;
  width: 100%;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.msg .meta {
  margin-bottom: 0;
}

.bookmark-btn {
  border: 1px solid #d6dbe3;
  border-radius: 8px;
  background: #ffffff;
  color: #7d8795;
  width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

.bookmark-btn:hover {
  background: #f7f9fc;
}

.bookmark-btn.active {
  color: #d79b00;
  border-color: #e9cf7a;
  background: #fff8dd;
}

.msg.flash {
  animation: msg-flash 1s ease;
}

@keyframes msg-flash {
  0% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(16, 163, 127, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0); }
}

.markdown-body {
  font-size: 17px;
  line-height: 1.72;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin: 0 0 12px;
}

.msg-attachments {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.msg-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.msg-image-card {
  display: grid;
  gap: 6px;
}

.msg-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #dde3ec;
  background: #ffffff;
  cursor: zoom-in;
}

.msg-image-actions {
  display: flex;
  gap: 6px;
}

.msg-image-btn {
  padding: 6px 10px;
  font-size: 13px;
}

.msg-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.msg-file-chip {
  font-size: 12px;
  color: #425466;
  border: 1px solid #d7dce3;
  background: #f5f7fa;
  border-radius: 999px;
  padding: 4px 10px;
}

.msg-audio-list {
  display: grid;
  gap: 8px;
}

.msg-audio-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
  padding: 8px;
  display: grid;
  gap: 6px;
  width: 100%;
}

.msg-audio-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.msg-audio-player {
  width: 100%;
  min-width: 0;
}

.code-shell {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  background: #f8fafc;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f2f4f7;
  border-bottom: 1px solid #e5e7eb;
}

.code-lang {
  font-family: var(--mono);
  font-size: 13px;
  color: #5b6472;
  text-transform: lowercase;
}

.markdown-body pre {
  margin: 0;
  padding: 12px;
  background: #ffffff;
  overflow: auto;
}

.markdown-body pre code {
  font-family: var(--mono);
  font-size: 14px;
  color: #1f2937;
}

.markdown-body code,
.markdown-body pre code,
.markdown-body .hljs {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0, "clig" 0;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeSpeed;
}

.copy-btn {
  border: 1px solid #d6dbe3;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  background: #f7f9fc;
}

.thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4f5b6b;
  font-weight: 600;
}

.thinking-loader {
  width: 156px;
  height: 156px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thinking-lottie {
  width: 156px;
  height: 156px;
}

.thinking-only-loader {
  min-height: 164px;
}

.skeleton-wrap {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  width: min(440px, 100%);
}

.skeleton-line {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9edf4 8%, #f8fafe 42%, #e9edf4 84%);
  background-size: 220% 100%;
  animation: skeleton-run 1.3s linear infinite;
}

.skeleton-line.w1 { width: 96%; }
.skeleton-line.w2 { width: 78%; }
.skeleton-line.w3 { width: 64%; }

@keyframes skeleton-run {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #95a2b2;
  display: inline-block;
  animation: think-bounce 1s infinite ease-in-out;
}

.thinking-dots i:nth-child(2) {
  animation-delay: .15s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: .3s;
}

@keyframes think-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.composer {
  width: min(var(--chat-content-max-width), 100%);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 14px 8px 16px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 2;
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.05);
}

.composer.drag {
  box-shadow: inset 0 0 0 2px rgba(16, 163, 127, 0.3);
}

.composer-input-shell {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #d5dae2;
  border-radius: 22px;
  background: var(--panel);
  padding: 6px 10px;
  overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.composer-input-shell:focus-within {
  border-color: #94d8c7;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 360px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .2s ease, opacity .2s ease, transform .2s ease;
}

.quick-row.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.quick-row-toggle {
  display: inline-flex;
  padding: 8px 12px;
  font-size: 13px;
  align-self: flex-start;
  border-radius: 999px;
}

.att {
  border: 1px solid #d8dde5;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  background: #f7f9fc;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.att button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--danger);
}

body[data-theme="graphite"] .att,
body[data-theme="pixel"] .att,
body[data-theme="bio"] .att {
  background: color-mix(in srgb, var(--panel) 88%, #0a0f1d 12%);
  border-color: color-mix(in srgb, var(--line) 74%, var(--accent) 26%);
  color: var(--text);
}

body[data-theme="graphite"] .att button,
body[data-theme="pixel"] .att button,
body[data-theme="bio"] .att button {
  color: color-mix(in srgb, #ff6b6b 82%, var(--text) 18%);
}

#input,
.input {
  width: 100%;
  border: 1px solid #d5dae2;
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
}

#input {
  min-height: 62px;
  resize: none;
}

#input:focus,
.input:focus {
  outline: none;
  border-color: #94d8c7;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.composer-input-shell #input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  min-height: 42px;
  max-height: 260px;
  padding: 8px 6px;
  line-height: 1.38;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.composer-input-shell #input.input-scrollable {
  overflow-y: auto !important;
}

.composer-input-shell #input:focus {
  border: none;
  box-shadow: none;
}

.composer-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.composer-actions-hidden {
  display: none;
}

.btn {
  border: 1px solid #d5dae2;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: #f7f8fa;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .72;
  background: color-mix(in srgb, var(--panel) 85%, var(--line) 15%);
}

body[data-theme="graphite"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line) 72%);
  color: var(--text);
}

body[data-theme="bio"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line) 70%);
  color: var(--text);
}

body[data-theme="aqua"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 84%, var(--accent-weak) 16%);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line) 54%);
  color: var(--text);
}

body[data-theme="violet"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 84%, var(--accent-weak) 16%);
  border-color: color-mix(in srgb, #8d5dff 48%, var(--line) 52%);
  color: var(--text);
}

body[data-theme="neon"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 84%, var(--accent-weak) 16%);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line) 54%);
  color: var(--text);
}

body[data-theme="cosmos"] .btn:hover {
  background: color-mix(in srgb, var(--panel) 84%, var(--accent-weak) 16%);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line) 54%);
  color: var(--text);
}

body[data-theme="graphite"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #1a1e25 14%);
  border-color: color-mix(in srgb, var(--line) 82%, #1a1e25 18%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="bio"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #0f1628 14%);
  border-color: color-mix(in srgb, var(--line) 78%, #0f1628 22%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="aqua"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #081742 14%);
  border-color: color-mix(in srgb, var(--line) 80%, #081742 20%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="violet"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #140826 14%);
  border-color: color-mix(in srgb, var(--line) 80%, #140826 20%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="neon"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #101327 14%);
  border-color: color-mix(in srgb, var(--line) 80%, #101327 20%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="cosmos"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 86%, #101936 14%);
  border-color: color-mix(in srgb, var(--line) 80%, #101936 20%);
  color: var(--muted);
  opacity: 0.9;
}

body[data-theme="pixel"] .btn:hover {
  background: color-mix(in srgb, var(--accent-weak) 72%, var(--panel) 28%);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line) 48%);
  color: var(--text);
}

body[data-theme="pixel"] .btn:disabled {
  background: color-mix(in srgb, var(--panel) 85%, #0c1328 15%);
  border-color: color-mix(in srgb, var(--line) 75%, #0c1328 25%);
  color: var(--muted);
  opacity: 0.9;
}

.btn-primary {
  border: 1px solid #0e9b79;
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: #0d966f;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
}

.icon-btn .icon-glyph {
  font-size: 24px;
  line-height: 1;
}

.icon-svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: block;
}

.composer-actions .btn-primary {
  margin-left: auto;
}

#voiceRecordBtn.recording {
  width: auto;
  min-width: 116px;
  padding: 0 12px;
  justify-content: flex-start;
}

#voiceRecordBtn .voice-timer {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.composer-icon-btn {
  align-self: flex-end;
  border-color: transparent;
  background: transparent;
}

.composer-icon-btn:hover {
  background: color-mix(in srgb, var(--panel) 70%, var(--line) 30%);
}

.send-hidden {
  display: none !important;
}

.send-icon-btn {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line) 28%);
  color: #ffffff;
}

.send-icon-btn:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000 12%);
  border-color: color-mix(in srgb, var(--accent) 78%, var(--line) 22%);
}

.send-icon-btn .icon-svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.1;
}

#voiceRecordBtn.recording {
  border-color: color-mix(in srgb, #ff5b6a 68%, var(--line) 32%);
  color: color-mix(in srgb, #ff5b6a 78%, var(--text) 22%);
  background: color-mix(in srgb, #ff5b6a 16%, var(--panel) 84%);
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.theme-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.theme-btn {
  font-size: 13px;
  padding: 8px 8px;
}

.theme-btn.active {
  border-color: color-mix(in srgb, var(--accent) 70%, #ffffff 30%);
  background: var(--accent-weak);
  color: var(--accent);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.search-row .btn {
  padding-left: 10px;
  padding-right: 10px;
}

.msg.search-hit {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, #ffffff 45%);
  outline-offset: 2px;
}

.model-hint {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 9px;
  line-height: 1.35;
  font-size: 13px;
  max-height: none;
  overflow: visible;
  display: block;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.markdown-body a {
  color: color-mix(in srgb, var(--accent) 86%, #4f8cff 14%);
  text-decoration-color: color-mix(in srgb, var(--accent) 70%, #4f8cff 30%);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.markdown-body a:visited {
  color: color-mix(in srgb, var(--accent) 70%, #8c72ff 30%);
}

.markdown-body a:hover {
  text-decoration-thickness: 2px;
}

body[data-theme="graphite"] .markdown-body a,
body[data-theme="pixel"] .markdown-body a,
body[data-theme="bio"] .markdown-body a,
body[data-theme="aqua"] .markdown-body a,
body[data-theme="violet"] .markdown-body a,
body[data-theme="cosmos"] .markdown-body a,
body[data-theme="neon"] .markdown-body a {
  color: #79cfff;
  text-decoration-color: rgba(121, 207, 255, 0.75);
}

body[data-theme="graphite"] .markdown-body a:visited,
body[data-theme="pixel"] .markdown-body a:visited,
body[data-theme="bio"] .markdown-body a:visited,
body[data-theme="aqua"] .markdown-body a:visited,
body[data-theme="violet"] .markdown-body a:visited,
body[data-theme="cosmos"] .markdown-body a:visited,
body[data-theme="neon"] .markdown-body a:visited {
  color: #b7a5ff;
}

#tgLinkHint {
  border-radius: 10px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: all .25s ease;
}

#tgLinkHint.ok {
  background: color-mix(in srgb, var(--accent-weak) 88%, var(--panel) 12%);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line) 55%);
  color: color-mix(in srgb, var(--accent) 80%, var(--text) 20%);
}

#tgLinkHint.error {
  background: color-mix(in srgb, #bf1f2f 18%, var(--panel) 82%);
  border-color: color-mix(in srgb, #bf1f2f 45%, var(--line) 55%);
  color: color-mix(in srgb, #ff6a77 78%, var(--text) 22%);
}

#tgLinkHint.pulse {
  animation: hint-pulse .6s ease;
}

@keyframes hint-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.34);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  backdrop-filter: blur(4px);
}

.corner-pet {
  display: none;
  position: fixed;
  right: 12px;
  bottom: 2px;
  width: 384px;
  height: 384px;
  z-index: 8;
  pointer-events: none;
  opacity: 0.96;
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.18));
}

/* Show pet only in focus mode (both side panels hidden) on wide desktop. */
body.sidebar-hidden.account-hidden:not(.help-visible):not(.compact-layout) .corner-pet {
  display: block;
}

.corner-pet-lottie {
  width: 100%;
  height: 100%;
}

.corner-links {
  display: none;
  position: fixed;
  right: 96px;
  bottom: 8px;
  z-index: 12;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 220px;
}

.corner-links a {
  color: color-mix(in srgb, var(--accent) 78%, var(--text) 22%);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 78%, transparent 22%);
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--accent) 28%);
  backdrop-filter: blur(4px);
}

.corner-links a:hover {
  text-decoration: underline;
}

.overlay.active {
  display: flex;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(10, 14, 22, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox-img {
  max-width: min(1200px, 96vw);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f1522;
  z-index: 1;
  cursor: auto;
}

.image-lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}

body.lightbox-open {
  overflow: hidden;
}

.modal {
  width: min(430px, 90vw);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  animation: modal-in .22s ease;
}

.modal h2 {
  margin: 0;
  font-size: 24px;
}

.modal p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 15px;
}

.human-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.human-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

body[data-theme="pixel"] .modal {
  background: color-mix(in srgb, var(--panel) 92%, #0a1124 8%);
  border-color: color-mix(in srgb, var(--line) 70%, #7cd6ff 30%);
  box-shadow: 0 20px 52px rgba(5, 8, 18, 0.6);
}

.full {
  width: 100%;
}

.error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.floating-help {
  position: fixed;
  top: var(--floating-panels-top);
  right: 348px;
  width: clamp(280px, 24vw, 340px);
  max-height: calc(100vh - var(--floating-panels-top) - 12px);
  max-height: calc(100dvh - var(--floating-panels-top) - 12px);
  z-index: 19;
}

.floating-help[hidden] {
  display: none;
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.help-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-close-btn {
  width: 34px;
  height: 32px;
  padding: 0;
  line-height: 1;
  font-size: 18px;
}

.help-body {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
  display: grid;
  gap: 8px;
  overflow: auto;
  max-height: calc(100vh - 86px);
  transition: max-height .22s ease, opacity .22s ease, transform .22s ease;
}

.floating-help.collapsed .help-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  pointer-events: none;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.help-item {
  font-size: 15px;
  color: var(--text);
  line-height: 1.48;
}

.help-item code {
  font-family: var(--mono);
  font-size: 13px;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 20, 0.44);
  backdrop-filter: blur(2px);
  z-index: 34;
  pointer-events: auto;
}

.mobile-backdrop[hidden] {
  display: none !important;
}

/* Compact laptop layout (desktop screens with limited width/height). */
body.compact-layout:not(.sidebar-hidden) .app-shell {
  grid-template-columns: minmax(360px, 430px) 1fr;
}

body.compact-layout.sidebar-hidden .app-shell {
  grid-template-columns: 1fr;
}

body.compact-layout .chat {
  padding: 0 14px;
}

body.compact-layout .chat-header,
body.compact-layout .messages,
body.compact-layout .composer {
  width: min(1120px, 100%);
}

body.compact-layout:not(.account-hidden) .chat-header,
body.compact-layout:not(.account-hidden) .messages,
body.compact-layout:not(.account-hidden) .composer {
  width: min(1120px, calc(100% - 316px));
}

body.compact-layout .chat-header-right {
  max-width: 320px;
}

body.compact-layout .top-model-wrap {
  grid-template-columns: auto minmax(200px, 1fr);
  column-gap: 8px;
}

body.compact-layout .top-model-hint {
  font-size: 12px;
  line-height: 1.32;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.compact-layout .header-tools-collapse-btn {
  display: inline-flex;
  align-self: flex-start;
  min-width: 0;
  padding: 7px 12px;
}

body.compact-layout .header-tools {
  justify-content: flex-start;
  max-height: 140px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
}

body.compact-layout .header-tools.mobile-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

body.compact-layout .floating-account {
  right: 10px;
  width: min(300px, calc(100vw - 20px));
}

body.compact-layout .floating-help {
  right: 10px;
  width: min(300px, calc(100vw - 20px));
  max-height: calc(100vh - var(--floating-panels-top) - 12px);
  max-height: calc(100dvh - var(--floating-panels-top) - 12px);
}

body.compact-layout:not(.account-hidden).help-visible .floating-help {
  top: 430px;
  max-height: calc(100vh - 442px);
}

body.compact-layout .corner-pet {
  width: 220px;
  height: 220px;
  right: -42px;
  bottom: -52px;
  opacity: 0.9;
}

body.compact-layout .corner-links {
  display: none;
}

@media (max-width: 1280px) and (min-width: 981px) {
  body.compact-layout .app-shell {
    grid-template-columns: minmax(320px, 390px) 1fr;
  }

  body.compact-layout .corner-pet {
    display: none;
  }
}

@keyframes modal-in {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 980px) {
  body {
    min-height: 100dvh;
    height: 100dvh;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(90vw, 380px);
    max-width: 100%;
    z-index: 40;
    border-right: 1px solid var(--line);
    border-bottom: none;
    height: 100vh;
    height: 100dvh;
    overflow: auto;
    transform: translateX(-102%);
    transition: transform .24s ease;
  }

  .sidebar-columns {
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;
  }

  .sidebar-col {
    overflow: visible;
    padding-right: 0;
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open .sidebar,
  body.mobile-account-open .floating-account,
  body.mobile-help-open .floating-help {
    pointer-events: auto;
  }

  body[data-theme="pixel"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #000814 4%);
  }

  body[data-theme="bio"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #05070a 4%);
  }

  body[data-theme="neon"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #0a0b14 4%);
  }

  body[data-theme="aqua"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #020024 4%);
  }

  body[data-theme="violet"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #050505 4%);
  }

  body[data-theme="cosmos"].mobile-sidebar-open .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--sidebar-bg) 96%, #0b1026 4%);
  }

  .messages {
    width: 100%;
    padding: 14px 2px 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }

  .composer {
    width: 100%;
    flex: 0 0 auto;
    padding: 10px 2px calc(10px + env(safe-area-inset-bottom));
    z-index: 6;
    margin-top: 0;
  }

  .composer-input-shell {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 18px;
  }

  .composer-input-shell #input {
    min-height: 40px;
    max-height: 160px;
    font-size: 16px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .icon-btn .icon-glyph {
    font-size: 22px;
  }

  .quick-row-toggle {
    display: inline-flex;
  }

  .chat {
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .top-model-wrap {
    grid-template-columns: 1fr;
  }

  .model-select-label {
    margin-bottom: 2px;
  }

  .top-model-hint {
    font-size: 12px;
  }

  .model-panel-toggle {
    display: inline-flex;
  }

  .chat-header {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
  }

  .chat-header-right {
    min-width: 0;
    justify-items: stretch;
  }

  .header-tools {
    justify-content: flex-start;
    max-height: 140px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
  }

  .header-tools.mobile-collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
  }

  .panel-toggle-btn {
    min-width: 0;
  }

  .header-tools-collapse-btn {
    display: inline-flex;
    align-self: flex-start;
    min-width: 0;
    padding: 7px 12px;
  }

  .panel-state-hint {
    text-align: left;
  }

  .status {
    justify-self: end;
  }

  .floating-account {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 390px);
    max-width: 100%;
    padding: 10px;
    margin: 0;
    z-index: 41;
    transform: translateX(102%);
    transition: transform .24s ease;
    overflow: auto;
    background: color-mix(in srgb, var(--bg) 86%, #ffffff 14%);
  }

  .floating-account .account-panel-body {
    max-height: calc(100vh - 110px);
  }

  body.mobile-account-open .floating-account {
    transform: translateX(0);
  }

  .floating-help {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 72vh;
    padding: 10px;
    z-index: 42;
    transform: translateY(105%);
    transition: transform .24s ease;
  }

  .floating-help .help-body {
    max-height: 52vh;
  }

  body.mobile-help-open .floating-help {
    transform: translateY(0);
  }

  .floating-account .header-account-wrap,
  .floating-help .help-body {
    box-shadow: 0 12px 30px rgba(7, 14, 28, 0.24);
    backdrop-filter: blur(6px);
  }

  body.mobile-panel-open {
    overflow: hidden;
  }

  .corner-pet {
    display: none;
  }

  .corner-links {
    display: none;
  }
}



