/* =============================================
   TUTOR IA — styles.css
   Design system sourced from awesome-design-md
   References: Claude, Linear, Notion, Raycast
   ============================================= */

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

/* ─── DESIGN TOKENS ─────────────────────────── */
:root {
  --font-main: 'Sora', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Brand accent — Claude/Anthropic Terracotta */
  --accent:        #c96442;
  --accent-hover:  #b8583a;
  --accent-subtle: rgba(201, 100, 66, 0.10);
  --accent-border: rgba(201, 100, 66, 0.22);

  /* Backgrounds — warm parchment (Claude-inspired) */
  --bg-base:    #f5f4ed;
  --bg-surface: #ffffff;
  --bg-raised:  #fdfcf8;

  /* Semantic fills */
  --bg-info:    #e8f0fb;
  --bg-success: #e6f4e8;
  --bg-warning: #fdf3de;
  --bg-danger:  #fdeaea;

  /* Text */
  --text-primary:   #141413;
  --text-secondary: #5e5d59;
  --text-muted:     #87867f;
  --text-info:      #2b5ca8;
  --text-success:   #27763a;
  --text-warning:   #7a5100;
  --text-danger:    #b53333;

  /* Borders */
  --border:        rgba(20, 20, 19, 0.08);
  --border-md:     rgba(20, 20, 19, 0.14);
  --border-strong: rgba(20, 20, 19, 0.26);

  /* Shadows — multi-layer warm (never single-layer) */
  --shadow-xs: 0 1px 3px rgba(20,20,19,0.04);
  --shadow-sm: 0 2px 8px rgba(20,20,19,0.06), 0 1px 2px rgba(20,20,19,0.04);
  --shadow-md: 0 4px 16px rgba(20,20,19,0.08), 0 2px 6px rgba(20,20,19,0.05), 0 0px 1px rgba(20,20,19,0.04);
  --shadow-lg: 0 12px 32px rgba(20,20,19,0.10), 0 4px 12px rgba(20,20,19,0.06), 0 0px 1px rgba(20,20,19,0.04);
  --shadow-accent: 0 2px 8px rgba(201, 100, 66, 0.30), 0 1px 2px rgba(0,0,0,0.08);

  /* Radii — 8px base unit */
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 0.12s ease;
  --t-base: 0.20s ease;
  --t-slow: 0.30s ease;

  /* Spacing — 8px base unit */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
}

/* ─── DARK MODE — warm charcoal ─────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-base:    #141413;
    --bg-surface: #1c1b19;
    --bg-raised:  #232220;

    --bg-info:    rgba(43, 92, 168, 0.18);
    --bg-success: rgba(39, 118, 58, 0.18);
    --bg-warning: rgba(122, 81, 0, 0.20);
    --bg-danger:  rgba(181, 51, 51, 0.18);

    --text-primary:   #f0ede6;
    --text-secondary: #b8b4ac;
    --text-muted:     #7a786f;
    --text-info:      #7faff0;
    --text-success:   #7acf8a;
    --text-warning:   #e8b354;
    --text-danger:    #e88a8a;

    --border:        rgba(255,255,255,0.06);
    --border-md:     rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.20);

    --shadow-xs: 0 1px 3px rgba(0,0,0,0.22);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.18);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.34), 0 2px 6px rgba(0,0,0,0.20), 0 0px 1px rgba(0,0,0,0.18);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.42), 0 4px 12px rgba(0,0,0,0.24), 0 0px 1px rgba(0,0,0,0.18);
  }
}

/* ─── RESET ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.60;
  padding: var(--s-6);
  max-width: 720px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ─── SCREENS ────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn var(--t-slow) ease; }

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

/* ─── BUTTONS ────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 0 var(--s-5);
  height: 44px;
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-accent);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(201,100,66,0.38), 0 1px 3px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  padding: 8px var(--s-4);
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn-secondary:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }

/* ─── SECTION TITLE ──────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* ─── LOADING ────────────────────────────────── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  gap: 18px;
}

.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.loading-sub {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.65;
  margin-top: 6px;
}

/* ─── HOME SCREEN ────────────────────────────── */
.home-header {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  margin-bottom: var(--s-6);
  display: flex;
  align-items: center;
  gap: var(--s-5);
  box-shadow: var(--shadow-sm);
}

.logo-icon {
  width: 56px; height: 56px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.home-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 3px;
}

.home-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.50;
}

/* Topic input */
.topic-input-row {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}

.topic-input-row input {
  flex: 1;
  font-family: var(--font-main);
  font-size: 14px;
  padding: 0 var(--s-4);
  height: 44px;
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.topic-input-row input::placeholder { color: var(--text-muted); }
.topic-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), var(--shadow-xs);
}

/* Quick topics */
.quick-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.quick-topic {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-family: var(--font-main);
  color: var(--text-primary);
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.quick-topic:hover {
  border-color: var(--border-strong);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.quick-topic .qt-emoji { font-size: 20px; display: block; margin-bottom: 8px; }
.qt-label { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 2px; }
.qt-sub   { font-size: 11px; color: var(--text-muted); }

/* How it works */
.how-it-works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-2);
}

.how-step {
  padding: var(--s-4);
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.how-step-icon  { font-size: 22px; margin-bottom: 10px; }
.how-step-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.how-step-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.50; }

/* ─── QUESTIONNAIRE ──────────────────────────── */
.q-progress { margin-bottom: var(--s-6); }
.q-progress-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.q-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--r-full);
}
.q-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-header { margin-bottom: var(--s-6); }

.q-topic-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  margin-bottom: var(--s-3);
}

.q-heading {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.q-sub { font-size: 14px; color: var(--text-muted); }

.q-block  { margin-bottom: var(--s-6); }
.q-label  {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-3);
  display: block;
}

.q-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.q-option {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast);
}
.q-option:hover {
  border-color: var(--border-md);
  background: var(--bg-raised);
  color: var(--text-primary);
}
.q-option.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 500;
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.q-textarea {
  width: 100%;
  min-height: 96px;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  resize: vertical;
  outline: none;
  line-height: 1.65;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.q-textarea::placeholder { color: var(--text-muted); }
.q-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ─── COURSE SCREEN ──────────────────────────── */
.course-header {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  margin-bottom: var(--s-6);
  box-shadow: var(--shadow-sm);
}

.course-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.course-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--s-4);
  line-height: 1.60;
}
.course-meta { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.course-meta span { font-size: 12px; color: var(--text-muted); }

/* Modules */
.modules-grid { display: flex; flex-direction: column; gap: var(--s-2); }

.module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.module-card:hover:not(.locked) {
  border-color: var(--border-md);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.module-card.locked { opacity: 0.38; cursor: not-allowed; }

.module-num {
  width: 34px; height: 34px;
  flex-shrink: 0;
  background: var(--bg-base);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.module-num.done {
  background: var(--bg-success);
  color: var(--text-success);
  border-color: transparent;
}
.module-num.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(201, 100, 66, 0.35);
}

.module-info { flex: 1; min-width: 0; }
.module-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.module-desc { font-size: 13px; color: var(--text-muted); line-height: 1.50; }
.module-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag.theory { background: var(--bg-info);    color: var(--text-info);    border-color: transparent; }
.tag.lab    { background: var(--bg-warning);  color: var(--text-warning); border-color: transparent; }
.tag.exam   { background: var(--bg-danger);   color: var(--text-danger);  border-color: transparent; }

/* ─── LESSON SCREEN ──────────────────────────── */
.lesson-nav {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.lesson-nav-back {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.lesson-nav-back:hover { color: var(--text-primary); }

.lesson-breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-weight: 500;
}

.lesson-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-5);
  line-height: 1.25;
}

/* Tabs */
.lesson-tabs {
  display: flex;
  gap: var(--s-1);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
  margin-bottom: var(--s-5);
}

.lesson-tab {
  flex: 1;
  padding: 8px var(--s-3);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--r-md);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.lesson-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-md);
}

/* Content area */
.content-area {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  min-height: 260px;
  box-shadow: var(--shadow-xs);
}

.content-area h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-3);
  color: var(--text-primary);
}
.content-area p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--s-3);
}
.content-area ul { padding-left: var(--s-5); }
.content-area li { font-size: 14px; color: var(--text-secondary); line-height: 1.85; }

/* Theory sections */
.theory-section {
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--border);
}
.theory-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.content-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
}

/* Lab */
.lab-info-banner {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-info);
  background: var(--bg-info);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}

.lab-materials {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
}

.lab-steps-list { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }

.lab-step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.lab-step.completed {
  background: var(--bg-success);
  border-color: rgba(39, 118, 58, 0.20);
}
.lab-step.completed .lab-step-text { text-decoration: line-through; color: var(--text-muted); }

.lab-step-label {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  cursor: pointer;
}

.lab-check {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.lab-step-body { display: flex; flex-direction: column; gap: 3px; }

.lab-step-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lab-step-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  transition: color var(--t-fast);
}

.lab-example {
  margin-top: var(--s-2);
  margin-left: calc(16px + var(--s-3));
}

/* Takeaways */
.takeaways-block {
  background: var(--bg-success);
  border: 1px solid rgba(39, 118, 58, 0.18);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-6) 0;
}
.takeaways-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-success);
  margin-bottom: var(--s-3);
}
.takeaways-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.takeaways-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: var(--s-4);
  position: relative;
  line-height: 1.55;
}
.takeaways-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--text-success);
  font-weight: 600;
}

/* Resources */
.resources-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-4) 0;
}
.resources-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--s-3);
}
.resource-item {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.resource-item:last-child { border-bottom: none; }
.resource-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-subtle);
  border-radius: var(--r-full);
  padding: 2px 7px;
  flex-shrink: 0;
}
.resource-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.resource-why {
  font-size: 12px;
  color: var(--text-muted);
  flex-basis: 100%;
  padding-left: calc(var(--s-2) + 40px);
  margin-top: -2px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  line-height: 1.70;
  white-space: pre-wrap;
  word-break: break-word;
}

.reflection-block {
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--bg-warning);
  border-radius: var(--r-md);
  border: 1px solid rgba(122, 81, 0, 0.12);
}
.reflection-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-warning);
}
.reflection-text { font-size: 13px; color: var(--text-secondary); line-height: 1.60; }

/* Exam */
.exam-q      { margin-bottom: var(--s-6); }
.exam-q-text { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--s-3); }
.exam-options { display: flex; flex-direction: column; gap: 6px; }

.exam-opt {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--t-fast);
}
.exam-opt:hover:not(:disabled) {
  border-color: var(--border-md);
  background: var(--bg-raised);
  color: var(--text-primary);
}
.exam-opt.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 500;
}
.exam-opt.correct {
  border-color: transparent;
  background: var(--bg-success);
  color: var(--text-success);
  font-weight: 500;
}
.exam-opt.wrong {
  border-color: transparent;
  background: var(--bg-danger);
  color: var(--text-danger);
}
.exam-explanation {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  padding: var(--s-2) var(--s-3);
  background: var(--bg-raised);
  border-radius: var(--r-md);
  line-height: 1.55;
}

/* Score */
.score-card { text-align: center; padding: var(--s-10) var(--s-4); }

.score-num {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: var(--s-2);
}

.score-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--s-6);
}

.score-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 6px 20px;
  border-radius: var(--r-full);
  margin-bottom: var(--s-6);
}
.score-badge.pass { background: var(--bg-success); color: var(--text-success); }
.score-badge.fail { background: var(--bg-warning); color: var(--text-warning); }

/* ─── AUTH SCREEN ────────────────────────────── */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--s-10));
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
  padding: var(--s-6) 0;
}

.auth-logo {
  width: 64px; height: 64px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin-bottom: var(--s-5);
}

.auth-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-bottom: var(--s-2);
}

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: var(--s-6);
}

#auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.auth-input {
  width: 100%;
  font-family: var(--font-main);
  font-size: 14px;
  padding: 0 var(--s-4);
  height: 44px;
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-xs);
  text-align: center;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.auth-reset-sent { text-align: center; }
.auth-sent-icon  { font-size: 40px; margin-bottom: var(--s-4); }
.auth-sent-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: var(--s-2); }
.auth-sent-sub   { font-size: 14px; color: var(--text-muted); line-height: 1.60; }

.auth-error {
  font-size: 13px;
  color: var(--text-danger);
  background: var(--bg-danger);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  text-align: center;
}

.auth-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--text-muted);
}

.btn-link {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { opacity: 0.75; }

/* ─── HOME USER ──────────────────────────────── */
.home-header-text { flex: 1; min-width: 0; }

.home-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.home-user-email {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  font-family: var(--font-main);
  font-size: 15px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-md);
  background: var(--bg-surface);
}

/* ─── SETTINGS PANEL ─────────────────────────── */
.settings-panel {
  margin-bottom: var(--s-4);
  padding: var(--s-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.settings-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-key-status {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.settings-key-status.active { color: var(--text-success); }

.settings-key-row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}

.settings-key-input {
  flex: 1;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  height: 40px !important;
  padding: 0 12px !important;
}

/* ─── PROGRESS PILL ──────────────────────────── */
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-success);
  background: var(--bg-success);
  border-radius: var(--r-full);
  padding: 2px 7px;
}
.progress-pill.started { color: var(--text-warning); background: var(--bg-warning); }

/* ─── DELETE BUTTON ON CARD ──────────────────── */
.course-card-mini  { position: relative; }
.team-course-card  { position: relative; }

.card-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--bg-danger);
  color: var(--text-danger);
  border: none;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-fast);
  z-index: 1;
}
.course-card-mini:hover .card-delete-btn,
.team-course-card:hover  .card-delete-btn { display: flex; }

/* ─── TEAM FILTER ROW ────────────────────────── */
.team-filter-row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}

.team-search-input {
  flex: 1;
  min-width: 140px;
  padding: 7px 12px;
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--t-fast);
}
.team-search-input:focus { border-color: var(--accent-border); }
.team-search-input::placeholder { color: var(--text-muted); }

.level-filters {
  display: flex;
  gap: var(--s-1);
  flex-wrap: wrap;
}

.level-pill {
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.level-pill:hover  { border-color: var(--border-md); color: var(--text-secondary); }
.level-pill.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-border);
}

.btn-ghost {
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.btn-ghost:hover {
  color: var(--text-danger);
  border-color: rgba(181, 51, 51, 0.30);
  background: var(--bg-danger);
}

/* ─── TEAM COURSES ───────────────────────────── */
.team-courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.team-course-card {
  padding: var(--s-4);
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-family: var(--font-main);
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.team-course-card:hover {
  border-color: var(--accent-border);
  background: var(--accent-subtle);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.tc-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--s-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.40;
}

.tc-creator {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}
.tc-creator strong { color: var(--text-secondary); font-weight: 500; }
.tc-learners { color: var(--text-info); }

.tc-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.tc-duration { font-size: 11px; color: var(--text-muted); }

/* ─── MY COURSES ─────────────────────────────── */
.my-courses-grid {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-4);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.my-courses-grid::-webkit-scrollbar { display: none; }

.course-card-mini {
  flex-shrink: 0;
  width: 196px;
  padding: var(--s-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-main);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.course-card-mini:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.ccm-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--s-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.40;
}

.ccm-meta {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}
.ccm-meta span { font-size: 11px; color: var(--text-muted); }

/* ─── SETUP SCREEN ───────────────────────────── */
.setup-container {
  max-width: 440px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.setup-logo {
  font-size: 36px;
  text-align: center;
}

.setup-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-align: center;
}

.setup-email-badge {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 4px 14px;
  display: inline-block;
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-sub {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.55;
  margin: 0;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  box-shadow: var(--shadow-xs);
}

.setup-step {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
}

.setup-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.setup-step-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.setup-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.setup-link:hover { text-decoration: underline; }

.setup-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.key-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.key-input-wrap .auth-input {
  flex: 1;
  padding-right: 44px;
}

.btn-show-key {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.btn-show-key:hover {
  opacity: 1;
}

.setup-feedback {
  font-size: 13px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  text-align: center;
}
.setup-feedback.success {
  color: var(--text-success);
  background: var(--bg-success);
}
.setup-feedback.error {
  color: var(--text-danger);
  background: var(--bg-danger);
}

.setup-logout {
  align-self: center;
  margin-top: var(--s-2);
}

/* ─── VIDEOS ─────────────────────────────────── */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.video-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--t-fast);
}
.video-thumb-wrap:hover .video-thumb { opacity: 0.82; }

.video-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity var(--t-fast);
  user-select: none;
}
.video-thumb-wrap:hover .video-play-btn { opacity: 1; }

.video-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.video-info {
  padding: var(--s-3) var(--s-4);
}
.video-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-channel {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── CONTEXT / MATERIAL DE REFERENCIA ──────── */
.context-section {
  margin-bottom: var(--s-6);
  border: 1.5px dashed var(--border-md);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-base), border-style var(--t-base);
}

.context-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  background: var(--bg-surface);
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.context-toggle:hover { background: var(--bg-raised); color: var(--text-secondary); }

.context-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-success);
  background: var(--bg-success);
  border-radius: var(--r-full);
  padding: 2px 8px;
}

.context-chevron {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform var(--t-base);
}
.context-chevron.open { transform: rotate(180deg); }

.context-panel {
  border-top: 1px solid var(--border);
  padding: var(--s-4);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.context-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.context-file-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px var(--s-4);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  cursor: pointer;
  align-self: flex-start;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.context-file-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
}

.context-extract-status {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.context-textarea {
  width: 100%;
  min-height: 110px;
  max-height: 220px;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-md);
  resize: vertical;
  outline: none;
  line-height: 1.65;
  transition: border-color var(--t-fast);
}
.context-textarea::placeholder { color: var(--text-muted); }
.context-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.context-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.context-char-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.context-clear {
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--text-danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.context-clear:hover { opacity: 0.75; }

/* ─── MARKDOWN PROSE ─────────────────────────── */
.prose p,
.tutor-bubble p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--s-3);
}
.prose p:last-child,
.tutor-bubble p:last-child { margin-bottom: 0; }

.prose ul, .prose ol,
.tutor-bubble ul, .tutor-bubble ol {
  padding-left: var(--s-5);
  margin-bottom: var(--s-3);
}
.prose li, .tutor-bubble li {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 3px;
}

.prose strong, .tutor-bubble strong {
  font-weight: 600;
  color: var(--text-primary);
}

.prose code, .tutor-bubble code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  color: var(--accent);
}

.prose pre, .tutor-bubble pre {
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  overflow-x: auto;
  margin-bottom: var(--s-3);
}
.prose pre code, .tutor-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text-primary);
}

.prose h1, .prose h2, .prose h3, .prose h4,
.tutor-bubble h1, .tutor-bubble h2, .tutor-bubble h3, .tutor-bubble h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: var(--s-4) 0 var(--s-2);
  line-height: 1.3;
}
.prose h3, .tutor-bubble h3 { font-size: 14px; }
.prose h4, .tutor-bubble h4 { font-size: 13px; }

.prose blockquote, .tutor-bubble blockquote {
  border-left: 3px solid var(--accent-border);
  padding-left: var(--s-4);
  margin: var(--s-3) 0;
  color: var(--text-muted);
  font-style: italic;
}

.tutor-message.user .tutor-bubble p { color: rgba(255,255,255,0.92); }
.tutor-message.user .tutor-bubble strong { color: #fff; }
.tutor-message.user .tutor-bubble code {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}

/* ─── SESIÓN SOCRÁTICA ───────────────────────── */
.socratic-card {
  margin-top: var(--s-6);
  background: linear-gradient(135deg, rgba(201,100,66,0.07) 0%, var(--bg-surface) 65%);
  border: 1.5px solid var(--accent-border);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}
.socratic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #e8845e);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.socratic-card-top { margin-bottom: var(--s-3); }

.socratic-badge {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  padding: 2px 10px;
}

.socratic-card-body {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.socratic-card-icon-wrap {
  font-size: 28px;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.socratic-card-info { flex: 1; min-width: 0; }

.socratic-card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--s-2);
}

.socratic-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.60;
  margin-bottom: var(--s-3);
}

.socratic-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.socratic-step-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--r-full);
  padding: 3px 10px;
}

.socratic-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--accent-border);
}

.socratic-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Badge "Guiado" en el header del tutor */
.tutor-mode-badge {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  padding: 1px 7px;
  margin-left: var(--s-2);
  vertical-align: middle;
}

/* ─── TUTOR FLOTANTE ─────────────────────────── */
.tutor-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  width: 52px;
  height: 52px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.tutor-float-btn.visible { display: flex; }
.tutor-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.tutor-float-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  z-index: 950;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 10px));
  transition: transform var(--t-slow);
  pointer-events: none;
}
.tutor-float-panel.open {
  transform: translateX(0);
  pointer-events: all;
}

.tutor-float-header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  flex-shrink: 0;
}
.tutor-header-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tutor-cost {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.tutor-float-close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.tutor-float-close:hover {
  background: var(--bg-danger);
  color: var(--text-danger);
  border-color: transparent;
}

.tutor-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  scroll-behavior: smooth;
}

.tutor-message {
  display: flex;
  max-width: 85%;
}
.tutor-message.user      { align-self: flex-end; }
.tutor-message.assistant { align-self: flex-start; }

.tutor-bubble {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  font-size: 13.5px;
  line-height: 1.60;
  white-space: pre-wrap;
  word-break: break-word;
}
.tutor-message.user .tutor-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--r-sm);
}
.tutor-message.assistant .tutor-bubble {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--r-sm);
}

.tutor-input-row {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  flex-shrink: 0;
}
.tutor-input {
  flex: 1;
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  padding: 8px var(--s-4);
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-base);
  outline: none;
  transition: border-color var(--t-fast);
}
.tutor-input:focus { border-color: var(--accent); }

/* ─── DANGER BUTTON SMALL ───────────────────── */
.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  height: 36px;
  cursor: pointer;
  background: var(--bg-danger);
  color: var(--text-danger);
  border: 1px solid rgba(181, 51, 51, 0.22);
  border-radius: var(--r-md);
  transition: background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.btn-danger-sm:hover {
  background: rgba(181, 51, 51, 0.20);
  border-color: rgba(181, 51, 51, 0.40);
}

/* ─── PRE-ASSESSMENT ─────────────────────────── */
.pa-header { margin-bottom: var(--s-6); }

.pa-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.pa-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 520px;
}

.pa-question {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}

.pa-q-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-2);
}

.pa-footer {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
}
.pa-footer .btn-primary { flex: 1; }

/* Pre-completed modules banner */
.preassessment-banner {
  align-items: center;
  gap: var(--s-3);
  background: linear-gradient(90deg, rgba(43,92,168,0.10), rgba(43,92,168,0.04));
  border: 1px solid rgba(43, 92, 168, 0.14);
  border-left: 3px solid var(--text-info);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-5);
  margin-bottom: var(--s-4);
  font-size: 13px;
  color: var(--text-info);
  font-weight: 500;
  line-height: 1.50;
}
.pa-banner-icon { font-size: 15px; flex-shrink: 0; }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 480px) {
  body { padding: var(--s-4); }
  .q-options { grid-template-columns: 1fr; }
  .quick-topics { grid-template-columns: repeat(2, 1fr); }
  .how-it-works { grid-template-columns: repeat(2, 1fr); }
  .score-num { font-size: 52px; }
  .videos-grid { grid-template-columns: 1fr; }
  .tutor-float-btn { bottom: 16px; right: 16px; }
  .tutor-float-panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: 65vh;
    border-left: none;
    border-top: 1px solid var(--border-md);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(calc(100% + 10px));
  }
  .tutor-float-panel.open { transform: translateY(0); }
}

/* ─── KEY INPUT WRAPPER (show/hide toggle) ───── */
.key-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}
.key-input-wrap .auth-input {
  flex: 1;
  padding-right: 40px;
}
.btn-key-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.btn-key-toggle:hover { opacity: 1; }

/* ─── TOAST NOTIFICATIONS ────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  max-width: 380px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}
.toast-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.toast-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.toast-info {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-md);
}
