/* ═══════════════════════════════════════════════════════════════
   JITL Design System — The Amber Study
   Fraunces display serif (large-only) + DM Sans body
   Warm charcoal/amber palette. No Inter. No purple. No templates.
   ═══════════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,700;0,9..144,800;0,9..144,900;1,9..144,300;1,9..144,400;1,9..144,700;1,9..144,800;1,9..144,900&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap");

:root {
  --bg: #090f1c;
  --bg-raised: #0d1526;
  --bg-card: #111a30;
  --bg-hover: #182038;
  --border: #1e2d4a;
  --border-subtle: #131c34;
  --text: #e8edf8;
  --text-secondary: #8595b8;
  --text-muted: #485878;
  --accent: #f5b731;
  --accent-light: #f7cc5a;
  --accent-glow: rgba(245, 183, 49, 0.12);
  --success: #72b87a;
  --success-bg: rgba(114, 184, 122, 0.1);
  --warning: #e8c44a;
  --error: #c85a3a;
  --correct: #72b87a;
  --incorrect: #c85a3a;
  --type-content: #6baed4;
  --type-quiz: #e8c44a;
  --type-scenario: #c85a3a;
  --type-summary: #72b87a;
  --type-reflection: #b07fd4;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: "Fraunces", Georgia, serif;
  --font: "DM Sans", -apple-system, sans-serif;
  --font-mono: monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Top Bar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: rgba(16, 14, 11, 0.92);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
}
.topbar-brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font);
  font-weight: 800; font-size: 17px;
  letter-spacing: -0.5px; color: var(--text);
  text-decoration: none;
}
.topbar-brand .logo {
  width: 28px; height: 28px;
  background: var(--accent); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font);
  font-size: 14px; font-weight: 900;
  color: var(--bg);
}
.topbar-nav {
  display: flex; align-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.topbar-nav button {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: none; cursor: pointer; padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.topbar-nav button.active {
  background: var(--bg-card); color: var(--text);
}
.topbar-nav button:not(.active):hover { color: var(--text-secondary); }
.topbar-actions {
  display: flex; align-items: center; gap: 16px;
}
.streak-badge {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: 12px; color: var(--text-muted);
}
.streak-icon { font-size: 14px; }
.streak-count { font-weight: 600; color: var(--accent); }
.streak-label { color: var(--text-muted); }
.topbar-xp {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  padding: 4px 12px; border-radius: 20px;
}
.xp-icon { color: var(--accent); font-size: 13px; }
.xp-value { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--accent); }
.xp-label { font-family: var(--font); font-size: 11px; color: var(--text-muted); }
.topbar-actions a {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  text-decoration: none; transition: var(--transition);
}
.topbar-actions a:hover { color: var(--accent-light); }
.topbar-kbd-btn {
  font-size: 16px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); padding: 4px 6px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.topbar-kbd-btn:hover { background: var(--bg-raised); color: var(--text-secondary); }

/* ── Main layout ── */
main {
  padding-top: 56px;
  min-height: 100vh;
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ── Home / Create View ── */
#view-home {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 32px 80px;
}

.hero {
  text-align: center;
  padding-bottom: 52px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 14px;
  color: var(--text);
}
.hero h1 em { font-style: italic; color: var(--accent-light); }
.hero p {
  font-size: 16px; color: var(--text-secondary);
  max-width: 440px; margin: 0 auto; line-height: 1.7;
}

/* ── Input Tabs ── */
.input-tabs {
  display: flex; gap: 0;
  margin-bottom: 0;
}
.input-tab {
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); background: var(--bg-raised);
  border: 1px solid var(--border-subtle); border-bottom: none;
  cursor: pointer; padding: 10px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.15s ease;
  display: flex; align-items: center; gap: 7px;
  margin-right: 4px;
}
.input-tab.active { color: var(--text); background: var(--bg-card); border-color: var(--border); }
.input-tab:not(.active):hover { color: var(--text-secondary); }
.tab-icon { font-size: 14px; }

/* ── Input Panels ── */
.input-panel { display: none; }
.input-panel.active { display: block; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 64px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
  position: relative; overflow: hidden;
}
.upload-zone::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(245, 183, 49, 0.04) 0%, transparent 60%);
  pointer-events: none;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(245, 183, 49, 0.04);
}
.upload-zone.dragover {
  border-style: solid;
  background: rgba(232, 148, 58, 0.07);
}
.upload-zone .icon {
  font-size: 40px; margin-bottom: 16px;
  display: block; opacity: 0.7;
  transition: transform 0.2s;
}
.upload-zone:hover .icon { transform: translateY(-4px); }
.upload-zone h3 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; font-style: italic;
  letter-spacing: -0.4px; margin-bottom: 6px;
}
.upload-zone p { font-size: 13.5px; color: var(--text-muted); }
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ── Text Input Zone ── */
.text-input-zone {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
#text-input {
  width: 100%; min-height: 220px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 14px;
  line-height: 1.7; resize: vertical; padding: 24px;
}
#text-input::placeholder { color: var(--text-muted); }
.char-count {
  padding: 8px 24px;
  font-family: var(--font); font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}
.text-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Setup Form ── */
.setup-form {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.file-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(114, 184, 122, 0.1);
  border: 1px solid rgba(114, 184, 122, 0.25);
  color: var(--success);
  padding: 6px 14px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; font-family: var(--font);
  margin-bottom: 24px;
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 700;
  font-family: var(--font); text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-secondary); margin-bottom: 7px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font); font-size: 14px; padding: 11px 14px;
  outline: none; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { min-height: 80px; resize: vertical; line-height: 1.6; }
.form-group select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.18s ease;
  border: none; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: var(--bg);
  box-shadow: 0 2px 12px rgba(245, 183, 49, 0.2);
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245, 183, 49, 0.3); }
.btn-secondary {
  background: var(--bg-raised); color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-secondary); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ── Generating State ── */
.generating-state {
  text-align: center;
  padding: 72px 32px;
}
.orbit {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  margin: 0 auto 28px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.generating-state h3 {
  font-family: var(--font);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.3px; margin-bottom: 8px;
}
.generating-state p { font-size: 14px; color: var(--text-secondary); margin-bottom: 36px; }
.gen-steps {
  display: flex; justify-content: center; gap: 24px;
}
.gen-step {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font); font-size: 11.5px;
  color: var(--text-muted); letter-spacing: 0.3px;
  transition: color 0.3s;
}
.gen-step.active { color: var(--accent); }
.gen-step.done { color: var(--success); }
.gen-step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.gen-step.active .gen-step-dot { background: var(--accent); animation: dotPulse 1.2s ease infinite; }
.gen-step.done .gen-step-dot { background: var(--success); }
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.gen-tip {
  margin-top: 32px;
  display: inline-block;
  padding: 10px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--text-secondary); text-align: left;
  max-width: 440px; line-height: 1.55;
}
.gen-tip strong { color: var(--accent); font-weight: 600; }

/* ── Curriculum Review ── */
.curriculum-review { margin-top: 24px; }
.curriculum-header {
  margin-bottom: 28px;
}
.curriculum-header h2 {
  font-family: var(--font);
  font-size: 26px; font-weight: 800;
  letter-spacing: -0.8px; margin-bottom: 6px;
}
.curriculum-header p { font-size: 14px; color: var(--text-secondary); }
.curriculum-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px;
}
.curriculum-meta span {
  font-family: var(--font); font-size: 11.5px;
  color: var(--text-muted); letter-spacing: 0.2px;
}

/* ── Module Cards ── */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.module-card:hover { border-color: var(--border); }
.module-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.module-num {
  font-family: var(--font); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); flex-shrink: 0;
  padding-top: 3px;
}
.module-title {
  font-family: var(--font);
  font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
  line-height: 1.3; flex: 1;
}
.card-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.card-type-tag {
  font-family: var(--font);
  font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 3px 9px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.card-type-tag.content { color: var(--type-content); background: rgba(107, 174, 212, 0.08); border: 1px solid rgba(107, 174, 212, 0.2); }
.card-type-tag.quiz { color: var(--type-quiz); background: rgba(232, 196, 74, 0.08); border: 1px solid rgba(232, 196, 74, 0.2); }
.card-type-tag.scenario { color: var(--type-scenario); background: rgba(200, 90, 58, 0.08); border: 1px solid rgba(200, 90, 58, 0.2); }
.card-type-tag.summary { color: var(--type-summary); background: rgba(114, 184, 122, 0.08); border: 1px solid rgba(114, 184, 122, 0.2); }
.card-type-tag.reflection { color: var(--type-reflection); background: rgba(176, 127, 212, 0.08); border: 1px solid rgba(176, 127, 212, 0.2); }
.objective { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.pedagogy {
  font-family: var(--font); font-size: 12px; font-style: italic;
  color: var(--text-muted); line-height: 1.55;
  padding: 10px 14px;
  background: rgba(245, 183, 49, 0.04);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
}
.source-refs { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }

/* Edit fields */
.module-edit-input, .module-edit-textarea, .curriculum-edit-input, .curriculum-edit-textarea {
  width: 100%; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px;
  padding: 9px 12px; outline: none; transition: border-color 0.15s;
  resize: vertical;
}
.module-edit-input:focus, .module-edit-textarea:focus,
.curriculum-edit-input:focus, .curriculum-edit-textarea:focus { border-color: var(--accent); }
.module-edit-input { font-family: var(--font); font-size: 17px; font-weight: 700; }
.curriculum-edit-input { font-family: var(--font); font-size: 22px; font-weight: 800; }
.module-edit-textarea { min-height: 70px; line-height: 1.6; }
.curriculum-edit-textarea { min-height: 60px; line-height: 1.6; }

/* ── Course List ── */
#view-courses {
  max-width: 760px; margin: 0 auto;
  padding: 56px 32px 80px;
}
.course-list-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.course-list-header h2 {
  font-family: var(--font);
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.5px;
}
.course-count {
  font-family: var(--font); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.3px;
}
.course-list { display: flex; flex-direction: column; gap: 8px; }
.course-list-empty {
  text-align: center;
  padding: 72px 32px;
  color: var(--text-muted); font-size: 14px;
}
.course-list-empty-icon { font-size: 40px; margin-bottom: 14px; opacity: 0.5; }
.course-item {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  cursor: pointer; transition: all 0.15s ease;
  display: flex; justify-content: space-between; align-items: center;
}
.course-item:hover { background: var(--bg-card); border-color: rgba(245, 183, 49, 0.3); transform: translateX(2px); box-shadow: inset 3px 0 0 var(--accent); }
.course-item-info { flex: 1; min-width: 0; }
.course-item-title,
.course-item-info h3 {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700; letter-spacing: -0.3px;
  color: var(--text); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.course-item-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font); font-size: 11px; color: var(--text-muted);
}
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }
.course-item-types { display: flex; gap: 5px; margin-left: 4px; }
.course-item-type-dot { width: 7px; height: 7px; border-radius: 50%; }
.course-item-est { margin-left: 2px; }
.course-item-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: 16px; }
.course-item-status {
  font-family: var(--font); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.7px;
  padding: 3px 9px; border-radius: 4px;
  font-weight: 600;
}
.course-item-status.ready { color: var(--success); background: rgba(114, 184, 122, 0.1); border: 1px solid rgba(114, 184, 122, 0.2); }
.course-item-status.curriculum { color: var(--warning); background: rgba(232, 196, 74, 0.08); border: 1px solid rgba(232, 196, 74, 0.2); }
.course-item-status.draft { color: var(--text-muted); background: var(--bg-hover); border: 1px solid var(--border-subtle); }
.course-item-status.generating { color: var(--accent); background: rgba(245, 183, 49, 0.08); border: 1px solid rgba(245, 183, 49, 0.2); }
.course-item-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 4px 6px;
  border-radius: var(--radius-sm); transition: all 0.15s ease; opacity: 0;
}
.course-item:hover .course-item-delete { opacity: 1; }
.course-item-delete:hover { background: rgba(200, 90, 58, 0.12); color: var(--error); }

/* ── Course Viewer ── */
.course-viewer {
  max-width: 720px; margin: 0 auto;
  padding: 40px 32px 80px;
}
.viewer-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); padding: 0; margin-bottom: 40px;
  transition: color 0.15s;
}
.viewer-back:hover { color: var(--accent-light); }
.course-viewer-header {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
}
.course-viewer-header h1 {
  font-family: var(--font);
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 800;
  letter-spacing: -1px; margin-bottom: 8px; line-height: 1.1;
}
.course-viewer-header p { font-size: 14px; color: var(--text-secondary); line-height: 1.65; }

/* ── Module Tracker ── */
.module-tracker {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.module-tracker-item {
  font-family: var(--font); font-size: 11px;
  color: var(--text-muted); padding: 5px 12px;
  border-radius: 20px; border: 1px solid var(--border-subtle);
  transition: all 0.2s; cursor: default; letter-spacing: 0.2px;
}
.module-tracker-item.active {
  color: var(--text); border-color: var(--accent);
  background: rgba(245, 183, 49, 0.08);
}
.module-tracker-item.done { color: var(--success); border-color: rgba(114, 184, 122, 0.3); background: rgba(114, 184, 122, 0.05); }

/* ── Progress ── */
.progress-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.progress-pct {
  font-family: var(--font); font-size: 12px;
  color: var(--text-muted); min-width: 36px;
}
.progress-bar-wrap {
  flex: 1; height: 4px;
  background: var(--bg-raised); border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar-fill.complete { background: var(--success); }
.progress-time {
  font-family: var(--font); font-size: 11.5px;
  color: var(--text-muted); min-width: 36px; text-align: right;
}
.quiz-score {
  display: flex; align-items: center; gap: 3px;
  font-family: var(--font); font-size: 12px;
}
.quiz-score-correct { color: var(--success); font-weight: 700; }
.quiz-score-sep { color: var(--text-muted); }
.quiz-score-total { color: var(--text-muted); }

/* ── Module Transition ── */
.module-transition {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(9, 15, 28, 0.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.module-transition-inner { text-align: center; }
.module-transition-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(114, 184, 122, 0.15);
  border: 2px solid var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--success);
  margin: 0 auto 20px;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.module-transition-title {
  font-family: var(--font);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.3px; margin-bottom: 6px;
}
.module-transition-sub { font-size: 13.5px; color: var(--text-secondary); }

/* ── Card Container ── */
.card-container { min-height: 300px; }

/* ── Course Cards ── */
.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  animation: cardIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  position: relative; overflow: hidden;
}
.course-card::before {
  content: "";
  position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  transition: background 0.3s;
}
.course-card.type-content::before { background: var(--type-content); }
.course-card.type-quiz::before { background: var(--type-quiz); }
.course-card.type-scenario::before { background: var(--type-scenario); }
.course-card.type-summary::before { background: var(--type-summary); }
.course-card.type-reflection::before { background: var(--type-reflection); }
@keyframes cardIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
.course-card.slide-back { animation: cardInBack 0.3s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes cardInBack {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.card-module {
  font-family: var(--font);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
}
.card-type-tag {
  font-family: var(--font);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 10px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 5px;
}
.card-type-icon { font-size: 12px; }
.course-card h2 {
  font-family: var(--font);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800; letter-spacing: -0.6px; line-height: 1.2;
  margin-bottom: 18px;
}

/* ── Card Body ── */
.card-body {
  font-size: 15px; color: var(--text-secondary);
  line-height: 1.75; margin-bottom: 8px;
}
.card-body strong { color: var(--text); font-weight: 700; }
.card-body em { font-style: italic; color: var(--accent-light); }
.card-body p { margin-bottom: 12px; }
.card-body p:last-child { margin-bottom: 0; }

/* ── Quiz ── */
.quiz-options { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.quiz-option {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 13px 18px;
  text-align: left; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  color: var(--text-secondary); transition: all 0.15s ease;
}
.quiz-option:hover:not(:disabled) {
  background: var(--bg-hover); border-color: var(--border); color: var(--text);
}
.quiz-option:disabled { cursor: default; opacity: 0.8; }
.quiz-option.correct { border-color: var(--success); background: rgba(114, 184, 122, 0.1); color: var(--success); }
.quiz-option.incorrect { border-color: var(--error); background: rgba(200, 90, 58, 0.08); color: var(--error); }
.quiz-explanation {
  margin-top: 16px; padding: 14px 18px;
  background: rgba(232, 148, 58, 0.06);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px; color: var(--text-secondary); line-height: 1.65;
}

/* ── Scenario ── */
.scenario-situation {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--type-scenario);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 18px; margin: 16px 0;
  font-size: 14.5px; line-height: 1.65; color: var(--text);
  font-style: italic;
}
.scenario-situation strong { font-style: normal; }
.scenario-options { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.scenario-option {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 13px 18px;
  text-align: left; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  color: var(--text-secondary); transition: all 0.15s ease;
  width: 100%;
}
.scenario-option:hover:not([style*="pointer-events: none"]) {
  background: var(--bg-hover); border-color: var(--border); color: var(--text);
}
.scenario-outcome {
  margin-top: 8px; padding: 12px 16px;
  border-radius: var(--radius-sm); font-size: 13.5px;
  line-height: 1.6;
}
.scenario-outcome.correct { background: rgba(114, 184, 122, 0.08); border-left: 2px solid var(--success); color: var(--text-secondary); }
.scenario-outcome.incorrect { background: rgba(200, 90, 58, 0.06); border-left: 2px solid var(--error); color: var(--text-secondary); }

/* ── Source Ref ── */
.source-ref-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 20px; cursor: pointer;
  font-family: var(--font); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.3px;
  padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border-subtle);
  transition: all 0.15s;
}
.source-ref-badge:hover { color: var(--accent-light); border-color: var(--accent); }
.source-ref-expanded {
  margin-top: 8px; padding: 12px 16px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 12px;
  color: var(--text-muted); line-height: 1.6;
}

/* ── Pedagogy Note ── */
.pedagogy-note {
  margin-top: 24px; padding: 12px 16px; font-style: italic;
  background: rgba(245, 183, 49, 0.05);
  border-left: 2px solid rgba(232, 148, 58, 0.4);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px; font-family: var(--font);
  color: var(--text-muted); line-height: 1.55;
}

/* ── Card Nav ── */
.card-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0 0;
  gap: 16px;
}
.card-counter {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font); font-size: 12px; color: var(--text-muted);
}
.kbd-hint { display: flex; gap: 4px; }
.kbd {
  font-family: var(--font); font-size: 10px;
  padding: 2px 5px; border-radius: 3px;
  background: var(--bg-raised); border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── Review Schedule ── */
.review-schedule {
  margin-top: 40px; padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.review-schedule h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; font-style: italic;
  letter-spacing: -0.3px; margin-bottom: 18px;
}
.review-day {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border-subtle);
}
.review-day:last-child { border-bottom: none; }
.review-day-num {
  font-family: var(--font); font-size: 11px;
  color: var(--accent); letter-spacing: 0.3px;
  min-width: 50px; flex-shrink: 0; padding-top: 1px;
  text-transform: uppercase;
}
.review-day-modules { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.review-day-modules strong { color: var(--text); font-weight: 600; }
.review-day-reason { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }

/* ── Completion ── */
.course-complete {
  text-align: center;
  padding: 56px 24px;
}
.course-complete-icon {
  font-size: 52px; margin-bottom: 20px;
  display: block;
}
.course-complete h2 {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800; font-style: italic;
  letter-spacing: -1px; margin-bottom: 10px;
}
.course-complete p { font-size: 15px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.6; }
.completion-stats {
  display: flex; justify-content: center; gap: 32px;
  margin: 32px 0;
  flex-wrap: wrap;
}
.completion-stat { text-align: center; }
.completion-stat .stat-num {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 900; font-style: italic;
  letter-spacing: -1.5px; color: var(--accent);
  display: block; line-height: 1;
}
.completion-stat .stat-label {
  font-family: var(--font); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.3px;
  margin-top: 4px; text-transform: uppercase;
}
.xp-earned {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(245, 183, 49, 0.1); border: 1px solid rgba(245, 183, 49, 0.25);
  padding: 10px 22px; border-radius: 24px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--accent); margin: 16px auto 28px; display: inline-flex;
}

/* ── Toast ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  font-size: 13.5px; color: var(--text);
  animation: toastIn 0.25s ease both;
  max-width: 280px; line-height: 1.5;
  box-shadow: var(--shadow-lg);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Keyboard Shortcuts ── */
.kbd-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(16, 14, 11, 0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.kbd-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  min-width: 320px; box-shadow: var(--shadow-lg);
}
.kbd-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px;
}
.kbd-modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; font-style: italic;
  letter-spacing: -0.3px;
}
.kbd-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.kbd-close:hover { background: var(--bg-hover); color: var(--text); }
.kbd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border-subtle);
}
.kbd-row:last-child { border-bottom: none; }
.kbd-keys { display: flex; align-items: center; gap: 5px; }
.kbd-desc { font-size: 13px; color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .topbar { padding: 0 20px; }
  .topbar-brand span:not(.logo) { display: none; }
  .streak-badge { display: none; }
  #view-home, #view-courses { padding: 40px 20px 60px; }
  .course-viewer { padding: 32px 20px 60px; }
  .course-card { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .setup-form { padding: 24px 20px; }
  .hero h1 { font-size: 26px; }
}

/* ── Module Pips (JS-generated tracker) ── */
.module-pip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 11px;
  color: var(--text-muted); padding: 5px 12px;
  border-radius: 20px; border: 1px solid var(--border-subtle);
  transition: all 0.2s; cursor: default; letter-spacing: 0.2px;
}
.module-pip.active {
  color: var(--text); border-color: var(--accent);
  background: rgba(245, 183, 49, 0.08);
}
.module-pip.complete { color: var(--success); border-color: rgba(114, 184, 122, 0.3); background: rgba(114, 184, 122, 0.05); }
.module-pip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0; transition: background 0.2s;
}
.module-pip.active .module-pip-dot { background: var(--accent); }
.module-pip.complete .module-pip-dot { background: var(--success); }

/* ── Completion Card ── */
.completion-card {
  text-align: center; padding: 56px 36px !important;
}
.completion-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(114, 184, 122, 0.12);
  border: 2px solid var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--success);
  margin: 0 auto 24px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.completion-card h2 {
  font-family: var(--font);
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.8px; margin-bottom: 8px;
}
.completion-card > p { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.6; }
.completion-xp {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(245, 183, 49, 0.1); border: 1px solid rgba(245, 183, 49, 0.25);
  padding: 8px 20px; border-radius: 24px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--accent); margin: 18px auto 32px;
}
.completion-stats {
  display: flex; justify-content: center; gap: 32px;
  margin-bottom: 36px; flex-wrap: wrap;
}
.completion-stat { text-align: center; }
.completion-stat-num {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 900; font-style: italic;
  letter-spacing: -1.5px; color: var(--text);
  display: block; line-height: 1;
}
.completion-stat-num.accent { color: var(--accent); }
.completion-stat-num.success { color: var(--success); }
.completion-stat-label {
  font-family: var(--font); font-size: 10px;
  color: var(--text-muted); letter-spacing: 0.5px;
  margin-top: 5px; text-transform: uppercase;
}

/* ── Review Days (JS-generated) ── */
.review-day {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border-subtle);
}
.review-day:last-child { border-bottom: none; }
.day-num {
  font-family: var(--font); font-size: 11px;
  color: var(--accent); letter-spacing: 0.3px;
  min-width: 50px; flex-shrink: 0; padding-top: 1px;
  text-transform: uppercase;
}
.day-info { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.day-info strong { color: var(--text); }
.day-reason { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }

/* ── Confetti ── */
.confetti-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9999; overflow: hidden;
}
.confetti {
  position: absolute; top: -10px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
