/* Ringz AI — Premium Black & White Design System
   PHASE 2 — Default theme is now BLACK (per user request 2026-08-07).
   Previously body was white; now black is default. No other visual changes
   requested. This keeps the exact same layout, fonts, spacing, borders —
   only colors inverted to black-first.
*/
:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray-100: #1a1a1a;  /* was #f5f5f5 — now dark for cards on black */
  --gray-200: #222222;
  --gray-300: #2e2e2e;  /* borders on black */
  --gray-400: #525252;
  --gray-500: #8a8a8a;
  --gray-600: #a3a3a3;
  --gray-800: #d4d4d4;  /* light text on black */
  --accent: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--black); /* ← CHANGED: was var(--white), now black by default */
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Shared header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-300);
  position: sticky;
  top: 0;
  background: var(--black); /* ← CHANGED: was white */
  z-index: 10;
  backdrop-filter: blur(8px);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; color: var(--white); }
.brand span { color: var(--gray-500); font-weight: 700; }
.nav-links { display: flex; gap: 18px; font-size: 14px; }
.nav-links a { text-decoration: none; color: var(--gray-800); }

/* ---------- Homepage ---------- */
.hero {
  padding: 72px 20px 48px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 16px;
  color: var(--white);
}
.hero p {
  font-size: 17px;
  color: var(--gray-600);
  line-height: 1.6;
  margin: 0 0 28px;
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  border: 1.5px solid var(--white);
  transition: all .15s ease;
}
.btn-primary { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-primary:hover { background: #e5e5e5; }
.btn-secondary { background: transparent; color: var(--white); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }

.section { max-width: 960px; margin: 0 auto; padding: 40px 20px; }
.section h2 { font-size: 24px; margin-bottom: 8px; letter-spacing: -0.02em; color: var(--white); }
.section-sub { font-size: 14px; color: var(--gray-500); margin-bottom: 18px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.card {
  border: 1px solid var(--gray-300);
  border-radius: 16px;
  padding: 18px;
  font-size: 14px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--white);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--gray-400); transform: translateY(-1px); }
.card small {
  display: block;
  font-weight: 400;
  color: var(--gray-500);
  margin-top: 6px;
  line-height: 1.4;
}

.prompt-chip {
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  display: inline-block;
  margin: 5px;
  color: var(--gray-800);
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.prompt-chip:hover { background: var(--white); color: var(--black); border-color: var(--white); }

footer.site-footer {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
  padding: 28px 16px 40px;
  border-top: 1px solid var(--gray-300);
  margin-top: 24px;
}

/* ---------- Chat page ---------- */
.chat-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat-page .topbar { flex-shrink: 0; }

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-300);
  flex-shrink: 0;
  scrollbar-width: thin;
}
.quick-actions::-webkit-scrollbar { height: 4px; }
.quick-actions button {
  flex-shrink: 0;
  border: 1px solid var(--gray-300);
  background: transparent;
  color: var(--white);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.quick-actions button:hover { background: var(--gray-200); border-color: var(--gray-400); }
.quick-actions button.active { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 600; }
.quick-actions button:disabled { opacity: .4; cursor: not-allowed; }

/* Orange rectangle REMOVED — profile now in modal via topbar ⚙️ (Phase 4). 
   This frees ~70px for the blue chat area. Green rectangle (mode-bar) now sits directly under quick-actions. */
.mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-300);
  flex-shrink: 0;
  background: var(--black);
  flex-wrap: wrap;
}
.mode-bar .muted { flex: 1; min-width: 160px; }
.mode-bar-right { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--gray-300);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  color: var(--white);
  transition: all .15s;
}
.icon-btn:hover { background: var(--gray-200); border-color: var(--gray-400); }
.due-badge {
  background: var(--white);
  color: var(--black);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.due-badge.hidden { display: none !important; }
.timer-inline { font-size: 11px; color: var(--gray-500); font-weight: 700; letter-spacing: .03em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.callout {
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--gray-100);
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
}
.callout b { color: var(--white); }
#profileStatus { font-size: 12px; color: var(--gray-500); align-self: center; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.msg { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px);} to { opacity:1; transform:none;} }
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }
.bubble {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.assistant .bubble {
  background: var(--gray-100);
  color: var(--white);
  border: 1px solid var(--gray-300);
  border-bottom-left-radius: 6px;
}
.msg.user .bubble {
  background: var(--white);
  color: var(--black);
  border-bottom-right-radius: 6px;
}
.msg.typing .bubble { color: var(--gray-500); font-style: italic; border-style: dashed; }

/* composer */
.composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--gray-300);
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  background: var(--black);
}
.composer > * { flex-shrink: 0; }
.composer #messageInput { flex-shrink: 1; }
.attach { cursor: pointer; font-size: 19px; padding: 8px; color: var(--gray-500); }
.attach:hover { color: var(--white); }
#messageInput {
  flex: 1;
  min-width: 0; /* flex items default to min-width:auto which can force the whole
                   composer wider than the screen — this was the real cause of the
                   chat page being able to scroll left/right on mobile. */
  padding: 12px 16px;
  border: 1.5px solid var(--gray-300);
  border-radius: 999px;
  font-size: 15px;
  outline: none;
  background: var(--gray-100);
  color: var(--white);
}
#messageInput::placeholder { color: var(--gray-500); }
#messageInput:focus { border-color: var(--white); background: var(--gray-200); }
#sendBtn {
  background: var(--white);
  color: var(--black);
  border: none;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
#sendBtn:disabled { background: var(--gray-300); color: var(--gray-500); cursor: not-allowed; }
.fileNotice {
  font-size: 12px;
  color: var(--gray-500);
  padding: 0 16px 10px;
  min-height: 16px;
  flex-shrink: 0;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.status { font-size: 12px; color: var(--gray-500); }
.status.online { color: var(--success); }
.status.error { color: var(--danger); }
.chat-page footer.site-footer { flex-shrink: 0; padding: 10px; margin-top: 0; }

/* ---------- PHASE 2: Modes overlay & panels ---------- */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  margin-bottom: 6px;
}
.mode-badge.study { border-color: #3b82f6; color: #60a5fa; }
.mode-badge.revision { border-color: #a78bfa; color: #c4b5fd; }
.mode-badge.exam { border-color: #f59e0b; color: #fcd34d; }
.mode-badge.flashcard { border-color: #22c55e; color: #86efac; }

/* Study Level pills */
.level-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  font-size: 13px;
  cursor: pointer;
  margin: 4px;
  color: var(--gray-800);
}
.level-pill.selected { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 600; }

/* Modal common */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: #111111;
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.97) translateY(8px);} to { opacity:1; transform:none;} }
.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin:0; font-size: 16px; letter-spacing: -.02em; }
.modal-close {
  background: var(--gray-200);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--white);
  font-size: 16px;
}
.modal-body { padding: 18px 20px; overflow-y: auto; flex:1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-300);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-footer .btn { padding: 10px 18px; font-size: 14px; }

/* Form bits inside modal */
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gray-800); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 10px;
  background: var(--black);
  color: var(--white);
  font-size: 14px;
}
.field input:focus, .field select:focus { outline:none; border-color: var(--white); }
.field small { color: var(--gray-500); font-size: 12px; }

/* Exam timer (top-right) */
.exam-timer {
  position: fixed;
  top: 64px;
  right: 16px;
  background: var(--white);
  color: var(--black);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .02em;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
}
.exam-timer.warning { background: var(--warning); color: black; animation: pulse .8s infinite alternate; }
.exam-timer.danger { background: var(--danger); color: white; animation: pulse .4s infinite alternate; }
@keyframes pulse { from { transform:scale(1);} to { transform:scale(1.04);} }

/* Exam question cards */
.exam-card {
  border: 1px solid var(--gray-300);
  border-radius: 16px;
  padding: 16px;
  background: var(--gray-100);
  margin-bottom: 14px;
}
.exam-card h4 { margin: 0 0 10px; font-size: 14px; color: var(--gray-600); }
.exam-card p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
.exam-options label {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
}
.exam-options label:hover { border-color: var(--gray-400); background: var(--gray-200); }
.exam-options input { accent-color: white; }
.exam-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--gray-300);
  background: var(--black);
  color: white;
  font-size: 14px;
  font-family: inherit;
}

/* Flashcard */
.flashcard {
  border: 1px solid var(--gray-300);
  border-radius: 18px;
  padding: 22px;
  background: var(--gray-100);
  text-align: center;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.flashcard-q { font-size: 17px; font-weight: 700; line-height: 1.4; }
.flashcard-a { font-size: 15px; color: var(--gray-600); line-height: 1.5; }
.flashcard-actions { display:flex; gap:8px; justify-content:center; flex-wrap: wrap; }

/* Quick nudge after Study completion */
.nudge {
  border: 1px solid var(--gray-300);
  border-radius: 14px;
  padding: 14px;
  background: var(--gray-100);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.nudge p { margin:0; font-size: 14px; flex:1; min-width: 180px; }

/* ---------- Onboarding ---------- */
.onboard-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--black); }
.skip-all { font-size: 13px; color: var(--gray-500); text-decoration: none; }
.onboard-wrap { flex: 1; max-width: 480px; margin: 0 auto; padding: 24px 20px 40px; width: 100%; }
.progress-dots { display: flex; gap: 6px; margin-bottom: 24px; }
.dot { height: 4px; flex: 1; border-radius: 999px; background: var(--gray-300); }
.dot.active { background: var(--white); }
.step-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--gray-500); margin-bottom: 8px; text-transform: uppercase; }
.step h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 10px; line-height: 1.15; color: var(--white); }
.step-sub { font-size: 14px; color: var(--gray-500); line-height: 1.5; margin: 0 0 24px; }
.option-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.option {
  text-align: left;
  padding: 16px;
  border: 1px solid var(--gray-300);
  border-radius: 14px;
  background: var(--gray-100);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--white);
}
.option strong { font-size: 15px; }
.option small { color: var(--gray-500); font-size: 13px; }
.option.selected { border-color: var(--white); border-width: 1.5px; background: var(--white); color: var(--black); }
.option.selected small { color: #525252; }
.name-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--gray-300);
  border-radius: 14px;
  font-size: 16px;
  margin-bottom: 28px;
  background: var(--gray-100);
  color: var(--white);
}
.name-input::placeholder { color: var(--gray-500); }
.name-input:focus { outline: none; border-color: var(--white); }
.step-actions { display: flex; justify-content: space-between; gap: 10px; }
.step-actions .btn { flex: 1; text-align: center; }
.step-actions button.btn { font-family: inherit; }
.step-actions button.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.muted { color: var(--gray-500); font-size: 13px; }
.kbd { font-family: monospace; background: var(--gray-200); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- Light mode override (user can still choose) ---------- */
/* If user explicitly wants light mode, add class="light" to <body> */
body.light { background: #ffffff; color: #0a0a0a; }
body.light .topbar { background: #ffffff; border-color: #e5e5e5; }
body.light .card { background: #ffffff; border-color: #e5e5e5; color: #0a0a0a; }
body.light .bubble { /* keep etc */ }

/* ---------- Batch 1: Sidebar (Phase 12-14) ---------- */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); z-index: 40;
}
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 300px; max-width: 85vw;
  background: #0f0f0f; border-right: 1px solid var(--gray-300); z-index: 50;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(0); transition: transform .2s ease;
}
.sidebar.hidden { transform: translateX(-100%); }
.sidebar-overlay.hidden { display: none; }
.sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--gray-300); font-size: 14px;
}
.sidebar-section { padding: 12px 12px 8px; border-bottom: 1px solid #1a1a1a; }
.sidebar-section h4 { margin: 0 0 8px; font-size: 11px; letter-spacing:.07em; text-transform:uppercase; color: var(--gray-500); }
.sidebar-btn {
  width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--gray-300);
  background: var(--white); color: var(--black); font-weight: 700; font-size: 13px; cursor: pointer;
}
.sidebar-btn.primary { background: var(--white); }
.sidebar-item {
  width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: none;
  background: transparent; color: var(--gray-800); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-item:hover { background: var(--gray-100); color: var(--white); }
.sidebar-badge { margin-left: auto; background: var(--white); color: var(--black); font-size: 10px; padding: 2px 6px; border-radius: 999px; font-weight: 800; }
.sidebar-badge.hidden { display: none; }
.sidebar-footer { margin-top: auto; padding: 12px; font-size: 11px; color: var(--gray-500); border-top: 1px solid var(--gray-300); text-align: center; }

/* ---------- Batch 1: Stats & Progress (Phase 7) ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 560px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  border: 1px solid var(--gray-300); border-radius: 14px; padding: 14px; text-align: center; background: var(--gray-100);
}
.stat-card b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat-card span { font-size: 11px; color: var(--gray-500); letter-spacing: .05em; text-transform: uppercase; font-weight: 700; }

/* Homepage polish (Phase 12-14) */
.stats-row { display: flex; gap: 16px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.stat { text-align: center; min-width: 80px; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat span { font-size: 11px; color: var(--gray-500); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.steps-visual { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; }
.step-v { border: 1px solid var(--gray-300); border-radius: 14px; padding: 16px; background: var(--gray-100); text-align: center; }
.step-v span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--white); color: var(--black); font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.step-v b { display: block; font-size: 14px; margin-bottom: 4px; }
.step-v small { color: var(--gray-500); font-size: 12px; }
.testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 12px; }
.t-card { border: 1px solid var(--gray-300); border-radius: 14px; padding: 16px; background: var(--black); }
.t-card p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; font-style: italic; }
.t-card small { color: var(--gray-500); font-size: 12px; }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq details { border: 1px solid var(--gray-300); border-radius: 12px; padding: 12px 14px; background: var(--gray-100); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.faq p { margin: 8px 0 0; color: var(--gray-600); font-size: 13px; line-height: 1.5; }
.skip-btn { background: none; border: none; color: var(--gray-500); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* Timetable */
#ttDisplay table { width: 100%; border-collapse: collapse; font-size: 13px; }
#ttDisplay th, #ttDisplay td { border: 1px solid var(--gray-300); padding: 8px; text-align: left; }
#ttDisplay th { background: var(--gray-200); }
.badge { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--gray-300); color: var(--gray-600); background: var(--gray-100); }


/* ---------- Corrections: Full-screen chat (like Arena) ---------- */
.chat-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-page .topbar { flex-shrink: 0; }
.chat-page .mode-bar { flex-shrink: 0; }
.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.composer {
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.chat-page footer.site-footer {
  display: none; /* hidden on chat for full-screen — still visible on homepage */
}
.fileNotice { flex-shrink: 0; }
/* Send icon button */
.send-icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--black);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.send-icon-btn:hover { background: #e5e5e5; transform: scale(1.03); }
.send-icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-icon-btn svg { display: block; }
.mic-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gray-300);
  background: transparent;
  color: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
}
.mic-btn:hover { background: var(--gray-200); }
.mic-btn.recording { background: var(--danger); border-color: var(--danger); color: white; animation: pulse .8s infinite alternate; }

/* Download app button */
.download-card {
  border: 1px solid var(--gray-300);
  border-radius: 16px;
  padding: 20px;
  background: var(--gray-100);
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.download-card b { font-size: 15px; }
.download-card small { color: var(--gray-500); }
.pwa-btn {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  border: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.pwa-btn:disabled { opacity: .5; cursor: default; }


/* ---------- FIX: Fullscreen chat (remove white empty sections) ---------- */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--black);
}
html {
  height: 100%;
}
body {
  min-height: 100%;
  margin: 0;
}
.chat-page {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  min-height: 100dvh;
  background: var(--black);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
.chat-page .topbar,
.chat-page .mode-bar,
.chat-page .composer,
.chat-page .fileNotice {
  width: 100%;
  max-width: 100%;
}
.chat {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  background: var(--black);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.composer {
  width: 100%;
  max-width: 100%;
  background: var(--black);
  border-top: 1px solid var(--gray-300);
}
/* Remove any white containers that might leak */
.chat-page * {
  max-width: 100%;
}
.chat-page .bubble {
  max-width: 82%;
}
@media (max-width: 640px) {
  .chat-page .bubble { max-width: 88%; }
}
/* Ensure no horizontal scroll */
.chat-page {
  box-sizing: border-box;
}

/* ---------- FIX: Compact flashcard (orange rectangle) ---------- */
.mode-bar {
  padding: 6px 12px;
  gap: 8px;
  min-height: 36px;
}
.mode-bar .mode-badge {
  font-size: 10px;
  padding: 3px 8px;
  margin-bottom: 0;
}
.mode-bar .muted {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .mode-bar .muted { display: none; } /* hide long hint on mobile, keep badge compact */
  .mode-bar { padding: 6px 12px; }
}
/* Flashcard generation result - compact */
.flash-gen-card {
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 12px;
  background: var(--gray-100);
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  font-size: 13px;
}
.flash-gen-card b { font-size: 13px; }
.flash-gen-card .btn { padding: 8px 14px; font-size: 12px; }

/* ---------- FIX: Homepage download app visibility ---------- */
.download-card {
  border: 1.5px solid var(--white);
  background: var(--white);
  color: var(--black);
}
.download-card b { color: var(--black); }
.download-card small { color: #525252; }
.download-card .pwa-btn {
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--black);
}
.download-card .pwa-btn:hover { background: #222; }

/* Ensure homepage not constrained */
.hero, .section {
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
}

