@font-face{font-family:'Crimson Pro';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/crimsonpro/v28/q5uUsoa5M_tv7IihmnkabC5XiXCAlXGks1WZzm18OA.ttf) format('truetype')}
@font-face{font-family:'Crimson Pro';font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/crimsonpro/v28/q5uUsoa5M_tv7IihmnkabC5XiXCAlXGks1WZEGp8OA.ttf) format('truetype')}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7oUUsj.ttf) format('truetype')}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7aUUsj.ttf) format('truetype')}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/spacegrotesk/v22/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj4PVksj.ttf) format('truetype')}

.nav-btn .icon { display: inline-flex; vertical-align: middle; margin-right: 6px; width: 18px; height: 18px; border-radius: 5px; }

.warmup-stats .icon { display: inline-flex; vertical-align: middle; margin-right: 4px; }

.lp-feature-card .icon { display: inline-flex; vertical-align: middle; margin-bottom: 12px; }
.subj-icon .icon { display: inline-flex; vertical-align: middle; }
.setup-subject-option .subj-icon { display: flex; align-items: center; justify-content: center; }

.mascot .icon { display: flex; }

:root {
  --bg: #f4f5ed;
  --ink: #1f2b2b;
  --muted: #5f6a69;
  --panel: #fffdf7;
  --accent: #0f766e;
  --accent-soft: #d7efec;
  --danger: #b42318;
  --warning: #e6a700;
  --success: #237a57;
  --radius: 18px;
  --shadow: 0 16px 35px rgba(18, 36, 34, 0.12);
  --sidebar-bg: linear-gradient(165deg, #133633 0%, #235f59 100%);
  --sidebar-active-bg: #f6fffc;
  --sidebar-active-text: #103836;
  --sidebar-text: #fcfff8;
  --card-bg: #fffdf7;
  --border: #dbe8e4;
  --text: #1f2b2b;
  --surface: #f6faf7;
  /* Button design tokens — flat, matte, consistent */
  --on-accent: #f4fffd;
  --btn-bg: var(--accent);
  --btn-color: #f4fffd;
  --btn-radius: 12px;
  --btn-padding: 10px 16px;
  --btn-hover-filter: brightness(0.95);
  --btn-ghost-bg: #eef4f2;
  --btn-ghost-color: #1f3736;
  --btn-ghost-border: transparent;
  --btn-danger-bg: var(--danger);
  --btn-danger-color: #fff3f1;
  /* Focus-ring tokens — keyboard users see the same accent everywhere */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --focus-ring-color: color-mix(in srgb, var(--accent) 60%, transparent);
  --focus-ring-strong: color-mix(in srgb, var(--accent) 70%, white 20%);
  --focus-ring-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  /* Input + list-item tokens (light defaults; dark overrides below) */
  --input-bg: #ffffff;
  --input-border: #cfded9;
  --input-color: var(--ink);
  --item-bg: var(--surface);
}

/* Theme: Blue */
[data-theme="blue"] {
  --accent: #0b5cab;
  --accent-soft: #d9e9fb;
  --sidebar-bg: linear-gradient(165deg, #0a2744 0%, #1a4a7a 100%);
  --sidebar-active-bg: #e8f0ff;
  --sidebar-active-text: #0a2744;
  --danger: #b91c1c;
  --success: #15803d;
}

/* ===== DENSITY (layout customization) ===== */
[data-density="compact"] .app-shell { padding: 10px; gap: 12px; }
[data-density="compact"] .card { padding: 12px; }
[data-density="compact"] .nav-btn { padding: 7px 12px; }
[data-density="compact"] .nav { gap: 3px; }
[data-density="compact"] .metric-grid { gap: 10px; }
[data-density="compact"] .sidebar { padding: 16px 14px; }
[data-density="compact"] .topbar { padding: 10px 12px; }
[data-density="compact"] input, [data-density="compact"] select, [data-density="compact"] textarea { padding: 6px 10px; }
[data-density="compact"] .tab { gap: 10px; }

[data-density="roomy"] .app-shell { padding: 26px; gap: 28px; }
[data-density="roomy"] .card { padding: 24px; }
[data-density="roomy"] .nav-btn { padding: 13px 18px; }
[data-density="roomy"] .nav { gap: 10px; }
[data-density="roomy"] .metric-grid { gap: 18px; }
[data-density="roomy"] .sidebar { padding: 30px 24px; }
[data-density="roomy"] .topbar { padding: 18px 20px; }
[data-density="roomy"] input, [data-density="roomy"] select, [data-density="roomy"] textarea { padding: 11px 16px; }
[data-density="roomy"] .tab { gap: 22px; }

/* ===== COMPACT POWER MODE — collapse cards into dense lists ===== */
[data-power="true"] .app-shell { padding: 10px; gap: 12px; }
[data-power="true"] .tab { gap: 8px; }
[data-power="true"] .split-grid, [data-power="true"] .dash-top-grid, [data-power="true"] .metric-grid, [data-power="true"] .social-grid { gap: 8px; }
[data-power="true"] .card { padding: 10px 12px; }
[data-power="true"] .card h3 { margin-bottom: 8px; font-size: 0.95rem; }
[data-power="true"] .card .subtle { font-size: 0.8rem; }
[data-power="true"] .topbar { padding: 8px 12px; }
[data-power="true"] .topbar h2 { font-size: 1.2rem; }
[data-power="true"] .nav-btn { padding: 6px 10px; font-size: 0.8rem; }
[data-power="true"] .sidebar { padding: 12px; }
[data-power="true"] .nav { gap: 3px; }
[data-power="true"] .metric h3 { font-size: 1.5rem; }
[data-power="true"] .list li, [data-power="true"] .item { padding: 8px 10px; border-radius: 10px; }
[data-power="true"] .btn { padding: 7px 12px; font-size: 0.85rem; }
[data-power="true"] .btn-sm { padding: 4px 9px; font-size: 0.75rem; }
[data-power="true"] input, [data-power="true"] select, [data-power="true"] textarea { padding: 6px 10px; }
/* Dashboard lists: cards become compact single-column rows */
[data-power="true"] .goal-walk-grid { grid-template-columns: 1fr; gap: 6px; }
[data-power="true"] .goal-walk-card { flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; }
[data-power="true"] .goal-walk-card .goal-walk-top { flex: 1; min-width: 0; }
[data-power="true"] .goal-walk-card .goal-walk-cta { margin-top: 0; }
[data-power="true"] .wt-dots { display: none; }
[data-power="true"] .review-queue-list, [data-power="true"] .review-block-list { gap: 6px; }
[data-power="true"] .review-queue-item, [data-power="true"] .review-block-item, [data-power="true"] .peer-activity-item { padding: 8px 10px; }
[data-power="true"] .peer-activity-feed { max-height: 220px; gap: 6px; }
[data-power="true"] .chip-wrap { gap: 6px; }
[data-power="true"] .chip { padding: 4px 9px; font-size: 0.78rem; }
[data-power="true"] .exam-radar, [data-power="true"] .countdown-list { gap: 6px; }

/* Theme: Orange */
[data-theme="orange"] {
  --accent: #b45309;
  --accent-soft: #f9e8d0;
  --sidebar-bg: linear-gradient(165deg, #431407 0%, #7c2d12 100%);
  --sidebar-active-bg: #fff7ed;
  --sidebar-active-text: #431407;
  --danger: #b91c1c;
  --success: #15803d;
}

/* Theme: Green */
[data-theme="green"] {
  --accent: #2f855a;
  --accent-soft: #d8efdf;
  --sidebar-bg: linear-gradient(165deg, #14432a 0%, #276749 100%);
  --sidebar-active-bg: #ecfdf5;
  --sidebar-active-text: #14432a;
  --danger: #b91c1c;
}

/* Theme: Purple */
[data-theme="purple"] {
  --accent: #7c3aed;
  --accent-soft: #ede9fe;
  --sidebar-bg: linear-gradient(165deg, #2e1065 0%, #5b21b6 100%);
  --sidebar-active-bg: #f5f3ff;
  --sidebar-active-text: #2e1065;
  --danger: #b91c1c;
  --success: #15803d;
}

/* Theme: Red */
[data-theme="red"] {
  --accent: #dc2626;
  --accent-soft: #fee2e2;
  --sidebar-bg: linear-gradient(165deg, #450a0a 0%, #991b1b 100%);
  --sidebar-active-bg: #fef2f2;
  --sidebar-active-text: #450a0a;
  --success: #15803d;
}

/* Theme: Pink */
[data-theme="pink"] {
  --accent: #db2777;
  --accent-soft: #fce7f3;
  --sidebar-bg: linear-gradient(165deg, #500724 0%, #9d174d 100%);
  --sidebar-active-bg: #fdf2f8;
  --sidebar-active-text: #500724;
  --danger: #b91c1c;
  --success: #15803d;
}

/* Theme: Yellow */
[data-theme="yellow"] {
  --accent: #ca8a04;
  --accent-soft: #fef9c3;
  --sidebar-bg: linear-gradient(165deg, #422006 0%, #a16207 100%);
  --sidebar-active-bg: #fefce8;
  --sidebar-active-text: #422006;
  --danger: #b91c1c;
  --success: #15803d;
}

/* ===== TRUE DARK MODE ===== */
[data-dark="true"] {
  --bg: #000000;
  --ink: #e8e8e8;
  --muted: #888888;
  --panel: #111111;
  --card-bg: #0d0d0d;
  --border: #222222;
  --text: #e8e8e8;
  --surface: #0a0a0a;
  --shadow: 0 16px 35px rgba(0, 0, 0, 0.6);
  --sidebar-bg: linear-gradient(165deg, #0a0a0a 0%, #1a1a1a 100%);
  --sidebar-active-bg: #1a1a1a;
  --sidebar-active-text: #fff;
  --sidebar-text: #aaa;
  /* Dark-mode button tokens: flat surfaces with readable text */
  --btn-ghost-bg: #222222;
  --btn-ghost-color: #e8e8e8;
  --btn-ghost-border: #333333;
  --on-accent: #f4fffd;
  /* Dark-mode input tokens */
  --input-bg: #1a1a1a;
  --input-border: #333333;
  --input-color: #e8e8e8;
}

[data-dark="true"] body {
  background: #000 !important;
  background-image: none !important;
}

[data-dark="true"] .onboarding-overlay {
  background: #000;
}

[data-dark="true"] input,
[data-dark="true"] textarea,
[data-dark="true"] select {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-color);
}

[data-dark="true"] input:focus,
[data-dark="true"] textarea:focus,
[data-dark="true"] select:focus {
  border-color: var(--accent);
}

[data-dark="true"] .chip {
  color: #ddd;
  border-color: rgba(255,255,255,0.12);
}

[data-dark="true"] .calc-btn,
[data-dark="true"] .calc-display {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-color);
}

[data-dark="true"] .onb-field input,
[data-dark="true"] .setup-subject-option {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-color);
}

[data-dark="true"] .setup-subject-option:hover {
  border-color: var(--accent);
}

[data-dark="true"] .score-chip.mid {
  background: #2a2410;
  border-color: #4a3f1a;
}

[data-dark="true"] [class*="note-"] .note-content textarea,
[data-dark="true"] [class*="note-"] .note-content input,
[data-dark="true"] .note-field {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-color);
}

[data-dark="true"] .science-image-placeholder {
  background: linear-gradient(135deg, var(--accent-soft), #1a1a1a);
  border-color: var(--accent-soft);
}

[data-dark="true"] .ambient {
  opacity: 0.08;
}

[data-dark="true"] .lp-hero {
  background: linear-gradient(135deg, #000 0%, #0a0a0a 50%, #000 100%);
}

[data-dark="true"] .lp-hero::before {
  opacity: 0.5;
}

/* Theme-aware accent colors in dark mode */
[data-dark="true"][data-theme="teal"] { --accent-soft: #0f3a36; }
[data-dark="true"][data-theme="blue"] { --accent-soft: #0f2844; }
[data-dark="true"][data-theme="orange"] { --accent-soft: #3a1f07; }
[data-dark="true"][data-theme="green"] { --accent-soft: #0f2a1a; }
[data-dark="true"][data-theme="purple"] { --accent-soft: #1f0a3a; }
[data-dark="true"][data-theme="red"] { --accent-soft: #3a0a0a; }
[data-dark="true"][data-theme="pink"] { --accent-soft: #3a0720; }
[data-dark="true"][data-theme="yellow"] { --accent-soft: #3a2a04; }

/* Fix remaining hardcoded light backgrounds */
[data-dark="true"] .note-plain,
[data-dark="true"] .note-cornell,
[data-dark="true"] .note-outline,
[data-dark="true"] .note-mindmap,
[data-dark="true"] .note-charting,
[data-dark="true"] .note-sentence,
[data-dark="true"] .note-blurting,
[data-dark="true"] .assignment-card,
[data-dark="true"] .flashcard,
[data-dark="true"] .quiz-card,
[data-dark="true"] .recall-card,
[data-dark="true"] .session-card,
[data-dark="true"] .chat-message.user,
[data-dark="true"] .chat-message.ai,
[data-dark="true"] .coach-message {
  background: var(--card-bg);
  border-color: var(--border);
}
[data-dark="true"] .chat-bubble.assistant pre,
[data-dark="true"] .chat-bubble.ai pre { background: #0a0a0a; }
[data-dark="true"] .chat-bubble.assistant blockquote,
[data-dark="true"] .chat-bubble.ai blockquote { background: color-mix(in srgb, var(--accent) 10%, #0d0d0d); }

[data-dark="true"] .sidebar {
  box-shadow: 0 16px 35px rgba(0,0,0,0.8);
}

[data-dark="true"] .social-grid,
[data-dark="true"] .music-card,
[data-dark="true"] .setting-group,
[data-dark="true"] .planner-card,
[data-dark="true"] .kanban-card {
  background: var(--panel);
  border-color: var(--border);
}

[data-dark="true"] .warmup-tab-btn { border-color: #333; background: #1a1a1a; }
[data-dark="true"] .warmup-tab-btn.active { background: var(--accent); color: #fff; }
[data-dark="true"] .study-output { border-color: #222; }
[data-dark="true"] .study-output .sg-section { background: #0d0d0d; }
[data-dark="true"] .study-output .sg-planner-day { background: #0d0d0d; border-color: #222; }
[data-dark="true"] .calc-mode-btn { border: none; background: transparent; }
[data-dark="true"] .calc-mode-btn.active { background: var(--card-bg); }
[data-dark="true"] .calc-panel { border-color: #222; }
[data-dark="true"] .peer-method { border-color: #333; background: #1a1a1a; }
[data-dark="true"] .peer-method.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, #111); }
[data-dark="true"] .script-content { border-color: #333; }

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

/* ===== GENERATORS ===== */
.gen-map-canvas {
  min-height: 380px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--panel);
  user-select: none;
  overflow: auto;
}
.gen-map-canvas .subtle { text-align: center; margin-top: 120px; }
.gen-map-node {
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: grab;
  width: 150px;
  box-sizing: border-box;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.3;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  text-align: center;
}
.gen-map-node:hover { transform: scale(1.05); box-shadow: 0 6px 18px rgba(0,0,0,0.22); }
.gen-map-node.selected { box-shadow: 0 0 0 3px var(--ink), 0 6px 20px rgba(0,0,0,0.3); }
.gen-map-node:active { cursor: grabbing; }
.gen-map-label { word-break: break-word; }
.gen-map-explanation-box {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  min-height: 1em;
}
.gen-film-body { font-size: 0.9rem; line-height: 1.65; }

/* Performance coach chat */
.coach-chat { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.chat-history { display: flex; flex-direction: column; gap: 8px; }
.coach-bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.coach-bubble.coach { align-self: flex-start; background: var(--panel-soft, rgba(128,128,128,.12)); border-top-left-radius: 4px; }
.coach-bubble.user { align-self: flex-end; background: var(--accent, #6c5ce7); color: #fff; border-top-right-radius: 4px; }

/* Real image grid */
.img-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.img-cell { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); }
.img-cell img { width: 100%; height: 180px; object-fit: cover; display: block; }
.img-cell figcaption { font-size: 0.78rem; color: var(--muted); padding: 8px 10px 4px; line-height: 1.4; }
.img-actions { display: flex; gap: 8px; padding: 4px 10px 10px; }
.img-actions a { font-size: 0.75rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.img-actions a:hover { text-decoration: underline; }
@media (max-width: 640px) { .img-grid { grid-template-columns: 1fr; } }

/* Film player */
.film-player { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.film-screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.film-frame { width: 100%; height: 100%; }
.film-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-frame-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #e2e8f0; text-align: center; padding: 24px;
}
.film-frame-fallback .film-fallback-icon { font-size: 3rem; }
.film-frame-fallback strong { font-size: 1.05rem; max-width: 90%; }
.film-frame-fallback span { font-size: 0.85rem; color: #94a3b8; max-width: 85%; line-height: 1.45; }
.film-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 34px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff;
}
.film-scene-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #7dd3fc; margin-bottom: 4px; }
.film-caption p { margin: 0; font-size: 1rem; line-height: 1.4; }
.film-controls { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #0b1220; border-top: 1px solid rgba(255,255,255,0.08); }
.film-controls button { background: transparent; border: 1px solid rgba(255,255,255,0.18); color: #e2e8f0; border-radius: 10px; padding: 6px 12px; font-size: 0.85rem; cursor: pointer; }
.film-controls button:hover { background: rgba(255,255,255,0.12); }
.film-progress { margin-left: auto; color: #94a3b8; font-size: 0.8rem; }
@media (max-width: 640px) {
  .film-caption p { font-size: 0.9rem; }
}
.gen-model-parts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.gen-model-part { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--panel); }
.gen-model-part summary { cursor: pointer; font-weight: 600; }
.gen-model-part p { margin: 6px 0 0; font-size: 0.9rem; line-height: 1.5; }
.gen-model-flow { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.gen-model-flow-step { font-size: 0.85rem; }

/* ===== JUDGE BANNER ===== */
.judge-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  width: auto;
  max-width: 90vw;
  animation: slideDown 0.4s ease;
}
.judge-banner .judge-banner-text {
  line-height: 1.5;
}
.judge-banner-dismiss {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  margin-left: 8px;
}
.judge-banner-dismiss:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.6);
}
.judge-banner.hidden {
  display: none;
}

/* In-app update banner — same geometry as the judge banner, flat accent surface */
.update-banner {
  background: var(--accent);
  background-image: none;
}
.update-banner .judge-banner-dismiss { background: rgba(255,255,255,0.18); }

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== STREAK & XP COUNTER ===== */
.streak-xp-container {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: 8px;
}

.streak-counter,
.xp-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.95);
  padding: 6px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.streak-icon,
.xp-icon {
  font-size: 1rem;
}

.streak-value,
.xp-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}

.streak-label,
.xp-label {
  font-size: 0.7rem;
  opacity: 0.7;
  color: var(--muted);
}

[data-dark="true"] .streak-counter,
[data-dark="true"] .xp-counter {
  background: rgba(0,0,0,0.8);
  color: #e8e8e8;
}

[data-dark="true"] .streak-value,
[data-dark="true"] .xp-value {
  color: var(--accent-soft);
}

/* ===== EMPTY STATE FALLBACKS ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  text-align: center;
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
}

.empty-state p {
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 16px;
}

.empty-state-button {
  margin-top: 12px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
}

.empty-state-button:hover {
  filter: brightness(0.95);
}

/* ===== PEER ACTIVITY FEED ===== */
.peer-activity-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

.peer-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.5;
}

.peer-activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.peer-activity-content {
  flex: 1;
}

.peer-activity-name {
  font-weight: 600;
  color: var(--ink);
}

.peer-activity-action {
  color: var(--muted);
}

.peer-activity-time {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
  margin-top: 2px;
}

/* ===== LEADERBOARD ===== */
.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 40px 1fr 80px 80px;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 40px 1fr 80px 80px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.leaderboard-row:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.leaderboard-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

.leaderboard-name {
  font-weight: 600;
  color: var(--ink);
}

.leaderboard-streak {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.leaderboard-xp {
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

.leaderboard-row.me {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  border-color: var(--accent);
}

/* ===== RESOURCES ===== */
.resource-scout-item,
.resource-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.resource-scout-item + .resource-scout-item,
.resource-item + .resource-item { margin-top: 8px; }
.resource-scout-head,
.resource-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.resource-preview-content {
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
}
.danger-text { color: var(--danger) !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
[data-dark="true"] .modal-card { background: var(--card-bg); border: 1px solid var(--border); }

/* ===== GOAL WALKTHROUGHS ===== */
.goal-walk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 10px; }
/* ===== NEXT 15 MINUTES ===== */
.next15-pick { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.next15-icon { font-size: 1.9rem; flex-shrink: 0; animation: pulse-soft 2.4s ease-in-out infinite; }
.next15-body { flex: 1; min-width: 0; }
@keyframes pulse-soft { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: .85; } }

/* ===== EXAM-DAY SURVIVAL KIT ===== */
.survival-kit { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.survival-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.survival-col { background: color-mix(in srgb, var(--surface2, var(--surface)) 60%, transparent); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.survival-col h4 { margin: 0 0 8px; font-size: .86rem; }
.survival-col .list { margin: 0; }
.breathe-widget { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.breathe-circle { width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; font-weight: 700; font-size: .8rem; color: var(--accent); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent) 10%, transparent)); border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--border)); transition: transform 4s ease-in-out; transform: scale(1); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 22%, transparent); }

/* ===== EXPLAIN-THEN-VERIFY MODAL ===== */
.ev-modal { max-width: 520px; }
.ev-card-q { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); margin-top: 10px; }
.ev-card-a { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--success) 7%, var(--surface)); margin-top: 8px; }

.goal-walk-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.goal-walk-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.goal-walk-top { display: flex; align-items: center; gap: 10px; }
.goal-walk-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wt-ring { --wt-pct: 0; width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; background: conic-gradient(var(--accent) calc(var(--wt-pct) * 1%), var(--border) 0); display: flex; align-items: center; justify-content: center; }
.wt-ring-inner { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; }
.wt-dots { display: flex; gap: 4px; }
.wt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.wt-dot.done { background: var(--success); }
.goal-walk-cta { margin-top: 4px; font-size: .78rem; font-weight: 700; color: var(--accent); }
.wt-step { position: relative; }
.wt-step-check { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; cursor: pointer; color: var(--muted); background: var(--surface); transition: all .15s ease; z-index: 1; }
.wt-step-check:hover { border-color: var(--accent); color: var(--accent); }
.wt-step-done { opacity: .75; border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.wt-step-done .wt-step-check { border-color: var(--success); color: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--surface)); }
.wt-step-done .wt-step-icon { filter: grayscale(.3); }
.wt-guide { margin: 6px 0 14px; }
.wt-guide-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.wt-guide-body { font-size: .86rem; line-height: 1.55; max-height: 260px; overflow-y: auto; }
.wt-guide-body h2, .wt-guide-body h3 { margin: 10px 0 4px; font-size: 1rem; }
.wt-guide-body ul, .wt-guide-body ol { margin: 4px 0; padding-left: 20px; }
.wt-ring-sm { width: 34px; height: 34px; }
.wt-ring-sm .wt-ring-inner { width: 26px; height: 26px; font-size: .62rem; }
.goal-planner-item { display: flex; align-items: center; gap: 12px; }
.goal-planner-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.goal-planner-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ===== PRINT SHEET ===== */
.print-sheet { display: none; }
.print-sheet.print-active { display: block; position: fixed; inset: 0; z-index: 10000; background: #fff; color: #111; padding: 40px; overflow-y: auto; }
.print-sheet h1 { font-size: 1.6rem; margin: 0 0 4px; }
.print-sheet h2 { font-size: 1.1rem; margin: 22px 0 8px; border-bottom: 2px solid #111; padding-bottom: 4px; }
.print-sheet p { margin: 2px 0; }
.print-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.print-table th, .print-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #ccc; }
.print-table tr.done td { color: #888; text-decoration: line-through; }
.print-table .check { width: 32px; }
.print-topics { margin: 8px 0; padding-left: 22px; }
.print-guide { font-size: .92rem; line-height: 1.6; }
.print-guide h2, .print-guide h3 { font-size: 1rem; margin: 12px 0 4px; border: none; }
.print-lines { height: 160px; border-bottom: 1px solid #999; }
@media print {
  body > *:not(.print-sheet.print-active) { display: none !important; }
  .print-sheet.print-active { position: static; padding: 0; overflow: visible; }
  .print-sheet { display: block !important; }
}

/* ===== CONFETTI ===== */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 10001; overflow: hidden; }
.confetti-piece { position: absolute; top: -12px; border-radius: 2px; opacity: .95; animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards; }
@keyframes confetti-fall {
  0% { transform: translate3d(0, -10px, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift), 105vh, 0) rotate(var(--spin)); opacity: .6; }
}

/* ===== WALKTHROUGH ANALYTICS ===== */
.wt-an-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wt-an-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.wt-an-stat strong { display: block; font-size: 1.25rem; color: var(--accent); }
.wt-an-stat span { font-size: .72rem; opacity: .75; line-height: 1.3; }
.wt-an-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.wt-an-step { display: flex; align-items: center; gap: 10px; }
.wt-an-label { width: 150px; font-size: .78rem; flex-shrink: 0; }
.wt-an-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.wt-an-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--success))); transition: width .4s ease; }
.wt-an-num { width: 26px; text-align: right; font-size: .78rem; font-weight: 700; }
.wt-an-goals { display: flex; flex-direction: column; gap: 8px; }
.wt-an-goal { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.wt-an-goal-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wt-modal { max-width: 720px; }
.wt-phase-note { padding: 8px 12px; border-radius: var(--radius); font-size: .82rem; margin: 10px 0; background: var(--surface); border: 1px solid var(--border); }
.wt-phase-note.exam-urgent { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: var(--danger); }
.wt-phase-note.exam-soon { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border-color: var(--warning); }
.wt-phase-note.exam-ahead { background: color-mix(in srgb, var(--success) 10%, var(--surface)); border-color: var(--success); }
.wt-topics { margin: 6px 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.wt-steps { display: flex; flex-direction: column; gap: 10px; }
.wt-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.wt-step-icon { font-size: 1.4rem; line-height: 1; }
.wt-step-body { flex: 1; min-width: 0; }
.wt-step-body p { margin: 2px 0 0; font-size: .82rem; opacity: .8; }
.wt-step-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.wt-action { padding: 5px 10px; font-size: .75rem; font-weight: 700; border-radius: 999px; background: var(--accent); color: var(--on-accent); border: none; cursor: pointer; }
.wt-action:hover { filter: brightness(0.95); }
.wt-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.loading-skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--accent-soft) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ===== STUDY ROOM ===== */
.whiteboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.wb-tools { gap: 6px; }
.wb-tool {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.82rem;
  cursor: pointer;
}
.wb-tool.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.whiteboard-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
#whiteboardCanvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  background: #fff;
}
[data-dark="true"] .whiteboard-wrap,
[data-dark="true"] #whiteboardCanvas { background: #f8f9f1; }
.whiteboard-hint {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 0.72rem;
  color: #8a9aa0;
  pointer-events: none;
}
.wb-sticky {
  padding: 10px 12px;
  background: #fef9c3;
  border: 1px solid #e6d54a;
  border-radius: 8px;
  color: #422006;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.wb-sticky button { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: 0.6; }
.wb-sticky button:hover { opacity: 1; }
[data-dark="true"] .wb-sticky { background: #3a2f04; border-color: #6b5510; color: #fef9c3; }
[data-dark="true"] .wb-tool { background: #1a1a1a; border-color: #333; color: #e8e8e8; }

/* ===== IMPACT METRICS DASHBOARD ===== */
.impact-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.impact-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
}

.impact-metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.impact-metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4;
  max-width: 140px;
}

@media (max-width: 640px) {
  .impact-metrics-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .impact-metric-value {
    font-size: 1.6rem;
  }
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  border-radius: 6px;
}

.skeleton-text {
  height: 1rem;
  margin: 4px 0;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-title {
  height: 1.5rem;
  width: 80%;
  margin: 8px 0;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: 12px;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loading overlay for AI processing */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== MOBILE RESPONSIVE ===== */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  margin-right: 12px;
}

.hamburger-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: all 0.3s;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: all 0.3s;
}

.hamburger-icon::before { top: -7px; }
.hamburger-icon::after { bottom: -7px; }

.mobile-menu-btn.active .hamburger-icon {
  background: transparent;
}

.mobile-menu-btn.active .hamburger-icon::before {
  transform: rotate(45deg);
  top: 0;
}

.mobile-menu-btn.active .hamburger-icon::after {
  transform: rotate(-45deg);
  bottom: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 0 16px 35px rgba(0,0,0,0.2);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .main {
    padding-top: 0;
  }
  
  .topbar {
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .split-grid {
    grid-template-columns: 1fr;
  }
  
  .kanban {
    grid-template-columns: 1fr;
  }
  
  /* Ensure minimum touch targets of 44x44 */
  .fc-nav-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  .fc-rate-btn {
    min-height: 44px;
    padding: 12px 8px;
  }
  
  .calc-btn {
    min-height: 44px;
  }
  
  .quiz-type-card {
    min-height: 44px;
  }
  
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Fix input sizes for touch */
  input[type="number"],
  input[type="text"],
  input[type="date"],
  select,
  textarea {
    min-height: 44px;
    padding: 12px 14px;
  }
}

body {
  font-family: var(--font-ui, "Space Grotesk"), sans-serif;
  color: var(--ink);
  line-height: 1.55;
  background:
    radial-gradient(circle at 15% 20%, rgba(15, 118, 110, 0.14), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(230, 167, 0, 0.15), transparent 28%),
    linear-gradient(160deg, #f8f9f1 0%, #f2f6f4 100%);
  transition: background 0.3s ease;
}

[data-theme="blue"] body,
[data-theme="blue"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(11, 92, 171, 0.14), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(99, 182, 255, 0.12), transparent 28%),
    linear-gradient(160deg, #f0f4f8 0%, #e8f0fe 100%);
}

[data-theme="orange"] body,
[data-theme="orange"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(180, 83, 9, 0.14), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(255, 180, 50, 0.15), transparent 28%),
    linear-gradient(160deg, #fffbf5 0%, #fef3e2 100%);
}

[data-theme="green"] body,
[data-theme="green"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(47, 133, 90, 0.14), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(74, 222, 128, 0.12), transparent 28%),
    linear-gradient(160deg, #f0fdf4 0%, #ecfdf5 100%);
}

[data-theme="purple"] body,
[data-theme="purple"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.14), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(167, 139, 250, 0.15), transparent 28%),
    linear-gradient(160deg, #faf5ff 0%, #f3e8ff 100%);
}

[data-theme="red"] body,
[data-theme="red"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(220, 38, 38, 0.12), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(252, 165, 165, 0.15), transparent 28%),
    linear-gradient(160deg, #fef2f2 0%, #fff1f2 100%);
}

[data-theme="pink"] body,
[data-theme="pink"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(219, 39, 119, 0.12), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(244, 114, 182, 0.15), transparent 28%),
    linear-gradient(160deg, #fdf2f8 0%, #fce7f3 100%);
}

[data-theme="yellow"] body,
[data-theme="yellow"] {
  background:
    radial-gradient(circle at 15% 20%, rgba(202, 138, 4, 0.12), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(250, 204, 21, 0.15), transparent 28%),
    linear-gradient(160deg, #fefce8 0%, #fef9c3 100%);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(transparent 95%, rgba(31, 43, 43, 0.04) 96%),
    linear-gradient(90deg, transparent 95%, rgba(31, 43, 43, 0.04) 96%);
  background-size: 32px 32px;
  opacity: 0.4;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100vh - 36px);
  background: var(--sidebar-bg);
  border-radius: calc(var(--radius) + 6px);
  color: var(--sidebar-text);
  padding: 24px 18px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.brand h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  opacity: 0.8;
}

.subtle {
  color: var(--muted);
  margin: 0;
}

.sidebar .subtle {
  color: rgba(249, 255, 246, 0.82);
}

.nav {
  margin-top: 18px;
  display: grid;
  gap: 6px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
  text-align: left;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.nav-btn.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-color: var(--sidebar-active-bg);
  font-weight: 700;
}

.main {
  display: grid;
  gap: 16px;
  align-content: start;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.card {
  background: var(--panel);
  border: 1px solid rgba(24, 60, 60, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, rgba(24, 60, 60, 0.09));
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.card h4 {
  margin: 12px 0 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric h3 {
  margin: 6px 0 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dash-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 960px) {
  .dash-top-grid { grid-template-columns: 1fr; }
}
/* Grid children may always shrink: long URLs, code, and names stay in their track */
.tab.active > *,
.split-grid > *,
.dash-top-grid > *,
.metric-grid > *,
.social-grid > *,
.subject-panel > * {
  min-width: 0;
}
#next15Go { flex-shrink: 0; }
#missionText { overflow-wrap: anywhere; line-height: 1.5; }

.social-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.tab {
  display: none;
}
.tab.active {
  display: grid;
  gap: 12px;
  opacity: 1;
  pointer-events: auto;
}

.stack {
  display: grid;
  gap: 8px;
}

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

.list li,
.item {
  background: var(--item-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.2s ease;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.86rem;
  background: var(--accent-soft);
  color: #114641;
  border: 1px solid rgba(17, 70, 65, 0.22);
}

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 0.95rem;
}

input,
textarea,
select {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-color);
  border-radius: 12px;
  padding: 10px 11px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring-soft);
}

textarea {
  resize: vertical;
}

button {
  border: none;
  background: var(--btn-bg);
  color: var(--btn-color);
  padding: var(--btn-padding);
  border-radius: var(--btn-radius);
  font-weight: 600;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
  letter-spacing: 0.01em;
  min-width: 44px;
  min-height: 44px;
}
button:active {
  transform: scale(0.97);
}
button:hover {
  filter: var(--btn-hover-filter);
}
button.ghost,
.file-label {
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-color);
  border: 1px solid var(--btn-ghost-border);
}
button.ghost:hover {
  border-color: var(--accent);
}
button.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-color);
}
button.danger:hover {
  filter: var(--btn-hover-filter);
}

.file-label input {
  display: none;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wrap {
  flex-wrap: wrap;
}

.top-gap {
  margin-top: 10px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin: 6px 0 -2px;
  letter-spacing: 0.02em;
}

/* Skip-to-content link: hidden until keyboard focus */
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 10001;
  background: var(--accent);
  color: var(--btn-color);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
  outline: var(--focus-ring-width) solid var(--focus-ring-strong);
  outline-offset: 2px;
}

/* Topbar quick layout switch */
.layout-quickbar { display: flex; align-items: center; gap: 6px; }
.layout-quickbar select {
  width: auto;
  padding: 6px 8px;
  font-size: 0.78rem;
  border-radius: 10px;
  min-height: 0;
}
.layout-quickbar #powerModeQuickBtn { padding: 6px 10px; border-radius: 10px; font-size: 0.95rem; min-width: 0; }
#powerModeQuickBtn[aria-pressed="true"] { background: var(--accent); color: var(--btn-color); border-color: transparent; }
@media (max-width: 960px) {
  .layout-quickbar { display: none; }
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kanban h4 {
  margin: 0 0 8px;
}

.task-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.task-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.task-card .small {
  font-size: 0.8rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: #104641;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 4px 9px;
}

.timer-display {
  margin: 8px 0;
  font-size: 3rem;
  font-weight: 700;
}

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

.fc-stats {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  opacity: 0.7;
}

.fc-deck-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.fc-deck-chip {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  transition: all 0.2s;
}

.fc-deck-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.fc-card-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.fc-flip-card {
  width: 100%;
  max-width: 420px;
  height: 260px;
  perspective: 1000px;
  cursor: pointer;
  outline: none;
  touch-action: pan-y;
}

.fc-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.fc-flip-card.flipped .fc-flip-inner {
  transform: rotateY(180deg);
}

.fc-flip-front,
.fc-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.fc-flip-front {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--card-bg) 100%);
  border: 2px solid var(--accent);
}

.fc-flip-back {
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--accent-soft) 100%);
  border: 2px solid var(--accent);
  transform: rotateY(180deg);
}

.fc-flip-card:hover .fc-flip-inner {
  transform: scale(1.01);
}
.fc-flip-card.flipped:hover .fc-flip-inner {
  transform: rotateY(180deg) scale(1.01);
}

.fc-flip-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.5;
  margin-bottom: 12px;
  font-weight: 700;
}

.fc-flip-text {
  font-size: 1.1rem;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
  width: 100%;
  word-wrap: break-word;
}

.fc-flip-hint {
  font-size: 0.68rem;
  opacity: 0.35;
  margin-top: 12px;
}

.fc-nav-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.fc-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.fc-nav-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.fc-counter {
  font-size: 0.85rem;
  opacity: 0.6;
  min-width: 60px;
  text-align: center;
}

.fc-mastery {
  max-width: 420px;
  width: 100%;
}
.fc-mastery-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  margin-bottom: 6px;
}
.fc-mastery-track {
  height: 8px;
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
}
.fc-mastery-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong, var(--accent)));
  border-radius: 20px;
  transition: width 0.3s ease;
}

.fc-rating-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.fc-rate-btn {
  padding: 10px 4px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.fc-rate-again {
  background: #fde8e8;
  color: #7f1d1d;
  border-color: #f5c6c6;
}

.fc-rate-hard {
  background: #fef3cd;
  color: #856404;
  border-color: #f0e0a8;
}

.fc-rate-good {
  background: #d4edda;
  color: #155724;
  border-color: #b8dfbf;
}

.fc-rate-easy {
  background: #d1ecf1;
  color: #0c5460;
  border-color: #b8dce4;
}

.fc-rate-btn:hover {
  filter: brightness(0.95);
}

.fc-empty {
  text-align: center;
  padding: 32px;
  opacity: 0.5;
}

.fc-empty.hidden {
  display: none;
}

.fc-deck-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
}

/* Lesson styles */
.lesson-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lesson-progress {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.lesson-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.lesson-step-counter {
  font-size: 0.75rem;
  opacity: 0.6;
  white-space: nowrap;
}

.lesson-sim-area {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  min-height: 120px;
}

.lesson-sim-area.hidden {
  display: none;
}

.lesson-sim-area svg {
  max-width: 100%;
  height: auto;
}

.lesson-chat-area {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  max-height: 300px;
}

.lesson-chat-area.hidden {
  display: none;
}

.lesson-chat-history {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: 8px;
}

.lesson-chat-history .chat-bubble {
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.lesson-chat-history .chat-bubble.user {
  background: var(--accent-soft);
  margin-left: 20px;
}

.lesson-chat-history .chat-bubble.assistant {
  background: var(--border);
  margin-right: 20px;
}

.lesson-chat-input-row {
  display: flex;
  gap: 6px;
}

.lesson-chat-input-row input {
  flex: 1;
}

/* Old review-card styles kept for quiz compatibility */
.review-card .review-question {
  font-size: 1.2rem;
  margin: 10px 0;
  font-family: "Crimson Pro", serif;
}

.review-answer {
  background: #f0faf7;
  border: 1px dashed #b8d9cf;
  border-radius: 12px;
  padding: 10px;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.rating-btn {
  background: #e8f6f2;
  color: #124642;
}

.rating-btn[data-rating="1"] {
  background: #fde8e8;
  color: #7f1d1d;
}

.preview {
  min-height: 280px;
  background: #fafcf7;
  border: 1px solid #e1ece6;
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
}

.preview h1,
.preview h2,
.preview h3 {
  font-family: "Crimson Pro", serif;
  margin: 8px 0;
}

.preview p,
.preview li {
  line-height: 1.55;
}

.progress {
  background: #e6eeea;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #157a6e, #46ab80);
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 4px;
}

.heat-cell {
  border-radius: 7px;
  aspect-ratio: 1;
  background: #ebf0ee;
}

.heat-cell.level-1 { background: #cae8db; }
.heat-cell.level-2 { background: #92d3b6; }
.heat-cell.level-3 { background: #4ab284; }
.heat-cell.level-4 { background: #197755; }

/* ===== Confusion Heatmap ===== */
.confusion-heatmap { overflow-x: auto; }
.confusion-grid {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) repeat(14, minmax(18px, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 520px;
}
.confusion-corner { height: 14px; }
.confusion-day {
  font-size: 0.62rem;
  opacity: 0.55;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.confusion-week { opacity: 0.9; font-weight: 700; }
.confusion-topic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}
.confusion-score {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  flex: none;
}
.confusion-cell {
  border-radius: 6px;
  aspect-ratio: 1;
  background: #f0ecec;
  transition: transform 0.15s ease;
}
.confusion-cell:hover { transform: scale(1.25); }
.confusion-cell.cl-1 { background: #f8d7d3; }
.confusion-cell.cl-2 { background: #efa79d; }
.confusion-cell.cl-3 { background: #e26857; }
.confusion-cell.cl-4 { background: #b3261e; }
.confusion-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.65rem;
  opacity: 0.7;
}
.confusion-legend .confusion-cell { width: 14px; height: 14px; aspect-ratio: auto; }
.confusion-list { margin-top: 14px; display: grid; gap: 10px; }
.confusion-item {
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg-soft, rgba(0,0,0,0.02));
}
.confusion-src {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 9px;
  background: rgba(0,0,0,0.06);
  margin-right: 4px;
}
.confusion-concepts { margin: 4px 0 0; padding-left: 18px; font-size: 0.8rem; }
.confusion-concepts li { margin: 2px 0; }
body.dark .confusion-cell { background: #2c2626; }
body.dark .confusion-item { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.09); }
body.dark .confusion-src { background: rgba(255,255,255,0.08); }

/* ===== Exam Radar ===== */
.exam-radar { display: grid; gap: 12px; }
.exam-radar-banner {
  border-radius: 14px;
  padding: 14px 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.exam-radar-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  background-size: 250% 100%;
  animation: examShine 5s ease-in-out infinite;
}
@keyframes examShine { 0%, 100% { background-position: 200% 0; } 50% { background-position: -50% 0; } }
.exam-radar-banner.exam-urgent { background: linear-gradient(120deg, #b3261e, #e26857); }
.exam-radar-banner.exam-soon { background: linear-gradient(120deg, #b45309, #e6a700); }
.exam-radar-banner.exam-ahead { background: linear-gradient(120deg, #0f766e, #2a9d8f); }
.exam-radar-head { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.exam-radar-countdown {
  flex: none;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.35);
}
.exam-radar-countdown.sm { font-size: 0.68rem; padding: 4px 8px; }
.exam-radar-banner p { position: relative; z-index: 1; }
.exam-radar-list { display: grid; gap: 8px; }
.exam-radar-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-left-width: 4px;
  border-radius: 10px;
  padding: 8px 10px;
}
.exam-radar-item.exam-urgent { border-left-color: var(--danger, #b3261e); background: color-mix(in srgb, var(--danger, #b3261e) 6%, transparent); }
.exam-radar-item.exam-soon { border-left-color: var(--warning, #e6a700); background: color-mix(in srgb, var(--warning, #e6a700) 6%, transparent); }
.exam-radar-item.exam-ahead { border-left-color: var(--success, #237a57); }
.exam-radar-item-body { flex: 1; min-width: 0; }

/* ===== Exam Grade Estimator ===== */
.exam-grade-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  margin-left: 6px;
  vertical-align: middle;
}
.exam-estimate-preview, .exam-estimator { display: grid; gap: 12px; }
.est-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  background: linear-gradient(120deg, rgba(20,184,166,0.12), rgba(20,184,166,0.04));
}
.est-grade {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
}
.est-grade small { font-size: 0.85rem; font-weight: 700; opacity: 0.75; }
.est-numbers { display: grid; gap: 2px; }
.est-numbers .est-num {
  font-size: 1.05rem;
  font-weight: 800;
}
.est-numbers .est-num .est-band { font-weight: 600; opacity: 0.7; font-size: 0.9rem; }
.est-meta { font-size: 0.78rem; opacity: 0.7; }
.est-bar-wrap { flex: 1 1 220px; min-width: 180px; }
.est-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  overflow: visible;
  margin-top: 8px;
}
.est-bar .est-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #2a9d8f);
  min-width: 6px;
}
.est-bar .est-band-range {
  position: absolute;
  top: -3px; bottom: -3px;
  border-radius: 999px;
  border: 2px dashed rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.25);
}
.est-bar .est-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  bottom: -4px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 2px;
}
.est-subject-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 10px;
  padding: 8px 12px;
}
.est-subject-name { flex: 1 1 140px; font-weight: 700; font-size: 0.9rem; }
.est-subject-grade { font-weight: 900; font-size: 1rem; }
.est-subject-bar { flex: 2 1 160px; height: 8px; border-radius: 999px; background: rgba(0,0,0,0.08); position: relative; }
.est-subject-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.est-subject-evidence { font-size: 0.75rem; opacity: 0.65; }
.est-gap {
  border-left: 4px solid var(--warning, #e6a700);
  background: color-mix(in srgb, var(--warning, #e6a700) 7%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.est-gap strong { font-size: 0.95rem; }
.est-target-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.est-target-row label { font-size: 0.85rem; font-weight: 700; }
.est-target-row select, .est-target-row input {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(0,0,0,0.2));
  background: var(--card, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
}
.est-target-hint {
  flex: 1 1 100%;
  font-size: 0.82rem;
  border-radius: 10px;
  border: 1px dashed var(--border, rgba(0,0,0,0.18));
  padding: 8px 10px;
  background: rgba(0,0,0,0.02);
}

/* ===== Estimator vs Reality ===== */
.pred-list { display: grid; gap: 6px; }
.pred-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 10px;
  padding: 6px 10px;
}
.pred-row-meta { flex: 1 1 130px; font-weight: 700; }
.pred-src {
  font-weight: 600;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.07);
  margin-left: 4px;
}
.pred-bars { position: relative; flex: 2 1 180px; height: 16px; border-radius: 6px; background: rgba(0,0,0,0.06); overflow: hidden; }
.pred-bar { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 4px; font-size: 0.62rem; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; border-radius: 6px; }
.pred-pred { background: rgba(15,118,110,0.65); z-index: 1; }
.pred-date { flex: none; opacity: 0.6; font-size: 0.7rem; }

/* ===== Explain-It-Back ===== */
.explain-prompt, .explain-grade {
  border: 1px dashed var(--border, rgba(0,0,0,0.15));
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.025);
}
.explain-grade { border-style: solid; }
.explain-grade-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
body.dark .explain-prompt, body.dark .explain-grade { background: rgba(255,255,255,0.04); }
@media (prefers-reduced-motion: reduce) {
  .exam-radar-banner::after { animation: none; }
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  z-index: 9999;
  right: 16px;
  bottom: 16px;
  background: #152b2a;
  color: #f4fff9;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  animation: slideInRight 0.3s ease;
  max-width: 360px;
  font-size: 0.9rem;
  line-height: 1.4;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.info-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.info-line .small {
  font-size: 0.8rem;
  color: var(--muted);
}

.recall-prompt { border-left: 4px solid var(--accent); }

.chat-bubble {
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  line-height: 1.6;
  font-size: 0.92rem;
  max-width: 90%;
  word-wrap: break-word;
}
.chat-bubble.user {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
  align-self: flex-end;
  margin-left: auto;
}

.ai-thinking {
  opacity: 0.7;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  max-width: 90%;
  margin: 4px 0 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.chat-bubble.assistant, .chat-bubble.ai {
  background: var(--surface);
  border-color: var(--border);
  align-self: flex-start;
}
/* AI-proposed action cards (tasks/events from the tutor, with confirm buttons) */
.action-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 90%;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}
.action-card-icon { font-size: 1.3rem; line-height: 1.4; }
.action-card-body { flex: 1; min-width: 0; }
.action-card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.action-card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.action-card-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.action-card-btns .btn { padding: 6px 12px; border-radius: 9px; font-size: 0.8rem; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: color-mix(in srgb, var(--muted) 10%, transparent); opacity: 1; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 9px; }
/* Rich content inside assistant bubbles */
.chat-bubble.assistant p, .chat-bubble.ai p { margin: 4px 0; }
.chat-bubble.assistant p:first-child, .chat-bubble.ai p:first-child { margin-top: 0; }
.chat-bubble.assistant p:last-child, .chat-bubble.ai p:last-child { margin-bottom: 0; }
.chat-bubble.assistant h2, .chat-bubble.ai h2 { font-size: 1.1rem; margin: 12px 0 6px; color: var(--accent); }
.chat-bubble.assistant h3, .chat-bubble.ai h3 { font-size: 1rem; margin: 10px 0 4px; color: var(--accent); }
.chat-bubble.assistant h4, .chat-bubble.ai h4,
.chat-bubble.assistant h5, .chat-bubble.ai h5 { font-size: 0.92rem; margin: 8px 0 4px; font-weight: 700; }
.chat-bubble.assistant strong, .chat-bubble.ai strong { font-weight: 700; }
.chat-bubble.assistant em, .chat-bubble.ai em { font-style: italic; }
.chat-bubble.assistant code, .chat-bubble.ai code {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 2px 6px; border-radius: 6px; font-size: 0.85em; font-family: monospace;
}
.chat-bubble.assistant pre, .chat-bubble.ai pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; overflow-x: auto; margin: 8px 0;
}
.chat-bubble.assistant pre code, .chat-bubble.ai pre code {
  background: none; padding: 0; font-size: 0.82rem; line-height: 1.5;
}
.chat-bubble.assistant ul, .chat-bubble.ai ul {
  padding-left: 20px; margin: 6px 0; list-style: disc;
}
.chat-bubble.assistant li, .chat-bubble.ai li { margin: 2px 0; }
.chat-bubble.assistant blockquote, .chat-bubble.ai blockquote {
  border-left: 3px solid var(--accent); padding: 6px 12px; margin: 8px 0;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-radius: 0 8px 8px 0;
}

.score-chip {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e8f4ee;
  border: 1px solid #d0e4da;
  font-size: 0.78rem;
}

.score-chip.good { background: #dff3e8; border-color: #bbe2cc; }
.score-chip.mid { background: #fff3d9; border-color: #f1ddaf; }
.score-chip.low { background: #fde7e7; border-color: #efc2c2; }

canvas {
  width: 100%;
  border-radius: 12px;
  background: #fafcf9;
  border: 1px solid #e1ebe8;
}

/* ===== NOTE-TAKING STYLES ===== */

.note-style-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.note-style-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #e8f6f2;
  color: #124642;
  border: 2px solid transparent;
  cursor: pointer;
}

.note-style-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Cornell Method */
.note-cornell {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: 1fr auto;
  gap: 1px;
  background: #c5d5cf;
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
}

.note-cornell .cornell-cues {
  background: #f0f7f4;
  padding: 12px;
  border-right: 2px solid #c5d5cf;
  grid-row: 1 / 3;
}

.note-cornell .cornell-notes {
  background: #fff;
  padding: 12px;
}

.note-cornell .cornell-summary {
  background: #f5faf8;
  padding: 12px;
  border-top: 2px solid #c5d5cf;
  grid-column: 2;
}

.note-cornell textarea {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Outline Method */
.note-outline {
  padding: 12px;
}

.note-outline .outline-level-0 { padding-left: 0; font-weight: 700; font-size: 1.05rem; margin: 8px 0 4px; }
.note-outline .outline-level-1 { padding-left: 20px; font-weight: 600; margin: 4px 0 2px; }
.note-outline .outline-level-2 { padding-left: 40px; margin: 2px 0; }
.note-outline .outline-level-3 { padding-left: 60px; color: var(--muted); margin: 2px 0; }

/* Mapping Method */
.note-mapping-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  position: relative;
  overflow: auto;
}

.mapping-center {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  padding: 8px;
  position: relative;
  z-index: 2;
}

.mapping-branches {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mapping-branch {
  position: absolute;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: auto;
  max-width: 140px;
  text-align: center;
}

/* Charting Method */
.note-charting {
  overflow-x: auto;
}

.note-charting table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.note-charting th,
.note-charting td {
  border: 1px solid #d5e5df;
  padding: 8px 12px;
  text-align: left;
  min-width: 120px;
}

.note-charting th {
  background: var(--accent-soft);
  font-weight: 700;
}

.note-charting td[contenteditable="true"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Boxing Method */
.note-boxing {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px;
}

.note-box {
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 12px;
  min-width: 200px;
  flex: 1;
  background: #fff;
}

.note-box h4 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.9rem;
}

.note-box .box-content {
  min-height: 60px;
}

/* Sentence Method */
.note-sentence {
  padding: 12px;
}

.note-sentence .sentence-line {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  line-height: 1.6;
}

/* ===== AI INTERACTIVE LESSON STYLES ===== */
.lesson-container {
  max-width: 700px;
  margin: 0 auto;
}

.lesson-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.lesson-step {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e6eeea;
  transition: background 0.3s;
}

.lesson-step.completed { background: var(--success); }
.lesson-step.current { background: var(--accent); }

.lesson-card {
  background: #fff;
  border: 2px solid var(--accent-soft);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

.lesson-card h3 {
  font-family: "Crimson Pro", serif;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.lesson-card p {
  line-height: 1.7;
  margin: 8px 0;
}

.lesson-card .concept-box {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 12px 12px 0;
  margin: 12px 0;
  font-style: italic;
}

.lesson-quiz-options {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.lesson-quiz-option {
  padding: 12px 16px;
  border: 2px solid #d5e5df;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}

.lesson-quiz-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lesson-quiz-option.correct {
  border-color: var(--success);
  background: #d1fae5;
  color: #065f46;
}

.lesson-quiz-option.incorrect {
  border-color: var(--danger);
  background: #fee2e2;
  color: #991b1b;
}

.lesson-feedback {
  padding: 12px 16px;
  border-radius: 12px;
  margin: 12px 0;
  font-weight: 600;
}

.lesson-feedback.correct { background: #d1fae5; color: #065f46; }
.lesson-feedback.incorrect { background: #fee2e2; color: #991b1b; }

/* ===== VOICE MODE STYLES ===== */
.voice-mode-container {
  text-align: center;
  padding: 24px;
}

.voice-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 3rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.voice-avatar.speaking {
  animation: pulse 1s infinite;
  box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4);
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(15, 118, 110, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
}

.voice-transcript {
  background: var(--item-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
  margin: 16px 0;
  text-align: left;
  font-family: "Crimson Pro", serif;
  font-size: 1.1rem;
  line-height: 1.6;
}

.voice-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.voice-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  padding: 0;
}

.voice-btn.mic {
  background: var(--accent);
  color: #fff;
}

.voice-btn.stop {
  background: var(--danger);
  color: #fff;
}

.voice-btn.mode-switch {
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-color);
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}

/* ===== PDF UPLOAD STYLES ===== */
.pdf-upload-zone {
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--accent-soft);
}

.pdf-upload-zone:hover {
  background: #c7e8e0;
  border-color: var(--success);
}

.pdf-upload-zone.dragover {
  background: #b8e0d5;
  border-style: solid;
}

.pdf-upload-zone input {
  display: none;
}

.pdf-content-preview {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ===== TAB SUB-NAV ===== */
.sub-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sub-nav-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-color);
  border: 2px solid transparent;
  cursor: pointer;
}

.sub-nav-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== THEME PICKER ===== */
.mini-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(128,128,128,0.25);
  cursor: pointer; padding: 0; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.palette-swatch:hover { transform: scale(1.15); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
/* Custom layout choices */
[data-layout="single"] .split-grid { grid-template-columns: 1fr; }
[data-layout="single"] .social-grid { grid-template-columns: 1fr; }
[data-layout="single"] .tab > article, [data-layout="single"] .tab > .subject-panel { max-width: 880px; }
[data-layout="wide"] .content-wrap, [data-layout="wide"] .main { max-width: none; }
@media (max-width: 860px) {
  [data-layout="single"] .split-grid { grid-template-columns: 1fr; }
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.theme-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.theme-swatch:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.theme-swatch.active {
  border-color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 0 3px var(--ink), 0 6px 20px rgba(0,0,0,0.3);
}

.theme-swatch[data-theme="teal"] { background: #0f766e; }
.theme-swatch[data-theme="blue"] { background: #0b5cab; }
.theme-swatch[data-theme="orange"] { background: #b45309; }
.theme-swatch[data-theme="green"] { background: #2f855a; }
.theme-swatch[data-theme="purple"] { background: #7c3aed; }
.theme-swatch[data-theme="red"] { background: #dc2626; }
.theme-swatch[data-theme="pink"] { background: #db2777; }
.theme-swatch[data-theme="yellow"] { background: #ca8a04; }

/* ===== KEYBOARD SHORTCUTS ===== */
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shortcut-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.shortcut-label { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shortcut-key { font-size: 0.8rem; cursor: pointer; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.shortcut-key kbd { font-family: inherit; font-weight: 700; background: #eee; border-radius: 5px; padding: 1px 7px; border: 1px solid #ccc; border-bottom-width: 2px; }

/* ===== GRAPH CAMERA CONTROLS ===== */
.graph-cam-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--ink); font-size: 1rem; font-weight: 700; cursor: pointer; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.graph-cam-btn:hover { background: var(--accent-soft); }
[data-dark="true"] .graph-cam-btn { background: #22333b; color: #eef; border-color: #34454e; }

/* ===== HEALTH TABLE ===== */
.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.health-table th,
.health-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.health-table th {
  background: var(--accent-soft);
  font-weight: 700;
}

.health-table .status-ok { color: #15803d; font-weight: 700; }
.health-table .status-warn { color: #ca8a04; font-weight: 700; }
.health-table .status-err { color: #dc2626; font-weight: 700; }

/* ===== QUIZ TYPE SELECTOR ===== */
.quiz-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-type-card {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: #fff;
}

.quiz-type-card:hover {
  border-color: var(--accent);
}

.quiz-type-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-type-card .qt-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.quiz-type-card .qt-label {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Written quiz input */
.written-answer {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
}

.written-answer:focus {
  border-color: var(--accent);
  outline: none;
}

/* True/False buttons */
.tf-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tf-btn {
  padding: 16px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.tf-btn.selected {
  filter: brightness(0.9);
}

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


/* ===== SUBJECTS TAB ===== */
.subject-panel { display: grid; gap: 12px; }
.subject-panel.hidden { display: none; }
.math-calc { max-width: 360px; margin: 0 auto; }
.calc-display {
  width: 100%; padding: 20px 18px; font-size: 1.8rem; text-align: right;
  border: 2px solid var(--accent-soft); border-radius: 14px;
  background: var(--surface); color: var(--ink); margin-bottom: 14px;
  font-family: 'Space Grotesk', monospace; font-weight: 500;
  letter-spacing: 1px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
}
.calc-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calc-btn {
  padding: 16px 4px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--ink);
  font-size: 1.1rem; font-weight: 600; cursor: pointer;
  transition: all 0.12s; font-family: 'Space Grotesk', sans-serif;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.calc-btn:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.calc-btn:active { transform: translateY(0); box-shadow: none; }
.calc-num { background: var(--card-bg); font-weight: 700; }
.calc-op { color: var(--accent); font-weight: 700; }
.calc-fn { background: var(--surface); color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.calc-clear { background: #fee2e2; color: #b91c1c; border-color: #fecaca; font-weight: 700; }
.calc-clear:hover { background: #fecaca; }
[data-dark="true"] .calc-clear { background: #3b1a1a; color: #f87171; border-color: #5c2a2a; }
[data-dark="true"] .calc-clear:hover { background: #4a2222; }
.calc-eq {
  background: var(--accent); color: #fff; border-color: var(--accent);
  grid-column: span 2; font-size: 1.2rem; font-weight: 700;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent);
}
.calc-eq:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* Scientific calculator — wider grid */
#calcScientific .calc-buttons { grid-template-columns: repeat(5, 1fr); gap: 5px; }
#calcScientific .calc-btn { padding: 14px 2px; font-size: 0.95rem; }
#calcScientific .calc-eq { grid-column: span 2; }

/* Calculator panel */
.calc-panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 24px; max-width: 480px; margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
#calcGraphing.calc-panel, #calcConverter.calc-panel { max-width: none; }
#calcConverter .calc-panel { max-width: none; }
.conv-row { display: flex; align-items: center; gap: 10px; }
.conv-row input, .conv-row select { flex: 1; }
.conv-swap { font-size: 1.3rem; color: var(--accent); cursor: pointer; user-select: none; padding: 4px 8px; border-radius: 8px; transition: background 0.15s; }
.conv-swap:hover { background: var(--accent-soft); }
.science-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 8px; }
.science-image-card { text-align: center; }
.science-image-placeholder { width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, var(--accent-soft), #fff); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; border: 2px solid var(--accent-soft); }

/* ===== LANDING PAGE ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ===== ACHIEVEMENTS ===== */
.ach-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ach-count { font-size: 1.3rem; font-weight: 800; color: var(--accent); min-width: 50px; }
.ach-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.ach-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); border-radius: 4px; transition: width 0.4s; }
.ach-pct { font-size: 0.85rem; color: var(--muted); font-weight: 600; min-width: 40px; text-align: right; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ach-card {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-bg); transition: all 0.15s;
}
.ach-card:hover { border-color: var(--accent-soft); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.ach-locked { opacity: 0.5; }
.ach-locked:hover { opacity: 0.7; }
.ach-card-icon { flex-shrink: 0; }
.ach-card-body { flex: 1; min-width: 0; }
.ach-card-body strong { font-size: 0.85rem; display: block; }
.ach-card-body p { font-size: 0.75rem; color: var(--muted); margin: 0; }
.ach-card-status { flex-shrink: 0; }
.ach-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.ach-earned { background: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 50%, transparent); }
.ach-unlocked { background: var(--border); }
[data-dark="true"] .ach-locked { opacity: 0.35; }
[data-dark="true"] .ach-card { border-color: #222; }
[data-dark="true"] .ach-card:hover { border-color: #444; }
[data-dark="true"] .ach-bar { background: #222; }

/* ===== CSS ICON SYSTEM (replaces emojis) ===== */
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff));
  position: relative; flex-shrink: 0; box-sizing: border-box;
}
.icon-sm { width: 24px; height: 24px; border-radius: 6px; }
.icon-lg { width: 48px; height: 48px; border-radius: 12px; }
.icon-xl { width: 64px; height: 64px; border-radius: 16px; }

.icon::before, .icon::after {
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Timer icon — clock circle with hour hand */
.icon-timer::after {
  content: ''; width: 60%; height: 60%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
}
.icon-timer::before {
  content: ''; width: 2px; height: 30%;
  background: rgba(255,255,255,0.9);
  border-radius: 1px;
  transform: translate(-50%, -50%) rotate(-30deg);
  transform-origin: bottom center;
  top: 50%; left: 50%;
}

/* Card icon — rectangle with horizontal lines */
.icon-card::after {
  content: ''; width: 55%; height: 45%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 3px;
}
.icon-card::before {
  content: ''; width: 35%; height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 1px;
  box-shadow: 0 5px 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}

/* AI icon — rounded square with eye dots */
.icon-ai::after {
  content: ''; width: 50%; height: 45%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 5px;
}
.icon-ai::before {
  content: ''; width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  box-shadow: 6px 0 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}

/* Film icon — rectangle with sprocket holes */
.icon-film::after {
  content: ''; width: 62%; height: 48%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 3px;
}
.icon-film::before {
  content: ''; width: 4px; height: 4px;
  border-radius: 1px;
  background: rgba(255,255,255,0.9);
  box-shadow: 8px 0 0 rgba(255,255,255,0.9), -8px 0 0 rgba(255,255,255,0.9), 0 12px 0 rgba(255,255,255,0.9), 8px 12px 0 rgba(255,255,255,0.9), -8px 12px 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}

/* Image icon — rectangle with a sun circle */
.icon-image::after {
  content: ''; width: 60%; height: 55%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 3px;
}
.icon-image::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  box-shadow: 7px 9px 0 -4px rgba(255,255,255,0.9);
  transform: translate(30%, 30%);
}

/* Quiz icon — circle with checkmark */
.icon-quiz::after {
  content: ''; width: 60%; height: 60%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
}
.icon-quiz::before {
  content: ''; width: 30%; height: 18%;
  border-left: 2px solid rgba(255,255,255,0.9);
  border-bottom: 2px solid rgba(255,255,255,0.9);
  transform: translate(-50%, -60%) rotate(-45deg);
}

/* Note icon — document with text lines */
.icon-note::after {
  content: ''; width: 55%; height: 60%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 3px;
}
.icon-note::before {
  content: ''; width: 35%; height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 1px;
  box-shadow: 0 5px 0 rgba(255,255,255,0.9), 0 10px 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}

/* Target icon — concentric circles (bullseye) */
.icon-target::after {
  content: ''; width: 60%; height: 60%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
}
.icon-target::before {
  content: ''; width: 25%; height: 25%;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
}

/* Calendar icon — rectangle with small squares */
.icon-cal::after {
  content: ''; width: 60%; height: 55%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 3px;
}
.icon-cal::before {
  content: ''; width: 2px; height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 0;
  box-shadow:
    4px 0 0 rgba(255,255,255,0.9),
    8px 0 0 rgba(255,255,255,0.9),
    0 4px 0 rgba(255,255,255,0.9),
    4px 4px 0 rgba(255,255,255,0.9),
    8px 4px 0 rgba(255,255,255,0.9),
    0 8px 0 rgba(255,255,255,0.7),
    4px 8px 0 rgba(255,255,255,0.7),
    8px 8px 0 rgba(255,255,255,0.7);
  transform: translate(-50%, -50%);
}

/* Voice/mic icon — pill shape with arc */
.icon-voice::after {
  content: ''; width: 30%; height: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 6px 6px 4px 4px;
}
.icon-voice::before {
  content: ''; width: 40%; height: 2px;
  border-radius: 0 0 50% 50%;
  border: 2px solid rgba(255,255,255,0.9);
  border-top: none;
  background: transparent;
  transform: translate(-50%, 80%);
}

/* Music icon — two eighth notes */
.icon-music::after {
  content: ''; width: 3px; height: 55%;
  background: rgba(255,255,255,0.9);
  border-radius: 1px;
  transform: translate(-60%, -50%) rotate(-10deg);
}
.icon-music::before {
  content: ''; width: 7px; height: 7px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  background: transparent;
  transform: translate(-80%, 70%);
}

/* Book icon — two overlapping rectangles */
.icon-book::after {
  content: ''; width: 45%; height: 65%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 2px;
  transform: translate(-30%, -50%) skewX(-3deg);
}
.icon-book::before {
  content: ''; width: 45%; height: 65%;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 2px;
  transform: translate(-70%, -50%) skewX(3deg);
}

/* Chart icon — rectangle with bar graph */
.icon-chart::after {
  content: ''; width: 55%; height: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 2px;
}
.icon-chart::before {
  content: ''; width: 3px; height: 38%;
  background: rgba(255,255,255,0.9);
  border-radius: 1px;
  box-shadow: 5px 0 0 rgba(255,255,255,0.9), 10px 0 0 rgba(255,255,255,0.7);
  transform: translate(-50%, -50%);
}

/* Gear icon — simple circle with inner dot */
.icon-gear::after {
  content: ''; width: 55%; height: 55%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
}
.icon-gear::before {
  content: ''; width: 22%; height: 22%;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
}

/* Star icon — 4-point diamond star using rotated square */
.icon-star::after {
  content: ''; width: 45%; height: 45%;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.icon-star::before {
  content: ''; width: 45%; height: 45%;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Brain icon — oval shape with bumps */
.icon-brain::after {
  content: ''; width: 55%; height: 55%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.icon-brain::before {
  content: ''; width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  box-shadow: 7px 0 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -50%);
}

/* Check icon — simple checkmark */
.icon-check::after {
  content: ''; width: 40%; height: 25%;
  border-left: 2.5px solid rgba(255,255,255,0.9);
  border-bottom: 2.5px solid rgba(255,255,255,0.9);
  transform: translate(-50%, -60%) rotate(-45deg);
}

/* Arrow icon — simple arrow point */
.icon-arrow::after {
  content: ''; width: 35%; height: 35%;
  border-right: 2.5px solid rgba(255,255,255,0.9);
  border-top: 2.5px solid rgba(255,255,255,0.9);
  transform: translate(-30%, -30%) rotate(45deg);
}

/* Play icon — triangle */
.icon-play::after {
  content: ''; width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid rgba(255,255,255,0.9);
  transform: translate(-30%, -50%);
}

/* ===== AI MASCOT ===== */

/* ===== AI MASCOT ===== */
.mascot-area { text-align: center; padding: 16px 0 0; }
.mascot {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff));
  animation: mascotFloat 3s ease-in-out infinite;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
  overflow: hidden;
}
.mascot::before {
  content: ''; position: absolute; width: 20px; height: 8px;
  border-radius: 0 0 20px 20px;
  border: 3px solid rgba(255,255,255,0.9);
  border-top: 0; bottom: 14px;
}
.mascot::after {
  content: ''; position: absolute; top: 18px;
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 14px 0 0 0 rgba(255,255,255,0.95);
}
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.mascot-warmup { width: 76px; height: 76px; }
.mascot-warmup::before { bottom: 18px; width: 26px; height: 10px; border-width: 4px; }
.mascot-warmup::after { top: 22px; width: 8px; height: 8px; box-shadow: 18px 0 0 0 rgba(255,255,255,0.95); }

/* Mascot blink animation */
.mascot::after { animation: mascotBlink 4s ease-in-out infinite; }
@keyframes mascotBlink {
  0%, 95%, 100% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
}

/* Autism support-level spectrum */
.autism-spectrum {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  --level: 2;
}
.spectrum-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  font-family: inherit;
  color: inherit;
}
.spectrum-seg:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.spectrum-seg b { font-size: 0.82rem; line-height: 1.2; }
.spectrum-seg small { font-size: 0.68rem; color: var(--muted); line-height: 1.3; }
.spectrum-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.spectrum-seg.active {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border-color: var(--accent);
}
.spectrum-seg.active .spectrum-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
@media (max-width: 640px) {
  .autism-spectrum {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }
  .spectrum-seg small { display: none; }
  .spectrum-seg b { font-size: 0.72rem; }
}

/* Resizable chat */
.chat-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.chat-header span { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.expand-chat-btn {
  background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted);
  padding: 4px 8px; border-radius: 6px; transition: all 0.2s; line-height: 1;
}
.expand-chat-btn:hover { background: var(--accent-soft); color: var(--accent); }
.chat-history { resize: vertical; overflow: auto; min-height: 80px; max-height: 300px; transition: max-height 0.3s ease; }
.chat-history.expanded { max-height: 70vh; position: relative; z-index: 100; }

/* ===== WARM UP ===== */
.warmup-mascot { text-align: center; padding-bottom: 20px; }
.warmup-mascot h2 { margin: 12px 0 4px; font-size: 1.5rem; }
.warmup-tabs {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.warmup-tab-btn {
  flex: 1; padding: 12px; border: 2px solid var(--border); border-radius: 14px;
  background: var(--panel); color: var(--ink); cursor: pointer;
  font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
  min-width: 120px;
}
.warmup-tab-btn:hover { border-color: var(--accent); }
.warmup-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.warmup-game { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.warmup-game h3 { font-size: 1.2rem; margin: 0 0 8px; }
.warmup-game .warmup-problem { font-size: 2.8rem; font-weight: 800; letter-spacing: -0.03em; margin: 16px 0; font-variant-numeric: tabular-nums; }
.warmup-game input[type="number"] { max-width: 160px; text-align: center; font-size: 1.3rem; padding: 12px; }
.warmup-game .warmup-text { font-size: 1.1rem; line-height: 1.7; max-width: 500px; margin: 12px auto; }
.warmup-result {
  margin-top: 16px; padding: 16px; border-radius: 12px; text-align: center;
  font-weight: 600; font-size: 1.1rem;
}
.warmup-result.correct { background: var(--success); color: #fff; }
.warmup-result.wrong { background: var(--danger); color: #fff; }
.warmup-result.done { background: var(--accent-soft); color: var(--ink); }
.warmup-stats {
  display: flex; justify-content: center; gap: 32px; margin-top: 16px;
}
.warmup-stats > div { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; font-weight: 600; }
.warmup-stats .subtle { font-weight: 400; font-size: 0.8rem; }
.warmup-seq-display { font-size: 2rem; letter-spacing: 0.3em; font-weight: 700; margin: 16px 0; font-family: monospace; }
.warmup-seq-input { max-width: 200px; text-align: center; font-size: 1.3rem; padding: 12px; letter-spacing: 0.2em; font-family: monospace; }

/* ===== STUDY GUIDE & PLANNER ===== */
.study-output {
  margin-top: 16px; padding: 24px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--border);
}
.study-output h3 { margin: 16px 0 8px; font-size: 1.15rem; color: var(--accent); }
.study-output h4 { margin: 12px 0 6px; font-size: 1rem; }
.study-output ul, .study-output ol { padding-left: 20px; }
.study-output li { margin: 4px 0; line-height: 1.5; }
.study-output p { line-height: 1.6; margin: 8px 0; }
.study-output .sg-section {
  padding: 16px; margin: 12px 0; border-radius: 12px;
  background: var(--surface); border-left: 4px solid var(--accent);
}
.study-output .sg-keyword {
  display: inline-block; background: var(--accent-soft); padding: 2px 10px;
  border-radius: 999px; font-size: 0.82rem; font-weight: 600; margin: 2px;
}
.study-output .sg-planner-day {
  padding: 12px 16px; margin: 8px 0; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; grid-template-columns: 60px 1fr; gap: 8px; align-items: start;
}
.study-output .sg-planner-day strong { font-size: 1rem; }
.study-output .sg-planner-day p { margin: 0; font-size: 0.9rem; }

/* ===== CALCULATOR TABS ===== */
.calc-mode-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; background: var(--surface); padding: 4px; border-radius: 14px; max-width: 480px; margin-left: auto; margin-right: auto; }
.calc-mode-btn {
  flex: 1; padding: 10px 12px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-weight: 600; font-size: 0.85rem; transition: all 0.2s;
  min-width: 60px; text-align: center; font-family: 'Space Grotesk', sans-serif;
}
.calc-mode-btn:hover { color: var(--ink); }
.calc-mode-btn.active { background: var(--card-bg); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.calc-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }

/* ===== PEER TUTORING ===== */
.peer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.peer-method {
  padding: 16px 12px; border: 2px solid var(--border); border-radius: 16px;
  background: var(--panel); cursor: pointer; text-align: center; transition: all 0.2s;
  font-weight: 600; font-size: 0.85rem; line-height: 1.3;
}
.peer-method small { font-weight: 400; color: var(--muted); font-size: 0.75rem; display: block; margin-top: 4px; }
.peer-method:hover { border-color: var(--accent); transform: translateY(-2px); }
.peer-method.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ===== AUTISM SUPPORT ===== */
.script-area { background: var(--surface); border-radius: 16px; padding: 20px; margin-top: 12px; }
.script-content { font-size: 1rem; line-height: 1.7; padding: 12px 16px; background: var(--panel); border-radius: 12px; border: 1px solid var(--border); }
.script-feedback { font-size: 0.9rem; padding: 8px 12px; border-radius: 8px; }
.script-feedback.good { background: var(--success); color: #fff; }
.script-feedback.try-again { background: var(--accent-soft); color: var(--ink); }

.onboarding-overlay {
  position: fixed; inset: 0;
  z-index: 2000;
  background: var(--bg);
  overflow-y: auto;
  opacity: 1; transform: scale(1); transition: opacity 0.35s ease, transform 0.35s ease;
  display: block;
}
.onboarding-overlay.hidden { opacity: 0; transform: scale(0.98); pointer-events: none; display: none; }
.onboarding-inner { max-width: 1100px; margin: 0 auto; }

/* Landing Hero */
.landing { padding: 40px 24px 60px; }
/* ===== LANDING PAGE (lp) ===== */
.lp { min-height: 100vh; }

/* Hero */
.lp-hero {
  min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #0f0c29 100%);
  position: relative; overflow: hidden;
}
.lp-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, color-mix(in srgb, var(--accent) 25%, transparent) 0%, transparent 70%);
  pointer-events: none;
}
.lp-hero::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

/* Nav */
.lp-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px; position: relative; z-index: 2;
}
.lp-logo { font-size: 1.3rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.lp-nav-links { display: flex; align-items: center; gap: 24px; }
.lp-nav-links a { color: rgba(255,255,255,0.65); text-decoration: none; font-size: 0.88rem; font-weight: 500; transition: color 0.2s; }
.lp-nav-links a:hover { color: #fff; }
.lp-cta-sm {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 20px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.lp-cta-sm:hover { filter: brightness(0.95); }

.lp-hero-inner {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px; position: relative; z-index: 2;
}
.lp-badge {
  display: inline-block; background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.8); padding: 8px 18px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; margin-bottom: 24px; border: 1px solid rgba(255,255,255,0.08);
}
.lp-title {
  font-size: 4.5rem; font-weight: 800; letter-spacing: -0.05em;
  margin: 0 0 20px; line-height: 1.1; color: #fff;
}
.lp-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 60%, #fff) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lp-subtitle {
  font-size: 1.2rem; color: rgba(255,255,255,0.6); max-width: 600px;
  margin: 0 auto 40px; line-height: 1.7;
}
.lp-hero-btns { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.lp-cta {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 18px 48px; border-radius: 16px; font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: all 0.25s ease;
}
.lp-cta:hover { filter: brightness(0.95); }
.lp-cta-secondary {
  display: inline-block; background: rgba(255,255,255,0.08); backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.12);
  padding: 18px 36px; border-radius: 16px; font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease;
}
.lp-cta-secondary:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }

/* Hero Stats */
.lp-stats {
  display: flex; gap: 48px; margin-top: 60px; flex-wrap: wrap; justify-content: center;
}
.lp-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lp-stat-num { font-size: 2rem; font-weight: 800; color: #fff; }
.lp-stat-label { font-size: 0.82rem; color: rgba(255,255,255,0.5); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

/* Sections */
.lp-section {
  padding: 80px 40px 100px; max-width: 1100px; margin: 0 auto;
}
.lp-section-title {
  text-align: center; font-size: 2.2rem; font-weight: 800;
  margin: 0 0 12px; letter-spacing: -0.03em; color: var(--ink);
}
.lp-section-sub {
  text-align: center; font-size: 1.05rem; color: var(--muted);
  margin: 0 0 60px; max-width: 500px; margin-left: auto; margin-right: auto;
}

/* How It Works */
.lp-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.lp-step {
  background: var(--panel); border: 1px solid var(--border); border-radius: 24px;
  padding: 36px 28px; text-align: center; position: relative; transition: all 0.25s ease;
}
.lp-step:hover { transform: translateY(-4px); box-shadow: 0 16px 48px rgba(0,0,0,0.06); }
.lp-step-num {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
}
.lp-step-icon { font-size: 2.4rem; margin: 8px 0 12px; }
.lp-step h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.lp-step p { font-size: 0.9rem; color: var(--muted); line-height: 1.6; margin: 0; }

/* Features Grid */
.lp-features { background: var(--surface); }
.lp-feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.lp-feature-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 24px;
  transition: all 0.25s ease;
}
.lp-feature-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.06); }
.lp-feature-icon { font-size: 2.2rem; margin-bottom: 12px; }
.lp-feature-card h3 { font-size: 1rem; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.lp-feature-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* ===== LANDING / DOWNLOAD OVERLAY ===== */
.landing-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.landing-overlay.hidden { display: none; }
.landing-inner {
  position: relative;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 680px; width: 100%;
  padding: 36px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  text-align: center;
}
.landing-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 28px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.landing-hero h1 { font-size: 2.6rem; margin: 4px 0 8px; }
.landing-tagline { color: var(--muted); font-size: 1.02rem; max-width: 480px; margin: 0 auto; }
.landing-features {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 26px 0;
}
.landing-features .lp-feature-card {
  padding: 18px 16px; border-radius: 14px; text-align: left;
}
.landing-features .lp-feature-card strong { display: block; margin: 8px 0 2px; }
.landing-features .lp-feature-card span { font-size: 0.8rem; color: var(--muted); }
.landing-download h3 { margin-bottom: 12px; }
.landing-download-btns {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 12px;
}
.landing-download-btns .btn, .landing-download-btns button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--ink); font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.landing-download-btns button { background: var(--accent); color: #fff; border-color: transparent; }
.landing-open-app {
  margin-top: 18px; padding: 12px 26px; border-radius: 14px;
  background: var(--accent);
  color: #fff; font-weight: 700; border: none; cursor: pointer; font-size: 1rem;
}
@media (max-width: 520px) {
  .landing-features { grid-template-columns: 1fr; }
}

/* Testimonials */
.lp-why { background: var(--panel); text-align: center; }
.lp-testimonials {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.lp-testimonial {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px 24px; text-align: left;
}
.lp-test-text { font-size: 0.95rem; line-height: 1.6; color: var(--ink); margin-bottom: 16px; font-style: italic; }
.lp-test-author { font-size: 0.85rem; font-weight: 600; color: var(--muted); }

/* Bottom CTA */
.lp-cta-section {
  text-align: center; padding: 80px 20px 60px; background: var(--bg);
}
.lp-cta-section h2 { font-size: 2.2rem; font-weight: 800; margin: 0 0 12px; letter-spacing: -0.03em; color: var(--ink); }
.lp-cta-section p { color: var(--muted); margin: 0 0 32px; font-size: 1.1rem; }
.lp-hint { font-size: 0.82rem; color: var(--muted); margin-top: 16px; opacity: 0.7; }

/* Footer */
.lp-footer {
  text-align: center; padding: 24px 20px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem;
}

/* Setup Mode (steps 1-4) */
.onboarding-content.setup-mode {
  max-width: 520px; margin: 40px auto;
  background: var(--panel); border-radius: 28px; padding: 40px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.06); border: 1px solid var(--border);
}
.onb-step-inner { text-align: center; }
.onb-step-icon { font-size: 2.8rem; margin-bottom: 8px; }
.onb-step-inner h2 { font-size: 1.5rem; margin: 0 0 6px; }
.onb-desc { color: var(--muted); margin: 0 0 24px; }
.onb-field { margin-bottom: 16px; text-align: left; }
.onb-field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.onb-field input { width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: #fff; font-size: 0.95rem; outline: none; transition: border-color 0.2s ease; }
.onb-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.onb-field-row { display: flex; gap: 12px; }
.onb-field.half { flex: 1; }

.setup-subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-subject-option {
  padding: 18px 12px; border: 2px solid var(--border); border-radius: 16px;
  cursor: pointer; text-align: center; transition: all 0.2s ease;
  background: #fff; font-weight: 500; font-size: 0.92rem;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.setup-subject-option:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
.setup-subject-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.subj-icon { font-size: 1.5rem; }
.subj-name { font-size: 0.9rem; font-weight: 600; }

.onb-ready { padding: 20px 0; }
.onb-ready-icon { font-size: 4rem; margin-bottom: 12px; animation: rise 0.5s ease both; }
.onb-ready-list { text-align: left; max-width: 340px; margin: 0 auto; display: grid; gap: 10px; }
.onb-ready-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-radius: 12px; font-size: 0.9rem; font-weight: 500; }
.onb-ready-item span { font-size: 1.3rem; }

.onb-tour-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.onb-tour-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.onb-tour-item b { font-size: 0.9rem; }
.onb-tour-item small { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.onb-tour-item .icon { font-size: 1.3rem; }
@media (max-width: 640px) { .onb-tour-grid { grid-template-columns: 1fr; } }

.onboarding-footer {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  max-width: 520px; margin: -20px auto 40px; padding: 0 40px;
}
.onb-back {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: 12px; font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s ease;
}
.onb-back:hover { border-color: var(--accent); color: var(--accent); }
.onb-next {
  background: var(--accent); color: #fff; border: none;
  padding: 12px 28px; border-radius: 12px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease;
}
.onb-next:hover { transform: translateY(-1px); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.onb-finish {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  color: #fff; border: none; padding: 14px 32px; border-radius: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s ease;
}
.onb-finish:hover { transform: translateY(-2px); box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 40%, transparent); }

@media (max-width: 860px) {
  .lp-title { font-size: 3rem; }
  .lp-steps { grid-template-columns: 1fr; gap: 24px; }
  .lp-feature-grid { grid-template-columns: repeat(2, 1fr); }
  .lp-testimonials { grid-template-columns: 1fr; }
  .lp-stats { gap: 32px; }
  .lp-stat-num { font-size: 1.5rem; }
  .lp-nav { padding: 16px 24px; }
  .lp-section { padding: 60px 24px 80px; }
}
@media (max-width: 540px) {
  .lp-title { font-size: 2.2rem; }
  .lp-subtitle { font-size: 1rem; }
  .lp-nav-links a { display: none; }
  .lp-hero-inner { padding: 20px 16px; }
  .lp-badge { font-size: 0.75rem; padding: 6px 14px; }
  .lp-cta { padding: 14px 32px; font-size: 0.95rem; }
  .lp-cta-secondary { padding: 14px 24px; font-size: 0.88rem; }
  .lp-stats { gap: 24px; margin-top: 40px; }
  .lp-feature-grid { grid-template-columns: 1fr; }
  .lp-section-title { font-size: 1.6rem; }
  .lp-cta-section h2 { font-size: 1.6rem; }
  .lp-steps { gap: 20px; }
  .lp-step { padding: 28px 20px; }
  .onboarding-content.setup-mode { margin: 20px 16px; padding: 24px; }
  .onboarding-footer { margin: -12px 16px 24px; padding: 0; }
  .onb-field-row { flex-direction: column; }
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; padding: 10px; }
  .sidebar { position: static; height: auto; border-radius: var(--radius); }
  .sidebar .brand { display: flex; align-items: center; gap: 12px; }
  .sidebar .brand .eyebrow { display: none; }
  .sidebar .brand .subtle { display: none; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .nav-btn { padding: 8px 10px; font-size: 0.78rem; }
  .split-grid { grid-template-columns: 1fr; }
  .social-grid { grid-template-columns: 1fr; }
  .row-between { flex-direction: column; align-items: stretch; }
  .topbar { flex-direction: column; align-items: stretch; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .nav { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .heatmap { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .note-cornell { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-type-grid { grid-template-columns: 1fr; }
}

.music-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
  flex-wrap: wrap;
}

.music-info {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  max-width: 200px;
  overflow: hidden;
}

.music-title {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-artist {
  font-size: 0.72rem;
  opacity: 0.6;
  white-space: nowrap;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.music-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: background 0.2s;
}

.music-btn:hover {
  background: var(--accent-soft);
}

.music-play {
  width: 38px;
  height: 38px;
  font-size: 1rem;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.music-play:hover {
  opacity: 0.85;
  background: var(--accent);
}

.music-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 160px;
  font-size: 0.72rem;
  opacity: 0.8;
}

.music-seek {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.music-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.music-extras {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-volume {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.music-list-btn {
  font-size: 1rem;
}

.music-tracklist {
  position: absolute;
  bottom: 56px;
  right: 20px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  padding: 8px 0;
  z-index: 1001;
}

.music-tracklist.hidden {
  display: none;
}

.music-track-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}

.music-track-item:hover {
  background: var(--accent-soft);
}

.music-track-item.active {
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--accent);
}

.music-track-item .track-num {
  opacity: 0.4;
  margin-right: 8px;
  font-size: 0.72rem;
}

.music-track-item .track-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-track-item .track-duration {
  opacity: 0.5;
  font-size: 0.72rem;
  margin-left: 8px;
}

.main {
  /* Keep the last row of content clear of the fixed bottom music player */
  padding-bottom: 120px;
}

@media (max-width: 768px) {
  .main {
    padding-bottom: 230px;
  }
}

/* ===== STUDY MAP ===== */
.sm-map {
  height: 500px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #e8ecef;
  z-index: 0;
}

.sm-map .leaflet-popup-content {
  font-family: inherit;
}

.sm-map .leaflet-popup-content strong {
  display: block;
  margin-bottom: 4px;
}

.sm-place-item {
  cursor: pointer;
}

/* Category pins */
.sm-marker-wrap {
  background: transparent;
  border: none;
}
.sm-marker {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--mc);
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sm-marker > span, .sm-marker {
  transform: rotate(-45deg);
}
.sm-marker {
  color: #fff;
}
.sm-marker .sm-marker-icon {
  transform: rotate(45deg);
}
.sm-marker:hover {
  transform: rotate(-45deg) scale(1.18);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4);
}
/* Cluster bubbles */
.sm-cluster-wrap {
  background: transparent;
  border: none;
}
.sm-cluster {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 88%, black 12%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  animation: smClusterPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes smClusterPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.sm-cluster:hover {
  transform: scale(1.12);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 40%, rgba(0, 0, 0, 0.3));
}
/* Legend */
.sm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sm-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--lc) 40%, var(--border));
  background: color-mix(in srgb, var(--lc) 8%, var(--panel));
  color: var(--ink);
}

/* ===== CALENDAR ===== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cal-nav h4 {
  margin: 0;
  font-size: 1rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.8rem;
}
.cal-header {
  text-align: center;
  font-weight: 700;
  padding: 6px 2px;
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.cal-day {
  text-align: center;
  padding: 8px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.cal-day:hover {
  background: var(--accent-soft);
}
.cal-day.other-month {
  opacity: 0.25;
}
.cal-day.today {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.cal-day.has-event::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
}
.cal-day.today.has-event::after {
  background: #fff;
}
.cal-event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ===== SOCIAL MEDIA ===== */
.social-embed {
  background: var(--item-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.youtube-placeholder {
  padding: 20px;
}
.youtube-placeholder p {
  margin: 6px 0;
}
.social-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: filter 0.2s;
}
.social-link:hover {
  filter: brightness(1.1);
}

/* ===== GRADE ANALYSIS ===== */
.grade-subject-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e5f0eb;
}
.grade-subject-row:last-child {
  border-bottom: none;
}
.grade-subject-name {
  font-weight: 600;
}
.grade-subject-score {
  font-weight: 700;
  font-size: 0.9rem;
}
.grade-mini-chart {
  height: 8px;
  border-radius: 4px;
  background: #e8f0ed;
  overflow: hidden;
  margin: 4px 0;
}
.grade-mini-chart span {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== PLAYLIST ===== */
.playlist-panel {
  position: fixed;
  bottom: 56px;
  left: 20px;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(24, 60, 60, 0.09);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 1001;
}
.playlist-panel.hidden {
  display: none;
}
.playlist-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.playlist-header h4 {
  margin: 0;
}
.playlist-list {
  display: grid;
  gap: 4px;
}
.playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.playlist-item:hover {
  background: var(--accent-soft);
}
.playlist-item.active {
  background: var(--accent-soft);
  font-weight: 600;
}
.playlist-track-list {
  margin-top: 12px;
  border-top: 1px solid #e5f0eb;
  padding-top: 12px;
}
.playlist-track-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}
.playlist-track-item:hover {
  background: #f0f6f3;
}

@media (max-width: 640px) {
  .playlist-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }
}

/* ===== LIVE VOICE CALL INTERFACE ===== */
.voice-call-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 16px;
}
.call-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.call-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform .3s;
}
.call-avatar-text {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}
.call-avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: pulse-ring 2s infinite;
}
.call-avatar.speaking .call-avatar-ring { opacity: 1; }
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.08); opacity: 0; }
}
.call-info {
  text-align: center;
  width: 100%;
  max-width: 400px;
}
.call-lang-select {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}
.call-status {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 8px;
}
.call-status.idle { background: var(--panel); color: var(--muted); }
.call-status.active { background: #065f46; color: #d1fae5; }
.call-status.live { background: #065f46; color: #d1fae5; }
.call-status.analyzing { background: #1e3a5f; color: #bfdbfe; }
.call-status.ended { background: #1f2937; color: #9ca3af; }
.call-transcript {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.call-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn .3s;
}
.call-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.call-bubble.ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.call-correction {
  align-self: flex-start;
  font-size: 12px;
  color: #f59e0b;
  padding: 4px 12px;
  background: rgba(245,158,11,0.1);
  border-radius: 8px;
  margin-top: -4px;
}
.call-controls {
  display: flex;
  gap: 12px;
}
.call-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.call-btn-start {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
}
.call-btn-start:hover { transform: scale(1.03); }
.call-btn-end {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}
.call-btn-end:hover { transform: scale(1.03); }
.call-analysis, .call-exercises {
  width: 100%;
  padding: 16px;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.analysis-content {
  font-size: 13px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
}
.exercise-item {
  padding: 10px;
  margin: 6px 0;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ===== LECTURE RECORDING ===== */
.lecture-recording-section .consent-area {
  border: 1px solid var(--border);
}
.lecture-item {
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 8px 0;
}
.lecture-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.lecture-actions audio {
  border-radius: 6px;
}

/* ===== GOOGLE OAUTH ===== */
.google-oauth-section {
  padding: 12px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.google-oauth-section input[type="text"],
.google-oauth-section input[type="checkbox"] {
  margin-right: 6px;
}
#googleClientId {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: monospace;
}

/* ===== LANGUAGE SELECTOR ===== */
#appLanguageSelect {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}

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

/* ===== DOWNLOADS TAB ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--btn-padding);
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  color: var(--btn-color);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
}
.btn:hover { opacity: .88; }
.tab-title { margin: 0 0 6px; font-size: 1.4rem; }
#downloads .split-grid { margin-top: 14px; }
#downloads .card { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#downloads .card .btn { margin-top: auto; }
.dl-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.dl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--item-bg, var(--surface)); }
.dl-platform { font-weight: 600; min-width: 92px; }
.dl-name { flex: 1; min-width: 160px; font-size: 0.82rem; overflow-wrap: anywhere; }
.dl-size { min-width: 64px; color: var(--muted); font-size: 0.85rem; }
.dl-sha { font-size: 0.76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dl-verify-status { flex-basis: 100%; font-size: 0.78rem; color: var(--muted); min-height: 1em; }
.dl-verify-status.ok { color: var(--success); font-weight: 600; }
.dl-verify-status.bad { color: var(--danger); font-weight: 600; }
@media (max-width: 640px) { .dl-platform { min-width: 70px; } .dl-sha { width: 100%; } }

/* ===== PHONE ADAPTATION (browser/PWA on phones) ===== */
body.is-mobile .mobile-nav { display: flex; }
body.is-mobile .tab-content {
  padding-bottom: calc(300px + env(safe-area-inset-bottom, 0px));
}
body.is-mobile .music-player {
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
body.is-mobile .mobile-nav-item {
  min-width: 62px;
  padding: 8px 12px;
  font-size: 11px;
}
body.is-mobile .mobile-nav-item .nav-icon { font-size: 22px; }
body.is-mobile .mobile-nav-item:active { opacity: .7; }
body.is-mobile .card button,
body.is-mobile .topbar button { min-height: 44px; }
body.is-mobile input,
body.is-mobile select,
body.is-mobile textarea { font-size: 16px; }
body.is-mobile .music-player { z-index: 999; }

/* ===== Subject labs & topics ===== */
.lab-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lab-tab {
  padding: 8px 16px; border: 1px solid var(--border); background: var(--panel);
  border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lab-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lab-canvas { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; margin-top: 12px; }
.lab-periodic { display: grid; grid-template-columns: repeat(10, minmax(28px, 1fr)); gap: 4px; }
.el-tile {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer;
  padding: 2px; transition: transform 0.12s ease, border-color 0.12s ease;
}
.el-tile b { font-size: 0.8rem; line-height: 1; }
.el-tile small { font-size: 0.58rem; color: var(--muted); }
.el-tile:hover { transform: scale(1.12); border-color: var(--accent); z-index: 2; }
.el-tile.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.el-tile.active small { color: rgba(255,255,255,0.8); }
.el-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.el-facts span { background: var(--panel-soft, rgba(128,128,128,0.12)); border-radius: 8px; padding: 4px 10px; font-size: 0.82rem; }
.lab-ph { margin-top: 14px; }
.lab-ph-bar { position: relative; height: 22px; border-radius: 999px; margin-top: 8px; border: 1px solid var(--border); }
.lab-ph-bar span { position: absolute; top: -4px; width: 4px; height: 28px; background: #111; border-radius: 2px; transform: translateX(-50%); }
.lab-cell-wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.lab-cell {
  position: relative; width: 320px; height: 320px; max-width: 100%; border-radius: 50%;
  border: 3px solid var(--accent); background: radial-gradient(circle at 35% 30%, #fef9e7, #f9f2d8 60%, #f0e6c0);
  overflow: hidden; flex-shrink: 0;
}
.cell-part {
  position: absolute; border: none; border-radius: 8px; padding: 4px 8px; font-size: 0.7rem; font-weight: 700;
  cursor: pointer; color: #fff; opacity: 0.92; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cell-part:hover { transform: scale(1.15); }
.cell-part.active { outline: 3px solid #111; }
.cell-nucleus { top: 44%; left: 38%; background: #7c3aed; border-radius: 50% !important; padding: 14px; }
.cell-membrane { top: 4%; left: 40%; background: #0ea5e9; }
.cell-mito { top: 18%; right: 6%; background: #dc2626; }
.cell-ribosome { bottom: 12%; left: 12%; background: #059669; }
.cell-er { top: 60%; right: 4%; background: #d97706; }
.cell-golgi { bottom: 6%; right: 26%; background: #2563eb; }
.cell-cyto { position: absolute; bottom: 2%; right: 2%; font-size: 0.65rem; color: #9a6b00; font-style: italic; }
.lab-cell-info { flex: 1; min-width: 200px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--panel); line-height: 1.55; }
.lab-cell-info h4 { margin: 0 0 6px; }

/* Code playground */
.code-editor {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; line-height: 1.5; border: 1px solid var(--border); border-radius: 12px;
  background: #0f172a; color: #e2e8f0; padding: 12px; box-sizing: border-box; resize: vertical; tab-size: 2;
}
.code-output { width: 100%; height: 260px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.ai-fix-box {
  border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; line-height: 1.55; margin-top: 10px;
}

/* Mini terminal */
.mini-term { border: 1px solid var(--border); border-radius: 12px; background: #0f172a; padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; }
.mini-term-out { min-height: 90px; max-height: 180px; overflow-y: auto; color: #e2e8f0; }
.term-line { padding: 2px 0; white-space: pre-wrap; word-break: break-word; }
.term-dim { color: #64748b; }
.term-cmd { color: #7dd3fc; }
.term-out { color: #86efac; }
.term-err { color: #fca5a5; }
.mini-term-line { display: flex; align-items: center; gap: 6px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 6px; padding-top: 6px; }
.mini-term-prompt { color: #eab308; font-weight: 700; }
.mini-term-line input { flex: 1; background: transparent; border: none; outline: none; color: #e2e8f0; font-family: inherit; font-size: 0.8rem; }

/* Book library */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.book-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--panel); }
.book-cover {
  width: 44px; height: 60px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 800; flex-shrink: 0;
}
.book-card b { font-size: 0.88rem; line-height: 1.3; display: block; }
.book-card .subtle { margin: 2px 0 6px; }
.book-link { color: var(--accent); font-weight: 600; font-size: 0.82rem; text-decoration: none; }
.book-link:hover { text-decoration: underline; }

/* Shared explain box */
.explain-box { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; line-height: 1.6; }
.explain-box ul { margin: 6px 0 6px 18px; padding: 0; }

/* AI Subject Tutor */
#subjectAiCard .badge { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.subject-ai-chip { font-size: 0.78rem; padding: 5px 10px; }
.subject-ai-msg { border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; font-size: 0.88rem; line-height: 1.55; max-width: 92%; }
.subject-ai-msg.subject-ai-user {
  align-self: flex-end;
  margin-left: auto;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.subject-ai-msg.subject-ai-assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--border);
}
#subjectAiResult { display: flex; flex-direction: column; }
.explain-box li { margin: 4px 0; }
.health-guide { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--panel); line-height: 1.6; }
.health-guide h4 { margin: 0 0 8px; color: var(--accent); }
.health-guide ul { margin: 0 0 8px 18px; }
.health-guide li { margin: 5px 0; }

/* ===== Study Mates opt-in toggle ===== */
.mate-optin {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.5;
}
.mate-optin input { margin-top: 3px; accent-color: var(--accent); }

/* ===== Cloud sync status (Settings) ===== */
.cloud-status {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.5;
}
.cloud-status.cloud-good {
  background: color-mix(in srgb, #22c55e 8%, var(--panel));
  border-color: color-mix(in srgb, #22c55e 35%, var(--border));
  color: var(--muted);
}
.cloud-status.cloud-warn {
  background: color-mix(in srgb, #f59e0b 8%, var(--panel));
  border-color: color-mix(in srgb, #f59e0b 35%, var(--border));
  color: var(--muted);
}
.cloud-status.cloud-bad {
  background: color-mix(in srgb, #ef4444 8%, var(--panel));
  border-color: color-mix(in srgb, #ef4444 35%, var(--border));
  color: var(--muted);
}

/* ==========================================================================
   DESIGN POLISH v2 — layered depth, refined surfaces, motion & dark-mode love
   Appended as overrides so themes + density settings keep working.
   ========================================================================== */

/* --- Selection, scrollbars, keyboard focus --- */
::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--ink);
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 32%, transparent);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  border: 3px solid transparent;
  background-clip: padding-box;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-strong);
  outline-offset: var(--focus-ring-offset);
}
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* --- Cards: layered shadows, lit top edge, accent glow on hover --- */
.card {
  position: relative;
  border-color: rgba(24, 60, 60, 0.08);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, rgba(24, 60, 60, 0.08));
  box-shadow: var(--shadow);
}

/* --- Sidebar: clean flat panel --- */
.sidebar {
  box-shadow: var(--shadow);
}
.nav-btn {
  position: relative;
  box-shadow: none;
}
.nav-btn:hover {
  box-shadow: none;
}
.nav-btn.active {
  box-shadow: none;
}
.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 55%;
  border-radius: 3px;
  background: var(--accent);
}

/* --- Topbar: sticky glass --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

/* --- Primary buttons: flat, matte (ghost/tonal variants keep their own look) --- */
button:where(:not(.ghost):not(.nav-btn):not(.theme-swatch):not(.palette-swatch):not(.calc-btn):not(.mobile-nav-item):not(.chip):not(.empty-state-button):not(.shortcut-key):not(.toast-close):not(.sub-nav-btn):not(.voice-btn)) {
  background: var(--btn-bg);
  color: var(--btn-color);
  box-shadow: none;
  transition: filter 160ms ease, transform 160ms ease;
}
button:where(:not(.ghost):not(.nav-btn):not(.theme-swatch):not(.palette-swatch):not(.calc-btn):not(.mobile-nav-item):not(.chip):not(.empty-state-button):not(.shortcut-key):not(.toast-close):not(.sub-nav-btn):not(.voice-btn)):hover {
  transform: none;
  filter: var(--btn-hover-filter);
  box-shadow: none;
}

/* --- Ghost buttons: crisp border + accent tint --- */
button.ghost, .btn-ghost {
  border: 1px solid var(--btn-ghost-border);
  transition: background 160ms ease, border-color 160ms ease;
}
button.ghost:hover, .btn-ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* --- Inputs: soft inset, refined focus ring --- */
input, textarea, select {
  box-shadow: inset 0 1px 2px rgba(18, 36, 34, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder, textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}
input:focus, textarea:focus, select:focus {
  box-shadow:
    0 0 0 3px var(--focus-ring-soft),
    inset 0 1px 2px rgba(18, 36, 34, 0.04);
}

/* --- Metric numbers: solid accent --- */
.metric h3 {
  color: var(--accent);
}

/* --- List items: gentle hover --- */
.list li, .item {
  transition: transform 0.15s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.list li:hover, .item:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: 0 3px 12px rgba(18, 36, 34, 0.06);
}

/* --- Assistant chat bubbles: softer, tinted --- */
.chat-bubble.assistant, .chat-bubble.ai {
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel));
  box-shadow: 0 2px 10px rgba(18, 36, 34, 0.05);
}

/* --- Tab entrance: subtle rise --- */
.tab.active {
  animation: tabIn 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes tabIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* ===================== DARK MODE ===================== */
[data-dark="true"] .card {
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.45);
}
[data-dark="true"] .card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, rgba(255, 255, 255, 0.07));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 20px 48px color-mix(in srgb, var(--accent) 16%, rgba(0, 0, 0, 0.55));
}
[data-dark="true"] .topbar {
  background: color-mix(in srgb, #101010 66%, transparent);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-dark="true"] input, [data-dark="true"] textarea, [data-dark="true"] select {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
[data-dark="true"] input:focus, [data-dark="true"] textarea:focus, [data-dark="true"] select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
[data-dark="true"] .metric h3 {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, white 28%) 10%, color-mix(in srgb, var(--accent) 45%, white 55%) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-dark="true"] .chat-bubble.assistant, [data-dark="true"] .chat-bubble.ai {
  background: color-mix(in srgb, var(--accent) 14%, #121212);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
[data-dark="true"] ::selection {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
  color: #fff;
}
[data-dark="true"] ::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, #888 35%, transparent);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* ==========================================================================
   LANDING PAGE EFFECTS — original animated landing (onboarding step 0)
   ========================================================================== */

/* --- Full-bleed hero (never squished by the setup-mode card) --- */
.lp-hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background:
    radial-gradient(42% 55% at 12% 18%, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 62%),
    radial-gradient(38% 48% at 88% 12%, rgba(124, 58, 237, 0.45) 0%, transparent 60%),
    radial-gradient(50% 60% at 50% 108%, rgba(56, 189, 248, 0.28) 0%, transparent 65%),
    linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #0f0c29 100%);
  background-size: 220% 220%, 210% 210%, 230% 230%, 100% 100%;
  background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
  animation: lpAurora 26s ease-in-out infinite alternate;
}
@keyframes lpAurora {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%; }
  50%  { background-position: 55% 35%, 25% 55%, 80% 40%, 0% 0%; }
  100% { background-position: 30% 100%, 90% 30%, 15% 90%, 0% 0%; }
}

/* --- Floating study orbs (slow rise, soft glow, varied hue/size/delay) --- */
.lp-orbs {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; z-index: 0;
}
.lp-orbs span {
  position: absolute;
  left: var(--o-x, 50%); bottom: -140px;
  width: calc(88px * var(--o-s, 1)); height: calc(88px * var(--o-s, 1));
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, color-mix(in srgb, var(--accent) 58%, transparent) 0%, transparent 68%);
  filter: blur(1px);
  opacity: 0.5;
  animation: lpOrb 16s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  animation-delay: var(--o-d, 0s);
  will-change: transform, opacity;
}
.lp-orbs span:nth-child(2n) {
  background: radial-gradient(circle at 32% 32%, rgba(124, 58, 237, 0.5) 0%, transparent 68%);
}
.lp-orbs span:nth-child(3n) {
  background: radial-gradient(circle at 32% 32%, rgba(56, 189, 248, 0.45) 0%, transparent 68%);
}
@keyframes lpOrb {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  8%   { opacity: 0.5; }
  25%  { transform: translate(42px, -26vh) scale(1.14); }
  50%  { transform: translate(-30px, -52vh) scale(0.9); opacity: 0.4; }
  75%  { transform: translate(24px, -78vh) scale(1.1); }
  92%  { opacity: 0.5; }
  100% { transform: translate(-10px, -106vh) scale(0.95); opacity: 0; }
}

/* --- Headline: staggered line reveal + shimmering gradient --- */
.lp-title .lp-line {
  display: block;
  opacity: 0;
  transform: translateY(60px) rotate(1.5deg);
  filter: blur(4px);
  animation: lpLineUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.lp-title .lp-line:nth-child(1) { animation-delay: 0.15s; }
.lp-title .lp-line:nth-child(2) { animation-delay: 0.34s; }
@keyframes lpLineUp {
  to { opacity: 1; transform: translateY(0) rotate(0); filter: blur(0); }
}
.lp-gradient {
  display: inline-block;
  background: linear-gradient(120deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 45%, #fff) 30%, var(--accent) 50%, #38bdf8 78%, var(--accent) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: lpShimmer 7s linear infinite;
}
@keyframes lpShimmer { to { background-position: -220% 0; } }

/* --- Badge: entrance + twinkling sparkle --- */
.lp-badge {
  animation: lpBadgeIn 0.8s ease 0.05s both;
}
.lp-badge::after {
  content: '✦';
  margin-left: 8px;
  display: inline-block;
  color: #fbbf24;
  animation: lpTwinkle 2.4s ease-in-out infinite;
}
@keyframes lpBadgeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes lpTwinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85) rotate(0deg); }
  50%      { opacity: 1;    transform: scale(1.2) rotate(90deg); }
}

/* --- Subtitle + CTAs: gentle rise --- */
.lp-subtitle { animation: lpBadgeIn 0.9s ease 0.5s both; }
.lp-hero-btns { animation: lpBadgeIn 0.9s ease 0.62s both; }
.lp-stats { animation: lpBadgeIn 0.9s ease 0.78s both; }


/* --- 3D tilt cards with animated conic border ring --- */
@property --lp-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.lp-tilt {
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out, box-shadow 0.25s ease;
  will-change: transform;
}
.lp-tilt:hover { box-shadow: 0 22px 54px color-mix(in srgb, var(--accent) 18%, rgba(0, 0, 0, 0.12)); }
.lp-step, .lp-feature-card { position: relative; }
.lp-step::before, .lp-feature-card::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--lp-angle), transparent 0%, transparent 62%, color-mix(in srgb, var(--accent) 60%, transparent) 84%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: lpBorderSpin 4.5s linear infinite;
  pointer-events: none;
  z-index: 1;
}
.lp-tilt:hover::before { opacity: 1; }
@keyframes lpBorderSpin { to { --lp-angle: 360deg; } }

/* --- Scroll-triggered section reveal --- */
.lp-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.lp-reveal.in { opacity: 1; transform: none; }

/* --- Glass nav once the hero scrolls away --- */
.lp-nav {
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
  border-radius: 16px;
}
.lp-nav.scrolled {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(1080px, calc(100% - 32px));
  box-sizing: border-box;
  background: rgba(15, 12, 41, 0.62);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 22px;
  z-index: 50;
}

/* --- Small screens: keep it light --- */
@media (max-width: 720px) {
  .lp-orbs { display: none; }
  .lp-title { font-size: 2.9rem; }
  .lp-nav.scrolled { width: calc(100% - 20px); top: 8px; }
}

/* --- Respect reduced-motion preferences --- */
@media (prefers-reduced-motion: reduce) {
  .lp-hero, .lp-orbs span, .lp-title .lp-line, .lp-gradient, .lp-badge, .lp-badge::after, .lp-step::before, .lp-feature-card::before {
    animation: none !important;
  }
  .lp-title .lp-line, .lp-badge, .lp-subtitle, .lp-hero-btns, .lp-stats {
    opacity: 1 !important; transform: none !important; filter: none !important;
  }
  .lp-reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   MAIN UI EFFECTS — living surfaces for the app itself
   (complements the landing page effects; respects reduced motion)
   ============================================================ */

/* --- 1. Ambient accent tint behind the app (static, subtle) --- */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 22% 28%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(30% 34% at 82% 14%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(44% 40% at 68% 86%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
}
[data-dark="true"] body::before {
  background:
    radial-gradient(38% 42% at 22% 28%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(30% 34% at 82% 14%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(44% 40% at 68% 86%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%);
}

/* --- 5. Buttons: tactile press + glow bloom --- */
button:where(:not(.ghost):not(.nav-btn):not(.theme-swatch):not(.palette-swatch):not(.calc-btn):not(.mobile-nav-item):not(.chip):not(.empty-state-button):not(.shortcut-key):not(.toast-close)):active {
  transform: translateY(0) scale(0.97);
  filter: brightness(1.02);
}
button.ghost:active, .btn-ghost:active {
  transform: scale(0.97);
}
/* Focus glow (keyboard users) */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

/* --- 6. Streak / XP values: solid accent --- */
.streak-value, .xp-value, #streakValue, #xpValue {
  color: var(--accent);
}
[data-dark="true"] .streak-value, [data-dark="true"] .xp-value,
[data-dark="true"] #streakValue, [data-dark="true"] #xpValue {
  color: var(--accent-soft);
}

/* --- 8. Mobile nav: active item --- */
.mobile-nav-item.active {
  color: var(--accent);
}

/* --- 9. List items: left accent tick on hover --- */
.item, .list li {
  position: relative;
}
.item::before, .list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.item:hover::before, .list li:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

/* --- Reduced motion: keep it calm --- */
@media (prefers-reduced-motion: reduce) {
  .tab.active { animation: none; }
  body::before { animation: none; }
}

/* ===== LANDING: SDG 4 QUALITY EDUCATION SECTION ===== */
.lp-badges { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.lp-badge-sdg {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(197, 25, 45, 0.14); border: 1px solid rgba(197, 25, 45, 0.4);
  color: #fff; text-decoration: none; cursor: pointer; transition: all 0.2s ease;
}
.lp-badge-sdg:hover { background: rgba(197, 25, 45, 0.28); transform: translateY(-1px); }
.sdg-dot {
  width: 11px; height: 11px; border-radius: 3px; flex: none;
  background: #C5192D; box-shadow: 0 0 0 2px rgba(197, 25, 45, 0.35);
}

.lp-sdg { padding-top: 96px; }
.lp-sdg-banner {
  display: flex; align-items: center; gap: 32px;
  background: linear-gradient(135deg, #C5192D 0%, #7f1020 100%);
  border-radius: 28px; padding: 40px 44px; margin-bottom: 48px;
  box-shadow: 0 24px 60px rgba(197, 25, 45, 0.28);
  position: relative; overflow: hidden;
}
.lp-sdg-banner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(620px 220px at 88% -25%, rgba(255,255,255,0.18), transparent 60%);
}
.lp-sdg-emblem { flex: none; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35)); }
.lp-sdg-head { position: relative; }
.lp-sdg-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em;
  color: rgba(255,255,255,0.72); text-transform: uppercase; margin-bottom: 8px;
}
.lp-sdg-head .lp-section-title { color: #fff; text-align: left; margin-bottom: 8px; font-size: 1.9rem; }
.lp-sdg-goal {
  color: rgba(255,255,255,0.92); font-size: 1.05rem; line-height: 1.6; margin: 0; max-width: 640px; font-style: italic;
}

.lp-research-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lp-research-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 26px 24px 28px; position: relative; overflow: hidden; transition: all 0.25s ease;
}
.lp-research-card:hover { transform: translateY(-4px); box-shadow: 0 14px 44px rgba(0,0,0,0.08); }
.lp-research-num {
  position: absolute; top: 14px; right: 18px;
  font-size: 2.6rem; font-weight: 900; line-height: 1;
  color: rgba(197, 25, 45, 0.14); letter-spacing: -0.04em; user-select: none;
}
.lp-research-card h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.lp-research-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.55; margin: 0; }
.lp-research-card em { color: var(--ink); font-style: italic; }

.lp-sdg-pledge {
  display: flex; align-items: center; gap: 20px;
  margin-top: 44px; padding: 28px 32px;
  background: var(--surface); border: 1px dashed var(--border); border-radius: 20px;
}
.lp-sdg-pledge-icon {
  flex: none; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(197, 25, 45, 0.12); display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.lp-sdg-pledge-text strong { font-size: 1.02rem; color: var(--ink); }
.lp-sdg-pledge-text p { margin: 6px 0 0; font-size: 0.88rem; color: var(--muted); line-height: 1.55; }

[data-dark="true"] .lp-sdg-banner { box-shadow: 0 24px 70px rgba(197, 25, 45, 0.4); }
[data-dark="true"] .lp-research-num { color: rgba(197, 25, 45, 0.35); }

@media (max-width: 760px) {
  .lp-sdg-banner { flex-direction: column; text-align: center; padding: 32px 24px; }
  .lp-sdg-head .lp-section-title { text-align: center; }
  .lp-research-grid { grid-template-columns: 1fr; }
  .lp-sdg-pledge { flex-direction: column; text-align: center; }
}

/* ===== Confusion Review Queue ===== */
.review-queue-list { display: flex; flex-direction: column; gap: 8px; }
.review-queue-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-left: 4px solid var(--warning, #e6a700);
  border-radius: 10px; padding: 10px 12px;
  background: color-mix(in srgb, var(--warning, #e6a700) 5%, transparent);
}
.review-queue-item.rq-hot { border-left-color: var(--danger, #b3261e); background: color-mix(in srgb, var(--danger, #b3261e) 6%, transparent); }
.review-queue-body { flex: 1; min-width: 0; }
.review-queue-body strong { color: var(--text, #1b2f2a); }

/* ===== Smart Countdown Planner ===== */
.countdown-planner { display: flex; flex-direction: column; gap: 10px; }
.countdown-plan-list { display: flex; flex-direction: column; gap: 8px; }
.countdown-plan-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-left: 4px solid var(--success, #237a57);
  border-radius: 10px; padding: 10px 12px;
}
.countdown-plan-item.exam-urgent { border-left-color: var(--danger, #b3261e); background: color-mix(in srgb, var(--danger, #b3261e) 6%, transparent); }
.countdown-plan-item.exam-soon { border-left-color: var(--warning, #e6a700); background: color-mix(in srgb, var(--warning, #e6a700) 5%, transparent); }
.countdown-plan-head { display: flex; align-items: center; gap: 10px; }
.countdown-plan-title { display: flex; flex-direction: column; }
.countdown-plan-meta { display: flex; align-items: center; gap: 8px; }
.countdown-focus { margin-top: 4px; }
.countdown-actions { margin-top: 8px; }
.chip-ok { background: color-mix(in srgb, var(--success, #237a57) 14%, transparent); color: var(--success, #237a57); border-color: color-mix(in srgb, var(--success, #237a57) 40%, transparent); }
.chip-warn { background: color-mix(in srgb, var(--warning, #e6a700) 14%, transparent); color: #8a6400; border-color: color-mix(in srgb, var(--warning, #e6a700) 40%, transparent); }

/* Mobile-specific UI adaptations & gesture hints */
@media (max-width: 900px), (pointer: coarse) {
  .fc-flip-card {
    touch-action: pan-y;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
  }
  .fc-card-area {
    position: relative;
  }
  .fc-card-area::before, .fc-card-area::after {
    font-size: 0.75rem;
    color: var(--text-muted);
    position: absolute;
    top: -20px;
    opacity: 0.7;
    font-weight: 600;
  }
  .fc-card-area::before {
    content: "← Swipe Left (Hard)";
    left: 8px;
  }
  .fc-card-area::after {
    content: "Swipe Right (Easy) →";
    right: 8px;
  }
  .mobile-nav-item {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== Exam-aware task board ===== */
.task-card.task-hot {
  border-color: color-mix(in srgb, var(--warning, #e6a700) 55%, var(--border, rgba(0,0,0,0.08)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning, #e6a700) 25%, transparent);
  background: color-mix(in srgb, var(--warning, #e6a700) 5%, var(--panel, #ffffff));
}
.task-hot-badge { background: var(--warning, #e6a700); color: #2a1f00; font-size: 0.72rem; }
.plan-retrieval { border-left: 3px solid var(--warning, #e6a700); padding-left: 10px; }

/* ===== Daily Review Block ===== */
.review-block { display: flex; flex-direction: column; gap: 10px; }
.review-block-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.review-block-list { display: flex; flex-direction: column; gap: 6px; }
.review-block-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-left: 4px solid var(--accent, #0f766e);
  border-radius: 10px; padding: 8px 12px;
  background: color-mix(in srgb, var(--accent, #0f766e) 4%, transparent);
}
.review-block-body { flex: 1; min-width: 0; }

/* ===== Behind-on-Topic Nudge ===== */
.behind-nudge { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.behind-nudge-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--danger, #b3261e) 35%, transparent);
  border-left: 4px solid var(--danger, #b3261e);
  border-radius: 12px; padding: 10px 14px;
  background: color-mix(in srgb, var(--danger, #b3261e) 6%, transparent);
}
.behind-nudge-msg { font-size: 0.9rem; }

/* ===== Exam Lock ===== */
.exam-lock-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--warning, #e6a700) 45%, transparent);
  border-left: 4px solid var(--warning, #e6a700);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--warning, #e6a700) 8%, transparent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--warning, #e6a700) 14%, transparent);
}
.nav-btn.nav-hidden { display: none !important; }

/* ===== Command palette ===== */
.cmd-palette-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}
.cmd-palette-row.selected { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cmd-palette-row:focus-visible { outline: 2px solid var(--focus-ring-strong); outline-offset: -2px; }
.cmd-palette-hint {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-palette-group {
  padding: 8px 12px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cmd-palette-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

/* Undo toast action button */
.undo-toast-btn {
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}
.undo-toast-btn:hover { background: rgba(255,255,255,0.28); }
