/* ──────────────────────────────────────────────────────
   CLYA — Design System
   Notion structure · Duolingo warmth · Fraunces + DM Sans
────────────────────────────────────────────────────── */

:root {
  /* ── Colour layers ─────────────────────────────────── */
  --bg:              #EDE9E1;   /* page background */
  --bg-2:            #E5E0D7;
  --surface:         #F5F2EC;   /* cards — visibly lighter than bg */
  --surface-2:       #EDEAE3;   /* inputs, secondary cards */
  --surface-raised:  #F8F6F1;   /* dropdowns, tooltips */
  --border:          #D8D2C8;
  --border-strong:   #C4BDB1;
  --text:            #1c1917;
  --text-2:          #3d3935;
  --muted:           #78716c;
  --muted-light:     #a8a29e;

  --green:           #2d5a27;
  --green-hover:     #234a1e;
  --green-light:     #e2ede0;
  --green-mid:       #4a7c43;

  --amber:           #b45309;
  --amber-light:     #fef3c7;
  --amber-mid:       #d97706;

  --red:             #b91c1c;
  --red-light:       #fde8e8;
  --teal:            #0d9488;
  --teal-light:      #e6f9f7;
  --fire:            #ea580c;
  --fire-light:      #fff2e8;

  /* ── Radii ─────────────────────────────────────────── */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* ── Shadows ───────────────────────────────────────── */
  --shadow-sm: 0 1px 3px rgba(28,25,23,.08), 0 1px 2px rgba(28,25,23,.05);
  --shadow-md: 0 4px 12px rgba(28,25,23,.10), 0 2px 4px rgba(28,25,23,.06);
  --shadow-lg: 0 8px 24px rgba(28,25,23,.12), 0 4px 8px rgba(28,25,23,.06);
  --shadow-green: 0 0 0 3px rgba(45,90,39,.15);

  /* ── Typography scale ──────────────────────────────── */
  --text-hero:     40px;
  --text-page:     28px;
  --text-section:  20px;
  --text-question: 22px;
  --text-body:     15px;
  --text-small:    13px;
  --text-label:    11px;

  /* ── Spacing (8px grid) ────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --header-h: 60px;

  /* ── Legacy aliases (JS-generated HTML) ─────────────── */
  --accent:        var(--green);
  --accent-hover:  var(--green-hover);
  --accent-light:  var(--green-light);
  --surface2:      var(--surface-2);
  --radius:        var(--r-md);
  --radius-sm:     var(--r-sm);
  --shadow:        var(--shadow-sm);
  --correct:       var(--teal);
  --correct-light: var(--teal-light);
  --wrong:         var(--red);
  --wrong-light:   var(--red-light);
  --partial:       #92400e;
  --partial-light: #fef3c7;
  --gold:          var(--amber);
  --gold-light:    var(--amber-light);
  --danger:        var(--red);
  --danger-light:  var(--red-light);
}

/* ── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── BASE ────────────────────────────────────────────── */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── AUTH ────────────────────────────────────────────── */
#authScreen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--bg);
}
.auth-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); padding: 36px 32px;
  max-width: 380px; width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
}
.auth-card .logo { text-align: center; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--muted); font-size: 14px; margin-top: -4px; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; gap: 4px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; background: transparent;
  border-radius: calc(var(--r-md) - 2px);
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; color: var(--muted); transition: all .15s;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  outline: none; background: var(--surface-2); color: var(--text); transition: all .15s;
}
.auth-form input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }
.auth-message { font-size: 13px; text-align: center; min-height: 18px; color: var(--muted); }
.auth-message--error { color: var(--red); }
.auth-message--success { color: var(--teal); }
.auth-hint { font-size: 12px; margin-top: -4px; min-height: 16px; }
.auth-hint--error { color: var(--red); }
.auth-hint--ok { color: var(--teal); }

/* ── APP SHELL ───────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1.5px solid var(--border);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.header-nav { display: flex; align-items: center; gap: 8px; }

/* ── MYELO LOGO ──────────────────────────────────────── */
.logo-wrap {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.logo-mark { display: block; flex-shrink: 0; }
.logo-word {
  font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700;
  color: var(--text); letter-spacing: -0.4px;
}

/* Auth screen brand */
.auth-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 4px;
}
.auth-brand-mark { display: block; }
.auth-brand-name {
  font-family: 'Syne', sans-serif; font-size: 52px; font-weight: 800;
  color: var(--text); letter-spacing: -1.5px;
}

/* Legacy .logo kept for JS-generated HTML that still uses it */
.logo { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo .dot { color: var(--green); }

.stat-pill {
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-full); padding: 7px 14px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
  min-height: 40px; font-family: 'JetBrains Mono', monospace;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06), var(--shadow-sm);
}
.stat-pill.pill-fire {
  background: var(--fire-light); border-color: #fed7aa; color: var(--fire);
}
.stat-pill.pill-fire .pill-emoji { animation: firePulse 3s ease-in-out infinite; }
@keyframes firePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.stat-pill.pill-xp  { background: var(--amber-light); border-color: #fde68a; color: var(--amber); }

.profile-nav-btn {
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-full); padding: 5px 12px 5px 7px;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all .15s; flex-shrink: 0; max-width: 150px;
}
.profile-nav-btn:hover { background: var(--green-light); border-color: var(--green); }
#profileNavEmoji { font-size: 18px; line-height: 1; flex-shrink: 0; }
.header-username {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px;
}

.nav-pill-btn {
  background: transparent; border: 1.5px solid var(--border);
  border-radius: var(--r-full); padding: 5px 14px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all .15s;
}
.nav-pill-btn:hover { background: var(--surface-2); color: var(--text); }

.screens-wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 96px; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: var(--r-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, opacity 120ms ease;
  white-space: nowrap; min-height: 44px;
  position: relative; overflow: hidden;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97) !important; transition-duration: 80ms; }

/* Ripple effect */
.btn .ripple {
  position: absolute; border-radius: 50%;
  transform: scale(0); animation: btnRipple .5s linear;
  background: rgba(255,255,255,.35); pointer-events: none;
}
@keyframes btnRipple { to { transform: scale(4); opacity: 0; } }

.btn.primary { background: var(--green); color: #fff; box-shadow: 0 1px 3px rgba(45,90,39,.25); }
.btn.primary:hover:not(:disabled) { background: var(--green-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,90,39,.3); }

.btn.secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn.danger { background: var(--red-light); color: var(--red); border: 1.5px solid #f5abab; }
.btn.ghost { background: transparent; color: var(--muted); padding: 9px 12px; min-height: auto; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); border-radius: var(--r-md); }

.btn-full { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn {
  background: none; border: none; color: var(--green); cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: inherit; font-weight: 600;
  padding: 0; text-decoration: underline; text-underline-offset: 2px;
}

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: var(--space-5);
  box-shadow: var(--shadow-md);
}
.card-heading {
  font-family: 'Fraunces', serif; font-size: var(--text-section); font-weight: 700;
  margin-bottom: var(--space-4); letter-spacing: -0.2px;
}

/* ── FORMS ───────────────────────────────────────────── */
.text-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  outline: none; background: var(--surface-2); color: var(--text); transition: all .15s;
}
.text-input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }
.textarea { resize: vertical; }
.field-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; display: block;
}
.section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); display: block; margin-bottom: 12px;
}
.select-input {
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 28px 7px 12px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  background: var(--surface); color: var(--text); outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2378716c' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.divider-or {
  text-align: center; color: var(--muted-light); font-size: 13px; margin: 16px 0; position: relative;
}
.divider-or::before, .divider-or::after {
  content: ''; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--border);
}
.divider-or::before { left: 0; } .divider-or::after { right: 0; }

/* ── STATUS ──────────────────────────────────────────── */
.status-area { font-size: 13px; margin-top: 10px; min-height: 18px; }
.status-area.loading { color: var(--muted); }
.status-area.success { color: var(--teal); }
.status-area.error   { color: var(--red); }
.loading-text { color: var(--muted); font-size: 14px; padding: 16px 0; }

/* ── SCREEN STRUCTURE ────────────────────────────────── */
.screen-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.screen-title {
  font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
}
.back-btn { flex-shrink: 0; }
.study-meta-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topic-badge {
  background: var(--green-light); color: var(--green);
  border-radius: var(--r-full); padding: 4px 12px; font-size: 12px; font-weight: 600;
}
.mode-badge {
  background: var(--amber-light); color: var(--amber);
  border-radius: var(--r-full); padding: 4px 12px; font-size: 12px; font-weight: 600;
}
.empty-state {
  text-align: center; color: var(--muted); font-size: 14px;
  padding: 40px 24px; border: 2px dashed var(--border); border-radius: var(--r-lg);
}
.empty-state h3 { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── HOME ────────────────────────────────────────────── */
.home-section { margin-bottom: 40px; }
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.section-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.section-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── TOPICS GRID ─────────────────────────────────────── */
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.topic-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 18px 18px 16px; cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  display: flex; align-items: center; gap: 14px;
  border-left: 4px solid transparent; will-change: transform;
  box-shadow: var(--shadow-md);
  opacity: 0; animation: cardEnter .35s ease forwards;
}
.topic-card:hover { border-color: var(--green); border-left-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.topic-card:active { transform: translateY(0) scale(.99); }
.topic-card.selected { border-color: var(--green); border-left-color: var(--green); background: var(--green-light); }
@keyframes cardEnter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.topic-emoji { flex-shrink: 0; display: flex; align-items: center; }
.topic-card-body { flex: 1; min-width: 0; }
.topic-name {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.1px;
}
.topic-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.topic-no-content { color: var(--amber); font-weight: 600; }
.topic-mastery { font-size: 13px; font-weight: 600; color: var(--green); flex-shrink: 0; }

/* Topic empty state */
.topic-empty-card { text-align: center; padding: 24px; }
.topic-empty-icon { font-size: 36px; margin-bottom: 10px; }
.topic-empty-title { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.topic-empty-msg { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── UPLOAD ZONES ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--r-md);
  padding: 24px 16px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; cursor: pointer;
  transition: all .2s; text-align: center; color: var(--muted); background: var(--surface-2);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--green); background: var(--green-light); color: var(--green); }
.upload-icon { font-size: 32px; }
.upload-sub { font-size: 12px; color: var(--muted-light); }
.files-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.file-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 7px 10px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border);
}
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status { color: var(--muted); flex-shrink: 0; }

/* ── EMOJI PICKER ────────────────────────────────────── */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.emoji-btn { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 5px; cursor: pointer; transition: all .15s; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.emoji-btn:hover { border-color: var(--green); transform: scale(1.08); }
.emoji-btn.active { border-color: var(--green); background: var(--green-light); box-shadow: 0 0 0 2px var(--green); }
.emoji-custom-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.emoji-preview { display: inline-flex; align-items: center; }
.emoji-input { width: 80px; text-align: center; }

/* ── CHUNKS ──────────────────────────────────────────── */
.chunks-container { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.chunk-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm); cursor: pointer; transition: all .15s; }
.chunk-item.selected { border-color: var(--green); background: var(--green-light); }
.chunk-checkbox { margin-top: 2px; accent-color: var(--green); flex-shrink: 0; width: 16px; height: 16px; }
.chunk-body { flex: 1; min-width: 0; }
.chunk-source { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.chunk-preview { font-size: 13px; line-height: 1.5; color: var(--text); }
.step2-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.step2-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ── TOPIC DETAIL ────────────────────────────────────── */
.topic-detail-hero { margin-bottom: 0; }
.topic-detail-title { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.hero-emoji { display: flex; align-items: center; flex-shrink: 0; }
.hero-name { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.hero-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.mastery-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.mastery-bar { flex: 1; height: 7px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.mastery-bar > div { height: 100%; background: var(--green); border-radius: var(--r-full); transition: width .6s ease-out; }
.mastery-pct { font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--green); min-width: 40px; text-align: right; }
.category-list { display: flex; flex-direction: column; gap: 8px; }
.category-pill { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--border); }
.category-name { font-weight: 600; font-size: 14px; }
.category-count { font-size: 12px; color: var(--muted); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.mode-card { padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; text-align: left; transition: all .15s; font-family: 'DM Sans', sans-serif; }
.mode-card:hover, .mode-card.active { border-color: var(--green); background: var(--green-light); }
.mode-label { font-weight: 700; font-size: 14px; }
.mode-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.session-opts { margin-top: 4px; font-size: 14px; color: var(--muted); }
.session-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.session-row:last-child { border-bottom: none; }
.session-mode { background: var(--amber-light); color: var(--amber); border-radius: var(--r-full); padding: 2px 9px; font-size: 11px; font-weight: 600; }
.session-score { font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.session-date { margin-left: auto; color: var(--muted); }

/* ── PROGRESS BAR ────────────────────────────────────── */
.progress-bar-wrap { margin-bottom: 20px; }
.progress-bar { height: 7px; background: var(--border); border-radius: var(--r-full); overflow: hidden; margin-bottom: 8px; }
.progress-bar > div { height: 100%; background: var(--green); border-radius: var(--r-full); transition: width .8s cubic-bezier(.4,0,.2,1); width: 0%; will-change: width; }
.progress-stats { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--muted); }

/* ── STUDY CARDS ─────────────────────────────────────── */
#studyCardContainer { display: flex; flex-direction: column; gap: 14px; }
.study-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-md);
  animation: slideInRight .22s cubic-bezier(.4,0,.2,1);
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
.study-card.answer-correct { border-color: #6ee7b7; background: #e8faf5; animation: correctPulse .3s ease; }
.study-card.answer-wrong { animation: wrongShake .4s ease; border-color: #f5abab; background: #fff0f0; }
@keyframes correctPulse { 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.015) } }
@keyframes wrongShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

.breadcrumb { font-size: 12px; color: var(--muted-light); margin-bottom: 12px; font-weight: 500; }
.fact-block { background: var(--surface-2); border-left: 3px solid var(--green); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 14px 16px; font-size: 14px; line-height: 1.75; margin-bottom: 14px; }
.analogy-block { background: #FEF3C7; border-left: 3px solid var(--amber-mid); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 14px 16px; font-size: 13px; margin-bottom: 16px; color: #7c3a00; line-height: 1.6; }
.analogy-block::before { content: '💡 '; }
.question-text { font-family: 'Fraunces', serif; font-weight: 700; font-size: var(--text-question); margin-bottom: var(--space-4); line-height: 1.4; letter-spacing: -0.2px; color: var(--text); }
.drill-input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none; transition: all .15s; margin-bottom: 12px; resize: vertical; background: var(--surface-2); color: var(--text); }
.drill-input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }

/* Feedback */
.feedback { border-radius: var(--r-md); padding: 14px 16px; font-size: 14px; margin-top: 12px; line-height: 1.6; }
.feedback.correct { background: var(--teal-light); color: var(--teal); border: 1.5px solid #6ee7b7; }
.feedback.wrong   { background: #FDDCDC;  color: var(--red);  border: 1.5px solid #F5ABAB; }
.feedback.partial { background: var(--amber-light); color: var(--amber); border: 1.5px solid #fcd34d; }
.feedback.grading { background: var(--surface-2); color: var(--muted); }
.hint-block { background: #f0fdf4; border-left: 3px solid var(--green); padding: 11px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 13px; color: var(--green); margin-top: 10px; }
.misconception-block { background: var(--red-light); border-left: 3px solid #fca5a5; padding: 11px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 13px; color: var(--red); margin-top: 10px; }
.related-block { font-size: 13px; color: var(--muted); margin-top: 10px; }
.lockin-box { background: var(--amber-light); border: 1.5px solid #fcd34d; border-radius: var(--r-md); padding: 14px 16px; margin-top: 12px; font-size: 13px; }
.lockin-box strong { color: var(--amber); }
.lockin-textarea { width: 100%; border: 1.5px solid #fcd34d; border-radius: var(--r-sm); padding: 9px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px; margin-top: 8px; resize: vertical; outline: none; background: #fffbeb; }

/* Category cards */
.category-intro-card { text-align: center; padding: 36px 24px; }
.category-intro-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.category-intro-title { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; }
.category-intro-meta { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.category-summary-card { padding: 24px; }
.summary-concepts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.summary-concept { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 14px; border: 1px solid var(--border); }
.related-tag { font-size: 12px; color: var(--muted); }
.knowledge-map-card { padding: 24px; }
.km-category { margin-bottom: 18px; }
.km-cat-name { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--green); font-family: 'Fraunces', serif; }
.km-concepts { display: flex; flex-wrap: wrap; gap: 6px; }
.km-concept { background: var(--green-light); color: var(--green); border-radius: var(--r-full); padding: 3px 11px; font-size: 12px; font-weight: 600; }

/* MCQ */
.mcq-opt { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--r-md); cursor: pointer; font-size: 14px; transition: all .15s; background: var(--surface); margin-bottom: 8px; }
.mcq-opt:hover { border-color: var(--green); background: var(--green-light); }
.mcq-opt.correct { border-color: #6ee7b7; background: var(--teal-light); color: var(--teal); }
.mcq-opt.wrong   { border-color: #fca5a5; background: var(--red-light);  color: var(--red); }
.opt-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }

/* Flashcard */
.flashcard { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 36px 24px; text-align: center; cursor: pointer; min-height: 160px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; transition: all .2s; will-change: transform; }
.flashcard:hover { background: var(--green-light); border-color: var(--green); transform: translateY(-2px); }
.flashcard.flipped { background: var(--teal-light); border-color: #6ee7b7; cursor: default; }
.flash-q { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; letter-spacing: -0.1px; }
.flash-hint { font-size: 12px; color: var(--muted-light); margin-top: 6px; }
.flash-bullets { list-style: none; padding: 0; margin: 12px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.flash-bullets li { background: var(--green-light); color: var(--green); border-radius: var(--r-full); padding: 3px 11px; font-size: 13px; font-weight: 600; }
.flash-explanation { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Done screen */
.done-screen { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 48px 28px; text-align: center; }
.done-screen h2 { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.4px; }
.done-score { font-family: 'JetBrains Mono', monospace; font-size: 56px; font-weight: 600; color: var(--green); margin: 16px 0; letter-spacing: -2px; }
.done-screen p { color: var(--muted); margin-bottom: 24px; }

/* ── XP FLOAT ────────────────────────────────────────── */
.xp-float {
  position: fixed; pointer-events: none; z-index: 300;
  font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700;
  color: var(--green); background: var(--green-light);
  border: 1.5px solid var(--green); border-radius: var(--r-full);
  padding: 5px 14px;
  box-shadow: 0 0 12px rgba(45,90,39,.28), var(--shadow-sm);
  animation: xpFloatUp .85s ease-out forwards;
}
@keyframes xpFloatUp { 0%{ opacity: 1; transform: translateY(0) scale(1); } 30%{ opacity: 1; transform: translateY(-16px) scale(1.05); } 100%{ opacity: 0; transform: translateY(-52px) scale(.9); } }

/* ── SECTION TRANSITIONS ─────────────────────────────── */
.app-section { animation: sectionFadeIn .18s ease; }
@keyframes sectionFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── BIG STREAK ANIMATION ────────────────────────────── */
.streak-big-overlay {
  position: fixed; inset: 0; z-index: 700;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28,25,23,.45); backdrop-filter: blur(3px);
  animation: sboIn .3s cubic-bezier(.4,0,.2,1);
}
.streak-big-overlay.sbo-out {
  animation: sboOut .5s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes sboIn  { from { opacity:0; } to { opacity:1; } }
@keyframes sboOut { to   { opacity:0; } }
.sbo-inner {
  text-align: center;
  animation: sboPop .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes sboPop { from { transform:scale(.4); opacity:0; } to { transform:scale(1); opacity:1; } }
.sbo-fire   { font-size: 72px; line-height: 1; margin-bottom: 8px; animation: sboFire .4s ease .15s both; }
@keyframes sboFire { from { transform:scale(.5) rotate(-20deg); } to { transform:scale(1) rotate(0); } }
.sbo-number { font-family: 'Fraunces', serif; font-size: 96px; font-weight: 700; color: #fff; line-height: 1; letter-spacing: -4px; text-shadow: 0 4px 24px rgba(0,0,0,.4); }
.sbo-label  { font-size: 22px; font-weight: 600; color: rgba(255,255,255,.85); margin-top: 6px; letter-spacing: -.3px; }

/* ── STREAK MILESTONE BANNER ─────────────────────────── */
.streak-milestone-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  background: linear-gradient(135deg, var(--fire) 0%, #ea580c 100%);
  color: #fff; text-align: center;
  padding: 16px 24px;
  font-family: 'Fraunces', serif; font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 20px rgba(234,88,12,.4);
  transform: translateY(-100%);
  animation: bannerSlideDown .4s cubic-bezier(.4,0,.2,1) forwards, bannerSlideUp .4s cubic-bezier(.4,0,.2,1) 3s forwards;
}
@keyframes bannerSlideDown { to { transform: translateY(0); } }
@keyframes bannerSlideUp { to { transform: translateY(-100%); } }

/* ── CONFETTI ────────────────────────────────────────── */
.confetti-piece {
  position: fixed; top: -10px; pointer-events: none; z-index: 400;
  width: 8px; height: 8px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── EMPTY STATE NEURAL PATTERN ──────────────────────── */
.empty-state {
  text-align: center; color: var(--muted); font-size: 14px;
  padding: 40px 24px; border: 2px dashed var(--border); border-radius: var(--r-lg);
  position: relative; overflow: hidden;
}
.empty-state::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23C4BDB1' stroke-width='1' opacity='0.4'%3E%3Ccircle cx='100' cy='100' r='3'/%3E%3Ccircle cx='40' cy='60' r='2'/%3E%3Ccircle cx='160' cy='80' r='2'/%3E%3Ccircle cx='70' cy='150' r='2'/%3E%3Ccircle cx='140' cy='140' r='2'/%3E%3Cline x1='100' y1='100' x2='40' y2='60'/%3E%3Cline x1='100' y1='100' x2='160' y2='80'/%3E%3Cline x1='100' y1='100' x2='70' y2='150'/%3E%3Cline x1='100' y1='100' x2='140' y2='140'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: .15;
  pointer-events: none;
}
.empty-state h3 { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; position: relative; }

/* Loading shimmer with green tint */
.loading-text::after {
  content: '';
  display: block; height: 14px; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--surface-2) 25%, #d8f0d3 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite; margin-top: 8px; width: 60%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── MATH ────────────────────────────────────────────── */
.math-section { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.math-problem-input { font-size: 15px; line-height: 1.6; }
.math-input-row { display: flex; gap: 10px; margin-top: 12px; }
.math-img-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.img-question-picker { display: flex; flex-direction: column; gap: 6px; }
.img-q-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm); cursor: pointer; font-size: 14px; transition: all .15s; }
.img-q-item:hover { border-color: var(--green); background: var(--green-light); }
.img-q-num { background: var(--green); color: #fff; border-radius: 5px; padding: 1px 7px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.img-q-text { color: var(--text); }
.math-symbol-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.math-sym-btn { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 5px 12px; font-size: 15px; font-family: 'JetBrains Mono', monospace; cursor: pointer; transition: all .15s; line-height: 1; }
.math-sym-btn:hover { background: var(--green-light); border-color: var(--green); }

/* ── MATH TUTOR LAYOUT ───────────────────────────────── */
.math-screen { padding: 0 !important; }
.math-tutor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: calc(100vh - var(--header-h)); overflow: hidden; }
.tutor-panel { display: flex; flex-direction: column; gap: 14px; padding: 22px 18px 22px 22px; overflow-y: auto; border-right: 1.5px solid var(--border); }
.tutor-header { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tutor-step-card { flex-shrink: 0; }
.tutor-problem-banner { background: var(--surface-2); border: 1.5px solid var(--border); border-left: 4px solid var(--green); border-radius: var(--r-sm); padding: 14px 16px; flex-shrink: 0; }
.problem-banner-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--green); display: block; margin-bottom: 5px; }
.problem-banner-text { font-size: 14px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.step-number { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.step-title { font-family: 'Fraunces', serif; font-size: 21px; font-weight: 600; margin-bottom: 12px; letter-spacing: -0.2px; }
.step-maths { font-family: 'JetBrains Mono', monospace; font-size: 15px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); padding: 14px 16px; margin-bottom: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.step-why { font-size: 14px; color: var(--muted); line-height: 1.65; }
.tutor-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tutor-hint-card { background: var(--amber-light); border-color: #fcd34d; flex-shrink: 0; }
.hint-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--amber); margin-bottom: 6px; }
.final-answer-box { background: var(--teal-light); border: 2px solid #6ee7b7; border-radius: var(--r-lg); padding: 22px; margin-bottom: 0; }
.final-answer-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); margin-bottom: 6px; }
.final-answer-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 600; color: var(--teal); }
.practice-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; transition: color .15s; }
.practice-item:last-child { border-bottom: none; }
.practice-item:hover { color: var(--green); }
.practice-diff { border-radius: var(--r-full); padding: 2px 9px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.practice-diff.easy   { background: var(--teal-light);  color: var(--teal); }
.practice-diff.medium { background: var(--amber-light); color: var(--amber); }
.practice-diff.hard   { background: var(--red-light);   color: var(--red); }
.canvas-panel { display: flex; flex-direction: column; padding: 16px; background: #faf9f7; }
.canvas-panel-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-shrink: 0; }
.canvas-tool.active { background: var(--green-light); color: var(--green); border-color: var(--green); }
#mathCanvas { flex: 1; width: 100%; display: block; border: 1.5px solid var(--border); border-radius: var(--r-sm); background: #fff; cursor: crosshair; touch-action: none; }
.hint-status { font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 16px; }
.hint-steps-area { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.hint-steps-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hint-step-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hint-steps-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.hint-step-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); line-height: 1.6; animation: fadeInStep .3s ease; }
.hint-step-num { background: var(--green-light); color: var(--green); border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
@keyframes fadeInStep { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.solution-steps { display: flex; flex-direction: column; gap: 8px; }
.solution-step { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.solution-step:last-child { border-bottom: none; }
.step-num { background: var(--green-light); color: var(--green); border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* ── HOME PODS WIDGET ────────────────────────────────── */
.pods-home-section { background: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; color: inherit !important; }
.pods-home-section .section-title { color: var(--text) !important; }
.pods-home-section .section-sub   { color: var(--muted) !important; }
.pods-home-section .btn.secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }

/* Empty state */
.phw-empty { text-align: center; padding: 36px 24px; border: 2px dashed var(--border); border-radius: var(--r-lg); }
.phw-empty-icon    { margin-bottom: 12px; display: flex; justify-content: center; }
.phw-empty-heading { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.phw-empty-sub     { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* Pod card */
.phw-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  margin-bottom: 12px; cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  will-change: transform; box-shadow: var(--shadow-sm);
}
.phw-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--border-strong); }
.phw-card:last-child { margin-bottom: 0; }

/* Coloured header band */
.phw-head { padding: 16px 18px 14px; color: #fff; }
.phw-head-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.phw-name {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 18px;
  line-height: 1.25; letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.phw-streak-badge {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
  background: rgba(0,0,0,.18); border-radius: var(--r-full);
  padding: 3px 10px; white-space: nowrap; flex-shrink: 0;
}

/* Overlapping avatar circles */
.phw-avc-stack { display: flex; align-items: center; }
.phw-avc {
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; position: relative; flex-shrink: 0;
}
.phw-avc + .phw-avc { margin-left: -9px; }
.phw-avc-more { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.9); background: rgba(0,0,0,.2); }

/* Card body */
.phw-body { padding: 16px 18px 18px; }
.phw-prog-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px;
}
.phw-prog-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.phw-prog-pct   { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; }
.phw-progress-bar  { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; margin-bottom: 14px; }
.phw-progress-fill { height: 100%; border-radius: var(--r-full); transition: width .5s ease; }
.phw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Status pills */
.phw-sp { font-size: 12px; font-weight: 600; border-radius: var(--r-full); padding: 5px 12px; white-space: nowrap; }
.phw-sp-done     { background: var(--teal-light);  color: var(--teal); }
.phw-sp-risk     { background: var(--fire-light);  color: var(--fire); }
.phw-sp-progress { background: var(--amber-light); color: var(--amber); }
.phw-sp-idle     { background: var(--surface-2);   color: var(--muted); }

/* Study now button */
.phw-study-btn {
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
  color: #fff; border: none; border-radius: var(--r-md);
  padding: 8px 16px; cursor: pointer; transition: all .15s;
  white-space: nowrap; flex-shrink: 0; min-height: 36px;
}
.phw-study-btn:hover { opacity: .88; transform: translateY(-1px); }
.phw-done-check { font-size: 20px; color: var(--teal); }

/* legacy pod-home-card */
.pod-home-card { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; margin-bottom: 8px; transition: all .15s; }
.pod-home-card:last-child { margin-bottom: 0; }
.pod-home-card.phc-done     { background: var(--teal-light);  border-color: #6ee7b7; }
.pod-home-card.phc-urgent   { background: var(--red-light);   border-color: #fca5a5; animation: urgentPulse 2s ease-in-out infinite; }
.pod-home-card.phc-progress { background: var(--amber-light); border-color: #fcd34d; }
@keyframes urgentPulse { 0%,100%{border-color:#fca5a5} 50%{border-color:#ef4444;box-shadow:0 0 0 3px rgba(239,68,68,.2)} }
.phc-streak { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); min-width: 36px; line-height: 1.4; }
.phc-body { flex: 1; min-width: 0; }
.phc-name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.phc-bar  { height: 4px; background: var(--border); border-radius: var(--r-full); overflow: hidden; margin-top: 6px; }
.phc-fill { height: 100%; background: var(--green); border-radius: var(--r-full); transition: width .4s; }
.phc-btn  { flex-shrink: 0; font-size: 13px; }
.pods-home-empty { text-align: center; padding: 16px 0; }
.pods-empty-text { font-size: 14px; color: var(--muted); }

/* ── PODS v2 ─────────────────────────────────────────── */
.pod-list-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 18px; cursor: pointer; display: flex; align-items: center; gap: 14px; margin-bottom: 12px; transition: border-color .15s, box-shadow .15s, transform .15s, background .1s; }
.pod-list-card:hover { border-color: var(--green); box-shadow: var(--shadow-md); transform: translateY(-2px); background: color-mix(in srgb, var(--green) 4%, var(--surface)); }
.pod-list-card:active { transform: translateY(0); box-shadow: none; background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.pod-list-streak { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 48px; }
.pls-num { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; line-height: 1; }
.pod-list-body { flex: 1; min-width: 0; }
.pod-list-name { font-family: 'Fraunces', serif; font-weight: 700; font-size: 16px; letter-spacing: -0.1px; }
.pod-list-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pod-list-progress { font-size: 12px; color: var(--green); margin-top: 5px; font-weight: 600; }
.pod-list-arrow { color: var(--muted-light); flex-shrink: 0; display: flex; align-items: center; }

/* Dashboard header */
.pod-dash-header { border-radius: var(--r-lg); padding: 18px 22px 22px; margin-bottom: 0; color: #fff; }
.pdh-top { display: flex; align-items: flex-start; gap: 10px; }
.pdh-back { color: rgba(255,255,255,.9) !important; background: rgba(255,255,255,.15) !important; flex-shrink: 0; margin-top: 2px; }
.pdh-back:hover { background: rgba(255,255,255,.25) !important; }
.pdh-title { flex: 1; min-width: 0; }
.pdh-title h2 { color: #fff; font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.pdh-subject { color: rgba(255,255,255,.8); font-size: 13px; margin-top: 2px; }
.pdh-code-block { text-align: right; flex-shrink: 0; }
.pdh-code-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.65); margin-bottom: 5px; }
.pdh-code-row { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.pdh-code-value { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; letter-spacing: 3px; color: #fff; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: var(--r-sm); padding: 5px 11px; }
.pdh-copy-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); border-radius: var(--r-sm); padding: 5px 9px; font-size: 14px; cursor: pointer; color: #fff; transition: background .15s; }
.pdh-copy-btn:hover { background: rgba(255,255,255,.3); }

/* Streak hero */
.pod-streak-hero { text-align: center; padding: 24px 20px; margin: 0 0 16px; }
.pod-streak-number { display: flex; align-items: center; justify-content: center; gap: 8px; line-height: 1; }
.pod-streak-label { font-size: 14px; color: var(--muted); margin-top: 6px; }
.pod-countdown { font-size: 12px; color: var(--muted-light); margin-top: 8px; font-family: 'JetBrains Mono', monospace; }

/* Warnings */
.pod-warning { background: var(--amber-light); border: 1.5px solid #fcd34d; border-radius: var(--r-md); padding: 12px 16px; font-size: 14px; font-weight: 500; color: #78350f; margin-bottom: 16px; }
.pod-warning.urgent { background: var(--red-light); border-color: #fca5a5; color: var(--red); }
.pod-all-done { background: var(--teal-light); border: 1.5px solid #6ee7b7; border-radius: var(--r-md); padding: 12px 16px; font-size: 14px; font-weight: 500; color: var(--teal); margin-bottom: 16px; }

/* Member cards */
.member-cards-grid { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.member-card {
  background: var(--surface); border: 1.5px solid var(--border); border-left: 4px solid transparent;
  border-radius: var(--r-md); padding: 14px 16px 14px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: all .15s; will-change: transform;
}
.member-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.member-card.done        { border-color: #6ee7b7; border-left-color: var(--teal); background: var(--teal-light); }
.member-card.in-progress { border-color: #93c5fd; border-left-color: #3b82f6; background: #eff6ff; }
.member-card.at-risk     { border-color: #fca5a5; border-left-color: var(--red);  background: var(--red-light); }
.member-initial-avatar { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex-shrink: 0; transition: transform .2s; }
.member-card:hover .member-initial-avatar { transform: scale(1.06); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-family: 'Fraunces', serif; font-weight: 700; font-size: 15px; letter-spacing: -0.1px; }
.member-streak-sm { font-size: 12px; color: var(--muted); margin-top: 2px; }
.member-progress-track { height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; margin-top: 8px; }
.member-progress-fill { height: 100%; border-radius: var(--r-full); transition: width .5s ease; }
.member-you-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--green-light); color: var(--green); border-radius: 10px; padding: 1px 7px; margin-left: 5px; vertical-align: middle; }
.member-right-col { flex-shrink: 0; text-align: right; }
.msl { font-size: 12px; font-weight: 600; border-radius: var(--r-full); padding: 3px 10px; white-space: nowrap; }
.msl-done     { background: var(--teal-light);  color: var(--teal); }
.msl-progress { background: #dbeafe; color: #1d4ed8; }
.msl-risk     { background: var(--red-light);   color: var(--red); }
.msl-idle     { background: var(--surface-2);   color: var(--muted); }

/* member card compat */
.member-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.member-info-old { flex: 0 0 90px; }
.member-mins-label { font-size: 11px; color: var(--muted); min-width: 30px; text-align: right; }
.member-status-icon { font-size: 16px; flex-shrink: 0; }

/* Start session */
.pod-start-wrap { margin: 4px 0 16px; }
.pod-start-btn { padding: 16px !important; font-size: 16px !important; display: flex !important; flex-direction: column; gap: 3px; height: auto !important; }
.pod-start-sub { font-size: 11px; font-weight: 400; opacity: .8; letter-spacing: .02em; }

/* Tabs */
.pod-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; gap: 0; }
.pod-tab { padding: 11px 18px; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; background: none; border: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.pod-tab:hover { color: var(--text); }
.pod-tab.active { color: var(--green); border-bottom-color: var(--green); }
.pod-tab-content { min-height: 200px; }

/* Activity */
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 18px; flex-shrink: 0; }
.activity-body { flex: 1; }
.activity-time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* Topics tab */
.pod-topic-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.pod-topic-item:last-child { border-bottom: none; }
.pod-topic-info { flex: 1; font-size: 14px; }
.pod-upload-area { background: var(--surface-2); border-radius: var(--r-md); padding: 16px; }
.pod-upload-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* Leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface); border-radius: var(--r-md); font-size: 14px; border: 1px solid var(--border); }
.lb-rank { font-weight: 700; width: 24px; color: var(--muted); text-align: center; font-family: 'JetBrains Mono', monospace; }
.lb-rank.gold   { color: var(--amber); }
.lb-rank.silver { color: #6b7280; }
.lb-rank.bronze { color: #92400e; }
.lb-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.lb-info { flex: 1; }
.lb-name   { font-weight: 600; font-family: 'Fraunces', serif; font-size: 15px; }
.lb-streak { font-size: 12px; color: var(--muted); }
.lb-xp     { font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--amber); }

/* Confetti */
.confetti-piece { position: fixed; top: -12px; pointer-events: none; animation: confettiFall linear forwards; z-index: 500; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

/* ── MODALS ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(28,25,23,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--r-xl); padding: 28px;
  max-width: 480px; width: 100%; position: relative;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px;
  animation: modalIn .22s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.modal h3 { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.modal input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none; background: var(--surface-2); transition: all .15s; }
.modal input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 16px; cursor: pointer; color: var(--muted); border-radius: var(--r-sm); padding: 5px 9px; transition: all .15s; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-sub { font-size: 13px; color: var(--muted); margin: -6px 0 4px; }

/* ── TOAST ───────────────────────────────────────────── */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 22px; border-radius: var(--r-full); font-size: 14px; font-weight: 500; z-index: 200; animation: toastIn .2s ease; box-shadow: var(--shadow-lg); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── PERSISTENT TIMER ────────────────────────────────── */
.pod-persistent-timer { display: flex; align-items: center; gap: 12px; padding: 10px 22px 16px; margin-top: 2px; }
.ppt-label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.9); flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.ppt-track { flex: 1; height: 5px; background: rgba(255,255,255,.2); border-radius: var(--r-full); overflow: hidden; }
.ppt-fill  { height: 100%; border-radius: var(--r-full); transition: width 1s linear; will-change: transform; }
.pod-persistent-timer.ppt-done .ppt-label { color: #bbf7d0; }
.pod-timer-bar { display: flex; align-items: center; gap: 10px; background: var(--text); color: #fff; padding: 8px 18px; font-size: 13px; font-weight: 500; position: sticky; top: var(--header-h); z-index: 40; margin: -24px -20px 18px; }
.ptb-pod-name { flex-shrink: 0; font-size: 12px; opacity: .8; white-space: nowrap; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.ptb-track { flex: 1; height: 4px; background: rgba(255,255,255,.2); border-radius: var(--r-full); overflow: hidden; }
.ptb-fill  { height: 100%; background: var(--green-light); border-radius: var(--r-full); transition: width 1s linear; }
.ptb-time  { font-family: 'JetBrains Mono', monospace; font-weight: 600; flex-shrink: 0; }
.ptb-goal  { opacity: .6; font-size: 12px; flex-shrink: 0; }

/* ── CTA BANNER ──────────────────────────────────────── */
.pod-cta-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border: 1.5px solid var(--green); border-radius: var(--r-lg); padding: 18px 20px; margin: 14px 0; box-shadow: 0 2px 8px rgba(45,90,39,.1); }
.pod-cta-banner.pod-cta-progress { border-color: var(--amber-mid); }
.pod-cta-banner.pod-cta-done { border-color: #6ee7b7; background: var(--teal-light); color: var(--teal); font-weight: 600; justify-content: center; }
.pod-cta-text  { font-weight: 600; font-size: 14px; flex: 1; }
.pod-cta-start { flex-shrink: 0; white-space: nowrap; }

/* ── GETTING STARTED ─────────────────────────────────── */
.pod-getting-started { margin: 14px 0; text-align: left; }
.pod-gs-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.pod-gs-item { font-size: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.pod-gs-item:last-child { border-bottom: none; }
.pod-gs-item.checked { color: var(--muted); }
.pod-gs-code { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 13px; letter-spacing: 2px; background: var(--green-light); color: var(--green); border-radius: var(--r-sm); padding: 2px 9px; cursor: pointer; }
.pod-gs-code:hover { background: var(--green); color: #fff; }

/* ── STREAK MILESTONES ───────────────────────────────── */
.pod-milestones-card { margin: 0 0 16px; overflow: visible; }
.pod-milestones-intro { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 24px; line-height: 1.5; }
.pod-theme-track { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 20px; overflow: visible; padding: 4px 0 10px; }
.pod-theme-node { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; overflow: visible; width: 80px; }
.ptn-node-current { width: 90px; }
.ptn-badge { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ptn-badge svg { display: block; }
.ptn-badge-locked { opacity: .7; }
.ptn-icon-lbl { position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%); font-size: 20px; line-height: 1; pointer-events: none; user-select: none; }
.ptn-icon-lbl-lg { font-size: 26px; }
.ptn-icon-lbl-day { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--muted); display: flex; flex-direction: column; align-items: center; line-height: 1.1; top: 50%; }
.ptn-icon-lbl-day small { font-size: 9px; font-weight: 600; opacity: .7; }
.ptn-name { font-size: 11px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.3; }
.ptn-name-muted { color: var(--muted-light); font-weight: 400; }
.ptn-current-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--green); background: var(--green-light); border-radius: var(--r-full); padding: 3px 9px; }
.ptn-day-req { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.pod-theme-line { display: none; }

/* ── DANGER / EMPTY STATES ───────────────────────────── */
.pod-danger-zone { text-align: center; padding: 24px 0 8px; }
.pod-danger-btn { color: var(--muted) !important; font-size: 13px; }
.pod-danger-btn:hover { color: var(--red) !important; }
.pod-empty-state { text-align: center; padding: 32px 20px; }
.pod-es-icon { font-size: 40px; margin-bottom: 12px; }
.pod-es-heading { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.pod-es-msg { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── POD STUDY AREA ──────────────────────────────────── */
.pod-study-area { margin: 0 0 16px; padding: 0; overflow: hidden; }

/* ── STUDY ROOM ──────────────────────────────────────── */
.study-room { display: flex; flex-direction: column; }

.sr-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 20px 20px 0;
}
.sr-title { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.sr-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* Inline upload panel */
.sr-upload-panel {
  background: var(--surface-2); border-top: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border); padding: 18px 20px;
  animation: cardEnter .2s ease;
}
.sr-up-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sr-up-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; }
.sr-vis-row { display: flex; gap: 8px; margin-bottom: 12px; }
.sr-vis-btn {
  flex: 1; padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; text-align: center;
}
.sr-vis-btn.active { border-color: var(--green); background: var(--green-light); color: var(--green); }
.sr-drop-zone { margin-bottom: 0; }

/* Tabs */
.sr-tabs {
  display: flex; overflow-x: auto; border-bottom: 1.5px solid var(--border);
  padding: 0 20px; gap: 0; scrollbar-width: none; margin-top: 14px;
}
.sr-tabs::-webkit-scrollbar { display: none; }
.sr-tab {
  padding: 10px 14px; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  background: none; border: none; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; display: flex; align-items: center; gap: 5px; transition: color .15s;
}
.sr-tab:hover { color: var(--text); }
.sr-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.sr-badge { background: var(--surface-2); border-radius: var(--r-full); padding: 1px 7px; font-size: 11px; }
.sr-tab.active .sr-badge { background: var(--green-light); color: var(--green); }

/* Content list */
.sr-content {
  padding: 14px 20px;
  max-height: 340px;
  overflow-y: auto;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--green) var(--border);
}
.sr-content::-webkit-scrollbar { width: 5px; }
.sr-content::-webkit-scrollbar-track { background: var(--border); border-radius: 99px; }
.sr-content::-webkit-scrollbar-thumb { background: var(--green); border-radius: 99px; }

/* Topic ladder — wraps cards with connectors between them */
.sr-topic-ladder {
  display: flex;
  flex-direction: column;
}

/* Cards inside the ladder have no bottom margin — connectors provide spacing */
.sr-topic-ladder > .sr-topic-card { margin-bottom: 0; }

/* Connector element between two cards */
.sr-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
}
.sr-connector-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: transform .15s ease, background .15s;
}
.sr-connector-node.has-set { background: var(--green); }
.sr-connector-line {
  flex: 1;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--border-strong) 0px,
    var(--border-strong) 5px,
    transparent 5px,
    transparent 9px
  );
  opacity: .7;
  transition: opacity .15s, background-image .15s;
}

/* Hover: connector below a hovered card */
.sr-topic-card:hover + .sr-connector .sr-connector-line {
  opacity: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--green) 0px,
    var(--green) 5px,
    transparent 5px,
    transparent 9px
  );
}
.sr-topic-card:hover + .sr-connector .sr-connector-node { transform: scale(1.35); }

/* Hover: connector above a hovered card (using :has) */
.sr-connector:has(+ .sr-topic-card:hover) .sr-connector-line {
  opacity: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--green) 0px,
    var(--green) 5px,
    transparent 5px,
    transparent 9px
  );
}
.sr-connector:has(+ .sr-topic-card:hover) .sr-connector-node { transform: scale(1.35); }

.sr-topic-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  margin-bottom: 8px; background: var(--surface); transition: all .15s; cursor: default;
}
.sr-topic-card:last-child { margin-bottom: 0; }
.sr-topic-card.selected { border-color: var(--green); background: var(--green-light); }
.sr-topic-emoji { font-size: 22px; flex-shrink: 0; }
.sr-topic-info  { flex: 1; min-width: 0; }
.sr-topic-name  { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-topic-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sr-private-tag { background: var(--surface-2); border-radius: var(--r-full); padding: 1px 7px; font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.sr-topic-btns  { flex-shrink: 0; display: flex; gap: 6px; }
.sr-use-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface-2); font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s; color: var(--muted);
}
.sr-use-btn:hover { border-color: var(--green); background: var(--green-light); color: var(--green); }
.sr-use-btn.added { background: var(--green); border-color: var(--green); color: #fff; }
.sr-gen-btn {
  padding: 5px 12px; border: 1.5px solid var(--border); border-radius: var(--r-full);
  background: var(--surface-2); font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; color: var(--muted);
}
.sr-gen-btn:hover { border-color: var(--amber-mid); background: var(--amber-light); color: var(--amber); }

/* Empty states */
.sr-empty { text-align: center; padding: 32px 20px; }
.sr-empty-icon { font-size: 36px; margin-bottom: 10px; }
.sr-empty-msg  { font-size: 14px; color: var(--muted); }

/* Launcher (sticky at bottom of study room) */
.sr-launcher { border-top: 1.5px solid var(--border); padding: 14px 20px 18px; background: var(--surface-2); }
.sr-selected { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; align-items: center; margin-bottom: 12px; }
.sr-hint { font-size: 13px; color: var(--muted-light); }
.sr-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green); color: #fff; border-radius: var(--r-full);
  padding: 4px 10px 4px 12px; font-size: 12px; font-weight: 500;
}
.sr-tag-x { background: none; border: none; color: rgba(255,255,255,.8); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.sr-tag-x:hover { color: #fff; }
.sr-launcher-bottom { display: flex; align-items: center; gap: 10px; }
.sr-modes { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.sr-mode-btn {
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--r-full);
  background: var(--surface); font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.sr-mode-btn.active { border-color: var(--green); background: var(--green-light); color: var(--green); }

/* Legacy psa compat */
.psa-vis-row { display: flex; gap: 8px; margin-top: 4px; }
.psa-vis-opt { flex: 1; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: var(--r-md); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; text-align: center; }
.psa-vis-opt.active { border-color: var(--green); background: var(--green-light); color: var(--green); }
.psa-vis-opt input { display: none; }
.psa-loading { padding: 24px; color: var(--muted); font-size: 14px; text-align: center; }

/* ── STUDY BUBBLE (inline active session) ────────────── */
.study-bubble {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.sb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--surface-2); border-bottom: 1.5px solid var(--border);
  gap: 12px;
}
.sb-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sb-back { padding: 6px 10px !important; font-size: 13px !important; }
.sb-badges { display: flex; gap: 6px; }
.sb-status {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--green); background: var(--green-light); border-radius: var(--r-full);
  padding: 4px 10px; white-space: nowrap; flex-shrink: 0;
}
#podInlineStudyWrap .progress-bar-wrap { padding: 16px 18px 0; margin-bottom: 0; }
#podInlineStudyCards { padding: 0 18px 18px; }

/* Content select modal */
.pcs-modal { max-width: 480px; max-height: 85vh; overflow-y: auto; }
.pcs-heading { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; margin-bottom: 18px; letter-spacing: -0.2px; }
.pcs-section { margin-bottom: 22px; }
.pcs-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; display: block; }
.pcs-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pcs-mode-btn { border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); padding: 12px 14px; text-align: left; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all .15s; }
.pcs-mode-btn:hover, .pcs-mode-btn.active { border-color: var(--green); background: var(--green-light); }
.pcs-mode-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.pcs-mode-desc { font-size: 11px; color: var(--muted); }
.pcs-topic-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md); margin-bottom: 6px; cursor: pointer; background: var(--surface); transition: all .15s; }
.pcs-topic-row:hover { border-color: var(--green); background: var(--green-light); }
.pcs-topic-row input[type=checkbox] { accent-color: var(--green); width: 16px; height: 16px; flex-shrink: 0; }
.pcs-topic-emoji { font-size: 18px; flex-shrink: 0; }
.pcs-topic-name { font-size: 14px; font-weight: 500; }
.pcs-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 0; }
.pcs-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1.5px solid var(--border); margin-top: 8px; position: sticky; bottom: 0; background: var(--surface); padding-bottom: 4px; }
.pcs-count { font-size: 13px; color: var(--muted); }

/* ── DRILL MODE ──────────────────────────────────────── */
.teach-card { border-top: 3px solid var(--green); }
.teach-phase-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--green); margin-bottom: 12px; display: block; }
.teach-concept-name { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.2px; }
.teach-keywords { margin: 14px 0 18px; }
.teach-keywords-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; margin-bottom: 7px; }
.teach-kw-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.teach-kw { background: var(--green-light); color: var(--green); border-radius: var(--r-full); padding: 3px 11px; font-size: 12px; font-weight: 600; }

.blurt-card { border-top: 3px solid var(--amber-mid); }
.blurt-card .teach-phase-label { color: var(--amber); }
.blurt-prompt { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; margin-bottom: 10px; line-height: 1.4; letter-spacing: -0.2px; }
.blurt-prompt em { font-style: italic; color: var(--green); }
.blurt-hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.blurt-area { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 14px; font-family: 'DM Sans', sans-serif; font-size: 14px; background: var(--amber-light); color: var(--text); resize: vertical; outline: none; transition: all .15s; line-height: 1.7; }
.blurt-area:focus { border-color: var(--amber-mid); background: #fff; box-shadow: 0 0 0 3px var(--amber-light); }

.selfcheck-card { border-top: 3px solid #3b82f6; }
.selfcheck-card .teach-phase-label { color: #1d4ed8; }
.selfcheck-blurt-box { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 18px; max-height: 160px; overflow-y: auto; }
.selfcheck-blurt-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; margin-bottom: 6px; }
.selfcheck-blurt-text { font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.selfcheck-instruction { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.selfcheck-list { display: flex; flex-direction: column; gap: 10px; }
.selfcheck-item { border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; background: var(--surface); }
.selfcheck-concept-name { font-weight: 700; font-size: 15px; margin-bottom: 5px; font-family: 'Fraunces', serif; }
.selfcheck-answer { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.selfcheck-mark-btns { display: flex; gap: 7px; flex-wrap: wrap; }
.selfcheck-btn { padding: 7px 14px; border-radius: var(--r-full); font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--muted); transition: all .15s; }
.selfcheck-btn.got.active     { background: var(--teal-light);  border-color: #6ee7b7; color: var(--teal); }
.selfcheck-btn.partial.active { background: var(--amber-light); border-color: #fcd34d; color: var(--amber); }
.selfcheck-btn.missed.active  { background: var(--red-light);   border-color: #fca5a5; color: var(--red); }
.selfcheck-btn:not(.active):hover { background: var(--surface); border-color: var(--green); }
.followup-card { border-top: 3px solid var(--red); }
.followup-label { color: var(--red); }

/* ── WIZARD ──────────────────────────────────────────── */
.wizard-modal { max-width: 440px; gap: 0; padding: 0; overflow: hidden; border-radius: var(--r-xl); }
#wizardContent { padding: 28px 28px 0; }
.wizard-title { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.2px; }
.wizard-step-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 18px; display: block; }
.wizard-footer { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; border-top: 1.5px solid var(--border); margin-top: 22px; background: var(--surface-2); }
.pod-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.pod-type-card { border: 2px solid var(--border); border-radius: var(--r-lg); padding: 18px 14px; text-align: center; cursor: pointer; background: var(--surface); transition: all .15s; }
.pod-type-card:hover, .pod-type-card.active { border-color: var(--green); background: var(--green-light); }
.pod-type-icon { font-size: 30px; margin-bottom: 10px; }
.pod-type-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pod-type-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
#wizardContent input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none; background: var(--surface-2); color: var(--text); transition: all .15s; display: block; }
#wizardContent input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }
.colour-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 4px; }
.colour-swatch { width: 100%; aspect-ratio: 1; border-radius: var(--r-md); border: 3px solid transparent; cursor: pointer; font-size: 18px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.colour-swatch:hover { transform: scale(1.08); }
.colour-swatch.active { border-color: #fff; box-shadow: 0 0 0 3px var(--green); transform: scale(1.08); }
.wizard-colour-hint { margin-top: 16px; background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; font-size: 13px; color: var(--muted); }
.wizard-colour-hint p { margin-bottom: 8px; }
.wizard-colour-preview { display: flex; gap: 7px; }
.wcp-dot { width: 22px; height: 22px; border-radius: 50%; cursor: help; }

/* Wizard — use personal profile button */
.wizard-use-mine { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--green-light); border: 1.5px solid var(--green); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 4px; }
.wizard-use-mine span { flex: 1; min-width: 0; }

/* Maths resume banner */
.maths-resume-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 18px; }
.mrb-info { flex: 1; min-width: 0; }
.mrb-info strong { display: block; font-size: 14px; margin-bottom: 3px; }
.mrb-info span { font-size: 12px; color: var(--muted); }
.mrb-btns { display: flex; gap: 8px; flex-shrink: 0; }
.mrb-btns button { padding: 8px 14px; font-size: 13px; border-radius: var(--r-sm); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600; transition: all .15s; }
.mrb-btns button:first-child { background: var(--green); color: #fff; border-color: var(--green); }
.mrb-btns button:first-child:hover { opacity: .9; }
.mrb-btns button:last-child:hover { border-color: var(--text); }

/* Pod maths topics tab */
.pmt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pmt-profile-chip { display: flex; gap: 6px; flex-wrap: wrap; }
.pmt-chip-tag { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pmt-topic-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; transition: border-color .15s; }
.pmt-topic-card:hover { border-color: var(--border-strong); }
.pmt-topic-left { flex: 1; min-width: 0; }
.pmt-topic-name { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.pmt-topic-meta { font-size: 12px; color: var(--muted); }
.pmt-topic-btns { display: flex; gap: 6px; flex-shrink: 0; }
.pmt-add-form { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 16px; margin-top: 12px; }

/* Pod problem bank */
.ppb-header { margin-bottom: 12px; }
.ppb-list { display: flex; flex-direction: column; gap: 8px; }
.ppb-item { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 12px 16px; }
.ppb-q { font-size: 13px; line-height: 1.5; margin-bottom: 5px; }
.ppb-meta { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── USAGE INDICATOR ─────────────────────────────────── */
.sb-user-name-row { display: flex; align-items: center; gap: 6px; }
.sb-pro-badge { background: var(--green); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-full); letter-spacing: .04em; flex-shrink: 0; }
.sb-manage-plan {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px; margin-bottom: 4px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--green); transition: all .15s;
  text-align: left;
}
.sb-manage-plan:hover { background: var(--green-light); border-color: var(--green); }
.sb-manage-icon { font-size: 15px; flex-shrink: 0; }
.sb-manage-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .sb-manage-label { display: none; }
.sidebar.collapsed .sb-manage-plan { justify-content: center; padding: 9px; }

.sb-usage { padding: 8px 10px 4px; }
.sb-usage-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.sb-usage-bar { height: 4px; background: var(--border); border-radius: var(--r-full); overflow: hidden; }
.sb-usage-fill { height: 100%; border-radius: var(--r-full); transition: width .6s ease; }

/* ── USAGE WARNING BANNER ────────────────────────────── */
.usage-warning-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 400;
  background: #fef3c7; border-bottom: 1.5px solid var(--amber-mid);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 13px; color: #7c3a00;
}
.usage-warning-dismiss { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 12px; margin-left: auto; padding: 4px; text-decoration: underline; }

/* ── PAYWALL MODAL ───────────────────────────────────── */
.paywall-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(28,25,23,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.paywall-card {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 36px 32px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg); position: relative; text-align: center;
  animation: sectionFadeIn .2s ease;
}
.paywall-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: var(--r-sm); }
.paywall-close:hover { background: var(--surface-2); }
.paywall-graphic { font-size: 52px; margin-bottom: 16px; line-height: 1; }
.paywall-heading { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 8px; }
.paywall-sub { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.paywall-price-card { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 20px; }
.paywall-badge { display: inline-block; background: var(--amber-light); color: var(--amber); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 10px; border-radius: var(--r-full); margin-bottom: 10px; }
.paywall-price-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.paywall-old-price { font-size: 16px; color: var(--muted-light); text-decoration: line-through; }
.paywall-new-price { font-family: 'Fraunces', serif; font-size: 36px; font-weight: 700; color: var(--green); }
.paywall-period { font-size: 14px; color: var(--muted); }
.paywall-features { list-style: none; text-align: left; font-size: 14px; line-height: 1.9; margin-bottom: 22px; }
.paywall-cta { width: 100%; font-size: 16px; padding: 14px; margin-bottom: 10px; }
.paywall-later { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; font-family: 'DM Sans', sans-serif; text-decoration: underline; text-underline-offset: 2px; }

/* ── PROFILE ─────────────────────────────────────────── */
.profile-username-display { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; margin-bottom: 2px; }
.profile-modal { max-width: 380px; text-align: center; }
.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: 4px; }
.profile-avatar-btn { background: transparent; border: 2px solid var(--border); border-radius: 50%; width: 76px; height: 76px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; margin: 0 auto; padding: 0; overflow: hidden; }
.profile-avatar-btn:hover { border-color: var(--green); background: var(--green-light); }
.profile-avatar-picker { position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%); background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 10px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; box-shadow: var(--shadow-lg); z-index: 10; width: 280px; }
.profile-emoji-opt { padding: 4px; border: 1.5px solid transparent; background: none; cursor: pointer; border-radius: 50%; transition: all .1s; display: flex; align-items: center; justify-content: center; }
.profile-emoji-opt:hover { border-color: var(--green); transform: scale(1.1); }
.profile-name-input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 10px 14px; font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500; text-align: center; outline: none; background: var(--surface-2); }
.profile-name-input:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px var(--green-light); }
.profile-bio-input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 9px 14px; font-family: 'DM Sans', sans-serif; font-size: 13px; text-align: center; outline: none; background: var(--surface-2); resize: none; color: var(--muted); }
.profile-bio-input:focus { border-color: var(--green); background: var(--surface); color: var(--text); }
.profile-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 0; border-top: 1.5px solid var(--border); margin-top: 4px; }
.profile-stat { text-align: center; }
.profile-stat-val { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 600; color: var(--green); }
.profile-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.profile-stat-loading { color: var(--muted); font-size: 13px; grid-column: 1/-1; text-align: center; padding: 8px 0; }
.profile-pods-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; margin: 14px 0 7px; }
.profile-pod-chip { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--border); padding: 9px 14px; font-size: 13px; margin-bottom: 7px; text-align: left; }
.member-profile-avatar { display: flex; justify-content: center; margin-bottom: 10px; }
.member-profile-name { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 5px; letter-spacing: -0.2px; }
.member-profile-bio { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 14px; }

/* ── AUTH EXTRA ──────────────────────────────────────── */
.pod-join-code-badge { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 5px 12px; font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; cursor: pointer; letter-spacing: 2px; transition: all .15s; }
.pod-join-code-badge:hover { background: var(--green-light); border-color: var(--green); }

/* ── CONFUSION BOX ───────────────────────────────────── */
.confusion-box {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  animation: cardEnter .3s .25s ease both;
}
.cb-heading { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.2px; }
.cb-sub     { font-size: 14px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.cb-chips-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.cb-chips   { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.cb-chip {
  padding: 5px 12px; border: 1.5px solid var(--border); border-radius: var(--r-full);
  background: var(--surface-2); font-family: 'DM Sans', sans-serif; font-size: 13px;
  cursor: pointer; transition: all .15s; color: var(--text-2);
}
.cb-chip:hover { border-color: var(--green); background: var(--green-light); color: var(--green); }
.cb-textarea { margin-bottom: 12px; min-height: 80px; }
.cb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cb-skip    { font-size: 13px; color: var(--muted-light) !important; }
.cb-loading { padding: 20px 0; }

/* ── MICRO LESSON ────────────────────────────────────── */
.micro-lesson { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; animation: cardEnter .25s ease; }
.ml-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: block; margin-bottom: 6px; }
.ml-title  { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.ml-explanation { border-left: 3px solid var(--green); padding: 12px 16px; background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 15px; line-height: 1.7; }
.ml-analogy { display: flex; gap: 12px; align-items: flex-start; background: var(--amber-light); border: 1.5px solid #fcd34d; border-radius: var(--r-md); padding: 14px 16px; }
.ml-analogy-icon  { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.ml-analogy-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--amber); margin-bottom: 4px; }
.ml-analogy-text  { font-size: 14px; font-style: italic; color: var(--text-2); line-height: 1.6; }
.ml-steps { counter-reset: mlc; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ml-step  { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.6; counter-increment: mlc; }
.ml-step::before { content: counter(mlc); background: var(--green); color: #fff; border-radius: 50%; width: 22px; height: 22px; min-width: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-top: 1px; }
.ml-bigpicture { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; }
.ml-bp-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.ml-bp-text  { color: var(--text-2); line-height: 1.6; }
.ml-check       { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 18px; }
.ml-check-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.ml-check-q     { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 600; margin-bottom: 12px; line-height: 1.4; }
.ml-check-input { min-height: 72px; }
.ml-result { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 12px 14px; margin-top: 12px; font-size: 14px; line-height: 1.6; }
.ml-result-yes { background: var(--teal-light);  border: 1.5px solid #6ee7b7; }
.ml-result-no  { background: var(--amber-light); border: 1.5px solid #fcd34d; }
.ml-result-icon { font-size: 18px; flex-shrink: 0; }
.ml-clarification { margin-top: 8px; padding: 10px 12px; background: rgba(255,255,255,.6); border-radius: var(--r-sm); font-size: 13px; color: var(--text-2); }
.ml-another { border-top: 1.5px solid var(--border); margin-top: 18px; padding-top: 16px; }
.ml-another-q { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.done-extra { margin: 16px 0 4px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-md); text-align: left; }
.done-extra-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.done-extra-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.done-extra-pill  { background: var(--green-light); color: var(--green); border-radius: var(--r-full); padding: 3px 11px; font-size: 12px; font-weight: 600; }

/* ── USERNAME BANNER ─────────────────────────────────── */
.username-banner {
  background: var(--amber-light); border-bottom: 1.5px solid #fcd34d;
  padding: 12px 20px; display: flex; flex-direction: column; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.username-banner-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.username-banner-input { width: 160px !important; padding: 8px 12px !important; font-size: 13px !important; min-height: auto !important; }
.username-banner-hint { font-size: 12px; margin: 0; min-height: 16px; }

/* ── SCREEN TRANSITIONS ──────────────────────────────── */
.screen-enter-right { animation: scrInRight .28s cubic-bezier(.4,0,.2,1) forwards; }
.screen-enter-left  { animation: scrInLeft  .28s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes scrInRight { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scrInLeft  { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: translateX(0); } }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 680px) {
  .math-tutor-wrap { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .tutor-panel { border-right: none; border-bottom: 1.5px solid var(--border); padding: 18px; }
  .canvas-panel { padding: 14px; min-height: 320px; }
  #mathCanvas { min-height: 280px; }
}
@media (max-width: 520px) {
  .topics-grid { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: stretch; }
  .app-header { padding: 0 14px; }
  .screens-wrap { padding: 18px 14px 80px; }
  .pod-type-grid { grid-template-columns: 1fr 1fr; }
  .pcs-mode-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .header-nav { gap: 5px; }
  .stat-pill { padding: 4px 8px; font-size: 12px; }
}

/* ── BLURT PHASE ─────────────────────────────────────── */
.blurt-phase {
  display: flex; flex-direction: column; gap: 20px; min-height: 72vh;
  animation: scrInRight .25s cubic-bezier(.4,0,.2,1);
}
.blurt-ph-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.blurt-title {
  font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700;
  margin-bottom: 10px; letter-spacing: -0.4px;
}
.blurt-subtitle { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 480px; }
.blurt-timer {
  font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600;
  color: var(--muted); white-space: nowrap; flex-shrink: 0; padding-top: 4px;
}
.blurt-textarea-wrap { position: relative; flex: 1; }
.blurt-phase-area {
  width: 100%; min-height: 300px; height: 100%;
  border: 2px solid var(--border); border-radius: var(--r-lg);
  padding: 20px 20px 44px;
  font-family: 'DM Sans', sans-serif; font-size: 16px; line-height: 1.75;
  background: var(--surface); color: var(--text);
  resize: none; outline: none; transition: border-color .15s;
}
.blurt-phase-area:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.blurt-wordcount {
  position: absolute; bottom: 12px; right: 16px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted-light);
  pointer-events: none;
}
.blurt-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.blurt-done-btn { min-width: 200px; transition: all .3s; }
.blurt-btn-ready { animation: blurtBtnReady .4s ease; }
@keyframes blurtBtnReady { 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.04) } }
.blurt-countdown { font-size: 12px; opacity: .65; font-family: 'JetBrains Mono', monospace; }
.blurt-skip-btn { color: var(--muted-light) !important; font-size: 13px; }

/* Blurt loading */
.blurt-loading { padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 0; }
.blurt-shimmer {
  width: 100%; height: 100px; border-radius: var(--r-lg);
  background: linear-gradient(90deg, #f0ede6 25%, #e8e3db 50%, #f0ede6 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { 0%{ background-position: 200% 0; } 100%{ background-position: -200% 0; } }
.blurt-loading-msg { color: var(--muted); font-size: 15px; margin-top: 20px; }

/* ── BLURT RESULTS ────────────────────────────────────── */
.blurt-results { display: flex; flex-direction: column; gap: 14px; }
.br-title {
  font-family: 'Fraunces', serif; font-size: 24px; font-weight: 700;
  letter-spacing: -0.3px; margin-bottom: 2px;
}
.br-section {
  border-radius: var(--r-lg); border: 1.5px solid var(--border);
  padding: 18px; background: var(--surface);
  animation: cardEnter .3s ease both;
}
.br-section:nth-child(2){ animation-delay:.05s }
.br-section:nth-child(3){ animation-delay:.1s }
.br-section:nth-child(4){ animation-delay:.15s }
.br-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.br-icon    { font-size: 20px; flex-shrink: 0; }
.br-heading { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 600; flex: 1; }
.br-count   { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.br-remembered { border-color: #6ee7b7; background: var(--teal-light); }
.br-partial    { border-color: #fcd34d; background: var(--amber-light); }
.br-gaps       { border-color: #fca5a5; background: var(--red-light); }
.br-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.br-pill {
  border-radius: var(--r-full); padding: 5px 13px; font-size: 13px; font-weight: 600;
  background: var(--teal-light); color: var(--teal); border: 1.5px solid #6ee7b7;
}
.br-none { font-size: 13px; color: var(--muted); }
/* Partial */
.br-collapsible { border-radius: var(--r-sm); overflow: hidden; margin-bottom: 6px; background: rgba(255,255,255,.55); }
.br-collapsible:last-child { margin-bottom: 0; }
.br-toggle {
  width: 100%; text-align: left; padding: 11px 14px; border: none; background: none;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; color: var(--text);
}
.br-arrow { color: var(--amber); font-size: 16px; }
.br-collapsible-body { padding: 0 14px 12px; }
.br-got     { font-size: 13px; color: var(--teal);  margin-bottom: 4px; }
.br-missing { font-size: 13px; color: var(--amber); }
/* Gaps */
.br-gap {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(252,165,165,.3);
}
.br-gap:last-child { border-bottom: none; }
.br-gap-concept { font-size: 14px; font-weight: 700; display: block; margin-bottom: 4px; }
.br-gap-point   { font-size: 13px; color: var(--red); line-height: 1.5; }
.br-gotit {
  flex-shrink: 0; padding: 6px 14px; border: 1.5px solid #fca5a5;
  border-radius: var(--r-full); background: none;
  font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--red); transition: all .15s; white-space: nowrap;
}
.br-gotit:hover { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }
@keyframes brGapOut { to { opacity: 0; transform: translateX(-20px); } }
/* Encouragement */
.br-encouragement {
  background: var(--surface-2); border-radius: var(--r-lg);
  padding: 22px; border: 1.5px solid var(--border); text-align: center;
  animation: cardEnter .3s .2s ease both;
}
.br-enc-text {
  font-family: 'Fraunces', serif; font-size: 17px; font-style: italic;
  color: var(--text-2); line-height: 1.6;
}

/* ── SIDEBAR LAYOUT ──────────────────────────────────── */
:root {
  --sb-w: 220px;
  --sb-w-collapsed: 64px;
}

#mainApp {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w);
  min-height: 100vh;
  background: #E8E4DC;  /* distinct from both bg and surface */
  border-right: 1.5px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sb-logo {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.sb-logo-word {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.8px;
  white-space: nowrap;
}

/* Nav list */
.sb-nav {
  list-style: none;
  padding: 0 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.sb-nav li { position: relative; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
  white-space: nowrap;
  position: relative;
}
.sb-item:hover { background: rgba(45,90,39,.08); color: var(--green); }
.sb-item:hover .sb-icon { transform: scale(1.08); }
.sb-item.active {
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
  border-left: 3px solid var(--green);
  padding-left: 9px;
  box-shadow: inset 0 0 0 1px rgba(45,90,39,.12);
}
.sb-icon {
  flex-shrink: 0;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 150ms ease;
}
.sb-icon svg { display: block; }
.sb-label { flex: 1; }

@keyframes logoPulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* Tooltip (collapsed mode) */
.sb-tooltip {
  display: none;
  position: absolute;
  left: calc(var(--sb-w-collapsed) + 8px);
  top: 50%; transform: translateY(-50%);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}
.sb-tooltip::before {
  content: '';
  position: absolute;
  left: -5px; top: 50%; transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--text);
  border-left: none;
}

/* Sidebar footer */
.sb-footer {
  padding: 10px;
  border-top: 1.5px solid var(--border-strong);
  background: var(--surface-raised);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.sb-collapse-btn {
  align-self: flex-end;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.sb-collapse-btn:hover { background: var(--green-light); color: var(--green); border-color: var(--green); }

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  min-width: 0;
}
.sb-avatar-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green-light);
  border: 2px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .12s;
}
.sb-avatar-btn:hover { background: var(--green); }
.sb-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sb-user-name {
  font-family: 'Fraunces', serif;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-email {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-logout-btn {
  background: transparent; border: none;
  cursor: pointer; color: var(--muted);
  font-size: 16px; padding: 4px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  transition: all .12s;
}
.sb-logout-btn:hover { color: var(--red); background: var(--red-light); }

/* ── Collapsed sidebar ───────────────────────────────── */
.sidebar.collapsed {
  width: var(--sb-w-collapsed);
}
.sidebar.collapsed .sb-label,
.sidebar.collapsed .sb-user-info,
.sidebar.collapsed .sb-logout-btn,
.sidebar.collapsed .sb-logo-word {
  display: none;
}
.sidebar.collapsed .sb-collapse-btn {
  transform: rotate(180deg);
  align-self: center;
}
.sidebar.collapsed .sb-item:hover .sb-tooltip { display: block; }
.sidebar.collapsed .sb-user { justify-content: center; padding: 8px 6px; }
.sidebar.collapsed .sb-logo { justify-content: center; padding: 22px 8px 18px; }
.sidebar.collapsed .sb-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .sb-icon { width: auto; }

/* ── Mobile backdrop ─────────────────────────────────── */
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 190;
}
.sb-backdrop.open, .sb-backdrop.active { display: block; }

/* ── Main area ───────────────────────────────────────── */
.main-area {
  flex: 1;
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
.main-area.sb-collapsed { margin-left: var(--sb-w-collapsed); }

/* ── Mobile topbar ───────────────────────────────────── */
.mob-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}
.mob-logo {
  font-family: 'Syne', sans-serif;
  font-size: 24px; font-weight: 800;
  color: var(--text); letter-spacing: -0.6px;
}
.mob-pills { display: flex; gap: 6px; align-items: center; }
.mob-hamburger {
  background: none; border: none; cursor: pointer;
  padding: 6px; display: flex; flex-direction: column; gap: 5px;
}
.mob-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all .2s;
}

/* ── App sections ────────────────────────────────────── */
.app-section {
  padding: 32px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  animation: sectionFadeIn .15s ease;
}
@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Screens (full-screen overlays) */
.screen {
  padding: 24px 32px 80px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  animation: sectionFadeIn .15s ease;
}
.math-screen { max-width: 100%; padding: 0; }

/* ── HOME DASHBOARD ──────────────────────────────────── */
.dash-greeting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.dash-greeting-text { flex: 1; }
.dash-hello {
  font-family: 'Fraunces', serif;
  font-size: 30px; font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
  margin-bottom: 4px;
}
.dash-date { font-size: 13px; color: var(--muted); }
.dash-stat-pills {
  display: flex; gap: 10px; align-items: center;
  flex-shrink: 0;
}
.dash-stat-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  padding: 10px 18px;
  box-shadow: var(--shadow-sm);
}
.dash-stat-pill .dsp-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 700;
  color: var(--text);
}
.dash-stat-pill .dsp-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.dash-stat-pill.fire-pill { border-color: var(--fire); }
.dash-stat-pill.fire-pill .dsp-num { color: var(--fire); }
.dash-stat-pill.xp-pill { border-color: var(--amber); }
.dash-stat-pill.xp-pill .dsp-num { color: var(--amber); }

/* Today's focus row */
.dash-focus-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.dash-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.dash-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 14px;
}
/* Continue studying card */
.dash-continue-topic {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.dash-topic-emoji { font-size: 36px; line-height: 1; }
.dash-topic-info { flex: 1; min-width: 0; }
.dash-topic-name {
  font-family: 'Fraunces', serif;
  font-size: 17px; font-weight: 700;
  color: var(--text); margin-bottom: 2px;
}
.dash-topic-mastery {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 700;
}
.dash-topic-last { font-size: 12px; color: var(--muted); margin-bottom: 14px; }

/* Pod check-in card */
.dash-pod-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-pod-row:last-of-type { border-bottom: none; }
.dash-pod-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-pod-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.dash-pod-streak { font-size: 12px; color: var(--muted); }
.dash-pod-status { font-size: 16px; }
.dash-card.pods-done { background: var(--green-light); border-color: var(--green); }
.dash-card.pods-risk { background: var(--amber-light); border-color: var(--amber); }
.dash-view-link {
  font-size: 13px; color: var(--green); font-weight: 600;
  background: none; border: none; cursor: pointer; padding: 0; margin-top: 12px;
  display: block;
}
.dash-view-link:hover { text-decoration: underline; }

/* Suggested card */
.dash-suggested {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  margin-bottom: 24px;
}
.dash-suggested-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--green); margin-bottom: 8px;
}
.dash-suggested-text {
  font-size: 15px; color: var(--text); line-height: 1.5; margin-bottom: 16px;
}
.dash-suggested .btn-group { gap: 8px; }

/* Recent sessions */
.dash-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dash-section-title {
  font-family: 'Fraunces', serif;
  font-size: 18px; font-weight: 700; color: var(--text);
}
.dash-session-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  transition: background .1s;
  cursor: default;
}
.dash-session-row:hover { background: var(--surface); }
.dash-session-emoji { font-size: 18px; flex-shrink: 0; }
.dash-session-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.dash-session-mode {
  font-size: 12px; color: var(--muted);
  background: var(--surface-2); border-radius: var(--r-full);
  padding: 2px 8px;
}
.dash-session-score { font-size: 13px; font-weight: 600; color: var(--teal); font-family: 'JetBrains Mono', monospace; }
.dash-session-date { font-size: 12px; color: var(--muted-light); }

/* Revisit chips */
.revisit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.revisit-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-full); padding: 5px 12px 5px 10px;
  cursor: pointer; font-size: 13px; transition: all .12s;
}
.revisit-chip:hover { border-color: var(--green); background: var(--green-light); }
.revisit-chip .rc-name { font-weight: 500; color: var(--text); }
.revisit-chip .rc-topic { color: var(--muted); font-size: 12px; }
.revisit-chip .rc-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--red); font-weight: 700;
  background: var(--red-light); border-radius: var(--r-full);
  padding: 1px 6px;
}
.dash-green-card {
  background: var(--green-light); border: 1.5px solid var(--green);
  border-radius: var(--r-lg); padding: 14px 18px;
  font-size: 14px; color: var(--green); font-weight: 500;
}

/* ── PROGRESS SECTION ────────────────────────────────── */
.prog-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.prog-stat-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.prog-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px; font-weight: 700;
  color: var(--text); line-height: 1;
  margin-bottom: 4px;
}
.prog-stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Bar chart */
.prog-chart-wrap {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); padding: 20px 24px;
  margin-bottom: 20px;
}
.prog-chart-title { font-family: 'Fraunces', serif; font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.prog-bar-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 80px;
}
.prog-bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 4px; }
.prog-bar {
  width: 100%; background: var(--green); border-radius: 4px 4px 0 0;
  min-height: 4px; transition: height .3s ease;
  opacity: .85;
}
.prog-bar-label { font-size: 9px; color: var(--muted); white-space: nowrap; }

/* Topic table */
.prog-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden;
}
.prog-table th {
  text-align: left; padding: 12px 16px;
  background: var(--surface-2); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.prog-table th:hover { color: var(--green); }
.prog-table td {
  padding: 12px 16px; font-size: 14px;
  border-top: 1px solid var(--border);
}
.prog-table tr:hover td { background: var(--surface-2); }

/* ── SETTINGS SECTION ────────────────────────────────── */
.settings-group {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden;
  margin-bottom: 20px;
}
.settings-group-title {
  font-family: 'Fraunces', serif; font-size: 14px; font-weight: 700;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.settings-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { flex: 1; font-size: 14px; color: var(--text); font-weight: 500; }
.settings-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.settings-input { width: 200px; }
.settings-danger { border-color: var(--red); }
.settings-danger .settings-group-title { color: var(--red); }

/* Extra aliases used by JS renderers */
.prog-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.prog-stat-grid-5 { grid-template-columns: repeat(5, 1fr); }
.prog-bar-wrap {
  flex: 1; width: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 4px;
}
.prog-bar-fill {
  width: 100%; background: var(--green); border-radius: 4px 4px 0 0;
  min-height: 4px; transition: height .3s ease; opacity: .85;
}
.dash-recent-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.dash-recent-row:last-child { border-bottom: none; }
.settings-group-label {
  font-family: 'Fraunces', serif; font-size: 14px; font-weight: 700;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  color: var(--text); letter-spacing: .2px;
}
.settings-label { flex: 1; font-size: 14px; color: var(--text); font-weight: 500; }
.settings-value { font-size: 14px; color: var(--muted); }

/* ── Progress chart interactive ─────────────────────── */
.prog-chart-card { position: relative; }
.prog-bar-chart { position: relative; }

.prog-bar-active {
  background: var(--green);
  border-radius: 4px 4px 0 0;
  transition: opacity .12s, filter .12s;
  cursor: pointer;
}
.prog-bar-active:hover, .prog-bar-col:hover .prog-bar-active { opacity: .8; filter: brightness(1.1); }
.prog-bar-empty {
  background: var(--border);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
}
.prog-bar-col { cursor: pointer; position: relative; outline: none; }
.prog-bar-col:focus-visible .prog-bar-active { outline: 2px solid var(--green); }

.prog-tooltip {
  position: absolute;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.14);
  font-size: 13px;
  width: 180px;
  z-index: 30;
  pointer-events: none;
}
.pt-date { font-family: 'Fraunces', serif; font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 8px; }
.pt-empty { font-size: 12px; color: var(--muted); }
.pt-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12px; color: var(--text); }
.pt-icon { font-size: 13px; width: 18px; flex-shrink: 0; }

/* ── Streak animation ────────────────────────────────── */
@keyframes streakPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(.92); }
  100% { transform: scale(1); }
}
@keyframes streakFire {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%       { box-shadow: 0 0 12px 4px rgba(239,68,68,.35); }
}
#streakDisplay.streak-pop { animation: streakPop .45s cubic-bezier(.36,.07,.19,.97); }
.fire-pill.streak-fire, .dash-stat-pill.streak-fire { animation: streakFire .8s ease; }

/* ── MOBILE RESPONSIVE ───────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-280px);
    width: 280px;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.sb-open { transform: translateX(0); }
  .mob-topbar { display: flex; }
  .main-area { margin-left: 0 !important; }
  .app-section { padding: 16px; }
  .screen { padding: 16px 16px 80px; }
  .dash-focus-row { grid-template-columns: 1fr; }
  .prog-stats-row, .prog-stat-grid, .prog-stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .dash-greeting { flex-direction: column; gap: 12px; }
  .dash-hello { font-size: 24px; }
}

/* ── POD STUDY ENTRANCE (dashboard card) ─────────────── */
.pod-study-entrance {
  margin-top: 20px;
  border: 2px dashed var(--border);
  background: var(--bg);
  transition: border-color .2s, background .2s;
}
.pod-study-entrance:hover { border-color: var(--accent); background: var(--surface); }
.pse-body {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 20px 24px;
}
.pse-icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.pse-text { flex: 1; min-width: 140px; }
.pse-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.pse-sub { font-size: 13px; color: var(--muted); margin: 0; }
.pse-enter-btn { flex-shrink: 0; font-size: 15px; padding: 10px 22px; }

/* ── POD STUDY ROOM SCREEN ───────────────────────────── */
#podStudyRoomScreen { display: flex; flex-direction: column; gap: 0; max-width: 720px; }

.psr-header {
  display: flex; align-items: center; gap: 12px;
  padding: 0 0 18px;
}
.psr-title-wrap { flex: 1; }
.psr-pod-name {
  font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700;
  margin: 0; letter-spacing: -.3px;
}

/* Timer card */
.psr-timer-card {
  border-radius: var(--r-xl); overflow: hidden;
  margin-bottom: 20px;
}
.psr-timer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); padding: 22px 24px;
  transition: border-color .3s, background .3s;
}
.psr-timer-inner.psr-timer-done {
  border-color: var(--green); background: #f0faf0;
}
.psr-timer-left { flex: 1; }
.psr-timer-label { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.psr-timer-nums { display: flex; align-items: baseline; gap: 6px; margin-bottom: 14px; }
.psr-t-big { font-family: 'JetBrains Mono', monospace; font-size: 38px; font-weight: 700; line-height: 1; color: var(--text); }
.psr-t-small { font-size: 14px; color: var(--muted); }
.psr-bar-wrap {
  height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 6px;
}
.psr-bar-fill {
  height: 100%; background: var(--accent); border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.psr-timer-inner.psr-timer-done .psr-bar-fill { background: var(--green); }
.psr-bar-label { font-size: 12px; color: var(--muted); }

/* Ring on right */
.psr-timer-right { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.psr-ring { width: 72px; height: 72px; transform: rotate(-90deg); }
.psr-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.psr-ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round;
  transition: stroke-dasharray .8s cubic-bezier(.4,0,.2,1);
}
.psr-timer-inner.psr-timer-done .psr-ring-fg { stroke: var(--green); }
.psr-ring-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--text);
}

/* Launcher */
.psr-launcher {
  position: sticky; bottom: 0;
  background: var(--surface); border-top: 1.5px solid var(--border);
  padding: 14px 0; margin-top: 12px; z-index: 10;
}
.psr-selected { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; margin-bottom: 12px; }
.psr-launcher-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.psr-start-btn { font-size: 15px; padding: 11px 28px; }

/* ── STUDY ROOM V2 ───────────────────────────────────── */
.sr-page { display: flex; flex-direction: column; gap: 0; }

/* Room header */
.sr-room-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 20px; background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1.5px solid var(--border); border-bottom: none;
  position: sticky; top: 0; z-index: 10;
}
.sr-room-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 160px; }
.sr-room-icon { font-size: 28px; line-height: 1; }
.sr-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; margin: 0; }
.sr-sub { font-size: 13px; color: var(--muted); margin: 0; }
.sr-upload-trigger-btn { flex-shrink: 0; }

/* Timer ring */
.sr-timer-block {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: var(--r-lg); padding: 8px 14px;
  border: 1.5px solid var(--border); flex-shrink: 0;
}
.sr-timer-block.sr-timer-done { border-color: var(--green); background: #f0faf0; }
.sr-timer-ring-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.sr-timer-ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.sr-ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.sr-ring-fill {
  fill: none; stroke: var(--green); stroke-width: 3;
  stroke-linecap: round; transition: stroke-dasharray .8s ease;
}
.sr-timer-block.sr-timer-done .sr-ring-fill { stroke: var(--green); }
.sr-ring-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; color: var(--text);
}
.sr-timer-text { display: flex; flex-direction: column; line-height: 1.2; }
.sr-timer-mins { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; color: var(--text); }
.sr-timer-goal { font-size: 11px; color: var(--muted); }
.sr-timer-done-lbl { font-size: 13px; font-weight: 600; color: var(--green); }

/* Start button */
.sr-start-big {
  font-size: 15px; padding: 10px 28px; border-radius: var(--r-lg);
  letter-spacing: .2px; transition: transform .15s;
}
.sr-start-big:not(:disabled):hover { transform: scale(1.03); }
.sr-start-big:not(:disabled):active { transform: scale(.97); }

/* Generating shimmer on topic card */
.sr-topic-card.sr-generating { opacity: .85; }
.sr-gen-pulse {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--accent); font-style: italic;
}
.sr-gen-pulse::after {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
  animation: genPulse 1s ease-in-out infinite;
}
@keyframes genPulse { 0%,100%{ opacity:.3; transform:scale(.8) } 50%{ opacity:1; transform:scale(1.2) } }

/* Goal celebration overlay */
.goal-celebration-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
}
.goal-celebration-card {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 40px 36px; text-align: center; max-width: 380px; width: 90%;
  box-shadow: var(--shadow-lg); animation: celebrationPop .4s cubic-bezier(.34,1.56,.64,1);
}
.gc-emoji { font-size: 64px; line-height: 1; margin-bottom: 16px; }
.gc-title { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; margin: 0 0 10px; }
.gc-sub { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 24px; }
@keyframes celebrationPop {
  0% { transform: scale(.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Early exit warning */
.early-exit-warn {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.ew-card {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 32px 28px; text-align: center; max-width: 340px; width: 90%;
  box-shadow: var(--shadow-lg); animation: celebrationPop .3s cubic-bezier(.34,1.56,.64,1);
}
.ew-emoji { font-size: 48px; margin-bottom: 12px; }
.ew-msg { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; line-height: 1.4; color: var(--text); margin: 0 0 4px; }

/* Confetti */
.confetti-piece {
  position: fixed; top: -20px; z-index: 9999;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════════
   MATHS SECTION v2
   ══════════════════════════════════════════════════════ */

/* Onboarding shell */
.mob-shell { max-width: 560px; margin: 0 auto; padding: 0; }
.mob-header { padding: 28px 32px 20px; border-bottom: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.mob-brand { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; color: var(--text); }
.mob-prog { display: flex; align-items: center; gap: 4px; }
.mob-step { width: 28px; height: 28px; border-radius: 50%; background: var(--border); color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.mob-step.active { background: var(--green); color: #fff; }
.mob-step.done { background: var(--green-light); color: var(--green); }
.mob-step-line { width: 20px; height: 2px; background: var(--border); }
.mob-body { padding: 32px; }
.mob-title { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.mob-sub { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.mob-select { width: 100%; margin-bottom: 16px; }
.mob-next { margin-top: 8px; }
.mob-back { margin-top: 8px; }

/* Level/board cards */
.mob-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.mob-level-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--r-lg); padding: 14px 12px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-align: center; transition: all .12s; }
.mob-level-card:hover { border-color: var(--green); background: var(--green-light); }
.mob-level-card.selected { border-color: var(--green); background: var(--green); color: #fff; }
.mob-subjects { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.mob-subject-card { position: relative; padding: 12px 10px 12px 28px; text-align: left; }
.mob-subject-card.selected { background: var(--green-light); color: var(--green); }
.mob-subj-dot { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; }
.mob-notes-wrap { margin-bottom: 8px; }
.mob-notes-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: block; }
.mob-notes { width: 100%; resize: none; }

/* Calibration */
.mob-cal-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 20px; margin-bottom: 20px; }
.mob-cal-context { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.mob-cal-q { font-family: 'Fraunces', serif; font-size: 18px; color: var(--text); line-height: 1.5; }
.mob-cal-marks { font-size: 12px; color: var(--muted); margin-top: 8px; }
.mob-cal-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* Maths main shell */
.maths-shell { display: flex; flex-direction: column; min-height: calc(100vh - 52px); }
.maths-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; border-bottom: 1.5px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 50; flex-wrap: wrap; gap: 10px; }
.maths-profile-pill { background: var(--green-light); border: 1.5px solid var(--green); color: var(--green); border-radius: var(--r-full); padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; }
.maths-profile-pill:hover { background: var(--green); color: #fff; }
.maths-subnav { display: flex; gap: 4px; }
.mn-btn { background: transparent; border: none; padding: 8px 16px; border-radius: var(--r-lg); font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .12s; }
.mn-btn:hover { background: var(--surface-2); color: var(--text); }
.mn-btn.active { background: var(--green); color: #fff; }
.maths-content { flex: 1; max-width: 820px; margin: 0 auto; width: 100%; padding: 28px 24px 60px; }

/* Topics grid */
.maths-topics-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.maths-topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.maths-topic-card { background: var(--surface); border: 1.5px solid var(--border); border-left: 4px solid var(--green); border-radius: var(--r-xl); padding: 18px; cursor: pointer; transition: all .15s; }
.maths-topic-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mtc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mtc-subject { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: var(--r-full); }
.mtc-mastery { font-size: 20px; }
.mtc-name { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.mtc-meta { font-size: 12px; color: var(--muted); }
.maths-empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--muted); }

/* Add topic panel */
.add-topic-panel { background: var(--surface); border: 1.5px solid var(--green); border-radius: var(--r-xl); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.atp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.atp-row .text-input { flex: 1; min-width: 140px; }
.atp-subtopics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.atp-sub-check { display: flex; align-items: center; gap: 6px; font-size: 13px; background: var(--surface-2); border-radius: var(--r-full); padding: 4px 12px; cursor: pointer; }
.atp-custom-wrap { display: flex; gap: 8px; margin-top: 8px; }

/* Physics grouped subtopics — creation form */
.atp-sub-group { margin-bottom: 12px; }
.atp-sub-group-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.atp-sub-group-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.atp-sub-all-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.atp-sub-all-label input { cursor: pointer; }
.atp-sub-group-items { display: flex; flex-wrap: wrap; gap: 6px; }

/* Physics grouped subtopics — question setup */
.mq-physics-sub-groups { display: flex; flex-direction: column; gap: 12px; }
.mq-phy-group-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mq-phy-cat-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mq-phy-sel-all { font-size: 11px; color: var(--green); background: none; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600; padding: 2px 6px; border-radius: var(--r-sm); }
.mq-phy-sel-all:hover { background: var(--green-light); }
.mq-phy-pills { flex-wrap: wrap; }

/* Topic detail */
.mtd-back { margin-bottom: 16px; }
.mtd-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.mtd-tags { display: flex; gap: 8px; margin-bottom: 8px; }
.mtd-title { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; color: var(--text); }
.mtd-mastery { font-family: 'JetBrains Mono', monospace; font-size: 36px; font-weight: 700; text-align: right; flex-shrink: 0; }
.mtd-subtopics { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 16px 20px; margin-bottom: 4px; }
.mtd-sub-row { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mtd-sub-row:last-child { border-bottom: none; }
.mtd-sub-name { font-size: 14px; color: var(--text); }
.mtd-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 8px; }
.mtd-mode-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 20px 16px; cursor: pointer; text-align: center; transition: all .15s; }
.mtd-mode-card:hover { border-color: var(--green); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.mtd-mode-icon { font-size: 28px; margin-bottom: 10px; }
.mtd-mode-name { font-family: 'Fraunces', serif; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.mtd-mode-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.mtd-add-notes { margin-top: 4px; }

/* Question practice — two-panel layout */
.mq-screen-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-shrink: 0;
}
.mq-screen-header .mq-progress-bar { flex: 1; margin: 0; }
.mq-screen-header .mq-counter { white-space: nowrap; }

.mq-two-panel {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.mq-left-panel {
  flex: 0 0 55%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
}
.mq-right-panel {
  flex: 1;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green) var(--border);
}
.mq-right-panel::-webkit-scrollbar { width: 4px; }
.mq-right-panel::-webkit-scrollbar-track { background: var(--border); border-radius: 99px; }
.mq-right-panel::-webkit-scrollbar-thumb { background: var(--green); border-radius: 99px; }
.mq-right-inner { display: flex; flex-direction: column; gap: 14px; }

.mq-progress-bar { height: 4px; background: var(--border); border-radius: 2px; }
.mq-progress-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width .3s ease; }
.mq-counter { font-size: 12px; color: var(--muted); }

.mq-question-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-xl); padding: 20px 22px;
}
.mq-q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mq-subtopic-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; color: var(--muted); }
.mq-marks { font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: var(--r-full); }
.mq-q-text { font-size: 18px; color: var(--text); line-height: 1.6; }

/* Maths diagram */
.mq-diagram { margin: 0 0 16px; display: flex; justify-content: center; }
.maths-diagram { max-width: 340px; width: 100%; border-radius: var(--r-md); background: var(--surface-raised); border: 1.5px solid var(--border); padding: 8px; }

/* Canvas scratchpad */
.mq-scratchpad { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); overflow: hidden; }
.mq-scratchpad-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mq-scratchpad-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Canvas toolbar */
.mq-canvas-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.mq-canvas-label { font-size: 12px; color: var(--muted); font-weight: 600; flex: 1; min-width: 70px; }
.mq-pen-btns { display: flex; align-items: center; gap: 4px; }
.mq-pen-sz {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .12s, background .12s; flex-shrink: 0;
}
.mq-pen-sz:hover { border-color: var(--green); }
.mq-pen-sz.active { border-color: var(--green); background: var(--green-light); }
.mq-pen-dot { border-radius: 50%; background: #000; display: block; flex-shrink: 0; }
.mq-toolbar-btn {
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 12px; cursor: pointer; color: var(--text);
  transition: border-color .12s, background .12s; white-space: nowrap;
}
.mq-toolbar-btn:hover { border-color: var(--green); }
.mq-toolbar-btn.active { border-color: var(--amber); background: #fff8e1; color: var(--amber); }

.mq-canvas {
  display: block; width: 100%;
  height: 500px;
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
}
.mq-hint-area { background: #fffbeb; border: 1.5px solid var(--amber); border-radius: var(--r-xl); padding: 16px; margin-bottom: 14px; }
.mq-hint-inner .mq-hint-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--amber); margin-bottom: 6px; }
.mq-solution-area { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 20px; }
.mq-sol-inner .mq-sol-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 14px; }
.mq-next-step-btn { width: 100%; margin-top: 12px; }
.mq-sol-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mq-sol-step:last-child { border-bottom: none; }
.mq-sol-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--green-light); color: var(--green); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mq-sol-working { font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--text); margin: 4px 0; }
.mq-sol-why { font-size: 13px; color: var(--muted); font-style: italic; }
.mq-final-answer { background: var(--green-light); border: 1.5px solid var(--green); border-radius: var(--r-lg); padding: 12px 16px; margin-top: 14px; font-size: 15px; color: var(--green); font-weight: 600; }
.mq-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mq-self-report { display: flex; gap: 8px; width: 100%; }
.mq-got-it, .mq-got-wrong { flex: 1; }
.mq-got-wrong { background: transparent; border: 1.5px solid var(--red); color: var(--red); }
.mq-got-wrong:hover { background: var(--red); color: #fff; }

/* Difficulty / count pills */
.mq-diff-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mq-diff-pill { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-full); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .1s; }
.mq-diff-pill:hover { border-color: var(--green); }
.mq-diff-pill.active { background: var(--green); border-color: var(--green); color: #fff; }
.mq-sub-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mq-sub-pill { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-full); padding: 6px 12px; font-size: 12px; cursor: pointer; transition: all .1s; }
.mq-sub-pill.active { background: var(--green-light); border-color: var(--green); color: var(--green); }

/* Formula toggle button */
.mq-formula-toggle { font-size: 12px; padding: 5px 10px; white-space: nowrap; flex-shrink: 0; }

/* Formula panel — fixed slide-in from right */
.mq-formula-panel {
  position: fixed; top: 0; right: 0; width: 320px; height: 100vh;
  background: var(--surface); border-left: 2px solid var(--border);
  box-shadow: -6px 0 24px rgba(0,0,0,.15); z-index: 300;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
  pointer-events: none;
}
.mq-formula-panel.mq-fp-open { transform: translateX(0); pointer-events: all; }
.mq-fp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}
.mq-fp-title { font-weight: 700; font-size: 15px; }
.mq-fp-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.mq-fp-cat { margin-bottom: 20px; }
.mq-fp-cat-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.mq-fp-item { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 6px; }
.mq-fp-item-name { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.mq-fp-formula { font-size: 14px; overflow-x: auto; }
.mq-fp-vars { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
@media (max-width: 600px) { .mq-formula-panel { width: 100vw; } }

/* Results */
.mq-results { text-align: center; padding: 20px 0; }
.mq-results-score { font-family: 'JetBrains Mono', monospace; font-size: 64px; font-weight: 700; line-height: 1; }
.mq-results-label { font-size: 18px; color: var(--muted); margin-bottom: 20px; }
.mq-sub-result { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.mq-results-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; align-items: center; }

/* AI Chat */
.mch-shell { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.mch-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 0; flex-shrink: 0; }
.mch-messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.mch-welcome { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 15px; }
.mch-msg { max-width: 85%; padding: 12px 16px; border-radius: var(--r-xl); font-size: 14px; line-height: 1.6; }
.mch-user { background: var(--green); color: #fff; align-self: flex-end; border-radius: var(--r-xl) var(--r-xl) 4px var(--r-xl); }
.mch-ai { background: var(--surface); border: 1.5px solid var(--border); align-self: flex-start; border-radius: var(--r-xl) var(--r-xl) var(--r-xl) 4px; }
.mch-ai-text { white-space: pre-wrap; }
.mch-reveal-btn { margin-top: 10px; font-size: 12px; }
.mch-answer { margin-top: 8px; background: var(--green-light); border: 1px solid var(--green); border-radius: var(--r-lg); padding: 8px 12px; font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--green); }
.mch-loading { display: flex; gap: 4px; align-items: center; padding: 14px 18px; }
.mch-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: mchBounce .8s ease-in-out infinite; }
.mch-dot:nth-child(2) { animation-delay: .15s; }
.mch-dot:nth-child(3) { animation-delay: .3s; }
@keyframes mchBounce { 0%,80%,100%{transform:scale(0.8);opacity:.5} 40%{transform:scale(1.1);opacity:1} }
.mch-input-area { flex-shrink: 0; border-top: 1.5px solid var(--border); padding-top: 12px; }
.mch-symbol-bar { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 8px; scrollbar-width: none; }
.mch-symbol-bar::-webkit-scrollbar { display: none; }
.mch-input-row { display: flex; gap: 8px; align-items: flex-end; }
.mch-textarea { flex: 1; resize: none; min-height: 48px; max-height: 120px; }
.mch-send { flex-shrink: 0; height: 48px; }
.mch-preview {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 8px 12px;
  font-size: 14px; color: var(--text); margin-bottom: 8px;
  min-height: 32px; line-height: 1.6;
}

/* Worked examples */
.mex-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 24px; margin-bottom: 20px; }
.mex-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.mex-question { font-size: 16px; color: var(--muted); margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.mex-steps { display: flex; flex-direction: column; gap: 0; }
.mex-step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.mex-step:last-child { border-bottom: none; }
.mex-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.mex-step-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.mex-step-working { font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--text); margin: 4px 0; background: var(--surface-2); padding: 6px 10px; border-radius: var(--r-sm); }
.mex-step-why { font-size: 12px; color: var(--muted); font-style: italic; }
.mex-answer { margin-top: 16px; background: var(--green-light); border: 1.5px solid var(--green); border-radius: var(--r-lg); padding: 12px 16px; font-size: 15px; color: var(--green); font-weight: 600; }
.mex-method { margin-top: 8px; font-size: 13px; color: var(--muted); }
.mex-try { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-xl); padding: 20px; }
.mex-practice-q { font-family: 'Fraunces', serif; font-size: 17px; color: var(--text); margin-bottom: 16px; line-height: 1.5; }
.mex-scratchpad { margin-bottom: 14px; border-radius: var(--r-xl); overflow: hidden; border: 1.5px solid var(--border); }

/* Maths content wider in question mode */
.maths-content.mq-wide { max-width: 1140px; }

/* Maths responsive */
@media (max-width: 900px) {
  .mq-two-panel { flex-direction: column; }
  .mq-left-panel { flex: none; width: 100%; position: static; }
  .mq-right-panel { flex: none; width: 100%; max-height: none; overflow-y: visible; }
  .mq-canvas { height: 350px; }
}
@media (max-width: 768px) {
  .maths-topbar { padding: 10px 16px; }
  .maths-content { padding: 16px 16px 60px; }
  .mtd-modes { grid-template-columns: 1fr; }
  .maths-topics-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .mob-body { padding: 24px 16px; }
  .mob-header { padding: 20px 16px 14px; }
  .mch-shell { height: calc(100vh - 120px); }
}

/* ── REDUCED MOTION ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
