:root {
  color-scheme: light;
  --sidebar-width: 280px;
  --topbar-height: 64px;
  --bg: #f5f7fb;
  --bg-quiet: #f9fafe;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #ffffff;
  --surface-warm: #f0f2fa;
  --surface-cool: #eaf0fb;
  --glass: rgba(255, 255, 255, 0.60);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(0, 0, 0, 0.06);
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.10);
  --text: #1a1f36;
  --text-soft: #4a5578;
  --muted: #8892b0;
  --accent: #4f6df5;
  --accent-light: #6b85f7;
  --accent-deep: #3a54d4;
  --accent-soft: rgba(79, 109, 245, 0.08);
  --accent-glow: rgba(79, 109, 245, 0.18);
  --gold: #7c5cfc;
  --teal: #0ea5a0;
  --danger: #ef4444;
  --focus-ring: rgba(79, 109, 245, 0.18);
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 60px rgba(30, 40, 90, 0.10), 0 8px 20px rgba(0, 0, 0, 0.06);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: "Inter", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
  box-sizing: border-box;
}

::selection {
  background: rgba(79, 109, 245, 0.16);
  color: var(--accent-deep);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  position: relative;
}

/* Animated background blobs — same as login page */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

body::before {
  top: -8%;
  left: -4%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(79, 109, 245, 0.14), transparent 70%);
  animation: app-blob-1 20s ease-in-out infinite;
}

body::after {
  bottom: -10%;
  right: -5%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(14, 165, 160, 0.10), transparent 70%);
  animation: app-blob-2 24s ease-in-out infinite;
}

@keyframes app-blob-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 25px) scale(1.06); }
  66% { transform: translate(-15px, 50px) scale(0.96); }
}

@keyframes app-blob-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, -40px) scale(1.05); }
  66% { transform: translate(20px, -15px) scale(0.95); }
}

.login-body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(58, 84, 212, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(58, 84, 212, 0.06) 1px, transparent 1px),
    linear-gradient(120deg, #f5f7fb 0%, #eef1fa 38%, #eaf0fb 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
  gap: clamp(28px, 5vw, 76px);
  min-height: 100vh;
  align-items: center;
  padding: clamp(22px, 5vw, 68px);
}

.login-hero {
  display: grid;
  min-height: min(760px, calc(100vh - 72px));
  grid-template-rows: auto minmax(0, auto) auto auto;
  align-content: space-between;
  gap: clamp(22px, 4vh, 34px);
}

.login-panel {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  padding: clamp(22px, 3vw, 34px);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  padding: 9px 14px 9px 9px;
  box-shadow: var(--shadow-tight);
}

.login-brand strong,
.login-brand span,
.login-panel-heading p,
.login-panel-heading h2,
.logged-in-panel h1,
.logged-in-panel p {
  display: block;
  margin: 0;
}

.login-brand strong,
.login-panel-heading h2,
.logged-in-panel h1 {
  color: var(--accent-deep);
  font-family: var(--font-serif);
  font-size: 24px;
}

.login-brand span,
.login-panel-heading p,
.logged-in-panel p,
.form-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-panel-heading {
  margin-bottom: 20px;
}

.login-panel-heading p {
  color: var(--gold);
  font-weight: 800;
}

.login-panel-heading h2 {
  margin-top: 4px;
  font-size: clamp(25px, 3vw, 32px);
}

.login-hero-copy {
  max-width: 760px;
}

.login-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-hero-copy h1 {
  max-width: 760px;
  margin: 0;
  color: #102f34;
  font-family: var(--font-serif);
  font-size: clamp(44px, 6vw, 76px);
  line-height: 1.06;
  letter-spacing: 0;
}

.login-hero-copy p:last-child {
  max-width: 620px;
  margin: 18px 0 0;
  color: #52605b;
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.9;
}

.study-board {
  overflow: hidden;
  max-width: 760px;
  border: 1px solid rgba(32, 48, 45, 0.13);
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(79, 109, 245, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(79, 109, 245, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.56);
  background-size: 32px 32px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.study-board-top,
.study-pipeline,
.login-metrics {
  display: flex;
  align-items: center;
}

.study-board-top {
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

.study-board-top strong {
  border-radius: 999px;
  background: #1d5c4f;
  color: #fffef8;
  padding: 6px 10px;
  font-size: 12px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.subject-tile {
  display: grid;
  min-height: 126px;
  align-content: space-between;
  border: 1px solid rgba(32, 48, 45, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
}

.subject-tile.active {
  background: #153f45;
  color: #fffef8;
  box-shadow: 0 18px 38px rgba(58, 84, 212, 0.2);
}

.subject-tile span,
.subject-tile em {
  color: inherit;
  font-size: 12px;
  opacity: 0.74;
}

.subject-tile strong {
  color: inherit;
  font-size: 18px;
  line-height: 1.35;
}

.subject-tile em {
  font-style: normal;
  line-height: 1.5;
}

.study-pipeline {
  gap: 8px;
  margin-top: 12px;
}

.study-pipeline span {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(32, 48, 45, 0.11);
  border-radius: 999px;
  background: rgba(241, 234, 223, 0.82);
  color: var(--text-soft);
  padding: 8px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.login-metrics {
  flex-wrap: wrap;
  gap: 10px;
}

.login-metrics div {
  min-width: 126px;
  border: 1px solid rgba(32, 48, 45, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  padding: 14px 16px;
  box-shadow: var(--shadow-tight);
}

.login-metrics strong,
.login-metrics span {
  display: block;
}

.login-metrics strong {
  color: var(--accent-deep);
  font-size: 24px;
}

.login-metrics span {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.login-form label,
.login-form fieldset {
  display: grid;
  gap: 8px;
}

.login-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.login-form fieldset:disabled {
  opacity: 0.56;
}

.login-form label span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 0 13px;
}

.login-form input:disabled {
  cursor: not-allowed;
}

.invite-gate {
  display: grid;
  gap: 8px;
}

.form-hint {
  margin: 0;
}

.form-hint.ok {
  color: var(--accent);
  font-weight: 700;
}

.logged-in-panel {
  display: grid;
  gap: 16px;
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hidden {
  display: none !important;
}

button,
textarea,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100vh;
  min-height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  overflow: hidden;
  border-right: 0;
  padding-right: 0;
  padding-left: 0;
  pointer-events: none;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  min-height: 100vh;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.88) 0%, rgba(250, 251, 255, 0.80) 100%);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  overflow: hidden;
  padding: 16px 12px 12px;
  transition: width 240ms var(--spring), padding 240ms var(--spring);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-strong);
  box-shadow: var(--shadow-xs);
  padding: 8px 10px;
  transition: box-shadow 220ms var(--ease), transform 220ms var(--ease);
}

.brand-row:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.brand-mark,
.user-dot,
.avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  font-family: var(--font-serif);
  box-shadow: 0 6px 20px rgba(79, 109, 245, 0.28);
}

.brand-copy,
.user-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy span,
.user-copy strong,
.user-copy span {
  display: block;
}

.brand-copy strong,
.user-copy strong {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-copy span,
.user-copy span {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding-top: 16px;
}

.nav-button,
.thread-item,
.mode-button,
.tool-button,
.example-button,
.topbar-title button,
.round-button {
  border: 0;
  background: transparent;
  color: var(--text);
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 12px;
  padding: 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}

.nav-button:hover,
.nav-button.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.nav-button.active {
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79, 109, 245, 0.06);
}

.nav-button:hover {
  transform: translateX(2px);
}

.nav-icon {
  display: grid;
  width: 22px;
  place-items: center;
  color: currentColor;
  opacity: 0.75;
  transition: opacity 200ms var(--ease);
}

.nav-button:hover .nav-icon,
.nav-button.active .nav-icon {
  opacity: 1;
}

.sidebar-section {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.section-heading button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 200ms var(--ease);
}

.section-heading button:hover {
  color: var(--accent-deep);
}

.thread-list {
  display: grid;
  min-height: 0;
  flex: 1;
  gap: 4px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 109, 245, 0.18) transparent;
}

.thread-list::-webkit-scrollbar {
  width: 8px;
}

.thread-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(79, 109, 245, 0.24);
}

.thread-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-panel::-webkit-scrollbar {
  width: 8px;
}

.chat-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(79, 109, 245, 0.16);
}

.chat-panel::-webkit-scrollbar-track {
  background: transparent;
}

.thread-item {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  transition: background 200ms var(--ease), border-color 200ms var(--ease);
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.thread-main-button {
  min-width: 0;
}

.thread-icon-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  line-height: 1;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.thread-icon-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.thread-icon-button:hover {
  border-color: rgba(239, 68, 68, 0.12);
  background: rgba(239, 68, 68, 0.06);
  color: var(--danger);
}

.thread-item:hover,
.thread-item.active {
  border-color: var(--glass-border);
  background: var(--glass-strong);
}

.experience-item {
  cursor: default;
}

.experience-item:hover {
  transform: none;
}

.thread-item strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thread-item span {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thread-item-rich {
  padding-bottom: 12px;
}

.thread-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.thread-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
}

.thread-chip.subtle {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-soft);
}

.thread-chip.review-chip {
  background: rgba(124, 92, 252, 0.10);
  color: var(--gold);
}

.thread-empty {
  border: 1px dashed rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  padding: 14px 12px;
}

.chat-shell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 100vh;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.chat-shell.chat-active {
  grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.80) 0%, rgba(250, 251, 255, 0.72) 100%);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  padding: 0 24px;
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title button {
  display: block;
  padding: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  transition: color 200ms var(--ease);
}

.topbar-title button:hover {
  color: var(--accent-deep);
}

.topbar-title span {
  display: block;
  overflow: hidden;
  max-width: 720px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-user-button {
  min-height: 36px;
  max-width: 180px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--accent-deep);
  overflow: hidden;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}

.auth-user-button:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.topbar-actions select,
.settings-dialog select,
.settings-dialog input {
  min-height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0 13px;
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.topbar-actions select:focus,
.settings-dialog select:focus,
.settings-dialog input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.round-button {
  min-height: 36px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  padding: 0 14px;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
  transition: background 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}

.round-button:hover,
.icon-button:hover {
  background: #fff;
  color: var(--accent-deep);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.empty-state {
  display: grid;
  place-items: center;
  align-items: center;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(28px, 5vw, 72px) 24px;
  animation: hero-fade-in 700ms var(--spring) both;
}

@keyframes hero-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state.hidden {
  display: none;
}

.hero-layout {
  display: grid;
  width: min(100%, 860px);
  justify-items: center;
  margin: 0 auto;
  transform: translateY(-2vh);
}

.hero-main {
  display: grid;
  width: 100%;
  min-width: 0;
  justify-items: center;
  text-align: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-kicker span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  animation: kicker-pulse 2.8s ease-in-out infinite;
}

@keyframes kicker-pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--accent-soft); }
  50% { box-shadow: 0 0 0 10px rgba(79, 109, 245, 0.04); }
}

.empty-state h1 {
  max-width: 680px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.8vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.empty-state p {
  max-width: 560px;
  margin: 16px 0 28px;
  color: var(--text-soft);
  font-size: clamp(13.5px, 1.5vw, 15px);
  line-height: 1.85;
}

.home-quick-actions {
  display: grid;
  width: min(100%, 860px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.home-quick-card,
.home-strip-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  text-align: left;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease);
}

.home-quick-card {
  min-height: 140px;
  padding: 16px 17px;
}

.home-quick-card:hover,
.home-strip-card:hover {
  border-color: rgba(79, 109, 245, 0.12);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.home-quick-kicker {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-quick-card strong,
.home-strip-card strong {
  display: block;
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.home-quick-card p,
.home-strip-card span {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.home-recent-strip {
  width: min(100%, 860px);
  margin-top: 18px;
}

.home-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.home-strip-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-strip-card {
  min-height: 108px;
  padding: 14px 16px;
}

.hero-composer {
  width: min(100%, 860px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.92) 0%, rgba(250, 251, 255, 0.88) 100%);
  box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.90), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  padding: 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}

/* Shimmer bar on composer top edge */
.hero-composer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(79, 109, 245, 0.20) 20%, rgba(124, 92, 252, 0.15) 50%, rgba(14, 165, 160, 0.12) 80%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms var(--ease);
}

.hero-composer:focus-within::before {
  opacity: 1;
}

.hero-composer:hover {
  border-color: rgba(79, 109, 245, 0.15);
  transform: translateY(-1px);
}

.hero-composer:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-xl), 0 0 0 3px var(--accent-glow);
}

.hero-composer textarea {
  width: 100%;
  min-height: 72px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  line-height: 1.7;
  padding: 8px 10px 4px;
  font-size: 15px;
}

.hero-composer textarea::placeholder {
  color: #b0b8cc;
}

.hero-composer.compact {
  width: min(100%, 1080px);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.hero-composer.compact textarea {
  min-height: 44px;
  font-size: 14px;
}

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

.composer-left {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.key-hint {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.mode-button {
  min-height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  color: var(--accent);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.mode-button:hover {
  border-color: rgba(79, 109, 245, 0.20);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.send-button {
  display: inline-flex;
  min-width: 90px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(79, 109, 245, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), filter 200ms var(--ease);
}

/* Send button shimmer */
.send-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg);
  animation: send-shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes send-shimmer {
  0%, 85%, 100% { left: -100%; }
  50% { left: 150%; }
}

.send-button svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms var(--ease);
}

.send-button:hover:not(:disabled) svg {
  transform: translateY(-2px);
}

.send-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 999px;
  animation: send-spin 820ms linear infinite;
}

.send-button[data-mode="abort"] {
  min-width: 52px;
  width: 52px;
  padding: 0;
}

.send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(79, 109, 245, 0.35);
  filter: brightness(1.06);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

@keyframes send-spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-panel {
  display: none;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 36px;
  scroll-behavior: smooth;
}

.chat-panel.active {
  display: block;
}

.message-list {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding: 20px 0;
}

.message.user {
  grid-template-columns: minmax(0, 1fr);
}

.avatar {
  width: 36px;
  height: 36px;
  background: #fff;
  color: var(--accent-deep);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-serif);
  box-shadow: var(--shadow-xs);
}

.message.assistant .avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(79, 109, 245, 0.24);
}

.message.user .avatar {
  display: none;
}

.message-body {
  min-width: 0;
  color: var(--text);
  line-height: 1.86;
  font-size: 14px;
}

.message.user .message-body {
  display: inline-block;
  justify-self: end;
  max-width: min(900px, 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  padding: 13px 16px;
  box-shadow: var(--shadow-xs);
}

.message.assistant .message-body {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.85) 0%, rgba(250, 251, 255, 0.78) 100%);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.message-body h2,
.message-body h3 {
  margin: 18px 0 8px;
  color: var(--accent-deep);
  font-size: 18px;
  line-height: 1.45;
}

.message-body h2:first-child,
.message-body h3:first-child {
  margin-top: 0;
}

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

.message-body ul,
.message-body ol {
  padding-left: 22px;
}

.message-body li + li {
  margin-top: 5px;
}

.message-body code {
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 2px 6px;
}

.math-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  border-radius: 6px;
  background: rgba(79, 109, 245, 0.07);
  color: #24315f;
  padding: 0 4px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 1.02em;
  line-height: 1.55;
  white-space: nowrap;
}

.math-block {
  display: block;
  overflow-x: auto;
  border: 1px solid rgba(79, 109, 245, 0.12);
  border-radius: 12px;
  background: rgba(247, 249, 255, 0.9);
  color: #18224d;
  margin: 10px 0 14px;
  padding: 12px 14px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.math-frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 1.6em;
  margin: 0 2px;
  text-align: center;
  vertical-align: middle;
}

.math-frac > span:first-child {
  border-bottom: 1px solid currentColor;
  padding: 0 3px 1px;
}

.math-frac > span:last-child {
  padding: 1px 3px 0;
}

.assistant-meta,
.answer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--text-soft);
  padding: 0 10px;
  font-size: 11px;
}

.tool-button {
  min-height: 30px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  transition: background 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}

.tool-button.active,
.tool-button:hover {
  background: rgba(79, 109, 245, 0.14);
  transform: translateY(-1px);
}

.tool-button[data-action="review"].active {
  background: rgba(124, 92, 252, 0.14);
  color: #7a561d;
}

.answer-sheet {
  display: grid;
  gap: 12px;
}

.answer-summary,
.answer-section,
.answer-image-block {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  box-shadow: var(--shadow-xs);
}

.answer-summary {
  padding: 18px 19px 6px;
}

.answer-summary-label,
.answer-section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(124, 92, 252, 0.12);
  color: var(--gold);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-summary p {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
}

.answer-summary .answer-section-body {
  padding: 0;
}

.answer-section {
  overflow: hidden;
}

.answer-section summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 18px;
  color: var(--accent-deep);
  font-size: 15px;
  font-weight: 700;
}

.answer-section summary::-webkit-details-marker {
  display: none;
}

.answer-section summary::after {
  float: right;
  color: var(--muted);
  content: "展开";
  font-size: 12px;
  font-weight: 600;
}

.answer-section[open] summary::after {
  content: "收起";
}

.answer-section-primary {
  padding: 18px 19px 6px;
}

.answer-section-head {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.answer-section-head h2,
.answer-image-head h3 {
  margin: 0;
  color: var(--accent-deep);
  font-size: 20px;
  line-height: 1.35;
}

.answer-section-body {
  padding: 0 18px 16px;
  color: var(--text);
  line-height: 1.86;
}

.answer-section-primary .answer-section-body {
  padding: 0;
}

.answer-image-block {
  padding: 18px;
}

.answer-image-head {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.answer-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-image-card {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(245, 247, 251, 0.72);
  padding: 10px;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.answer-image-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.answer-image-card img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.citation-box {
  margin-top: 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(245, 247, 251, 0.72);
  padding: 13px 14px;
}

.citation-box summary {
  cursor: pointer;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
}

.citation-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.citation-item {
  border-top: 1px solid var(--glass-border);
  padding-top: 9px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.62;
}

.chat-composer-wrap {
  display: none;
  justify-content: center;
  border-top: 1px solid var(--glass-border);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.88) 0%, rgba(250, 251, 255, 0.80) 100%);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  padding: 14px 24px 20px;
}

.chat-shell.chat-active .chat-composer-wrap {
  display: flex;
}

.settings-dialog {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  padding: 0;
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.94) 0%, rgba(250, 251, 255, 0.90) 100%);
  box-shadow: var(--shadow-xl);
  color: var(--text);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  animation: dialog-in 400ms var(--spring) both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-dialog::backdrop {
  background: rgba(30, 40, 80, 0.24);
  backdrop-filter: blur(6px);
}

.settings-dialog form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.dialog-head h2,
.dialog-head p {
  margin: 0;
}

.dialog-head h2 {
  color: var(--accent-deep);
  font-family: var(--font-serif);
  font-size: 24px;
}

.dialog-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(245, 247, 251, 0.80);
  color: var(--muted);
  font-size: 20px;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}

.dialog-close:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.settings-dialog label {
  display: grid;
  gap: 7px;
}

.settings-dialog label span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.settings-dialog input,
.settings-dialog select {
  width: 100%;
  border-radius: 14px;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 24px));
}

.auth-dialog {
  width: min(520px, calc(100vw - 24px));
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  background: rgba(245, 247, 251, 0.70);
  padding: 4px;
}

.auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 200ms var(--ease), background 200ms var(--ease), box-shadow 200ms var(--ease);
}

.auth-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(79, 109, 245, 0.05);
  font-weight: 700;
}

.register-fields {
  display: none;
  gap: 14px;
}

.auth-dialog.register-mode .register-fields {
  display: grid;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-field .ghost-button {
  min-height: 38px;
  white-space: nowrap;
}

.auth-dialog:not(.logged-in) #authLogoutButton {
  display: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.ghost-button,
.danger-button,
.save-button {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), filter 200ms var(--ease);
}

.ghost-button {
  border: 1px solid var(--glass-border);
  background: #fff;
  color: var(--text-soft);
  box-shadow: var(--shadow-xs);
}

.ghost-button:hover {
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
}

.danger-button {
  border: 0;
  background: linear-gradient(135deg, #dc2626, var(--danger));
  color: #fff;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.24);
}

.save-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(79, 109, 245, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.save-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(79, 109, 245, 0.35);
  filter: brightness(1.06);
}

.danger-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(239, 68, 68, 0.30);
  filter: brightness(1.06);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 48px));
  transform: translateY(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-strong);
  color: var(--text);
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 14px;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 10px 0;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 160ms;
}

.typing span:nth-child(3) {
  animation-delay: 320ms;
}

@media (max-width: 1080px) {
  .login-page {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .login-hero {
    min-height: auto;
  }

  .login-panel {
    max-width: 640px;
  }
}

@media (max-width: 720px) {
  .login-page {
    gap: 20px;
    padding: 16px;
  }

  .login-hero-copy h1 {
    font-size: clamp(34px, 10vw, 46px);
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subject-tile {
    min-height: 112px;
  }

  .study-pipeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-tabs {
    border-radius: 18px;
  }

  .auth-tab {
    min-height: 42px;
    border-radius: 14px;
    font-size: 13px;
  }
}

@media (max-width: 520px) {
  .login-brand {
    width: 100%;
  }

  .login-panel {
    border-radius: 24px;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .inline-field .ghost-button {
    width: 100%;
  }

  .login-metrics {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-metrics div {
    min-width: 0;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    max-width: calc(100vw - 32px);
  }
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Main app de-framed SaaS treatment. Login page styles are intentionally left alone. */
body.app-body {
  background: #ffffff;
}

body.app-body::before,
body.app-body::after {
  display: none;
}

.app-body .app-shell {
  background: #ffffff;
}

.app-body .sidebar {
  border-right: 1px solid #e7e7e8;
  background: #f7f7f8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 14px 10px 12px;
}

.app-body .brand-row {
  min-height: 54px;
  border-color: #ececf1;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: none;
}

.app-body .brand-row:hover,
.app-body .nav-button:hover,
.app-body .thread-item:hover,
.app-body .auth-user-button:hover,
.app-body .round-button:hover,
.app-body .icon-button:hover,
.app-body .mode-button:hover,
.app-body .tool-button:hover {
  transform: none;
}

.app-body .brand-mark,
.app-body .message.assistant .avatar {
  background: #5b68f6;
  box-shadow: none;
}

.app-body .sidebar-nav {
  gap: 2px;
  padding-top: 18px;
}

.app-body .nav-button {
  min-height: 40px;
  border-radius: 10px;
  color: #4b5563;
  font-weight: 500;
}

.app-body .nav-button:hover,
.app-body .nav-button.active {
  background: #ececf1;
  color: #1f2937;
}

.app-body .nav-button.active {
  box-shadow: none;
  font-weight: 650;
}

.app-body .sidebar-section {
  margin-top: 18px;
  border-top-color: #e7e7e8;
  padding-top: 18px;
}

.app-body .section-heading {
  padding-inline: 8px;
  color: #6b7280;
  letter-spacing: 0;
  text-transform: none;
}

.app-body .thread-list {
  gap: 2px;
  padding-right: 2px;
}

.app-body .thread-item {
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  background: transparent;
}

.app-body .thread-item:hover,
.app-body .thread-item.active {
  background: #ececf1;
}

.app-body .thread-item strong {
  color: #111827;
  font-size: 13px;
  font-weight: 600;
}

.app-body .thread-item span,
.app-body .thread-item p {
  color: #6b7280;
}

.app-body .thread-chip {
  background: #f1f1f3;
  color: #4b5563;
}

.app-body .thread-empty {
  border-color: #e5e7eb;
  background: #ffffff;
}

.app-body .chat-shell {
  background: #ffffff;
}

.app-body .topbar {
  border-bottom: 1px solid #ececf1;
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0 28px;
}

.app-body .topbar-title button {
  color: #111827;
}

.app-body .topbar-title span {
  color: #6b7280;
}

.app-body .topbar-actions select,
.app-body .auth-user-button {
  border-color: #e5e7eb;
  background: #ffffff;
  box-shadow: none;
}

.app-body .auth-user-button:hover,
.app-body .topbar-actions select:hover {
  background: #f7f7f8;
}

.app-body .empty-state {
  background: #ffffff;
}

.app-body .empty-state h1 {
  font-family: var(--font-sans);
  color: #111827;
  font-size: clamp(30px, 4vw, 46px);
}

.app-body .hero-kicker,
.app-body .hero-kicker span {
  display: none;
}

.app-body .hero-composer {
  border-color: #e5e7eb;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 10px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.app-body .hero-composer::before,
.app-body .send-button::after {
  display: none;
}

.app-body .hero-composer:hover {
  border-color: #d7d7dc;
}

.app-body .hero-composer:focus-within {
  border-color: #c7c7d1;
  box-shadow: 0 12px 38px rgba(15, 23, 42, 0.10), 0 0 0 3px rgba(17, 24, 39, 0.04);
}

.app-body .mode-button {
  border-color: #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #3f55d8;
  box-shadow: none;
}

.app-body .mode-button:hover {
  background: #f7f7f8;
  box-shadow: none;
}

.app-body .send-button {
  min-width: 78px;
  height: 40px;
  border-radius: 12px;
  background: #5b68f6;
  box-shadow: none;
}

.app-body .send-button:hover:not(:disabled) {
  box-shadow: none;
  filter: brightness(0.97);
}

.app-body .chat-panel {
  background: #ffffff;
  padding: 8px 24px 116px;
}

.app-body .message-list {
  width: min(100%, 900px);
  margin: 0 auto;
}

.app-body .message {
  gap: 14px;
  padding: 18px 0;
}

.app-body .message.assistant {
  grid-template-columns: 32px minmax(0, 1fr);
}

.app-body .message.user {
  display: flex;
  justify-content: flex-end;
}

.app-body .avatar {
  width: 32px;
  height: 32px;
  border: 0;
  box-shadow: none;
}

.app-body .message-body {
  font-size: 15px;
  line-height: 1.82;
}

.app-body .message.assistant .message-body {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.app-body .message.user .message-body {
  max-width: min(680px, 82%);
  border: 0;
  border-radius: 22px;
  background: #f4f4f5;
  box-shadow: none;
  padding: 10px 16px;
  color: #111827;
}

.app-body .message-body h2,
.app-body .message-body h3 {
  color: #1f2937;
  font-size: 18px;
}

.app-body .answer-sheet {
  display: block;
}

.app-body .answer-summary,
.app-body .answer-section,
.app-body .answer-image-block {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-body .answer-summary {
  padding: 0 0 18px;
}

.app-body .answer-section,
.app-body .answer-image-block,
.app-body .citation-box {
  margin-top: 18px;
  border-top: 1px solid #ececf1;
  padding-top: 16px;
}

.app-body .answer-section-primary {
  padding: 0 0 18px;
}

.app-body .answer-section-head {
  gap: 8px;
  margin-bottom: 10px;
}

.app-body .answer-summary-label,
.app-body .answer-section-kicker {
  min-height: 22px;
  border-radius: 999px;
  background: #f1f1f3;
  color: #4b5563;
  padding: 0 9px;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.app-body .answer-section-head h2,
.app-body .answer-image-head h3 {
  color: #1f2937;
  font-size: 19px;
}

.app-body .answer-section-body {
  padding: 0;
  color: #111827;
}

.app-body .answer-section summary {
  padding: 0;
  color: #1f2937;
  font-size: 15px;
}

.app-body .answer-section summary::after {
  color: #6b7280;
}

.app-body .answer-summary p {
  color: #111827;
  font-size: 15px;
}

.app-body .answer-image-block {
  padding: 16px 0 0;
}

.app-body .answer-image-card {
  border: 1px solid #ececf1;
  border-radius: 12px;
  background: #fafafa;
  padding: 8px;
}

.app-body .citation-box {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  padding: 14px 0 0;
}

.app-body .citation-item {
  border-top-color: #ececf1;
}

.app-body .assistant-meta,
.app-body .answer-tools {
  margin-top: 18px;
}

.app-body .pill,
.app-body .tool-button {
  border: 0;
  background: #f4f4f5;
  color: #4b5563;
}

.app-body .tool-button.active,
.app-body .tool-button:hover {
  background: #ececf1;
}

.app-body .chat-composer-wrap {
  position: relative;
  border-top: 0;
  background: linear-gradient(to top, #ffffff 72%, rgba(255, 255, 255, 0.92));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 12px 24px 22px;
}

.app-body .chat-composer-wrap .hero-composer.compact {
  width: min(100%, 860px);
  border-radius: 26px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.10);
}

.app-body .hero-composer.compact textarea {
  min-height: 38px;
  padding-top: 6px;
  padding-bottom: 2px;
}

.scroll-bottom-button {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 146px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), background 160ms var(--ease);
}

.scroll-bottom-button[hidden] {
  display: none;
}

.scroll-bottom-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.scroll-bottom-button:hover {
  background: #f7f7f8;
}

.scroll-bottom-button svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 760px) {
  .app-body .topbar {
    padding: 0 14px;
  }

  .app-body .chat-panel {
    padding: 8px 16px 118px;
  }

  .app-body .message-list {
    width: 100%;
  }

  .app-body .message.assistant {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .app-body .avatar {
    width: 28px;
    height: 28px;
  }

  .app-body .message.user .message-body {
    max-width: 92%;
  }

  .app-body .answer-image-grid {
    grid-template-columns: 1fr;
  }

  .app-body .chat-composer-wrap {
    padding: 10px 12px 14px;
  }

  .scroll-bottom-button {
    bottom: 128px;
  }
}
