/* V3 student — rich learning hub.
   Inherits home.css + studio.css design tokens; adds dedicated student components. */

/* Student design language — a warmer, friendlier palette than the teacher
   studio. Loaded after studio.css on the student pages only (teacher pages do
   not load this file), so these overrides re-theme the dashboard + class
   workspace without touching the teacher UI. */
:root {
  --bg: #120e12;
  --surface: #1b161c;
  --surface-2: #241d26;
  --border: #362d34;
  --accent: #fb7a5a;
  --accent-2: #ee6644;
}
body { background: var(--bg); }

.student-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── HERO STRIP (Continue learning) ──────────────────────────────────── */
.study-ai-strip {
  margin-top: 8px;
}
.study-ai-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 28px;
  border-radius: 18px;
  border: 1px solid rgba(255, 184, 76, 0.30);
  background:
    radial-gradient(900px 160px at 100% 0%, rgba(255, 184, 76, 0.14), transparent),
    linear-gradient(135deg, rgba(255, 184, 76, 0.14), rgba(251, 122, 90, 0.10));
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
}
.study-ai-main { min-width: 0; }
.study-ai-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 200, 120, 1);
  margin-bottom: 6px;
}
.study-ai-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--text);
}
.study-ai-subtitle {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 640px;
}
.study-ai-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.study-ai-topic {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  min-width: 230px;
  transition: border-color 0.15s;
}
.study-ai-topic:focus-visible { border-color: var(--accent); }
.study-ai-cta {
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
}

.hero-strip {
  margin-top: 8px;
}
.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: 20px;
  padding: 28px 32px;
  border-radius: 18px;
  border: 1px solid rgba(251, 122, 90,0.28);
  background:
    radial-gradient(1200px 200px at 0% 0%, rgba(255, 196, 150,0.15), transparent),
    linear-gradient(135deg, rgba(251, 122, 90,0.18), rgba(255, 150, 120,0.08));
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}
.hero-main { min-width: 0; }
.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 196, 150,1);
  margin-bottom: 8px;
}
.hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--text);
}
.hero-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 600px;
}
.hero-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  max-width: 480px;
}
.hero-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 168, 140,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(255, 150, 120,0.9));
  border-radius: 3px;
  transition: width 0.3s;
}
.hero-progress-text {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hero-current-lesson {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.hero-pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(9,12,24,0.4);
  border: 1px solid rgba(255, 168, 140,0.2);
  color: var(--text);
  font-size: 12px;
}
.hero-pill.ok { background: rgba(140,255,170,0.08); border-color: rgba(140,255,170,0.3); color: rgba(180,255,200,1); }
.hero-pill.warn { background: rgba(255,184,107,0.08); border-color: rgba(255,184,107,0.3); color: var(--warn); }
.hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.hero-cta {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}
.hero-secondary {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  text-decoration: none;
}
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-stat {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(9,12,24,0.4);
  border: 1px solid rgba(255, 168, 140,0.18);
}
.hero-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.hero-stat-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

/* ── SECTIONS ────────────────────────────────────────────────────────── */
.home-section-head h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
}
.home-section-head h2 .muted {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 14px;
}
.home-section-head .section-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 14px;
}

/* ── STUDENT CLASS CARDS ─────────────────────────────────────────────── */
.student-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.student-class-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.15s;
}
.student-class-card:hover {
  border-color: rgba(255, 196, 150,0.45);
  transform: translateY(-2px);
}
.student-class-card.paused { opacity: 0.7; }
.student-class-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.student-class-card .card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.student-class-card .card-teacher {
  font-size: 12px;
  color: rgba(255, 196, 150,0.9);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.student-class-card .card-summary {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.student-class-card .card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
}
.student-class-card .card-progress-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 168, 140,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.student-class-card .card-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.student-class-card .card-progress-text {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.student-class-card .card-next-lesson {
  font-size: 12px;
  color: var(--text);
}
.student-class-card .card-focus-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 4px;
}
.student-class-card .card-focus-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.student-class-card .card-main-action {
  margin-top: 6px;
  width: 100%;
  text-align: center;
  text-decoration: none;
  font-weight: 500;
}
.student-class-card .card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.student-class-card .card-actions .small-btn {
  font-size: 11px;
  padding: 4px 10px;
}
.student-class-card .card-actions .danger {
  color: var(--danger);
  border-color: rgba(255,140,140,0.3);
}
.student-class-card .card-actions .danger:hover {
  background: rgba(255,140,140,0.1);
}

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.status-badge.active { color: rgba(140,255,170,0.95); background: rgba(76,175,80,0.12); }
.status-badge.pending { color: var(--warn); background: rgba(255,184,107,0.12); }
.status-badge.paused { color: var(--warn); background: rgba(255,209,102,0.12); }

/* ── LEARNING SNAPSHOT ───────────────────────────────────────────────── */
.progress-grid {
  display: block;
}
.learn-snapshot {
  background:
    radial-gradient(900px 160px at 0% 0%, rgba(255, 196, 150,0.10), transparent),
    linear-gradient(135deg, rgba(251, 122, 90,0.10), rgba(255, 150, 120,0.05));
  border: 1px solid rgba(251, 122, 90,0.24);
  border-radius: 16px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.learn-headline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.learn-headline p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
  min-width: 220px;
}
.learn-momentum {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.learn-momentum.hot { background: rgba(255, 184, 76,0.16); color: #7fe6ff; border: 1px solid rgba(255, 184, 76,0.4); }
.learn-momentum.warm { background: rgba(251, 122, 90,0.16); color: #9db0ff; border: 1px solid rgba(251, 122, 90,0.4); }
.learn-momentum.cool { background: rgba(255, 168, 140,0.08); color: var(--text-dim); border: 1px solid var(--border); }
.learn-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.learn-stat {
  background: rgba(10,14,28,0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.learn-stat-num {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.learn-stat-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}
.learn-stat-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.learn-focus {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.learn-focus-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}
.learn-focus-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.learn-chip {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(251, 122, 90,0.12);
  border: 1px solid rgba(251, 122, 90,0.28);
  color: var(--text);
}

/* ── CATALOG ─────────────────────────────────────────────────────────── */
.catalog-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.filter-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-chip:hover:not(.active) { background: var(--surface-2); color: var(--text); }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.catalog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.catalog-card.kind-curriculum {
  border-color: rgba(255, 196, 150,0.3);
  background: linear-gradient(180deg, rgba(255, 196, 150,0.04), var(--surface));
}
.catalog-card .cat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.catalog-card .cat-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-dim);
}
.catalog-card.kind-curriculum .cat-badge {
  background: rgba(255, 196, 150,0.15);
  color: rgba(160,210,255,1);
}
.catalog-card .cat-enrolled {
  font-size: 11px;
  color: rgba(140,255,170,0.9);
  font-weight: 600;
}
.catalog-card .cat-name { font-size: 15px; font-weight: 600; margin: 0; }
.catalog-card .cat-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}
.catalog-card .cat-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin: 4px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.catalog-card .cat-by { font-weight: 500; color: var(--accent); }
.catalog-card .cat-teachers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 4px 0;
}
.teacher-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.teacher-chip.more { color: var(--text-dim); font-style: italic; }
.catalog-card .cat-enroll,
.catalog-card .cat-open {
  align-self: stretch;
  margin-top: auto;
  text-align: center;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
  padding: 8px 12px;
}

.catalog-redeem-row {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.catalog-redeem-row .muted { color: var(--text-dim); font-size: 13px; }
/* Brief highlight when the header "Redeem code" button jumps here. */
.catalog-redeem-row.redeem-flash {
  border-color: var(--accent);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(251, 122, 90, 0.22);
  transition: box-shadow 0.3s, border-color 0.3s;
}
.catalog-redeem-row .inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.catalog-redeem-row input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  width: 160px;
  font-size: 13px;
}

/* ── MODALS ──────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 16px 18px; overflow-y: auto; }

.teacher-card {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.teacher-card .teacher-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.teacher-card .teacher-voice {
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
}
.teacher-card .teacher-desc {
  font-size: 13px;
  color: var(--text);
  margin: 4px 0;
}
.teacher-card .teacher-greet {
  font-size: 12px;
  color: var(--text-dim);
  margin: 6px 0;
  font-style: italic;
}

.profile-json {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 12px;
  border-radius: 6px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
}
.profile-intro { color: var(--text-dim); font-size: 13px; margin: 0 0 14px; }
.profile-form { display: flex; flex-direction: column; gap: 12px; }
.profile-field { display: flex; flex-direction: column; gap: 5px; }
.profile-field > span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.profile-field input,
.profile-field textarea,
.profile-field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.profile-field textarea { resize: vertical; min-height: 40px; }
.profile-field input:focus-visible,
.profile-field textarea:focus-visible,
.profile-field select:focus-visible { border-color: var(--accent); }
.profile-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

.empty-state-line { color: var(--text-dim); padding: 16px; text-align: center; font-size: 13px; }
.section-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 138, 128, 0.28);
  background: rgba(255, 100, 90, 0.06);
  color: var(--text);
  font-size: 13.5px;
}
.section-error button { flex: 0 0 auto; }
.muted { color: var(--text-dim); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .student-main { padding: 16px; gap: 20px; }
  .hero-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .hero-title { font-size: 20px; margin-bottom: 6px; }
  .hero-subtitle {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .hero-meta { display: none; }
  .hero-side { display: none; }
  .hero-progress { margin-top: 10px; }
  .hero-actions { margin-top: 12px; }
  .study-ai-card { flex-direction: column; align-items: flex-start; padding: 16px; }
  .study-ai-title { font-size: 19px; }
  .study-ai-subtitle {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .study-ai-actions { width: 100%; }
  .study-ai-topic { width: 100%; min-width: 0; }
  .study-ai-cta { width: 100%; }
}

/* ─────────────────────────────────────────────────────────────────────── *
 * STUDENT CLASS WORKSPACE (/student/class/:id)
 * Styles below this line are used by class.html / student-class.js.
 * ─────────────────────────────────────────────────────────────────────── */

/* Per-lesson Learn/Discuss buttons */
.student-lesson-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.15s;
}
.student-lesson-row:hover { background: var(--surface-2); }
.student-lesson-row:last-child { border-bottom: none; }
.student-lesson-row .lesson-ordinal {
  flex: 0 0 24px;
  font-family: ui-monospace, monospace;
  color: var(--text-dim);
  font-size: 12px;
  padding-top: 2px;
}
.student-lesson-row .lesson-main { flex: 1; }
.student-lesson-row .lesson-title { font-weight: 500; margin-bottom: 4px; }
.student-lesson-row .lesson-sub { font-size: 12px; color: var(--text-dim); }
.student-lesson-row .item-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.student-lesson-row .lesson-actions {
  display: flex;
  gap: 4px;
  flex-direction: column;
}
.student-lesson-row .lesson-actions .small-btn {
  font-size: 11px;
  padding: 4px 8px;
  white-space: nowrap;
}
.item-pill {
  padding: 2px 8px;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.5;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
}
.item-pill:focus-visible {
  outline: 2px solid rgba(251, 122, 90, 0.6);
  outline-offset: 1px;
}
.item-pill:hover { filter: brightness(1.15); }
.item-pill.done { background: rgba(140,255,170,0.1); border-color: rgba(140,255,170,0.4); color: rgba(140,255,170,0.9); }
.item-pill.pending { background: rgba(255,184,107,0.1); border-color: rgba(255,184,107,0.4); color: var(--warn); }
.item-pill.locked { opacity: 0.4; }

/* Class workspace tabs */
.class-tabs-spacer { flex: 1; }
.class-tabs { display: flex; align-items: center; }

/* Item drawer */
.item-drawer {
  position: fixed;
  right: 0; top: 56px; bottom: 0;
  width: 460px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
}
.item-drawer[hidden] { display: none; }
.item-drawer .drawer-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-drawer .drawer-head-actions { display: inline-flex; gap: 6px; align-items: center; }
/* Full-screen / large view — fills the viewport so students can read/work on
   any item (reading, quiz, video) in a focused large view. Pure CSS resize, so
   in-progress state (quiz answers, video position, scroll) is preserved. */
.item-drawer.expanded {
  left: 0; right: 0; top: 0; bottom: 0;
  width: auto;
  border-left: none;
  box-shadow: none;
  z-index: 200;
}
.item-drawer.expanded .drawer-body { padding: 24px 24px 48px; }
.item-drawer.expanded .drawer-body > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.item-drawer.expanded .drawer-body > .video-item { max-width: 1200px; }
.item-drawer.expanded .video-item-frame { aspect-ratio: 16 / 9; }
.item-drawer .drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.item-body-content { font-size: 14px; line-height: 1.55; white-space: pre-wrap; margin-bottom: 16px; }
.item-answer-form textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  min-height: 120px;
  resize: vertical;
}
.item-feedback-card {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.item-feedback-card .score { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.item-feedback-card .feedback-section { font-size: 13px; margin-top: 8px; }
.item-feedback-card .feedback-section h4 {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.item-feedback-card .feedback-section ul { margin: 0; padding-left: 18px; }
.item-feedback-card.pending { border-left-color: var(--warn); }
.item-feedback-card.pending .score { color: var(--warn); font-size: 14px; font-weight: 500; }

/* File upload */
.attachment-strip {
  margin-top: 8px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px dashed var(--border);
}
.upload-btn {
  display: inline-block;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: 4px;
  font-size: 12px;
}
.upload-btn:hover { background: var(--accent); color: #fff; }
.attachment-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.attachment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 4px;
}

/* Session router modal (already in V3 student) */
.router-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.router-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.router-card:hover { border-color: var(--accent); }
.router-card.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(255, 196, 150,0.1), rgba(255, 150, 120,0.08));
  border-color: rgba(255, 196, 150,0.3);
}
/* Cross-topic Q&A spans full width so the grid reads Continue (full) / Review
   | Homework / Q&A (full) instead of leaving a lonely half-empty row. */
.router-card[data-action="qa"] { grid-column: 1 / -1; }
.router-card-eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.router-card-title { font-weight: 600; font-size: 14px; }
.router-card-sub { font-size: 12px; color: var(--text-dim); }
.router-card select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  margin-top: 4px;
}
.router-card .router-card-go {
  margin-top: 6px;
  padding: 6px 12px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

/* Announcements */
.announcement-card {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.announcement-card.pinned {
  border-left: 3px solid var(--warn);
  background: linear-gradient(180deg, rgba(255,184,107,0.05), var(--surface-2));
}
.announcement-card .pin-badge {
  font-size: 11px;
  color: var(--warn);
  font-weight: 600;
  margin-bottom: 4px;
}
.announcement-card h3 { margin: 0 0 8px; font-size: 15px; }
.announcement-card .announcement-body {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.announcement-card .announcement-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Structured quiz rendering */
.quiz-questions { display: flex; flex-direction: column; gap: 16px; }
.quiz-q {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.quiz-q .q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}
.quiz-q .q-number { font-weight: 700; color: var(--accent); font-size: 13px; }
.quiz-q .q-points {
  font-size: 11px; color: var(--text-dim); background: var(--surface);
  padding: 2px 8px; border-radius: 4px;
}
.quiz-q .q-diff {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: 3px; color: var(--text-dim);
}
.quiz-q .q-diff.diff-foundational { color: rgba(255, 196, 150,1); background: rgba(255, 196, 150,0.1); }
.quiz-q .q-diff.diff-intermediate { color: var(--warn); background: rgba(255,184,107,0.1); }
.quiz-q .q-diff.diff-advanced { color: var(--danger); background: rgba(255,140,140,0.1); }
.quiz-q .q-hint { font-size: 11px; font-style: italic; color: var(--text-dim); }
.quiz-q .q-prompt { font-size: 14px; line-height: 1.5; margin-bottom: 10px; color: var(--text); }
.quiz-q .q-options { display: flex; flex-direction: column; gap: 6px; }
.quiz-q .q-option {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-q .q-option:hover { border-color: var(--accent); background: var(--surface-2); }
.quiz-q .q-option input[type="radio"],
.quiz-q .q-option input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); }
.quiz-q .q-option-letter {
  font-weight: 600; color: var(--text-dim);
  font-family: ui-monospace, monospace; min-width: 18px;
}
.quiz-q .q-option-text { flex: 1; font-size: 13px; line-height: 1.5; }
.quiz-q .q-textarea {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 10px 12px;
  font-family: inherit; font-size: 13px; resize: vertical;
}
.quiz-q .q-wordhint { margin-top: 6px; font-size: 11px; color: var(--text-dim); }

.quiz-review { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.quiz-q.reviewed.correct { border-left: 3px solid rgba(140,255,170,0.7); }
.quiz-q.reviewed.wrong { border-left: 3px solid var(--danger); }
.quiz-q .q-correct { color: rgba(140,255,170,0.9); font-weight: 600; }
.quiz-q .q-wrong { color: var(--danger); font-weight: 600; }
.q-options.reviewed .q-option { cursor: default; padding: 6px 10px; }
.q-options.reviewed .q-option.chosen { border-color: var(--accent); background: rgba(255, 196, 150,0.08); }
.q-options.reviewed .q-option.is-answer { border-color: rgba(140,255,170,0.5); background: rgba(140,255,170,0.08); }
.q-options.reviewed .q-option.chosen.is-answer { border-color: rgba(140,255,170,0.8); }
.q-options.reviewed .q-option-marker { width: 16px; font-weight: 700; color: rgba(140,255,170,0.9); }
.q-your-answer { font-size: 13px; padding: 8px 12px; background: var(--surface); border-radius: 4px; margin-top: 6px; }
.q-feedback {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(255, 196, 150,0.06); border-left: 2px solid var(--accent);
  font-size: 12px; border-radius: 4px;
}
.q-explanation {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(255,184,107,0.06); border-left: 2px solid var(--warn);
  font-size: 12px; border-radius: 4px;
}

.item-kind-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Markdown body inside quiz prompts / options / feedback */
.md-body { display: inline; }
.md-body p { margin: 0; display: inline; }
.md-body p + p { display: block; margin-top: 8px; }
.quiz-q .q-prompt.md-body p { display: block; }
.quiz-q .q-prompt.md-body p + p { margin-top: 6px; }
.item-body-content.md-body p { display: block; margin: 0 0 8px; }
.md-body code {
  font-family: ui-monospace, monospace;
  font-size: 0.92em;
  background: rgba(255, 196, 150,0.08);
  padding: 1px 4px;
  border-radius: 3px;
}
.md-body strong { font-weight: 600; }
.md-body em { font-style: italic; }
.md-body .katex { color: var(--text); }
.md-body .katex-display {
  margin: 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ── Placement interview modal ────────────────────────────────────────── */
.interview-card {
  max-width: 620px;
  height: 600px;
  display: flex;
  flex-direction: column;
}
.interview-card .modal-head {
  align-items: flex-start;
}
.interview-card .interview-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin: 4px 0 0;
  max-width: 460px;
  line-height: 1.4;
}
.interview-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 196, 150,0.04), transparent 60%);
}
.iv-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.iv-msg.student {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.iv-msg.teacher {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.iv-msg.system {
  align-self: center;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(140,255,170,0.08);
  border: 1px solid rgba(140,255,170,0.25);
  border-radius: 999px;
  padding: 4px 14px;
}
.interview-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.interview-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.interview-input-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
}
.interview-input-row input:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(251, 122, 90, 0.5);
  outline-offset: 1px;
}
.interview-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.interview-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* ── Pre-interview gate on /student/class/:id ────────────────────── */
.interview-gate {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px;
}
.interview-gate-card {
  max-width: 560px;
  width: 100%;
  padding: 40px 36px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 196, 150,0.08), var(--surface) 60%);
  border-color: rgba(255, 196, 150,0.3);
}
.interview-gate-card .gate-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.interview-gate-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
}
.interview-gate-card .gate-sub {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 auto 20px;
  max-width: 440px;
}
.interview-gate-card .gate-bullets {
  list-style: none;
  padding: 0;
  margin: 0 auto 24px;
  text-align: left;
  display: inline-block;
  font-size: 13px;
  color: var(--text);
  line-height: 2;
}
.interview-gate-card .gate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.interview-gate-card .primary-btn {
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
}
.class-tab.muted { opacity: 0.4; pointer-events: none; }

/* Mobile: the class workspace tab bar is a non-wrapping flex row with a
   spacer that pushes the "Start AI tutor" button off-screen on narrow
   viewports. Let the bar wrap and drop the AI tutor button onto its own
   full-width row. Scoped to student pages (teacher pages don't load this). */
@media (max-width: 640px) {
  .class-tabs {
    position: sticky;
    top: 52px;
    z-index: 9;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding: 0 10px;
    gap: 2px;
  }
  .class-tabs::-webkit-scrollbar { display: none; }
  .class-tab { flex: 0 0 auto; white-space: nowrap; }
  .class-tabs .class-tabs-spacer { display: none; }
  .class-tabs #aiTutorBtn {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 45;
    width: auto;
    min-height: 48px;
    margin: 0;
    justify-content: center;
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(0,0,0,0.42);
  }
  .class-canvas { padding: 14px 12px calc(86px + env(safe-area-inset-bottom)); }
  .v3-header {
    min-height: 52px;
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .v3-header-left { min-width: 0; gap: 6px; }
  .v3-header-left .ghost-btn,
  .v3-header-right .ghost-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .class-title-badge {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Declutter the header on phones: drop the name label so the action
     buttons (Redeem code / Help / Settings / Sign out) fit without crowding. */
  .v3-header-right {
    min-width: 0;
    margin-left: auto;
    gap: 4px;
  }
  .v3-header-right .teacher-name { display: none; }
  .student-main { padding-top: 14px; }
}

/* ── Video lesson item (embedded lecture player) ──────────────────────────── */
.item-pill.video { background: rgba(251,122,90,.14); border-color: rgba(251,122,90,.4); color: var(--accent, #fb7a5a); }
.video-item-frame { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #0f1115; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.video-item-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
