:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #0a1017;
  --sidebar: #0c131c;
  --panel: #111a25;
  --surface: #162230;
  --surface-strong: #1b2a3a;
  --stroke: #2b3c4e;
  --stroke-strong: #3a5064;
  --text: #edf5fb;
  --muted: #afbecb;
  --soft: #8295a7;
  --accent: #79deb0;
  --accent-strong: #4fc992;
  --accent-ink: #082218;
  --danger: #f4b8bb;
  --danger-bg: #392326;
  --warning: #efb36e;
  --shadow: 0 20px 64px rgb(0 0 0 / 32%);
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
textarea { font: inherit; }

button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 24px 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--stroke);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 24px;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid #2b654d;
  border-radius: 14px;
  background: #113326;
  color: var(--accent);
  font-size: 29px;
  font-weight: 800;
}

.brand strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  letter-spacing: -.35px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
}

.new-chat {
  display: grid;
  grid-template-columns: auto 1fr auto;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--stroke-strong);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
  font-size: 14px;
  font-weight: 650;
  transition: border-color .18s, background .18s;
}

.new-chat:hover {
  border-color: #55836f;
  background: var(--surface-strong);
}

.sidebar-auth-nav { display: none; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.sidebar-auth-nav a { display: grid; min-height: 40px; place-items: center; border: 1px solid var(--stroke); border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.sidebar-auth-nav a:last-child { border-color: #376c56; background: #173329; color: var(--accent); }

.plus-icon { font-size: 23px; font-weight: 300; line-height: 1; }
.kbd { color: var(--soft); font-size: 12px; font-weight: 500; }

.sidebar-section-title {
  margin: 32px 10px 13px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 1.7px;
}

.chat-list {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
}

.chat-item:hover,
.chat-item.active {
  border-color: var(--stroke);
  background: var(--surface);
  color: var(--text);
}

.chat-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-icon { flex: 0 0 auto; opacity: .85; font-size: 17px; }

.sidebar-bottom {
  margin-top: auto;
  padding: 20px 8px 0;
  border-top: 1px solid var(--stroke);
}

.sidebar-verification {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--stroke);
}

.sidebar-verification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-verification-head strong { display: block; font-size: 13px; }
.sidebar-verification-head small { display: block; margin-top: 2px; color: var(--soft); font-size: 12px; }
.sidebar-shield {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  color: var(--soft);
  font-size: 14px;
}
.sidebar-verification:has(.proof-row[data-state="verified"]) .sidebar-shield {
  border-color: #376c56;
  background: #173329;
  color: var(--accent);
}

.mini-info { display: flex; align-items: center; gap: 11px; }
.mini-info strong { display: block; font-size: 13px; }
.mini-info small { display: block; margin-top: 3px; color: var(--soft); font-size: 12px; }

.pulse-dot,
.status-dot,
.gpu-quota-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--warning);
}

.pulse-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgb(121 222 176 / 12%);
}

.sidebar-bottom p {
  margin: 15px 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.75;
}

.sidebar-bottom a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.sidebar-bottom a:hover { text-decoration: underline; }
.sidebar-backdrop { display: none; }

.main-column {
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) auto;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(360px, 680px) auto;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--stroke);
  background: rgb(10 16 23 / 88%);
  backdrop-filter: blur(14px);
}

.topbar-model,
.topbar-actions,
.service-status {
  display: flex;
  align-items: center;
}

.topbar-model { gap: 10px; font-size: 15px; }
.topbar-model strong { letter-spacing: -.2px; }

.version {
  padding: 3px 7px;
  border: 1px solid #2e654f;
  border-radius: 7px;
  background: #153429;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.topbar-actions { gap: 8px; }
.service-status { gap: 8px; margin-right: 4px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.service-status.ready .status-dot { background: var(--accent); }
.service-status.paused .status-dot { background: var(--warning); }

.icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.icon-btn:hover { background: var(--surface); color: var(--text); }
.account-link { display: flex; width: auto; min-width: 38px; padding: 0 11px; gap: 7px; border: 1px solid var(--stroke); background: var(--surface); font-size: 13px; font-weight: 700; white-space: nowrap; }
.account-link:hover { border-color: #55836f; }
.account-link span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.account-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.menu-btn,
.sidebar-close { display: none; }

.gpu-quota-strip {
  display: grid;
  grid-template-columns: auto auto minmax(80px, 1fr) auto;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: var(--panel);
}

.gpu-quota-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.gpu-quota-label strong { color: var(--text); }
.gpu-quota-indicator { background: #a9b5c0; }
.gpu-quota-strip[data-state="available"] .gpu-quota-indicator { background: var(--accent); }
.gpu-quota-strip[data-state="low"] .gpu-quota-indicator,
.gpu-quota-strip[data-state="exhausted"] .gpu-quota-indicator { background: var(--warning); }
.gpu-quota-strip[data-state="unavailable"] .gpu-quota-indicator { background: var(--soft); }

.gpu-quota-data {
  display: flex;
  min-width: 185px;
  flex-direction: column;
  gap: 1px;
}

.gpu-quota-data strong { font-size: 14px; }
.gpu-quota-compact { display: none; }
.gpu-quota-data span,
.gpu-quota-updated { color: var(--soft); font-size: 12px; }
.gpu-quota-updated { display: none; }

.gpu-quota-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--stroke);
}

.gpu-quota-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .25s ease;
}

.gpu-quota-strip[data-state="low"] .gpu-quota-progress span,
.gpu-quota-strip[data-state="exhausted"] .gpu-quota-progress span { background: var(--warning); }

.gpu-quota-refresh {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
}

.gpu-quota-refresh:hover:not(:disabled) { border-color: var(--stroke-strong); background: var(--surface-strong); }

.conversation-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.empty-state {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vh, 52px) 32px 24px;
  overflow-y: auto;
  text-align: center;
  animation: appear .45s ease;
}

.hero-logo {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  place-items: center;
  border: 1px solid #2b654d;
  border-radius: 22px;
  background: linear-gradient(145deg, #173a2d, #0d181c);
  box-shadow: 0 20px 70px rgb(121 222 176 / 8%);
  color: var(--accent);
  font-size: 44px;
  font-weight: 800;
}

.hero-spark { position: absolute; top: -10px; right: -12px; color: #a9c9ff; font-size: 21px; }
.eyebrow { margin: 22px 0 9px; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: 1.8px; }

.empty-state h1 {
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 720;
  letter-spacing: -2px;
  line-height: 1.16;
}

.empty-state h1 em { color: var(--accent); font-style: normal; }

.hero-description {
  max-width: 650px;
  margin: 20px 0 28px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.examples {
  display: grid;
  width: min(760px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.examples button {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 13px 16px;
  border: 1px solid var(--stroke);
  border-radius: 13px;
  background: linear-gradient(145deg, var(--surface), #121c27);
  text-align: left;
  transition: border-color .18s, background .18s, transform .18s;
}

.examples button:hover {
  border-color: #4c806a;
  background: var(--surface-strong);
  transform: translateY(-1px);
}

.examples button strong { font-size: 14px; font-weight: 680; }
.examples button small { color: var(--soft); font-size: 12px; }

.messages {
  display: none;
  width: min(920px, 100%);
  height: 100%;
  margin: 0 auto;
  flex-direction: column;
  gap: 26px;
  padding: 28px 32px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.messages.active { display: flex; }
.session-image-context {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  width: min(100%, 560px);
  min-height: 66px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 10px 7px 7px;
  border: 1px solid #376652;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 12px 34px rgb(0 0 0 / 24%);
  color: var(--text);
  text-align: left;
  backdrop-filter: blur(14px);
}
.session-image-context:hover { border-color: #62a785; background: var(--surface); }
.session-image-context img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: white; }
.session-image-copy { min-width: 0; }
.session-image-copy strong,
.session-image-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-image-copy strong { font-size: 13px; }
.session-image-copy small { margin-top: 4px; color: var(--soft); font-size: 12px; }
.session-image-action { color: var(--accent); font-size: 12px; font-weight: 750; }
.session-image-missing {
  width: min(100%, 620px);
  padding: 12px 14px;
  border: 1px solid #72593c;
  border-radius: 12px;
  background: #2d251b;
  color: #e6c89e;
  font-size: 13px;
  line-height: 1.55;
}
.message { display: flex; max-width: 100%; gap: 14px; animation: appear .2s ease; }
.message.user { justify-content: flex-end; }

.message.user .message-content {
  max-width: 78%;
  padding: 14px 17px;
  border: 1px solid var(--stroke);
  border-radius: 17px 17px 5px;
  background: var(--surface-strong);
}

.message.assistant .message-content { min-width: 0; max-width: 90%; padding: 5px 0; }

.bot-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #36775a;
  border-radius: 11px;
  background: #153629;
  color: var(--accent);
  font-size: 21px;
  font-weight: 800;
}

.msg-label { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.msg-body { overflow-wrap: anywhere; font-size: 15px; line-height: 1.75; white-space: pre-wrap; }

.message-image {
  display: block;
  max-width: 250px;
  max-height: 220px;
  margin-bottom: 10px;
  object-fit: contain;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: var(--bg);
}

.message-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.meta-pill { padding: 5px 9px; border: 1px solid #315d4d; border-radius: 999px; background: #18302b; color: #a9dec5; font-size: 12px; }
.meta-pill.warn { border-color: #805431; background: #382719; color: #f1be85; }
.detail-box { margin-top: 10px; color: var(--muted); font-size: 12px; }
.detail-box summary { padding: 6px 0; cursor: pointer; }
.detail-box pre { padding: 14px; overflow: auto; border-radius: 10px; background: var(--surface); font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.typing { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }

.composer-wrap {
  width: min(920px, calc(100% - 48px));
  margin: 0 auto;
  padding: 12px 0 16px;
}

.composer {
  position: relative;
  padding: 14px 16px 13px;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s;
}

.composer:focus-within {
  border-color: #58836f;
  box-shadow: 0 22px 68px rgb(0 0 0 / 38%), 0 0 0 3px rgb(121 222 176 / 7%);
}

.drop-overlay {
  position: absolute;
  z-index: 8;
  inset: 7px;
  display: flex;
  visibility: hidden;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 2px dashed var(--accent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
  opacity: 0;
  pointer-events: none;
  transform: scale(.985);
  transition: opacity .16s, transform .16s, visibility .16s;
}
.drop-overlay span { color: var(--accent); font-size: 30px; line-height: 1; }
.drop-overlay strong { font-size: 14px; }
.drop-overlay small { color: var(--muted); font-size: 12px; }
.composer.drag-active { border-color: var(--accent); box-shadow: 0 0 0 4px rgb(121 222 176 / 11%), var(--shadow); }
.composer.drag-active .drop-overlay { visibility: visible; opacity: 1; transform: scale(1); }

.composer-main textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  max-height: 150px;
  padding: 1px 2px 8px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.composer-main textarea::placeholder { color: var(--soft); }
.token-selector {
  display: grid;
  min-width: 0;
  grid-template-columns: auto repeat(3, minmax(82px, auto));
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.token-selector legend {
  padding: 0 5px 0 2px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.token-option { position: relative; min-width: 0; cursor: pointer; }
.token-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.token-option span {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  color: var(--muted);
  transition: border-color .16s, background .16s, color .16s;
  white-space: nowrap;
}
.token-option strong { font-size: 13px; }
.token-option small { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.token-option:hover input:not(:disabled) + span { border-color: #55836f; color: var(--text); }
.token-option input:checked + span { border-color: #477c64; background: #173329; color: var(--accent); }
.token-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.token-option input:disabled + span { cursor: not-allowed; opacity: .52; }
.composer-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}
.left-tools { display: flex; min-width: 0; align-items: center; gap: 12px; }

.attach-button {
  display: flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.attach-button:hover { border-color: #55836f; color: var(--text); }
.attach-button span:first-child { font-size: 20px; font-weight: 300; line-height: 1; }
.input-hint { overflow: hidden; color: var(--soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.save-image-option {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.save-image-option[hidden] { display: none; }
.save-image-option:hover { border-color: #55836f; color: var(--text); }
.save-image-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.session-lock-state { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.session-lock-state span { color: var(--accent); }

.send-btn {
  min-width: 70px;
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 750;
}

.send-btn:hover:not(:disabled) { background: #a0edca; }

.image-chip {
  display: flex;
  width: min(100%, 380px);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid #355246;
  border-radius: 12px;
  background: #172e2b;
}

.image-chip img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: white; }
.image-chip-preview { display: block; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in; }
.image-chip-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.image-chip-text { min-width: 0; flex: 1; }
.image-chip-text strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.image-chip-text small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.remove-image { border: 0; background: transparent; color: var(--muted); }

.proof-row {
  display: flex;
  min-height: 0;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.turnstile-box { width: 150px; max-width: 100%; min-height: 140px; margin: 0 auto; overflow: hidden; }
.turnstile-box:empty { display: none; }
.verification-badge {
  display: none;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid #376c56;
  border-radius: 10px;
  background: #173329;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.verification-badge span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
}
.proof-row[data-state="verified"] { min-width: 0; }
.proof-row[data-state="verified"] .turnstile-box { display: none; }
.proof-row[data-state="verified"] .verification-badge { display: flex; }
.text-btn { border: 0; background: transparent; color: var(--accent); font-size: 13px; text-decoration: underline; }

.verification-trigger {
  display: none;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.verification-trigger:hover { border-color: #55836f; color: var(--text); }
.verification-trigger[data-state="error"] { border-color: #7a4449; color: var(--danger); }

.composer-footnote {
  margin: 9px auto 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.error-notice {
  margin-bottom: 10px;
  padding: 11px 14px;
  border: 1px solid #7a4449;
  border-radius: 11px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.6;
}

.about-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
}

.image-viewer {
  width: min(1120px, calc(100vw - 34px));
  height: min(88vh, 860px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
}
.image-viewer::backdrop { background: rgb(0 0 0 / 78%); backdrop-filter: blur(7px); }
.image-viewer-top { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 13px 10px 18px; border-bottom: 1px solid var(--stroke); }
.image-viewer-top strong,
.image-viewer-top small { display: block; }
.image-viewer-top small { margin-top: 2px; color: var(--soft); font-size: 12px; }
.image-viewer-canvas { display: grid; height: calc(100% - 62px); padding: 16px; overflow: auto; place-items: center; background: #080c11; }
.image-viewer-canvas img { width: auto; max-width: 100%; height: auto; max-height: 100%; object-fit: contain; background: white; box-shadow: 0 16px 60px rgb(0 0 0 / 42%); }

.about-dialog::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(5px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; }
.about-dialog p { color: var(--muted); font-size: 14px; line-height: 1.75; }
.about-dialog .dialog-alert { color: #e8b4a1; }
.dialog-ok { min-height: 42px; padding: 9px 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 750; }

.theme-light {
  color-scheme: light;
  --bg: #f5f8fa;
  --sidebar: #eef3f5;
  --panel: #ffffff;
  --surface: #e8eff3;
  --surface-strong: #dde8ed;
  --stroke: #cfdae1;
  --stroke-strong: #b5c6d0;
  --text: #172633;
  --muted: #4c6272;
  --soft: #637989;
  --accent: #16825b;
  --accent-strong: #126c4d;
  --accent-ink: #ffffff;
  --danger: #882f39;
  --danger-bg: #fcecef;
  --shadow: 0 18px 54px rgb(63 86 101 / 18%);
}

.theme-light .topbar { background: rgb(245 248 250 / 90%); }
.theme-light .brand-mark,
.theme-light .hero-logo { background: #dcefe7; color: #136f50; }
.theme-light .version { background: #dcefe7; color: #126a4d; }
.theme-light .examples button { background: linear-gradient(145deg, white, #edf3f6); }
.theme-light .image-chip { background: #e2f2ec; }
.theme-light .token-option input:checked + span { background: #e2f2ec; color: #126a4d; }
.theme-light .session-image-missing { background: #fff3df; color: #704d1f; }
.theme-light .meta-pill { background: #e0f1e9; color: #1e6047; }
.theme-light .message-image { background: white; }
.theme-light .verification-badge { background: #e2f2ec; color: #126a4d; }

@keyframes bounce {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@keyframes appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 1180px) {
  .examples { width: min(900px, 100%); grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .topbar { grid-template-columns: auto auto minmax(260px, 1fr) auto; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(312px, calc(100vw - 40px));
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-close,
  .menu-btn { display: grid; }

  .sidebar-backdrop:not([hidden]) {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: block;
    background: rgb(0 0 0 / 56%);
  }

  .verification-trigger:not([hidden]) { display: flex; }
  .sidebar-auth-nav { display: grid; }
}

@media (max-height: 760px) and (min-width: 701px) {
  .empty-state { justify-content: flex-start; padding-top: 22px; }
  .hero-logo { width: 56px; height: 56px; flex-basis: 56px; border-radius: 17px; font-size: 36px; }
  .eyebrow { margin-top: 15px; }
  .hero-description { margin: 13px 0 18px; }
  .examples button { min-height: 62px; }
}

@media (max-height: 760px) {
  .sidebar-bottom p { display: none; }
}

@media (max-width: 1280px) {
  .gpu-quota-strip {
    display: flex;
    width: auto;
    min-width: 0;
    justify-self: end;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 10px;
  }
  .gpu-quota-label strong,
  #gpuQuotaRemaining,
  .gpu-quota-data span,
  .gpu-quota-progress,
  .gpu-quota-refresh { display: none; }
  .gpu-quota-label { gap: 0; }
  .gpu-quota-data { min-width: 0; }
  .gpu-quota-compact { display: block; font-size: 12px; white-space: nowrap; }
}

@media (min-width: 1025px) and (max-width: 1280px) {
  .topbar { grid-template-columns: auto minmax(72px, 1fr) auto; gap: 8px; }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto auto minmax(72px, 1fr) auto; gap: 8px; }
}

@media (max-width: 700px) {
  .main-column { grid-template-rows: 64px minmax(0, 1fr) auto; }
  .topbar { padding: 0 11px; }
  .topbar-model { gap: 7px; font-size: 14px; }
  .topbar-actions { gap: 2px; }
  .service-status { margin-right: 0; font-size: 0; }
  .service-status .status-dot { width: 9px; height: 9px; }
  .account-link { display: flex; width: 38px; padding: 0; justify-content: center; }
  .account-link span { display: none; }

  .empty-state {
    justify-content: flex-start;
    padding: 22px 16px 18px;
  }

  .hero-logo { width: 56px; height: 56px; flex-basis: 56px; border-radius: 17px; font-size: 36px; }
  .hero-spark { top: -8px; right: -10px; font-size: 18px; }
  .eyebrow { margin-top: 16px; font-size: 10px; }
  .empty-state h1 { font-size: clamp(29px, 9vw, 38px); letter-spacing: -1.4px; }
  .hero-description { margin: 13px 0 18px; font-size: 14px; line-height: 1.6; }
  .examples { grid-template-columns: 1fr; gap: 8px; }
  .examples button { min-height: 58px; padding: 10px 13px; }

  .messages { gap: 21px; padding: 20px 14px; }
  .session-image-context { grid-template-columns: 46px minmax(0, 1fr); }
  .session-image-context img { width: 46px; height: 46px; }
  .session-image-action { display: none; }
  .message.user .message-content { max-width: 90%; }
  .message.assistant .message-content { max-width: 100%; }
  .msg-body { font-size: 14px; }

  .composer-wrap { width: calc(100% - 20px); padding: 9px 0 10px; }
  .composer { padding: 11px 12px; border-radius: 15px; }
  .token-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .token-selector legend { grid-column: 1 / -1; padding: 0 2px 2px; }
  .token-option span { min-height: 36px; padding-inline: 5px; }
  .token-option small { display: none; }
  .composer-bottom { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .left-tools { gap: 7px; }
  .input-hint { display: none; }
  .save-image-option { padding-inline: 8px; }
  .save-image-option span { display: none; }
  .send-btn { min-width: 64px; }
  .composer-footnote { padding: 0 8px; font-size: 11px; }
}

@media (max-width: 560px) {
  .image-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .image-viewer-canvas { padding: 8px; }
}

@media (min-width: 360px) and (max-width: 700px) {
  .examples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .examples button { min-height: 68px; }
}

@media (max-width: 420px) {
  .topbar .about { display: none; }
  .version { display: none; }
  .eyebrow { letter-spacing: 1.2px; }
  .composer-footnote { display: none; }
}

@media (max-width: 350px) {
  .service-status,
  #themeToggle { display: none; }
  .verification-trigger { width: 38px; justify-content: center; padding-inline: 7px; }
  .verification-trigger span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

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