/* ==========================================================
   XERA AI — Design System
   ========================================================== */

:root {
  /* Type */
  --font-sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Accent (violet, from logo) */
  --accent-h: 282;
  --accent: oklch(0.72 0.18 var(--accent-h));
  --accent-hi: oklch(0.82 0.15 var(--accent-h));
  --accent-lo: oklch(0.55 0.20 var(--accent-h));
  --accent-glow: oklch(0.72 0.18 var(--accent-h) / 0.35);
  --accent-glow-soft: oklch(0.72 0.18 var(--accent-h) / 0.12);

  /* Radii / shadow scale */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}

/* ---------- Dark (default) ---------- */
[data-theme="dark"], :root {
  --bg: #07070b;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, oklch(0.25 0.08 var(--accent-h) / 0.22), transparent 60%),
             radial-gradient(900px 500px at 90% 110%, oklch(0.30 0.10 var(--accent-h) / 0.15), transparent 60%),
             #07070b;
  --surface: #0e0e15;
  --surface-2: #14141d;
  --surface-3: #1a1a26;
  --border: #22222e;
  --border-strong: #2e2e3c;
  --text: #f3f3f7;
  --text-2: #b6b6c4;
  --text-3: #7c7c8a;
  --text-disabled: #4a4a55;
  --discord: #5865f2;
  --discord-hover: #4752c4;
  --shadow-card: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 30px 60px -20px oklch(0 0 0 / 0.6), 0 0 0 1px var(--border);
  --grid-line: oklch(1 0 0 / 0.02);
  --code-bg: #050509;
}

/* ---------- Light ---------- */
[data-theme="light"] {
  --bg: #fafafb;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, oklch(0.85 0.10 var(--accent-h) / 0.35), transparent 60%),
             radial-gradient(900px 500px at 90% 110%, oklch(0.88 0.06 var(--accent-h) / 0.30), transparent 60%),
             #fafafb;
  --surface: #ffffff;
  --surface-2: #f4f4f7;
  --surface-3: #ebebf0;
  --border: #e6e6ec;
  --border-strong: #d4d4dd;
  --text: #0a0a12;
  --text-2: #4b4b58;
  --text-3: #76768a;
  --text-disabled: #b4b4be;
  --accent: oklch(0.52 0.22 var(--accent-h));
  --accent-hi: oklch(0.60 0.22 var(--accent-h));
  --accent-lo: oklch(0.40 0.22 var(--accent-h));
  --accent-glow: oklch(0.52 0.22 var(--accent-h) / 0.18);
  --accent-glow-soft: oklch(0.52 0.22 var(--accent-h) / 0.06);
  --shadow-card: 0 1px 0 oklch(1 0 0 / 1) inset, 0 30px 60px -30px oklch(0.1 0.05 var(--accent-h) / 0.18), 0 0 0 1px var(--border);
  --grid-line: oklch(0 0 0 / 0.03);
  --code-bg: #0e0e15;
}

* { box-sizing: border-box; }
.hljs { background: transparent !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* Subtle grid backdrop */
.bg-grid {
  position: fixed; inset: 0;
  background: var(--bg-grad);
  z-index: -2;
}
.bg-grid::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 80%);
}

/* Animated gradient orbs for landing page */
.landing-bg {
  position: fixed; inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.landing-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbFloat 12s ease-in-out infinite;
}
.landing-orb-1 {
  width: 500px; height: 500px;
  background: oklch(0.55 0.20 var(--accent-h));
  top: -10%; left: 20%;
  animation-duration: 14s;
}
.landing-orb-2 {
  width: 400px; height: 400px;
  background: oklch(0.45 0.15 calc(var(--accent-h) + 40));
  top: 30%; right: -5%;
  animation-duration: 18s;
  animation-delay: -4s;
}
.landing-orb-3 {
  width: 350px; height: 350px;
  background: oklch(0.50 0.18 calc(var(--accent-h) - 30));
  bottom: 5%; left: 10%;
  animation-duration: 16s;
  animation-delay: -8s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.02); }
}
[data-theme="light"] .landing-orb { opacity: 0.25; filter: blur(100px); }

/* ==========================================================
   Top bar (theme toggle + nav)
   ========================================================== */
.topbar {
  position: fixed;
  top: 18px; right: 18px;
  display: flex; gap: 8px; align-items: center;
  z-index: 50;
}
.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--surface) 70%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle-segment {
  display: flex;
  padding: 4px;
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}
.theme-toggle-segment button {
  background: transparent;
  border: 0;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s ease;
}
.theme-toggle-segment button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border);
}

/* ==========================================================
   Login page
   ========================================================== */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, var(--accent-glow), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

/* Wordmark — CSS-cropped to just the "XERA AI" wordmark portion of the PNG.
   Image: 1254×1254. Wordmark sits at roughly x=[140,1115], y=[410,735]. */
.wordmark {
  display: block;
  width: clamp(240px, 80%, 320px);
  aspect-ratio: 975 / 325;
  margin: 0 auto;
  background-image: url('assets/xera-logo.png');
  background-size: 128.6% auto;
  background-position: 50.2% 44%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 6px 20px var(--accent-glow));
}
[data-theme="light"] .wordmark {
  background-color: #07070b;
  border-radius: 14px;
  padding: 22px 24px;
  background-clip: content-box;
  width: clamp(220px, 70%, 280px);
}

.brand-tag {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 4px 0 0;
  font-family: var(--font-mono);
}

/* X-mark — just the angular "X" portion of the same PNG, cropped via background-position.
   X glyph occupies roughly x=[120,450], y=[405,735] — a 330×330 region. */
.x-mark {
  display: inline-block;
  background-color: #000;
  background-image: url('assets/xera-logo.png');
  background-size: 380% 380%;
  background-position: 13% 44%;
  background-repeat: no-repeat;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 14px var(--accent-glow);
}

.login-pitch {
  text-align: center;
  font-size: 15px;
  color: var(--text-2);
  margin: 0 0 22px;
  line-height: 1.55;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.feature svg {
  flex-shrink: 0;
  color: var(--accent);
}
.feature span { line-height: 1.2; }

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  background: var(--discord);
  color: #fff;
  text-decoration: none;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  box-shadow: 0 10px 30px -10px color-mix(in oklch, var(--discord) 60%, transparent);
}
.discord-btn:hover { background: var(--discord-hover); }
.discord-btn:active { transform: translateY(1px); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.terminal-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.terminal-block code {
  flex: 1;
  color: #d6d6e0;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.terminal-block code::-webkit-scrollbar { display: none; }
.terminal-block .prompt-glyph { color: var(--accent); user-select: none; }
.copy-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s ease;
  letter-spacing: 0.04em;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

.login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.login-footer .dot { color: var(--accent); }

/* ==========================================================
   Chat page
   ========================================================== */
.chat-page {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

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

/* Sidebar */
.sidebar {
  background: color-mix(in oklch, var(--surface) 85%, transparent);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-header {
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .x-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
}
.sidebar-brand h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.sidebar-brand h2 .accent {
  color: var(--accent);
  font-weight: 500;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.new-chat-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
  color: var(--text);
}
.new-chat-btn svg { color: var(--accent); }

/* Sidebar search */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
}
.sidebar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}
.sidebar-search input::placeholder { color: var(--text-3); }
.sidebar-search-clear {
  background: none; border: none; padding: 0;
  color: var(--text-3); cursor: pointer;
  display: grid; place-items: center;
}
.sidebar-search-clear:hover { color: var(--text); }

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sessions-list::-webkit-scrollbar { width: 6px; }
.sessions-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Date group labels */
.session-group { margin-bottom: 4px; }
.session-group-label {
  padding: 6px 10px 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all .12s ease;
  position: relative;
}
.session-item:hover { background: var(--surface-2); color: var(--text); }
.session-item.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.session-item.active::before {
  content: "";
  position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
}
.session-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Session action buttons (rename/delete) */
.session-actions {
  display: none;
  gap: 2px;
  align-items: center;
  flex-shrink: 0;
}
.session-item:hover .session-actions { display: flex; }
.session-action-btn {
  background: none; border: none; padding: 4px;
  color: var(--text-3); cursor: pointer;
  border-radius: 4px;
  display: grid; place-items: center;
  transition: all .12s;
}
.session-action-btn:hover { color: var(--text); background: var(--surface-3); }
.session-action-delete:hover { color: #f87171; }

/* Inline rename input */
.session-rename-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
}

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

/* Controls strip — theme + settings, above the user card */
.sidebar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.sidebar-controls .ctrl-btn {
  flex: 1;
  height: 30px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
.sidebar-controls .ctrl-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}
.sidebar-controls .ctrl-btn.on {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--border-strong), 0 1px 0 oklch(1 0 0 / 0.04) inset;
}
.sidebar-controls .ctrl-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-lo));
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-meta {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-status {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.user-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.logout-btn {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  text-align: center;
  padding: 6px;
  border-radius: 6px;
  transition: color .15s ease;
}
.logout-btn:hover { color: var(--text); }

/* Main chat area */
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.chat-header {
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in oklch, var(--surface) 60%, transparent);
  backdrop-filter: blur(12px);
}
.chat-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-title .model-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--accent-glow-soft);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}
.prompt-counter {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.prompt-counter .num { color: var(--text); }
.prompt-counter .bar {
  width: 80px; height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.prompt-counter .bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-lo), var(--accent));
  transition: width .4s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.welcome-msg {
  margin: auto;
  text-align: center;
  max-width: 520px;
  padding: 40px 20px;
}
.welcome-msg .x-mark {
  width: 60px; height: 60px;
  border-radius: 14px;
  margin: 0 auto 20px;
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 32px var(--accent-glow);
}
.welcome-msg h2 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.welcome-msg p {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}
.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
.suggestion {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}
.suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
  color: var(--text);
  transform: translateY(-1px);
}
.suggestion .s-label {
  display: block;
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.msg-row {
  display: flex;
  gap: 14px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  animation: msgIn .25s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.msg-row.user .msg-avatar {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}
.msg-row.assistant .msg-avatar {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.msg-row.assistant .msg-avatar .x-mark { width: 30px; height: 30px; border-radius: 8px; }
.msg-body { flex: 1; min-width: 0; }
.msg-role {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
.msg-row.assistant .msg-role { color: var(--accent); }
.msg-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text);
}
.msg-content p { margin: 0 0 10px; }
.msg-content p:last-child { margin: 0; }
.msg-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
}
/* Code blocks with header */
.code-block {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  text-transform: lowercase;
}
.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all .12s;
}
.code-copy-btn:hover { color: var(--text); background: var(--surface-3); }
.code-block pre {
  background: var(--code-bg);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: #d6d6e0;
  border: 0;
  border-radius: 0;
}
.code-block pre code {
  background: transparent;
  border: 0;
  padding: 0;
}
.msg-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: #d6d6e0;
}
.msg-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Message actions */
.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .15s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: all .12s;
}
.msg-action-btn:hover { color: var(--text); background: var(--surface-3); }

/* Error messages + retry */
.msg-row.error .msg-content { color: #f87171; }
.msg-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
}
.msg-retry-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }

/* Thinking indicator */
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: thinkPulse 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}
.thinking-text {
  font-size: 13px;
  color: var(--text-3);
  margin-left: 6px;
  font-style: italic;
}

/* Scroll-to-bottom */
.scroll-bottom-btn {
  position: sticky;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px oklch(0 0 0 / 0.3);
  transition: all .15s;
  z-index: 10;
}
.scroll-bottom-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.cursor-blink {
  display: inline-block;
  width: 7px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s infinite steps(2);
  box-shadow: 0 0 8px var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }

/* Input area */
.input-area {
  padding: 12px 24px 22px;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.input-wrapper {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 6px 6px 6px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow-soft), 0 20px 40px -20px var(--accent-glow);
}
.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  padding: 10px 0;
  max-height: 200px;
}
.input-wrapper textarea::placeholder { color: var(--text-3); }
.send-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-3);
  border: 0;
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}
.send-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--accent-lo), 0 0 18px var(--accent-glow);
}
.send-btn.active:hover { background: var(--accent-hi); }
.send-btn:disabled { cursor: not-allowed; }

.disclaimer {
  max-width: 820px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.disclaimer .dot { color: var(--accent); }

/* Limit overlay */
.limit-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 30;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.limit-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 30px 30px 26px;
  text-align: center;
  box-shadow: var(--shadow-card);
  position: relative;
}
.limit-card .limit-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--accent-glow-soft);
  border: 1px solid var(--accent-glow);
  display: grid; place-items: center;
  color: var(--accent);
  margin: 0 auto 16px;
}
.limit-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 500;
}
.limit-card p {
  margin: 0 0 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}
.limit-card p strong { color: var(--accent); font-weight: 500; }
.limit-card .discord-btn { margin-top: 18px; }
.limit-card .close-x {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
}
.limit-card .close-x:hover { color: var(--text); background: var(--surface-2); }

/* ==========================================================
   Mobile drawer + hamburger
   ========================================================== */
.mobile-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-hamburger:hover { color: var(--text); border-color: var(--border-strong); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: color-mix(in oklch, #000 50%, transparent);
  z-index: 60;
  animation: fadeIn .2s ease;
}

/* Small screens */
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .mobile-hamburger { display: grid; }

  .sidebar {
    display: flex;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    background: var(--surface);
    backdrop-filter: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,0.5);
  }
  .sidebar-overlay.open { display: block; }

  .feature-grid { grid-template-columns: 1fr; }
  .suggestions { grid-template-columns: 1fr; }

  /* Chat header */
  .chat-header { padding: 0 12px; gap: 8px; }
  .chat-title { font-size: 13px; }
  .prompt-counter { font-size: 10px; }
  .prompt-counter .bar { width: 50px; }

  /* Messages */
  .messages { padding: 16px 12px 8px; gap: 14px; }
  .msg-row { gap: 10px; }
  .msg-avatar { width: 26px; height: 26px; font-size: 10px; }
  .msg-row.assistant .msg-avatar .x-mark { width: 26px; height: 26px; border-radius: 6px; }
  .msg-content { font-size: 14px; }
  .msg-actions { opacity: 1; }

  /* Input area — sticky bottom */
  .input-area { padding: 8px 12px 16px; }
  .input-wrapper { padding: 4px 4px 4px 12px; }
  .input-wrapper textarea { font-size: 16px; padding: 8px 0; }
  .send-btn { width: 40px; height: 40px; }

  /* Welcome */
  .welcome-msg { padding: 24px 12px; }
  .welcome-msg h2 { font-size: 22px; }
  .welcome-msg p { font-size: 14px; }
  .suggestion { padding: 10px 12px; font-size: 12px; }

  /* Touch targets */
  .new-chat-btn { min-height: 44px; }
  .session-item { min-height: 44px; padding: 10px 10px; }
  .session-actions { display: flex; }
  .session-action-btn { padding: 6px; }
  .ctrl-btn { min-height: 36px; }
  .discord-btn { min-height: 48px; }
  .guest-btn { min-height: 48px; }

  /* Login page mobile */
  .login-card { padding: 28px 20px 24px; max-width: 100%; }
  .login-pitch { font-size: 14px; }
  .login-page { padding: 20px 16px; }

  /* Limit overlay */
  .limit-card { padding: 24px 20px; max-width: calc(100% - 32px); }
  .limit-card h3 { font-size: 18px; }
}

/* ==========================================================
   Settings Modal
   ========================================================== */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklch, #000 60%, transparent);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 40px 20px;
  animation: fadeIn .2s ease;
}
.settings-modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 80px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card), 0 40px 100px -20px oklch(0 0 0 / 0.7);
  display: grid;
  grid-template-columns: 200px 1fr;
  overflow: hidden;
}
.settings-side {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-side .title {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 12px 10px;
  font-family: var(--font-mono);
}
.settings-side button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s ease;
}
.settings-side button:hover { background: var(--surface-3); color: var(--text); }
.settings-side button.active {
  background: var(--accent-glow-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
.settings-side button.active svg { color: var(--accent); }
.settings-side button svg { color: var(--text-3); flex-shrink: 0; }

.settings-side-bottom {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-3);
  padding: 10px 12px 4px;
  font-family: var(--font-mono);
  line-height: 1.6;
}
.settings-side-bottom .creator {
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.settings-side-bottom .creator .name {
  color: var(--accent);
}
.settings-side-bottom .ver {
  letter-spacing: 0.1em;
  opacity: 0.7;
  margin-top: 4px;
}

.settings-main {
  padding: 22px 26px 26px;
  overflow-y: auto;
}
.settings-main::-webkit-scrollbar { width: 8px; }
.settings-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.settings-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}
.settings-header .close-x {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
}
.settings-header .close-x:hover { color: var(--text); border-color: var(--border-strong); }

.settings-section {
  margin-bottom: 26px;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .label .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.setting-row .label .hint {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.4;
  max-width: 380px;
}

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 0;
}
.seg button {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .12s ease;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border-strong), 0 1px 0 oklch(1 0 0 / 0.05) inset;
}

/* Select (custom-look native) */
.sel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 14px, calc(100% - 12px) 14px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color .15s ease;
  min-width: 200px;
}
.sel:hover, .sel:focus { border-color: var(--accent); outline: none; }

/* Plan cards */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.plan-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-card:hover { border-color: var(--border-strong); }
.plan-card.on {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 30px -16px var(--accent-glow);
}
.plan-card .plan-head {
  display: flex; align-items: center; justify-content: space-between;
}
.plan-card .plan-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.plan-card .plan-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
}
.plan-card.on .plan-badge {
  background: var(--accent);
  color: #fff;
}
.plan-card .plan-price {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
}
.plan-card .plan-price .per {
  font-size: 12px;
  color: var(--text-3);
  margin-left: 2px;
  font-weight: 400;
}
.plan-card .plan-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
}
.plan-card .plan-list li::before {
  content: "✓ ";
  color: var(--accent);
  font-weight: 600;
}

/* Agent toggle rows */
.agent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .12s ease;
}
.agent-row:hover { border-color: var(--border-strong); }
.agent-row.on {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
}
.agent-row .agent-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 8px;
  flex-shrink: 0;
}
.agent-row.on .agent-icon { background: var(--accent); color: #fff; }
.agent-row .agent-meta { flex: 1; min-width: 0; }
.agent-row .agent-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.agent-row .agent-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Toggle switch */
.switch {
  width: 38px; height: 22px;
  border-radius: 11px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all .2s ease;
}
.switch i {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-3);
  transition: all .2s ease;
}
.switch.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.switch.on i {
  left: 18px;
  background: #fff;
}

/* "Pro" pill in sidebar/topbar */
.plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.plan-pill.free {
  background: var(--surface-3);
  color: var(--text-3);
}
.plan-pill.pro {
  background: linear-gradient(135deg, var(--accent), var(--accent-lo));
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}

@media (max-width: 720px) {
  .settings-modal { grid-template-columns: 1fr; max-height: calc(100vh - 40px); }
  .settings-side { flex-direction: row; flex-wrap: wrap; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .settings-side .title, .settings-side-bottom { display: none; }
  .plan-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   Guest button (login page)
   ========================================================== */
.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.guest-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
}
.guest-btn svg { color: var(--accent); }

/* ==========================================================
   Landing page
   ========================================================== */
.landing-page {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Nav */
.landing-nav {
  width: 100%;
  max-width: 1100px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.landing-nav-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.landing-nav-name .accent { color: var(--accent); font-weight: 500; }
.landing-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.landing-nav-login {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.landing-nav-login:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hero */
.landing-hero {
  text-align: center;
  padding: 80px 24px 40px;
  max-width: 700px;
  z-index: 5;
}
.landing-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent-glow-soft);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}
.landing-hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  line-height: 1.1;
  background: linear-gradient(180deg, var(--text) 40%, var(--text-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.landing-hero-sub {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 36px;
}
.landing-hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.landing-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 10px 30px -10px var(--accent-glow);
}
.landing-btn-primary:hover { background: var(--accent-hi); transform: translateY(-1px); }
.landing-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.landing-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Stats */
.landing-stats {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 32px 24px;
  z-index: 5;
}
.landing-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.landing-stat-num {
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  text-shadow: 0 0 20px var(--accent-glow);
}
.landing-stat-label {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.landing-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* Features */
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 900px;
  width: 100%;
  padding: 20px 24px;
  z-index: 5;
}
.landing-feature-card {
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  transition: all .2s ease;
}
.landing-feature-card:hover {
  border-color: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -20px var(--accent-glow);
}
.landing-feature-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-glow-soft);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  margin-bottom: 16px;
}
.landing-feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 500;
}
.landing-feature-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Demo Preview */
.landing-demo {
  max-width: 600px;
  width: 100%;
  padding: 20px 24px 40px;
  z-index: 5;
}
.landing-demo h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px;
}
.demo-window {
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 20px 50px -15px oklch(0 0 0 / 0.5);
}
[data-theme="light"] .demo-window {
  box-shadow: 0 20px 50px -15px oklch(0 0 0 / 0.12);
}
.demo-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.demo-dots { display: flex; gap: 6px; }
.demo-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.demo-dot-r { background: #ff5f56; }
.demo-dot-y { background: #ffbd2e; }
.demo-dot-g { background: #27c93f; }
.demo-titlebar-text {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.demo-chat {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 160px;
}
.demo-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.demo-msg-user { justify-content: flex-end; }
.demo-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.55;
}
.demo-bubble-user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.demo-bubble-ai {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.demo-msg-avatar {
  flex-shrink: 0;
  margin-top: 2px;
}
.demo-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s steps(2) infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* About */
.landing-about {
  max-width: 600px;
  width: 100%;
  padding: 40px 24px;
  z-index: 5;
}
.landing-about-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.landing-about-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-lo));
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.landing-about-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}
.landing-about-card h3 .accent {
  color: var(--accent);
}
.landing-about-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

/* Footer */
.landing-footer {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  z-index: 5;
}
.landing-footer .dot { color: var(--accent); }

/* Landing responsive */
@media (max-width: 720px) {
  .landing-hero { padding: 40px 20px 24px; }
  .landing-hero h1 { font-size: 32px; }
  .landing-features { grid-template-columns: 1fr; }
  .landing-stats { gap: 20px; }
  .landing-stat-num { font-size: 24px; }
  .landing-hero-btns { flex-direction: column; align-items: center; }
  .landing-btn-primary, .landing-btn-secondary { width: 100%; max-width: 300px; justify-content: center; }
  .landing-about-card { flex-direction: column; text-align: center; }
  .demo-msg-bubble { max-width: 90%; font-size: 12px; }
}
