@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  /* Default theme (light) */
  --bg: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f7f8fb;
  --text-1: #0f172a;
  --text-2: #4b5563;
  --border-1: rgba(15, 23, 42, 0.12);
  --accent-color: #ffffff;
  --muted: var(--text-2);
  --shadow: 0 6px 24px rgba(0,0,0,0.08);
  --bg-app: var(--bg);
  --card-bg: var(--surface-1);
  --bg-color: var(--bg);
  --text-color: var(--text-1);
  --panel: var(--surface-2);
  --card: var(--surface-1);
  --text: var(--text-1);
  --border: var(--border-1);
  --new-chat-bar-height: 120px;
  --frost-bg: rgba(255, 255, 255, 0.72);
  --frost-border: rgba(255, 255, 255, 0.42);
  --frost-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  --presence-core: #22c55e;
  --presence-glow: #8b5cf6;
  --aura-purple: #a78bfa;
  --aura-blue: #7dd3fc;
  --cosmic-noise: rgba(255, 255, 255, 0.08);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg-app);
  color: var(--text-1);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
    padding-top: env(safe-area-inset-top);
}

.ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 320px;
  pointer-events: none;
  background:
    radial-gradient(70% 70% at 50% -10%, rgba(124, 101, 255, 0.09), transparent 60%),
    radial-gradient(55% 55% at 52% 0%, rgba(59, 130, 246, 0.07), transparent 62%);
  background-blend-mode: screen;
  opacity: 0.6;
  z-index: 0;
}

.ambient-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAQAAAC1HAwCAAAAC0lEQVR42mP8/58BAgMBCNJJpAoAAAAASUVORK5CYII=");
  background-repeat: repeat;
  opacity: 0.08;
}

body[data-theme="dark"] .ambient-canvas {
  opacity: 0.4;
}

.page-wrapper {
  min-height: 100dvh;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background: transparent;
  position: relative;
  z-index: 1;
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
  width: 100%;
  flex: 1;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.project-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.project-page-main {
  flex: 1 1 auto;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 12px calc(var(--new-chat-bar-height) + 24px);
  box-sizing: border-box;
}

.bubble {
  white-space: pre-wrap;
  border-radius: 18px;
  padding: 12px 14px;
  max-width: 90%;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.bubble.me {
  background: rgba(99, 102, 241, 0.15);
  align-self: flex-end;
  color: #0f172a;
}

.bubble.bot {
  background: rgba(226, 232, 240, 0.9);
  align-self: flex-start;
  color: #0f172a;
}

.row {
  display: flex;
  margin: 0 0 22px;
  align-items: flex-start;
}
.me {
  justify-content: flex-end;
}
.bot {
  justify-content: flex-start;
  margin: 0;
}
.bot .bubble {
  background: transparent;
  color: #3a3a3a;
  font-weight: 400;
  font-size: 1rem;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 8px 0 12px;
  line-height: 1.6;
  max-width: 720px;
  width: 100%;
  margin: 10px auto 18px;
  text-align: left;
}
.row.bot.assistant-short .bubble { margin: 6px auto 10px; }
.row.bot.assistant-medium .bubble { margin: 10px auto 16px; }
.row.bot.assistant-long .bubble { margin: 14px auto 22px; }
.bot .bubble p { margin: 0 0 0.5rem; }
.bot .bubble p:last-child { margin-bottom: 0; }
.bot .bubble h1,
.bot .bubble h2,
.bot .bubble h3,
.bot .bubble h4 {
  color: #111111;
  font-weight: 700;
  margin: 0.75rem 0 0.4rem;
  line-height: 1.4;
}
.bot .bubble h1 { font-size: 1.2rem; }
.bot .bubble h2 { font-size: 1.14rem; }
.bot .bubble h3 { font-size: 1.08rem; }
.bot .bubble h4 { font-size: 1.04rem; }
.bot .bubble strong { color: #111111; font-weight: 700; }
.bot .bubble em { font-style: italic; }
.bot .bubble ul,
.bot .bubble ol {
  margin: 0.35rem 0 0.8rem 1.2rem;
  padding: 0;
}
.bot .bubble ul { list-style: disc; }
.bot .bubble ol { list-style: decimal; }
.bot .bubble li { margin: 0.28rem 0; padding-left: 0.1rem; }
.bot .bubble ul ul,
.bot .bubble ol ol { margin-top: 0.2rem; }

@media (max-width: 600px) {
  .row {
    margin: 0 0 20px;
  }
  .row.bot {
    margin: 0;
  }
  .bot .bubble {
    max-width: calc(100% - 10px);
    padding: 8px 0 12px;
    margin: 10px auto 18px 6px;
  }
  .row.bot.assistant-short .bubble { margin: 6px auto 10px 6px; }
  .row.bot.assistant-medium .bubble { margin: 10px auto 16px 6px; }
  .row.bot.assistant-long .bubble { margin: 14px auto 22px 6px; }
}

.header,
.card,
button,
input,
textarea {
  border-radius: 12px;
}

.header {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background-color: var(--bg-app);
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--frost-bg);
  border: 1px solid var(--frost-border);
  box-shadow: var(--frost-shadow);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
  border-radius: 16px;
  position: sticky;
  top: 12px;
  z-index: 12;
}

.top-bar .top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar .top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-with-presence {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.presence-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #ffffff, var(--presence-core));
  box-shadow:
    0 0 0 0 rgba(34, 197, 94, 0.25),
    0 0 10px rgba(139, 92, 246, 0.55);
  animation: presencePulse 8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes presencePulse {
  0%, 68%, 100% { transform: scale(1); opacity: 0.94; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.2), 0 0 10px rgba(139, 92, 246, 0.4); }
  78% { transform: scale(1.08); opacity: 1; box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.06), 0 0 16px rgba(139, 92, 246, 0.55); }
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .top-bar {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  }

  body[data-theme="dark"] .top-bar {
    background: rgba(15, 18, 35, 0.9);
  }
}

.top-actions {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 76px);
  z-index: 9;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 20px 10px;
  margin: 10px 0 18px;
  box-sizing: border-box;
  background: transparent;
}

#new-chat-button.topbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #b4a4ff, #7fa3ff);
  color: #0f172a;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.14);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, outline-color 0.2s ease;
}

#new-chat-button.topbar-pill:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.18);
}

#new-chat-button.topbar-pill:active {
  transform: scale(0.97);
}

#new-chat-button.topbar-pill:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 3px;
}

#new-chat-button.topbar-pill.cta-idle {
  animation: ctaIdleGlow 12s ease-in-out infinite;
  animation-delay: 1.5s;
}

@keyframes ctaIdleGlow {
  0%, 80%, 100% { box-shadow: 0 14px 34px rgba(17, 24, 39, 0.14); filter: brightness(1); }
  45% { box-shadow: 0 18px 44px rgba(99, 102, 241, 0.26); filter: brightness(1.04); }
}

@media (max-width: 640px) {
  .top-bar {
    padding: 12px 16px;
  }
  .top-actions {
    padding: 6px 14px 10px;
    margin: 10px 0 14px;
    top: calc(env(safe-area-inset-top) + 70px);
  }
  #new-chat-button.topbar-pill {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

.pinned-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#pinnedBtn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  font-weight: 600;
}

#pinnedBtn:hover {
  background: #e5e7eb;
}

#pinnedBtn:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 2px;
}

.pinned-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
  font-size: 0.88rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 12;
}

.pinned-wrapper:hover .pinned-tooltip,
.pinned-wrapper:focus-within .pinned-tooltip {
  opacity: 1;
  transform: translateY(0);
}

body[data-theme="dark"] #pinnedBtn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e5e7eb;
}

body[data-theme="dark"] .pinned-tooltip {
  background: rgba(30, 41, 59, 0.92);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.update-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
}

.update-banner.show {
  display: flex;
}

.update-banner button {
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
}

button {
  background: var(--surface-2); /* neutral */
  color: var(--text-1);
  border: 1px solid var(--border-1);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--surface-1);
  border-color: var(--border-1);
}

/* Only “primary” actions use accent; theme button stays neutral per your request */
button.primary {
  background: var(--accent-color);
  color: #fff;
  border: none;
}

.card {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 12px;
}

.top-bar-subtitle {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-left: 4px;
  display: inline-block;
}

.project-detail-section {
  padding: 0 20px 40px;
}

.project-detail-card {
  border-radius: 26px;
  padding: 26px;
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  max-width: 700px;
  margin: 0 auto;
}

.project-detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-detail-header h1 {
  margin: 0;
  font-size: 2rem;
}

.project-detail-kicker {
  margin: 0 0 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #818cf8;
}

.project-detail-date {
  font-size: 0.95rem;
  color: #6b7280;
}

.project-error {
  margin: 0;
  color: #b91c1c;
  font-weight: 500;
}

.project-description {
  margin: 0;
  color: #1f2937;
  line-height: 1.5;
}

body[data-page="project"] {
  background: linear-gradient(180deg, #f7f8fb 0%, #ffffff 35%);
  overscroll-behavior: none;
}

/* Project page facelift */
body[data-page="project"] .project-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 20%);
}

body[data-page="project"] .project-sidebar {
  border-right: 1px solid #e5e7eb;
  padding: 22px 18px 20px;
  background: #f8fafc;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body[data-page="project"] .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

body[data-page="project"] .sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body[data-page="project"] .sidebar-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0f172a;
}

body[data-page="project"] .sidebar-subtitle {
  color: #6b7280;
  font-size: 0.9rem;
}

body[data-page="project"] .sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body[data-page="project"] .sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

body[data-page="project"] .sidebar-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

body[data-page="project"] .sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eef2ff;
  color: #0f172a;
  border: 1px solid #e0e7ff;
  border-radius: 14px;
  padding: 12px 12px;
  cursor: default;
  text-align: left;
  box-shadow: 0 10px 32px rgba(79, 70, 229, 0.1);
}

body[data-page="project"] .sidebar-item .sidebar-icon {
  font-size: 1.1rem;
}

body[data-page="project"] .sidebar-item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body[data-page="project"] .sidebar-pill-btn {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  color: #0f172a;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

body[data-page="project"] .sidebar-pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
}

body[data-page="project"] .project-convo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

body[data-page="project"] .project-convo-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

body[data-page="project"] .project-convo-item:hover {
  border-color: #c7d2fe;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

body[data-page="project"] .project-convo-item.active {
  border-color: #c7d2fe;
  background: #eef2ff;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.16);
}

body[data-page="project"] .project-convo-title {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
  font-size: 0.98rem;
}

body[data-page="project"] .project-convo-preview {
  margin: 0;
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.4;
}

body[data-page="project"] .project-convo-time {
  margin: 0;
  color: #9ca3af;
  font-size: 0.82rem;
}

body[data-page="project"] .project-convo-empty {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #d1d5db;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #4b5563;
}

body[data-page="project"] .project-convo-hint {
  margin: 0;
  font-size: 0.9rem;
  color: #94a3b8;
}

body[data-page="project"] .project-new-chat-form {
  margin-top: 10px;
}

body[data-page="project"] .project-new-chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 8px 10px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

body[data-page="project"] .project-new-chat-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  padding: 8px 4px;
}

body[data-page="project"] .project-new-chat-input-wrap button {
  border: none;
  background: #111827;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

body[data-page="project"] .sidebar-item-text small {
  color: #6b7280;
}

body[data-page="project"] .sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

body[data-page="project"] .sidebar-ghost-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #0f172a;
  padding: 10px 12px;
  border-radius: 12px;
}

body[data-page="project"] .project-main-surface {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 38px 140px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body[data-page="project"] .project-hero {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 14px 46px rgba(15, 23, 42, 0.09);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

body[data-page="project"] .project-hero-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

body[data-page="project"] .project-badge {
  background: #0f172a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
}

body[data-page="project"] .project-hero-heading h1 {
  margin: 0 0 4px;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
}

body[data-page="project"] .project-hero-meta {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
}

body[data-page="project"] .project-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body[data-page="project"] .ghost-chip {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
}

body[data-page="project"] .project-description-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  color: #1f2937;
}

body[data-page="project"] .project-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body[data-page="project"] .project-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body[data-page="project"] .project-chat-kicker {
  margin: 0;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #94a3b8;
}

body[data-page="project"] .project-chat-title {
  margin: 2px 0 0;
  font-size: 1.15rem;
}

body[data-page="project"] .chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  border-radius: 12px;
  color: #0f172a;
  background: #fff;
}

body[data-page="project"] .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

body[data-page="project"] .project-chat-thread {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 36px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 16px 54px rgba(15, 23, 42, 0.08);
}

body[data-page="project"] .project-chat-placeholder {
  color: #6b7280;
  padding: 10px 0;
}

body[data-page="project"] .project-chat-error {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 500;
  margin: 0 0 14px;
}

body[data-page="project"] .row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 6px 0;
}

body[data-page="project"] .row.me {
  justify-content: flex-end;
}

body[data-page="project"] .row.bot {
  justify-content: flex-start;
}

body[data-page="project"] .project-chat-thread .bubble {
  max-width: 75ch;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.98rem;
  line-height: 1.6;
}

body[data-page="project"] .project-chat-thread .row.me .bubble {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.26);
}

body[data-page="project"] .project-chat-thread .row.bot .bubble {
  background: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
  box-shadow: none;
  width: auto;
}

body[data-page="project"] .project-chat-thread .row.bot .bubble,
body[data-page="project"] .project-chat-thread .row.me .bubble,
body[data-page="project"] .project-chat-thread .row.bot.assistant-short .bubble,
body[data-page="project"] .project-chat-thread .row.bot.assistant-medium .bubble,
body[data-page="project"] .project-chat-thread .row.bot.assistant-long .bubble {
  margin: 0;
}

body[data-page="project"] .project-chat-input-row {
  position: sticky;
  bottom: 16px;
  left: auto;
  transform: none;
  width: 100%;
  background: #ffffff;
  border-radius: 999px;
  padding: 14px 14px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5e7eb;
  z-index: 5;
}

body[data-page="project"] .project-chat-input-row input[type="text"],
body[data-page="project"] .project-chat-input-row textarea {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 12px 18px;
  font-size: 0.97rem;
  box-shadow: none;
}

body[data-page="project"] .project-chat-input-row button[type="submit"] {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  border: none;
  background: #111827;
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
}

@media (max-width: 960px) {
  body[data-page="project"] .project-shell {
    grid-template-columns: 1fr;
  }

  body[data-page="project"] .project-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0 0 16px 16px;
    padding: 14px 16px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 10px;
  }

  body[data-page="project"] .project-main-surface {
    padding: 18px 14px 140px;
  }

  body[data-page="project"] .project-chat-input-row {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    bottom: calc(env(safe-area-inset-bottom, 12px) + 12px);
  }

  body[data-page="project"] .project-new-chat-input-wrap {
    padding: 10px 12px;
  }
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
  border-radius: 18px;
  padding: 16px 20px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: #c7d2fe;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.project-card:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 2px;
}

.project-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.project-card-meta {
  font-size: 0.85rem;
  color: #6b7280;
}

.home-projects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

/* Theme variants (applied via JS by changing CSS variables) */

/* Modern Account Modal Styles - Gradient Theme */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.account-card-modern {
  animation: slideInFromLeft 0.6s ease-out;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 0;
  width: min(500px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.account-header-modern {
  position: relative;
  padding: 32px 24px 20px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-header-modern h2 {
  font-size: 32px;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.account-header-modern p {
  font-size: 14px;
  color: #d1d5db;
  margin: 0;
}

.close-btn-modern {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.close-btn-modern:hover {
  opacity: 0.8;
}

.auth-tabs-modern {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0;
}

.auth-tab-modern {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 12px 16px 12px 0;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.auth-tab-modern.active {
  color: #ffffff;
  border-bottom-color: #7e22ce;
}

.auth-tab-modern:hover {
  color: #ffffff;
}

.account-form-modern {
  padding: 24px;
}

.form-group-modern {
  position: relative;
  margin-bottom: 18px;
}

.input-modern {
  width: 100%;
  height: 40px;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.3s;
}

.input-modern::placeholder {
  color: transparent;
}

.input-modern:focus {
  border-bottom-color: #9d4edd;
}

.input-modern:focus + .label-modern,
.input-modern:not(:placeholder-shown) + .label-modern {
  top: -24px;
  font-size: 12px;
  color: #9d4edd;
}

.label-modern {
  position: absolute;
  left: 0;
  top: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.form-options-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-size: 13px;
}

.checkbox-modern {
  display: flex;
  align-items: center;
  color: #d1d5db;
  cursor: pointer;
}

.checkbox-modern input {
  margin-right: 6px;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.forgot-link-modern {
  color: #c084fc;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link-modern:hover {
  text-decoration: underline;
}

.button-modern {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #7e22ce 0%, #a855f7 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.3);
}

.button-modern:hover {
  background: linear-gradient(135deg, #9d4edd 0%, #c084fc 100%);
  box-shadow: 0 6px 16px rgba(126, 34, 206, 0.4);
}

.button-modern:active {
  transform: translateY(1px);
}

.button-modern.secondary {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  margin-top: 8px;
}

.button-modern.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.toggle-auth-modern {
  padding: 16px 24px;
  text-align: center;
  color: #d1d5db;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.link-modern {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
}

.link-modern:hover {
  text-decoration: underline;
}

.signed-in-modern {
  padding: 24px;
}

.badge-modern {
  display: inline-block;
  background: linear-gradient(135deg, #9d4edd 0%, #c084fc 100%);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.profile-section-modern {
  margin-bottom: 16px;
}

.actions-modern {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 600px) {
  .account-card-modern {
    width: 95vw;
  }
  
  .account-header-modern {
    padding: 24px 16px 16px 16px;
  }
  
  .account-header-modern h2 {
    font-size: 24px;
  }
  
  .account-form-modern {
    padding: 16px;
  }
}
[data-theme="calm-sky"] {
  --bg-color: hsl(0, 0%, 100%);
  --text-color: #111827;
  --accent-color: #3b82f6;
  --card-bg: #ffffff;
}

[data-theme="warm-amber"] {
  --bg-color: #ffffff;
  --text-color: #3a2e1f;
  --accent-color: #f59e0b;
  --card-bg: #ffffff;
}

:root[data-theme="light"],
body[data-theme="light"] {
  --bg: #f8fafc;
  --surface-1: #ffffff;
  --surface-2: #f5f7fb;
  --text-1: #0f172a;
  --text-2: #4b5563;
  --border-1: rgba(15, 23, 42, 0.12);
  --bg-app: var(--bg);
}

:root[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #0b1220;
  --surface-1: #0f172a;
  --surface-2: #111827;
  --text-1: #e5e7eb;
  --text-2: #cbd5e1;
  --border-1: rgba(255, 255, 255, 0.12);
  --bg-app: var(--bg);
  --card-bg: var(--surface-1);
  --panel: var(--surface-2);
  --card: var(--surface-1);
  --text: var(--text-1);
  --frost-bg: rgba(13, 17, 32, 0.62);
  --frost-border: rgba(255, 255, 255, 0.08);
  --frost-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

body[data-theme="light"] {
  background-color: var(--bg-app);
  color: var(--text-1);
}

body[data-theme="dark"] {
  background:
    radial-gradient(900px 720px at 16% 12%, rgba(124, 101, 255, 0.1), transparent 42%),
    radial-gradient(1100px 780px at 84% 8%, rgba(56, 189, 248, 0.12), transparent 46%),
    linear-gradient(160deg, #0a1022 0%, #0c1326 40%, #0a1022 85%);
  color: var(--text-1);
}

.page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  width: 100%;
  background: transparent;
}

.main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: 0;
  background: transparent;
  padding-bottom: 0;
}

.main-content > * {
  width: 100%;
}

.hidden {
  display: none !important;
}

.content-columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 0 16px;
}

.content-columns .chat {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.account-panel {
  flex: 0 0 360px;
  max-width: 420px;
}

.account-panel .account-card-modern {
  width: 100%;
  max-height: none;
  position: static;
}

#accountBackdrop {
  display: none !important;
}

.side-menu-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.15), transparent 45%),
    rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
  z-index: 40;
}

.side-menu {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 14px;
  pointer-events: none;
  z-index: 41;
}

.side-menu-inner {
  width: min(420px, 94vw);
  max-height: calc(100vh - 28px);
  background: #fdfdfd;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.28);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  transform: translateX(-20px);
  opacity: 0;
  transition: transform 200ms ease-out, opacity 200ms ease-out;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #111827, #0ea5e9);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.menu-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-title {
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.4px;
}

.menu-subtitle {
  color: #6b7280;
  font-size: 13px;
}

.side-menu-close {
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 14px;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}

.menu-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.menu-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.menu-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-section {
  border: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #ffffff, #f9fafb);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.menu-item[href] {
  text-decoration: none;
  color: inherit;
}

.menu-item[href]:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.menu-item:hover {
  background: #f8fafc;
  border-color: #e5e7eb;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transform: translateX(2px);
}

.menu-item:active {
  transform: translateX(0);
}

.menu-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #0f172a;
  flex-shrink: 0;
}

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

.menu-item-title {
  font-weight: 700;
  color: #0f172a;
}

.menu-item-sub {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-caret {
  color: #9ca3af;
  font-weight: 700;
}

.menu-item-ghost {
  background: #f9fafb;
  border-style: dashed;
}

.menu-item-danger {
  color: #b91c1c;
  border-color: #fecdd3;
}

.menu-account-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.menu-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #111827, #0ea5e9);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.menu-account-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-account-name {
  font-weight: 800;
  color: #0f172a;
}

.menu-account-plan {
  font-size: 13px;
  color: #6b7280;
}

.menu-plan {
  display: flex;
  gap: 6px;
}

.menu-plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #065f46;
  font-weight: 700;
  font-size: 12px;
}

.menu-plan-pill-muted {
  background: #f3f4f6;
  color: #4b5563;
}

.menu-manage-btn {
  margin-left: auto;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.menu-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-pill {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.side-menu-open .side-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.side-menu-open .side-menu {
  pointer-events: auto;
}

.side-menu-open .side-menu-inner {
  opacity: 1;
  transform: translateX(0);
}

/* Keep menu button styling light */
.menu-button {
  border-radius: 999px;
  border: none;
  width: 52px;
  height: 52px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc, #e5e7eb);
  color: #0f172a;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, box-shadow 0.18s ease, background 0.2s ease, opacity 0.2s ease;
}

.menu-button:hover {
  background: linear-gradient(135deg, #eef2ff, #e5e7eb);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.menu-button:active {
  transform: scale(0.97);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
}

.menu-button:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 3px;
}

body[data-theme="dark"] .menu-button {
  background: linear-gradient(135deg, #0f172a, #111827);
  color: #e5e7eb;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .menu-button:hover {
  background: linear-gradient(135deg, #111827, #1f2937);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

body[data-theme="dark"] .menu-button:active {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.nav-login-button {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  padding: 10px 18px;
  min-height: 44px;
  min-width: 150px;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-login-button:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(79, 70, 229, 0.28);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.nav-login-button:active {
  transform: scale(0.98);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.1);
}

.nav-login-button:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 3px;
}

body[data-theme="dark"] .nav-login-button {
  background: rgba(17, 24, 39, 0.9);
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .nav-login-button:hover {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.empty-state {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.voice-highlight-card {
  display: none;
  position: relative;
  margin-top: 12px;
  padding: 18px 18px 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.12), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(59, 130, 246, 0.1), transparent 55%),
    linear-gradient(135deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border-1);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  gap: 16px;
  align-items: center;
}

.voice-highlight-card.visible {
  display: flex;
}

.voice-highlight-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 540px;
}

.voice-highlight-kicker {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4338ca;
}

.voice-highlight-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-1);
}

.voice-highlight-sub {
  margin: 0;
  color: var(--text-2);
  opacity: 0.9;
  font-size: 1rem;
}

.voice-highlight-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #0f172a, #4f46e5);
  color: #f8fafc;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 16px 40px rgba(79, 70, 229, 0.35);
  cursor: pointer;
}

.voice-highlight-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.voice-highlight-btn:active {
  transform: scale(0.99);
}

.voice-highlight-visual {
  position: relative;
  flex: 0 0 180px;
  height: 120px;
  display: grid;
  place-items: center;
}

.voice-highlight-mic {
  position: relative;
  z-index: 1;
  height: 76px;
  width: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  background: radial-gradient(circle at 30% 20%, #ffffff, #d3dcff 60%, #4f46e5 100%);
  color: #0b1220;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.25),
    0 0 0 10px rgba(79, 70, 229, 0.12);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.voice-highlight-mic:hover,
.voice-highlight-mic:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px rgba(15, 23, 42, 0.28),
    0 0 0 12px rgba(79, 70, 229, 0.18);
}

.voice-highlight-wave {
  position: absolute;
  inset: -18%;
  border-radius: 32px;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(79, 70, 229, 0.22), transparent 65%),
    radial-gradient(70% 50% at 60% 70%, rgba(16, 185, 129, 0.12), transparent 72%);
  filter: blur(10px);
  animation: voice-wave-breathe 4s ease-in-out infinite;
}

@keyframes voice-wave-breathe {
  0%, 100% { transform: scale(0.96); opacity: 0.75; }
  50%      { transform: scale(1.05); opacity: 1; }
}

@media (max-width: 640px) {
  .voice-highlight-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .voice-highlight-btn {
    width: 100%;
    justify-content: center;
  }
  .voice-highlight-visual {
    align-self: stretch;
    min-height: 120px;
  }
}

.home-dashboard {
  display: none;
  flex-direction: column;
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 6px calc(var(--new-chat-bar-height) + 12px + env(safe-area-inset-bottom));
}

.home-dashboard-visible {
  display: flex;
}

.home-dashboard-hidden {
  display: none !important;
}

.learn-view {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 6px calc(var(--new-chat-bar-height) + 28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.learn-view-header {
  display: flex;
  justify-content: flex-end;
}

.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 20px 20px 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.98));
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
  isolation: isolate;
  min-height: 170px;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: -24% -16%;
  background:
    radial-gradient(40% 36% at 32% 28%, rgba(167, 139, 250, 0.14), transparent 60%),
    radial-gradient(42% 34% at 74% 42%, rgba(125, 211, 252, 0.12), transparent 62%);
  opacity: 0.16;
  filter: blur(8px);
  animation: auraDrift 12s ease-in-out infinite;
  z-index: 1;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 12%, rgba(99, 102, 241, 0.16), transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.home-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.home-hero.is-preparing .home-hero-content {
  opacity: 0;
  transform: translateY(12px);
  animation: heroContentReveal 0.65s ease forwards;
  animation-delay: 1s;
}

.home-hero.is-loaded .home-hero-content {
  opacity: 1;
  transform: translateY(0);
}

.hero-loading {
  position: absolute;
  inset: 18px 20px auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  color: var(--text-1);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.45s ease;
  z-index: 3;
}

.hero-loading-text {
  font-weight: 700;
  font-size: 0.96rem;
}

.home-hero.is-preparing .hero-loading {
  opacity: 1;
  transform: translateY(0);
  animation: heroLoaderFade 0.55s ease forwards;
  animation-delay: 1s;
}

.home-hero.is-loaded .hero-loading {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.loading-dots {
  display: inline-flex;
  gap: 5px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--presence-core);
  opacity: 0.45;
  animation: dotPulse 1.1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dotPulse {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-2px); opacity: 1; }
}

@keyframes auraDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6px, -6px, 0) scale(1.04); }
}

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

@keyframes heroLoaderFade {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

.home-hero-kicker {
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: #4338ca;
  margin: 0;
}

.home-greeting-title {
  position: relative;
  z-index: 1;
  margin: 6px 0 2px;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-1);
}

.home-greeting-sub {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--text-2);
  opacity: 0.9;
  max-width: 540px;
  font-size: 0.98rem;
  line-height: 1.6;
}

.home-guest-guide {
  position: relative;
  z-index: 1;
  margin: 2px 0 0;
  color: var(--text-2);
  opacity: 0.8;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 620px;
}

body[data-theme="dark"] .home-greeting-sub {
  color: var(--text-2);
  opacity: 1;
}

body[data-theme="dark"] .home-hero {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(12, 17, 31, 0.94));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

body[data-theme="dark"] .hero-loading {
  background: rgba(17, 24, 39, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.home-card {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

.home-card:hover {
  border-color: rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.home-continue-card {
  cursor: pointer;
  background: linear-gradient(135deg, #4338ca, #4f46e5, #1d4ed8);
  color: #f8fafc;
  box-shadow: 0 16px 38px rgba(67, 56, 202, 0.3);
}

.home-continue-card .home-card-subtitle {
  color: #e0e7ff;
}

.home-empty-card {
  background: #f8fafc;
}

.home-card-label {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.home-card-subtitle {
  margin: 0;
  color: #4b5563;
}

.home-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.learning-projects-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.learning-projects-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.learning-projects-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.learning-projects-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-1);
}

.learning-projects-subtitle {
  margin: 0;
  color: var(--text-2);
  font-size: 0.95rem;
}

.learning-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 1rem;
  transition: transform 0.18s ease;
}

.learning-projects-content {
  overflow: visible;
  border-radius: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  padding: 0;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.24s ease, opacity 0.24s ease, padding 0.2s ease;
  min-height: 0;
}

.learning-projects-block.is-collapsed .learning-projects-content {
  max-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.learning-projects-block.is-expanded .learning-projects-content {
  padding: 12px 14px 6px;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
  margin-top: 8px;
}

.learning-projects-block.is-expanded .learning-chevron {
  transform: rotate(180deg);
}

.learning-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.learning-pill {
  width: 100%;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.12s ease;
  color: #0f172a;
}

.learning-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(67, 56, 202, 0.14);
  border-color: rgba(67, 56, 202, 0.22);
}

.learning-pill:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 3px;
}

.learning-pill-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.learning-pill-label {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-1);
}

.learning-pill-sub {
  display: block;
  font-size: 0.95rem;
  color: var(--text-2);
}

.learning-pill-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.learning-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.learning-field-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.learning-topic-input {
  flex: 1;
  min-width: 0;
}

.learning-primary-row {
  display: flex;
  width: 100%;
}

.learning-primary-row .learning-start-button {
  width: 100%;
}

.learning-utility-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.learning-save-button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(79, 70, 229, 0.35);
  background: rgba(99, 102, 241, 0.06);
  color: #312e81;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.learning-save-button:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(79, 70, 229, 0.5);
}

.learning-save-button:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 2px;
}

.learning-start-button {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f172a, #818cf8);
  color: #f8fafc;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
  transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.learning-start-button:hover {
  box-shadow: 0 12px 24px rgba(67, 56, 202, 0.2);
  filter: brightness(1.02);
}

.learning-start-button:active {
  transform: translateY(1px);
}

.learning-start-button:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 2px;
}

.learning-clear-button {
  padding: 10px 10px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}

.learning-clear-button:hover {
  background: transparent;
  color: #dc2626;
}

.learning-clear-button:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 2px;
}

body[data-theme="dark"] .learning-pill {
  background: linear-gradient(135deg, #0f172a, #111827);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
}

body[data-theme="dark"] .learning-pill-sub {
  color: #cbd5e1;
}

body[data-theme="dark"] .learning-field-label {
  color: #e5e7eb;
  opacity: 0.9;
}

body[data-theme="dark"] .learn-input {
  background: #0b1220;
  border-color: rgba(255, 255, 255, 0.18);
  color: #e5e7eb;
}

body[data-theme="dark"] .learning-save-button {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(199, 210, 254, 0.6);
  color: #e0e7ff;
}

body[data-theme="dark"] .learning-clear-button {
  color: #d1d5db;
}

body[data-theme="dark"] .learning-clear-button:hover {
  color: #fca5a5;
}

#chat-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-app);
}

.chat-view-header {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 6px 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#chat-view:not(.hidden) .chat-view-header {
  opacity: 1;
  transform: translateY(0);
}

.learn-card {
  cursor: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.learn-card:hover {
  transform: none;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.learn-input {
  width: 100%;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.98rem;
  background: var(--surface-1);
  color: var(--text-1);
}

.learn-input:focus {
  outline: 2px solid #c7d2fe;
  outline-offset: 1px;
  border-color: #a5b4fc;
}

.home-recent-block {
  border-radius: 16px;
  padding: 12px 12px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.home-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.home-recent-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.home-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-recent-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 9px 11px;
  background: var(--surface-1);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.1s ease, background 0.12s ease;
}

.home-recent-item:hover {
  border-color: var(--border-1);
  transform: translateY(-1px);
  background: var(--surface-2);
}

.home-recent-title {
  font-weight: 700;
  margin-bottom: 1px;
  font-size: 0.98rem;
  color: var(--text-1);
}

.home-recent-subtitle {
  margin: 0;
  color: var(--text-2);
  font-size: 0.9rem;
}

.home-recent-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.home-recent-link {
  background: transparent;
  border: none;
  color: var(--text-1);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 6px 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.home-recent-link:hover,
.home-recent-link:focus-visible {
  text-decoration: underline;
}

.home-projects-section {
  margin: 16px auto 32px;
  max-width: 900px;
  padding: 0 12px 24px;
  background: var(--card-bg, var(--surface-1));
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border-1);
}

.home-projects-hidden {
  display: none;
}

.home-projects-empty {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--text-subtle, #6b7280);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-projects-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.home-projects-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.home-projects-new-btn {
  align-self: center;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border: none;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.home-projects-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.2);
}

.home-projects-new-btn:active {
  transform: translateY(0);
}

.home-projects-empty-btn {
  align-self: flex-start;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #0f172a;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.home-projects-empty p {
  margin: 0;
}

.project-create-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  z-index: 1300;
}

.project-create-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1301;
}

.project-create-card {
  width: min(520px, 92vw);
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.25);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-create-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-create-kicker {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.project-create-header h3 {
  margin: 2px 0 0;
  font-size: 1.4rem;
}

.project-create-close {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.project-create-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-create-label {
  font-weight: 600;
  color: #0f172a;
}

.project-create-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 10px 12px;
  background: #f8fafc;
}

.project-create-input-wrap input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 1rem;
  padding: 8px 6px;
  outline: none;
}

.project-create-icon {
  font-size: 1.1rem;
}

.project-create-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-cat-chip {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
}

.project-cat-chip.is-active {
  border-color: #c7d2fe;
  background: #eef2ff;
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.18);
}

.project-create-hint {
  margin: 2px 0 0;
  color: #4b5563;
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.96rem;
}

.project-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.project-create-ghost {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #0f172a;
  padding: 10px 12px;
  font-weight: 600;
}

.project-create-submit {
  border-radius: 12px;
  border: none;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  min-width: 140px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

@media (max-width: 640px) {
  .home-projects-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-projects-new-btn {
    width: 100%;
    text-align: center;
  }

  .project-create-card {
    padding: 16px 14px;
  }

  .project-create-actions {
    flex-direction: column-reverse;
  }

  .project-create-submit,
  .project-create-ghost {
    width: 100%;
    text-align: center;
  }
}

.home-project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  font-size: 0.95rem;
}

.home-project-item + .home-project-item {
  margin-top: 8px;
}

.home-project-name {
  font-weight: 500;
  color: var(--text-1);
}

.home-project-meta {
  font-size: 0.85rem;
  color: var(--text-subtle, #6b7280);
}

.vibe-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: #eef2ff;
  color: #312e81;
  white-space: nowrap;
}

.badge-project { background: #ede9fe; color: #4c1d95; border-color: #c4b5fd; }
.badge-science { background: #e0f2fe; color: #0b5394; border-color: #bae6fd; }
.badge-productivity { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.badge-reflection { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.badge-creative { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-career { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.badge-relationships { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-history { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.badge-puzzles { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.badge-neutral { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }

@media (max-width: 640px) {
  .home-hero {
    padding: 16px;
  }
  .home-greeting-title {
    font-size: 1.4rem;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .learning-projects-grid {
    grid-template-columns: 1fr;
  }
  .learning-grid {
    grid-template-columns: 1fr;
  }
}

.chat-column {
  max-width: 780px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .content-wrapper {
    max-width: none;
    margin: 0;
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-left)) calc(48px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
    width: 100%;
  }

  .home-dashboard,
  .learn-view {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .chat-column {
    max-width: none;
    margin: 0;
  }
}

.chat {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--new-chat-bar-height) + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: var(--bg-app);
}

main.chat,
#chat {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--bg-app);
}

#input-footer {
  width: 100%;
  flex-shrink: 0;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: var(--bg-app);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.07);
}

.input-footer-inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.thinking-indicator {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, filter 0.18s ease;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.25));
  z-index: 2;
}

#input-footer .thinking-indicator {
  top: -4px;
}

.thinking-indicator.visible {
  opacity: 1;
}

.thinking-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.82);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
  animation: thinkingPulse 1.05s infinite ease-in-out;
}

.thinking-indicator span:nth-child(2) { animation-delay: 0.12s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0.24s; }

@keyframes thinkingPulse {
  0%, 100% { transform: scale(0.82); opacity: 0.45; }
  50% { transform: scale(1.25); opacity: 0.95; }
}

body[data-page="project"] .project-thinking-indicator {
  top: -14px;
  transform: translate(-50%, -60%);
}

body[data-theme="dark"] #input-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
}

.chat-input-shell {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-icon-btn {
  flex: 0 0 auto;
  height: 40px;
  width: 40px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat-icon-btn.active {
  background: var(--text-1);
  color: var(--surface-1);
}

.chat-icon-btn.listening {
  background: var(--text-1);
  color: var(--surface-1);
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
}

.chat-icon-btn.danger {
  color: #b91c1c;
}

.chat-icon-btn.disabled,
.chat-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.chat-input-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.65rem 0.5rem 0.65rem 1rem;
  border: 1px solid var(--border-1);
  background: var(--surface-1);
}

.input-bar {
  background: transparent;
  border: 1px solid transparent;
}

body.voice-mode-active .voice-btn {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
  background: #111827;
  color: #ffffff;
}

body.voice-mode-active .input-bar {
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.23);
}

.chat-textarea {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 16px;
  line-height: 1.5;
  max-height: 6.25rem;
  min-height: 48px;
  color: var(--text-1);
  font-weight: 500;
}

.chat-textarea::placeholder {
  color: var(--text-2);
  font-weight: 400;
}

.chat-send-btn {
  flex: 0 0 auto;
  border-radius: 999px;
  border: none;
  height: 40px;
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text-1);
  color: var(--surface-1);
  font-size: 0.85rem;
  cursor: pointer;
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 640px) {
  #input-footer {
    padding-inline: 0.75rem;
  }

  .chat-input-shell {
    gap: 0.4rem;
  }

  .chat-icon-btn {
    height: 36px;
    width: 36px;
    font-size: 0.8rem;
  }

  .chat-input-main {
    padding-inline: 0.85rem 0.35rem;
  }

  .chat-textarea {
    font-size: 16px;
  }

  .chat-send-btn {
    height: 36px;
    width: 36px;
  }
}

@media (max-width: 900px) {
  .content-columns {
    flex-direction: column;
  }

  .account-panel {
    width: 100%;
    max-width: none;
  }
}

/* Settings modal */
.settings-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(12px);
  z-index: 1000;
}

.settings-sheet.is-hidden {
  display: none;
}

.settings-sheet-inner {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.24);
  border: 1px solid var(--border, #e5e7eb);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--muted, #f3f4f6);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  color: #111827;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.settings-tab.is-active {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.settings-tab-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #eef2ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.settings-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: block;
}

.settings-card {
  background: var(--panel, #f8fafc);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.settings-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-label {
  font-weight: 600;
  color: #0f172a;
}

.settings-helper {
  color: #6b7280;
  font-size: 13px;
}

.settings-value {
  font-weight: 600;
  color: #111827;
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge-muted {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-success {
  background: #ecfdf3;
  color: #065f46;
}

.settings-action-btn {
  width: 100%;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  padding: 12px 14px;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  margin-top: 10px;
}

.settings-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.settings-action-btn.settings-danger {
  color: #b91c1c;
  border-color: #fecdd3;
  background: #fff1f2;
}

.plan-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.plan-feature-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #0f172a;
  margin-top: 2px;
}

.plan-feature-text {
  color: #111827;
  line-height: 1.4;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 10px 0;
}

.settings-toggle input {
  display: none;
}

.settings-toggle-ui {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e5e7eb;
  position: relative;
  transition: background 0.2s ease;
}

.settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.settings-toggle input:checked + .settings-toggle-ui {
  background: #111827;
}

.settings-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(20px);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  background: #f3f4f6;
  padding: 6px;
  border-radius: 12px;
}

.segmented-item {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 10px 12px;
  font-weight: 600;
  color: #111827;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.segmented-item.is-active {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.pill-button {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
}

.pill-button-secondary {
  background: #ffffff;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  transition: opacity 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.back-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.back-button:active {
  transform: translateY(0);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

@media (max-width: 520px) {
  .settings-sheet-inner {
    max-height: 90vh;
    overflow: auto;
  }

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

/* Full-screen cosmic background for Voice Mode */
.voice-mode-screen {
  position: fixed;
  inset: 0;
  background-image: url("/static/images/omnia2.0.png");
  background-size: cover;
  background-position: center;
  background-color: #000;
  background-repeat: no-repeat;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
  overflow: hidden;
}

.voice-mode-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.voice-mode-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.8), transparent 55%),
    radial-gradient(1px 1px at 35% 10%, rgba(255,210,150,0.75), transparent 55%),
    radial-gradient(1px 1px at 60% 18%, rgba(180,210,255,0.8), transparent 55%),
    radial-gradient(1px 1px at 75% 30%, rgba(255,240,200,0.7), transparent 55%),
    radial-gradient(1px 1px at 25% 68%, rgba(255,255,255,0.7), transparent 55%),
    radial-gradient(1px 1px at 55% 76%, rgba(200,225,255,0.75), transparent 55%),
    radial-gradient(1px 1px at 78% 82%, rgba(255,210,150,0.7), transparent 55%),
    radial-gradient(1px 1px at 90% 55%, rgba(255,255,255,0.7), transparent 55%);
  opacity: 0.55;
  animation: twinkle 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.voice-mode-screen::after {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(60% 50% at 30% 25%, rgba(82, 118, 205, 0.18), transparent 65%),
    radial-gradient(60% 50% at 75% 55%, rgba(255, 160, 120, 0.12), transparent 70%),
    radial-gradient(55% 45% at 50% 75%, rgba(94, 70, 150, 0.12), transparent 75%);
  mix-blend-mode: screen;
  filter: blur(24px);
  opacity: 0.6;
  animation: nebula-shift 28s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
}

.voice-mode-content {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 40px;
}

@media (min-width: 768px) {
  .voice-mode-content {
    padding-top: 40px;
    max-width: 640px;
    margin: 0 auto;
  }
}

.voice-modal,
.voice-mode {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: none;
  background: transparent;
  z-index: 9999;
  color: #dfe8ff;
  text-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.voice-modal::after,
.voice-mode::after,
.voice-modal::before,
.voice-mode::before {
  display: none;
}

.voice-modal::backdrop,
.voice-mode::backdrop {
  background: transparent;
}

.voice-modal.hidden,
.voice-mode.hidden {
  display: none;
}

.voice-modal-inner {
  width: 100%;
  max-width: 560px;
  padding: 0 20px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #eaf2ff;
  font-family: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.voice-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #dbe7ff;
  text-shadow: none;
  width: 100%;
  max-width: 560px;
}

.voice-modal-header span {
  font-size: 15px;
  font-weight: 500;
  opacity: 0.72;
  color: #b7c5ff;
  display: none;
}

.voice-close-btn {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  background: rgba(18, 28, 58, 0.7);
  color: #e8efff;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

.voice-close-btn:hover {
  background: rgba(38, 56, 102, 0.85);
}

.voice-modal-body {
  background: transparent !important;
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.voice-cubes-bg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 1;
  width: 260px;
  height: 320px;
  margin: 0 auto;
}

.cubes {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%);
}

.loop {
  transform: rotateX(-35deg) rotateY(-45deg) translateZ(1.5625em) scale(1.6);
}

@keyframes s {
  to {
    transform: scale3d(0.2, 0.2, 0.2);
  }
}

.item {
  margin: -1.5625em;
  width: 3.125em;
  height: 3.125em;
  transform-origin: 50% 50% -1.5625em;
  box-shadow: 0 0 0.125em currentColor;
  background: currentColor;
  animation: s 0.6s cubic-bezier(0.45, 0.03, 0.51, 0.95) infinite alternate;
}

.item:before,
.item:after {
  position: absolute;
  width: inherit;
  height: inherit;
  transform-origin: 0 100%;
  box-shadow: inherit;
  background: currentColor;
  content: "";
}

.item:before {
  bottom: 100%;
  transform: rotateX(90deg);
}

.item:after {
  left: 100%;
  transform: rotateY(90deg);
}

.item:nth-child(1) {
  margin-top: 6.25em;
  color: #fe1e52;
  animation-delay: -1.2s;
}

.item:nth-child(1):before {
  color: #ff6488;
}

.item:nth-child(1):after {
  color: #ff416d;
}

.item:nth-child(2) {
  margin-top: 3.125em;
  color: #fe4252;
  animation-delay: -1s;
}

.item:nth-child(2):before {
  color: #ff8892;
}

.item:nth-child(2):after {
  color: #ff6572;
}

.item:nth-child(3) {
  margin-top: 0em;
  color: #fe6553;
  animation-delay: -0.8s;
}

.item:nth-child(3):before {
  color: #ffa499;
}

.item:nth-child(3):after {
  color: #ff8476;
}

.item:nth-child(4) {
  margin-top: -3.125em;
  color: #fe8953;
  animation-delay: -0.6s;
}

.item:nth-child(4):before {
  color: #ffb999;
}

.item:nth-child(4):after {
  color: #ffa176;
}

.item:nth-child(5) {
  margin-top: -6.25em;
  color: #feac54;
  animation-delay: -0.4s;
}

.item:nth-child(5):before {
  color: #ffce9a;
}

.item:nth-child(5):after {
  color: #ffbd77;
}

.item:nth-child(6) {
  margin-top: -9.375em;
  color: #fed054;
  animation-delay: -0.2s;
}

.item:nth-child(6):before {
  color: #ffe49a;
}

.item:nth-child(6):after {
  color: #ffda77;
}

.voice-status {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
  z-index: 2;
  display: none;
}

.voice-sphere-stage {
  position: relative;
  width: min(420px, 88vw);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  z-index: 1;
}

.voice-sphere-stage { display: none; }

.voice-hint {
  margin: 0;
  font-size: 15px;
  color: #e6e6e6;
  letter-spacing: 0.01em;
  z-index: 2;
  display: none;
}

.voice-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 2;
}

.voice-pill {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(12, 18, 40, 0.7);
  color: #f0f4ff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(0,0,0,0.35);
}

.voice-pill.ghost {
  background: rgba(255,255,255,0.08);
  color: #f0f4ff;
  display: none;
}

.voice-mic-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(118, 182, 255, 0.45);
  background:
    radial-gradient(40% 40% at 35% 30%, rgba(115, 195, 255, 0.95), rgba(21, 82, 142, 0.85)),
    radial-gradient(90% 90% at 50% 65%, rgba(46, 30, 95, 0.6), rgba(8, 14, 34, 0.92));
  box-shadow:
    0 14px 34px rgba(0,0,0,0.35),
    0 0 36px rgba(98, 177, 255, 0.35),
    0 0 120px rgba(60, 101, 180, 0.25);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.voice-mic-btn[aria-pressed="true"] {
  box-shadow:
    0 14px 34px rgba(12, 54, 112, 0.32),
    0 0 46px rgba(117, 210, 255, 0.5),
    0 0 120px rgba(90, 158, 255, 0.32);
  border-color: rgba(117, 210, 255, 0.65);
  background:
    radial-gradient(42% 42% at 35% 30%, rgba(153, 226, 255, 0.95), rgba(38, 124, 196, 0.9)),
    radial-gradient(95% 95% at 50% 65%, rgba(26, 32, 72, 0.85), rgba(10, 20, 52, 0.95));
}

.voice-mic-btn:active {
  transform: scale(0.97);
}

.voice-mic-btn::before,
.voice-mic-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 194, 255, 0.45) 0%, rgba(123, 194, 255, 0) 55%);
  opacity: 0.6;
  transform: scale(1);
  animation: mic-ring 2.4s ease-out infinite;
}

.voice-mic-btn::after {
  animation-delay: 0.8s;
}

.voice-mic-dot {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 50% 40%, #e9f7ff, #8fd0ff 70%, #3fa0ff 100%);
  border-radius: 50%;
  box-shadow:
    0 0 0 10px rgba(123, 194, 255, 0.18),
    0 0 32px rgba(123, 194, 255, 0.45);
  position: relative;
  z-index: 1;
}

.voice-orb,
.voice-orb-ring,
.voice-wave,
.voice-wave-live {
  display: none !important;
}

@keyframes mic-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@keyframes dot-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
  50%      { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.75; }
}

@keyframes nebula-shift {
  0% { transform: translate3d(-2%, -2%, 0) scale(1); }
  50% { transform: translate3d(2%, 1%, 0) scale(1.02); }
  100% { transform: translate3d(-1%, 2%, 0) scale(1); }
}


/* When voice mode is open, dim the chat input row */
body.voice-mode-open .chat-input-shell,
body.voice-mode-open .chat-input-main {
  opacity: 0.15;
  pointer-events: none;
}

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

/* === AUTH MODAL BASE === */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 25, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

/* Glassy card */
.auth-modal-card {
  position: relative;
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  margin: 0 16px;
  border-radius: 28px;
  padding: 20px 20px 24px;
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.25),
    0 0 0 1px var(--border-1);
}

/* 3D gradient header band */
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.auth-modal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, #4f46e5, #2563eb);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.6);
}

.auth-logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35);
}

.auth-logo-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e5e7ff;
}

.auth-close-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

/* Hero text */
.auth-modal-hero h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 4px 0;
  color: var(--text-1);
}

.auth-modal-hero p {
  font-size: 0.9rem;
  color: var(--text-2);
}

/* Tabs */
.auth-tabs {
  display: inline-flex;
  margin-top: 16px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
}

.auth-tab {
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--text-1);
  color: var(--surface-1);
}

/* Form */
.auth-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}

.auth-field input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  background: var(--surface-1);
  color: var(--text-1);
}

.auth-field input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.45);
}

/* Extra rows */
.auth-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-top: 4px;
}

.auth-extra-row.hidden {
  display: none;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.auth-checkbox input {
  accent-color: #4f46e5;
}

.auth-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.78rem;
  color: #4f46e5;
  cursor: pointer;
}

/* Hint + error */
.auth-hint {
  font-size: 0.78rem;
  color: var(--text-2);
}

.auth-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #dc2626;
}

.auth-error.hidden {
  display: none;
}

/* Submit button */
.auth-submit-btn {
  margin-top: 12px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.93rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #6366f1, #0ea5e9);
  box-shadow:
    0 10px 30px rgba(79, 70, 229, 0.6),
    0 0 0 1px rgba(191, 219, 254, 0.6);
}

.auth-status {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #15803d;
}

.auth-status.hidden {
  display: none;
}

.auth-legal-note {
  margin: 4px 0 0;
  font-size: 0.83rem;
  color: var(--text-2);
  line-height: 1.5;
}

.auth-legal-note a {
  color: #4f46e5;
  font-weight: 600;
  text-decoration: none;
}

.auth-legal-note a:hover {
  text-decoration: underline;
}

/* === DARK THEME OVERRIDES === */

body[data-theme="dark"] .auth-modal-backdrop,
.theme-dark .auth-modal-backdrop {
  background: rgba(15, 23, 42, 0.75);
}

body[data-theme="dark"] .auth-modal-card,
.theme-dark .auth-modal-card {
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.8),
    0 0 0 1px var(--border-1);
}

body[data-theme="dark"] .auth-modal-hero h2,
.theme-dark .auth-modal-hero h2 {
  color: var(--text-1);
}

body[data-theme="dark"] .auth-modal-hero p,
body[data-theme="dark"] .auth-label,
body[data-theme="dark"] .auth-hint,
.theme-dark .auth-modal-hero p,
.theme-dark .auth-label,
.theme-dark .auth-hint {
  color: var(--text-2);
}

body[data-theme="dark"] .auth-tabs,
.theme-dark .auth-tabs {
  background: rgba(15, 23, 42, 0.7);
}

body[data-theme="dark"] .auth-tab,
.theme-dark .auth-tab {
  color: #9ca3af;
}

body[data-theme="dark"] .auth-tab.active,
.theme-dark .auth-tab.active {
  background: #f9fafb;
  color: #020617;
}

body[data-theme="dark"] .auth-field input,
.theme-dark .auth-field input {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: rgba(55, 65, 81, 0.9);
}

body[data-theme="dark"] .auth-submit-btn,
.theme-dark .auth-submit-btn {
  box-shadow:
    0 16px 40px rgba(59, 130, 246, 0.85),
    0 0 0 1px rgba(129, 140, 248, 0.9);
}

/* === PROFILE MODAL === */

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 32, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

.profile-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 18px;
  border-radius: 28px;
  padding: 22px 22px 26px;
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow:
    0 28px 68px rgba(15, 23, 42, 0.3),
    0 0 0 1px var(--border-1);
  pointer-events: auto;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-id-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: #f8fafc;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.35);
}

.profile-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-1);
}

.profile-subtitle {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 0.92rem;
}

.profile-close-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-section {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
}

.profile-section-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-1);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.profile-field:last-child {
  margin-bottom: 0;
}

.profile-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

.profile-field input,
.profile-field select,
.profile-value {
  border-radius: 12px;
  border: 1px solid var(--border-1);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: var(--surface-1);
  color: var(--text-1);
}

.profile-field select {
  cursor: pointer;
}

.profile-field.read-only .profile-value {
  background: var(--surface-2);
  color: var(--text-2);
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.profile-primary-btn,
.profile-secondary-btn,
.profile-danger-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.profile-primary-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1, #0ea5e9);
  color: #fff;
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.45);
}

.profile-secondary-btn {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-1);
}

.profile-danger {
  margin-top: 6px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(254, 242, 242, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-danger-title {
  font-weight: 700;
  color: #991b1b;
}

.profile-danger-text {
  margin: 4px 0 0;
  color: #b91c1c;
  font-size: 0.92rem;
}

.profile-danger-btn {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.35);
}

.profile-status {
  min-height: 18px;
  font-size: 0.9rem;
  color: #0f172a;
}

.profile-status.error {
  color: #dc2626;
}

.profile-status.success {
  color: #16a34a;
}

/* Profile summary (settings) */
.profile-card-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-summary {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-weight: 700;
  color: #0f172a;
}

.profile-email,
.profile-join {
  color: #475569;
  font-size: 0.95rem;
}

.profile-actions-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-actions-inline .settings-action-btn {
  margin-left: auto;
}

/* Dark theme */
body[data-theme="dark"] .profile-modal-card,
.theme-dark .profile-modal-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.75),
    0 0 0 1px var(--border-1);
}

body[data-theme="dark"] .profile-section,
.theme-dark .profile-section {
  background: var(--surface-1);
  border-color: var(--border-1);
}

body[data-theme="dark"] .profile-label,
body[data-theme="dark"] .profile-subtitle,
body[data-theme="dark"] .profile-email,
body[data-theme="dark"] .profile-join,
.theme-dark .profile-label,
.theme-dark .profile-subtitle,
.theme-dark .profile-email,
.theme-dark .profile-join {
  color: var(--text-2);
}

body[data-theme="dark"] .profile-title,
body[data-theme="dark"] .profile-name,
.theme-dark .profile-title,
.theme-dark .profile-name {
  color: var(--text-1);
}

body[data-theme="dark"] .profile-field input,
body[data-theme="dark"] .profile-field select,
body[data-theme="dark"] .profile-value,
.theme-dark .profile-field input,
.theme-dark .profile-field select,
.theme-dark .profile-value {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.6);
}

body[data-theme="dark"] .profile-danger,
.theme-dark .profile-danger {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(248, 113, 113, 0.35);
}

.idle-whisper {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 8px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(12, 18, 30, 0.76);
  color: #f8fafc;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s ease;
  z-index: 40;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

.idle-whisper.is-visible {
  opacity: 0.78;
  transform: translate(-50%, 0);
}

body[data-theme="dark"] .idle-whisper {
  background: rgba(17, 24, 39, 0.82);
  color: #e5e7eb;
}

.site-legal-footer {
  max-width: 960px;
  margin: 32px auto calc(var(--new-chat-bar-height) + 32px);
  padding: 16px 12px 0;
  text-align: center;
  color: var(--text-2);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

body.legal-body .site-legal-footer,
body[data-page="project"] .site-legal-footer {
  margin-bottom: 48px;
}

.site-legal-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 4px;
  font-weight: 600;
}

.site-legal-links a {
  color: #4f46e5;
  text-decoration: none;
}

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

.site-legal-brand {
  font-size: 0.9rem;
  color: var(--text-2);
}

.legal-body {
  background: var(--bg-app);
  color: var(--text-1);
}

.legal-shell {
  min-height: 100vh;
  padding: 48px 16px calc(54px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg-app);
}

.legal-header {
  width: min(960px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.legal-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0f172a;
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc, #93c5fd);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.25);
}

.legal-brand-title {
  font-weight: 800;
  font-size: 1rem;
  color: #0f172a;
}

.legal-brand-subtitle {
  color: var(--text-2);
  font-size: 0.93rem;
}

.legal-back-link {
  color: #4f46e5;
  font-weight: 600;
  text-decoration: none;
}

.legal-back-link:hover {
  text-decoration: underline;
}

.legal-content {
  width: min(960px, 100%);
}

.legal-card {
  background: var(--surface-1);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.legal-article h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
}

.legal-updated {
  margin: 0 0 16px;
  color: var(--text-2);
  font-weight: 600;
}

.legal-section {
  margin: 16px 0 22px;
}

.legal-section h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.legal-section p {
  margin: 0 0 10px;
  line-height: 1.7;
}

.legal-list {
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.7;
}

.legal-list li + li {
  margin-top: 8px;
}

.legal-list strong {
  color: #0f172a;
}

body[data-theme="dark"] .legal-card {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .legal-brand-title,
body[data-theme="dark"] .legal-article h1 {
  color: #e5e7eb;
}

body[data-theme="dark"] .legal-brand-subtitle,
body[data-theme="dark"] .legal-updated,
body[data-theme="dark"] .site-legal-brand {
  color: #cbd5e1;
}

body[data-theme="dark"] .site-legal-footer {
  border-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .legal-shell {
    padding: 32px 14px calc(44px + env(safe-area-inset-bottom));
  }

  .legal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .legal-back-link {
    align-self: flex-end;
  }

  .site-legal-footer {
    margin-bottom: calc(var(--new-chat-bar-height) + 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .presence-dot,
  .home-hero::before,
  .home-hero.is-preparing .home-hero-content,
  .home-hero.is-preparing .hero-loading,
  .loading-dots span,
  #new-chat-button.topbar-pill.cta-idle {
    animation: none !important;
  }

  .home-hero-content,
  .hero-loading,
  .idle-whisper {
    transition: none !important;
  }

  .home-hero.is-preparing .home-hero-content {
    opacity: 1 !important;
    transform: none !important;
  }

  .home-hero.is-preparing .hero-loading {
    opacity: 0 !important;
  }
}
