:root {
  --bg: #212121;
  --bg-soft: #171717;
  --panel: #2a2a2a;
  --panel-soft: #303030;
  --panel-strong: #1c1c1c;
  --text: #ececec;
  --text-muted: #a1a1aa;
  --text-soft: #c9c9cf;
  --accent: #f3f4f6;
  --accent-text: #111827;
  --accent-soft: #343434;
  --border: #3a3a3a;
  --border-strong: #4a4a4a;
  --success: #19c37d;
  --bubble-user: #343541;
  --bubble-assistant: transparent;
  --code-bg: #2f2f2f;
  --sidebar-bg: #171717;
  --sidebar-surface: #212121;
  --sidebar-surface-hover: #2b2b2b;
  --sidebar-surface-strong: #303030;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-soft: #ececef;
  --panel: #ffffff;
  --panel-soft: #f6f7f8;
  --panel-strong: #e7e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #4b5563;
  --accent: #111827;
  --accent-text: #ffffff;
  --accent-soft: #eceff3;
  --border: #d7d7dc;
  --border-strong: #c7c9d1;
  --success: #10b981;
  --bubble-user: #f1f3f6;
  --bubble-assistant: transparent;
  --code-bg: #f1f3f5;
  --sidebar-bg: #f4f4f5;
  --sidebar-surface: #ffffff;
  --sidebar-surface-hover: #eceef2;
  --sidebar-surface-strong: #e5e7eb;
  --sidebar-border: rgba(17, 24, 39, 0.08);
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

body.page-ready {
  opacity: 1;
  transform: translateY(0);
}

body.page-leaving {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

body.modal-open {
  overflow: hidden;
}

.chat-page-body {
  background: var(--bg);
}

a,
button,
input,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

code {
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: Consolas, "Courier New", monospace;
}

pre {
  margin: 0 0 1rem;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--code-bg);
  overflow: auto;
}

.page-frame {
  width: min(1180px, calc(100% - 28px));
  margin: 14px auto;
}

.topbar,
.hero-card,
.feature-card,
.account-panel,
.account-summary-panel,
.legal-card,
.home-preview-card,
.boot-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-link-sidebar {
  width: 100%;
}

.brand-mark,
.avatar,
.boot-mark {
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
}

.brand-text small,
.brand-text-light small {
  color: var(--text-muted);
}

.header-tools,
.nav,
.footer-links,
.hero-badges,
.hero-actions,
.account-actions,
.boot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.header-tools {
  justify-content: flex-end;
}

.nav a,
.theme-toggle,
.button,
.file-button,
.auth-tab,
.chat-primary-action,
.send-button,
.prompt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav a {
  min-height: 38px;
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.nav a:hover,
.nav .is-active,
.theme-toggle:hover,
.button-secondary:hover,
.file-button:hover,
.auth-tab:hover,
.chat-primary-action:hover,
.prompt-chip:hover {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--text);
}

.button-primary,
.send-button,
.auth-tab.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.button-primary:hover,
.send-button:hover,
.auth-tab.is-active:hover {
  opacity: 0.92;
}

.button-secondary,
.file-button,
.auth-tab,
.theme-toggle,
.chat-primary-action,
.prompt-chip {
  background: var(--panel-soft);
}

.full-width {
  width: 100%;
}

.landing-main {
  padding: 24px 0 18px;
}

.landing-neutral {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

.hero-copy,
.home-preview-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-preview-card {
  padding: 20px;
  border-radius: var(--radius-xl);
}

.home-preview-title {
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.home-preview-list,
.feature-grid,
.summary-grid {
  display: grid;
  gap: 14px;
}

.home-preview-list {
  grid-template-columns: 1fr;
}

.home-preview-item,
.summary-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.home-preview-item strong {
  display: block;
  margin-bottom: 6px;
}

.home-preview-item span,
.lead,
.lead-compact,
.feature-card p:last-child,
.legal-card p,
.sidebar-muted,
.sidebar-caption,
.composer-note,
.summary-note,
.auth-feedback,
.composer-hint,
.chat-footer-note {
  color: var(--text-muted);
  line-height: 1.72;
}

.badge,
.section-label,
.summary-label,
.chat-model-pill,
.empty-pill {
  display: inline-flex;
  align-items: center;
}

.badge,
.chat-model-pill,
.empty-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.82rem;
}

.badge-muted {
  color: var(--text-muted);
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

h1,
h2,
h3,
p,
ul,
ol {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 5vw, 3.7rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.28rem;
}

.lead-compact {
  max-width: 42rem;
}

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

.feature-card,
.legal-card,
.account-panel,
.account-summary-panel {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 6px 40px;
  color: var(--text-muted);
}

.account-layout {
  display: grid;
  grid-template-columns: 1fr 0.88fr;
  gap: 16px;
  padding: 24px 0 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
}

.auth-form input:focus,
.composer textarea:focus {
  border-color: var(--border-strong);
}

.auth-feedback {
  min-height: 24px;
  margin-bottom: 8px;
}

.social-auth-section {
  margin-top: 20px;
}

.social-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.social-auth-divider::before,
.social-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-signin-slot {
  display: flex;
  justify-content: center;
}

.social-auth-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: center;
}

.cookie-consent-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: min(420px, calc(100vw - 24px));
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.cookie-consent-copy {
  display: grid;
  gap: 6px;
}

.cookie-consent-copy p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

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

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 14px;
}

.summary-label {
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.summary-value {
  display: block;
}

.chat-layout-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.chat-sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 12px 10px 10px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: auto;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-link-chat {
  gap: 10px;
  min-height: 40px;
  padding: 4px 8px;
}

.brand-mark-chat {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #0f0f0f;
  border: 1px solid var(--sidebar-border);
  color: #ffffff;
  font-size: 0.92rem;
}

html[data-theme="light"] .brand-mark-chat {
  background: #ffffff;
  color: #111827;
}

.brand-text-chat {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.sidebar-top-actions {
  display: grid;
  gap: 8px;
}

.chat-primary-action {
  justify-content: flex-start;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.92rem;
  background: var(--sidebar-surface);
  border-color: transparent;
  font-weight: 600;
}

.chat-primary-action::before {
  content: "+";
  margin-right: 10px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

.chat-primary-action:hover {
  background: var(--sidebar-surface-hover);
  border-color: transparent;
}

.premium-action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.9rem;
}

.premium-action:hover {
  background: var(--sidebar-surface);
  color: var(--text);
}

.premium-action.is-disabled {
  opacity: 0.72;
  pointer-events: none;
}

.chat-page-body.sidebar-collapsed .chat-layout-shell {
  grid-template-columns: 0 1fr;
}

.chat-page-body.sidebar-collapsed .chat-sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-history {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-border);
}

.chat-nav-section,
.sidebar-block {
  margin-bottom: 18px;
}

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

.sidebar-heading {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chat-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-nav a {
  display: inline-flex;
  justify-content: flex-start;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-soft);
}

.chat-nav a::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border: 1.4px solid currentColor;
  border-radius: 4px;
  opacity: 0.65;
  flex-shrink: 0;
}

.chat-nav a:hover,
.chat-nav .is-active {
  background: var(--sidebar-surface);
  border-color: transparent;
  color: var(--text);
}

.chat-feature-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-feature-list li {
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding: 0 2px 6px;
}

.conversation-item {
  width: 100%;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  overflow: hidden;
}

.conversation-item:hover,
.conversation-item.is-active {
  background: var(--sidebar-surface-hover);
  border-color: transparent;
}

.conversation-item.is-active {
  background: var(--sidebar-surface-strong);
}

.conversation-item.is-removing {
  pointer-events: none;
  animation: conversationRemove 0.2s ease forwards;
}

.conversation-main {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.conversation-title,
.conversation-preview,
.conversation-time {
  display: block;
}

.conversation-title {
  margin-bottom: 0;
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-preview {
  display: none;
}

.conversation-time {
  display: none;
}

.conversation-actions {
  display: flex;
  gap: 6px;
  max-height: 0;
  padding: 0 10px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, max-height 0.18s ease, transform 0.18s ease;
}

.conversation-item:hover .conversation-actions,
.conversation-item.is-active .conversation-actions {
  max-height: 38px;
  padding: 0 10px 8px;
  opacity: 1;
  transform: translateY(0);
}

.conversation-action,
.history-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.conversation-action:hover,
.history-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.conversation-action-danger:hover {
  color: #fca5a5;
}

.history-toggle {
  min-height: 24px;
  padding: 0 5px;
  border-color: transparent;
  background: transparent;
}

.conversation-empty {
  margin: 0;
  padding: 10px 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chat-page-body.history-collapsed .conversation-list {
  display: none;
}

.usage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.usage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
}

.usage-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sidebar-account-card {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-account-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
  border-radius: 12px;
  background: var(--sidebar-surface);
}

.sidebar-account-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--sidebar-surface-hover);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-account-copy strong,
.sidebar-account-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border-radius: 999px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.sidebar-account-link:hover {
  background: var(--sidebar-surface);
}

.chat-main-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
}

.chat-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px 0;
}

.chat-title-group h1 {
  margin: 10px 0 0;
  font-size: 1.7rem;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-actions .theme-toggle {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-muted);
}

.chat-header-actions .theme-toggle:hover {
  background: var(--panel-soft);
}

.menu-toggle {
  position: relative;
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 0;
}

.menu-toggle::before {
  content: "";
  width: 16px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  background: linear-gradient(to right, currentColor 0 4px, transparent 4px 100%);
  color: var(--text-muted);
  opacity: 0.95;
}

.chat-page-body.sidebar-collapsed .menu-toggle::before {
  background: linear-gradient(to right, transparent 0 calc(100% - 4px), currentColor calc(100% - 4px) 100%);
}

html[data-theme="light"] .conversation-action,
html[data-theme="light"] .history-toggle {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .history-toggle {
  background: transparent;
}

html[data-theme="light"] .conversation-action:hover,
html[data-theme="light"] .history-toggle:hover {
  background: rgba(17, 24, 39, 0.08);
}

.chat-stage {
  width: min(980px, calc(100% - 32px));
  flex: 1;
  min-height: 0;
  margin: 0 auto;
  padding: 18px 0 18px;
  display: flex;
  flex-direction: column;
}

.chat-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 112px);
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-scroll-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inline-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 30px 20px 56px;
}

.chat-empty h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  min-height: 1.3em;
}

#hero-rotating-text::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-left: 6px;
  background: currentColor;
  vertical-align: -0.08em;
  animation: heroCursorBlink 0.9s steps(1, end) infinite;
}

.chat-empty p {
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--text-muted);
}

.prompt-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.prompt-chip {
  min-height: 42px;
  padding: 0 16px;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 4px 18px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(100%, 860px);
  margin: 0 auto 24px;
}

.message-enter {
  animation: messageSlideIn 0.26s ease;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.92rem;
}

.assistant .avatar {
  background: var(--panel-strong);
}

.user .avatar {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.message-body {
  min-width: 0;
  flex: 1;
}

.bubble {
  max-width: min(82%, 760px);
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.assistant .bubble {
  max-width: 100%;
  padding: 2px 0 0;
  background: var(--bubble-assistant);
}

.user .bubble {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bubble-user);
  border: 1px solid var(--border);
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.typing-bubble {
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
}

.typing-label {
  margin: 0;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  color: var(--text-muted);
  opacity: 0.28;
  animation: typingPulse 1.15s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.reaction-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text-muted);
  cursor: pointer;
}

.chat-sidebar,
.conversation-list,
.chat-log {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.chat-sidebar::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar,
.chat-log::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.chat-sidebar::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track,
.chat-log::-webkit-scrollbar-track {
  background: transparent;
}

.chat-sidebar::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb,
.chat-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.chat-sidebar::-webkit-scrollbar-thumb:hover,
.conversation-list::-webkit-scrollbar-thumb:hover,
.chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
  background-clip: padding-box;
}

html[data-theme="light"] .chat-sidebar,
html[data-theme="light"] .conversation-list,
html[data-theme="light"] .chat-log {
  scrollbar-color: rgba(17, 24, 39, 0.2) transparent;
}

html[data-theme="light"] .chat-sidebar::-webkit-scrollbar-thumb,
html[data-theme="light"] .conversation-list::-webkit-scrollbar-thumb,
html[data-theme="light"] .chat-log::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.16);
  background-clip: padding-box;
}

html[data-theme="light"] .chat-sidebar::-webkit-scrollbar-thumb:hover,
html[data-theme="light"] .conversation-list::-webkit-scrollbar-thumb:hover,
html[data-theme="light"] .chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 24, 39, 0.28);
  background-clip: padding-box;
}

.reaction-button:hover,
.reaction-button.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.markdown-content p:last-child,
.markdown-content ul:last-child,
.markdown-content ol:last-child,
.markdown-content pre:last-child {
  margin-bottom: 0;
}

.markdown-content p {
  margin-bottom: 0.9rem;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.markdown-content li {
  margin-bottom: 0.45rem;
}

.markdown-content a {
  color: #7cc7ff;
  text-decoration: underline;
}

html[data-theme="light"] .markdown-content a {
  color: #1d4ed8;
}

.code-block {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #171717;
}

html[data-theme="light"] .code-block {
  background: #f5f7fb;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="light"] .code-block-header {
  background: rgba(15, 23, 42, 0.04);
}

.code-block-language {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.code-copy-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.code-copy-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.code-block pre {
  margin: 0;
  padding: 16px;
  border-radius: 0;
  background: transparent;
}

.code-block code {
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 0;
  white-space: pre-wrap;
}

.token-keyword {
  color: #8ab4f8;
}

.token-function {
  color: #7ee787;
  font-weight: 700;
}

.token-string {
  color: #f2cc60;
}

.token-number {
  color: #ff9e64;
}

.token-comment {
  color: #7d8590;
}

.attachment-list,
.composer,
.chat-footer-note {
  width: min(100%, 860px);
  margin-left: auto;
  margin-right: auto;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  cursor: pointer;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer-toolbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer textarea {
  min-height: 62px;
  max-height: 220px;
  resize: none;
  padding: 10px 4px 10px 4px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.send-button {
  min-width: 104px;
  min-height: 52px;
  align-self: end;
  border-radius: 14px;
}

.composer-note {
  margin-top: 12px;
  padding: 0 2px;
  font-size: 0.92rem;
}

.premium-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.premium-modal-card {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: modalRise 0.22s ease;
}

.premium-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text-muted);
  cursor: pointer;
}

.premium-modal-close:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.premium-modal-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.premium-modal-card h2 {
  margin-bottom: 10px;
  font-size: 1.45rem;
}

.premium-modal-card p {
  margin-bottom: 18px;
  color: var(--text-muted);
  line-height: 1.7;
}

.premium-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.boot-card {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 20px;
}

.boot-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
}

.boot-hint {
  margin-top: 16px;
  color: var(--text-muted);
}

.legal-layout {
  padding: 24px 0 14px;
}

.legal-card {
  max-width: 860px;
}

.hidden {
  display: none !important;
}

@keyframes heroCursorBlink {
  0%,
  45% {
    opacity: 1;
  }

  46%,
  100% {
    opacity: 0;
  }
}

@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.22;
    transform: translateY(0);
  }

  40% {
    opacity: 0.9;
    transform: translateY(-3px);
  }
}

@keyframes conversationRemove {
  0% {
    opacity: 1;
    transform: scale(1);
    max-height: 120px;
  }

  100% {
    opacity: 0;
    transform: scale(0.96);
    max-height: 0;
    margin: 0;
  }
}

@keyframes modalRise {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.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;
}

@media (max-width: 1080px) {
  .hero-card,
  .feature-grid,
  .account-layout,
  .chat-layout-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .chat-page-body.sidebar-collapsed .chat-layout-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-frame {
    width: calc(100% - 16px);
    margin: 8px auto;
  }

  .topbar,
  .chat-header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-card,
  .feature-card,
  .account-panel,
  .account-summary-panel,
  .legal-card,
  .home-preview-card {
    padding: 18px;
  }

  .chat-stage {
    width: calc(100% - 16px);
    padding-top: 16px;
  }

  .chat-empty {
    padding-top: 22px;
  }

  .chat-empty h2 {
    font-size: 2rem;
  }

  .chat-frame {
    height: calc(100vh - 132px);
    padding: 12px;
  }

  .prompt-grid {
    display: grid;
    width: 100%;
  }

  .prompt-chip {
    width: 100%;
  }

  .bubble,
  .composer,
  .attachment-list,
  .chat-footer-note,
  .inline-banner {
    width: 100%;
    max-width: 100%;
  }

  .message {
    width: 100%;
  }

  .bubble {
    max-width: calc(100% - 46px);
  }

  .composer {
    grid-template-columns: 1fr;
    border-radius: 16px;
  }

  .send-button {
    width: 100%;
  }

  .message-actions {
    flex-wrap: wrap;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}
