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

:root {
  --bg: #f0f2f6;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9ff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #6366f1;
  --nav-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.12), 0 8px 32px rgba(0,0,0,.08);
  --shadow-card: 0 2px 8px rgba(0,0,0,.07);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --accent: #6366f1;
  --accent-light: #eef2ff;
  --transition: 180ms ease;
  /* Mastery colors */
  --mastery-solid: #10b981;
  --mastery-shaky: #f59e0b;
  --green-50: #d1fae5;
  --green-700: #065f46;
  --orange-50: #fff7ed;
  --orange-700: #9a3412;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { line-height: 1.3; font-weight: 700; }
p { color: var(--text-muted); }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }

/* ─── Nav ───────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  height: 100%; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 2rem;
}
.nav-brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.5px;
  display: flex; align-items: center; gap: .5rem;
  color: var(--text);
}
.brand-icon { font-size: 1.3rem; }
.nav-links {
  display: flex; gap: .25rem; margin-left: auto;
}
.nav-links a {
  padding: .45rem .9rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; color: var(--text-muted);
  transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  background: var(--accent-light); color: var(--accent);
}
.nav-toggle {
  display: none; margin-left: auto;
  font-size: 1.2rem; padding: .4rem;
}

/* ─── Main ────��─────────────────────────────────────────────────────────────── */
main { flex: 1; padding-top: 0; }

/* ─── Loading ───────────────────────────────────────────────────────────────── */
.loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 1rem;
}
.loading-spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Hero ────────────────────────────────────���─────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: white; padding: 4rem 1.5rem 3rem;
  text-align: center;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900; letter-spacing: -1.5px;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: .75rem;
}
.hero-sub {
  color: rgba(255,255,255,.7); font-size: 1.05rem;
  margin-bottom: 2.5rem; line-height: 1.7;
}
.hero-search {
  display: flex; gap: .5rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50px; padding: .4rem .4rem .4rem 1.25rem;
  max-width: 520px; margin: 0 auto;
}
.hero-search input {
  flex: 1; background: none; border: none; outline: none;
  color: white; font-size: 1rem; font-family: var(--font);
}
.hero-search input::placeholder { color: rgba(255,255,255,.45); }
.hero-search button {
  background: var(--accent); color: white;
  border-radius: 40px; padding: .55rem 1.4rem;
  font-size: .9rem; font-weight: 600;
  transition: var(--transition);
}
.hero-search button:hover { background: #4f46e5; }

/* ─── Stats bar ─────────────────────────────────────────────────────────────── */
.stats-bar { background: white; border-bottom: 1px solid var(--border); }
.stats-bar-inner {
  max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-item strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat-item span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-light); }

/* ─── Section wrapper ───────────────���───────────────────��───────────────────── */
.section { max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem; }
.section-title {
  font-size: 1.4rem; font-weight: 800; margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: .75rem;
}
.section-title small { font-size: .85rem; font-weight: 500; color: var(--text-muted); }

/* ─── Quick Actions ─────��────────────────────────────���──────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 2.5rem;
}
.qa-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: .35rem;
  transition: var(--transition); border-top: 3px solid var(--accent);
}
.qa-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.qa-icon { font-size: 1.5rem; line-height: 1; margin-bottom: .15rem; }
.qa-label { font-weight: 700; font-size: .95rem; color: var(--text); }
.qa-sub { font-size: .75rem; color: var(--text-muted); }
.qa-study  { border-top-color: #6366f1; }
.qa-learn  { border-top-color: #10b981; }
.qa-concepts { border-top-color: #8b5cf6; }
.qa-shaky  { border-top-color: #f59e0b; }

/* ─── Field cards ────────────────────────────────────���──────────────────────── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.field-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-card);
  border-top: 4px solid var(--field-color, #888);
  transition: var(--transition); display: block;
}
.field-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.field-card-name { font-size: 1.1rem; font-weight: 700; margin-bottom: .3rem; }
.field-card-count { font-size: .85rem; color: var(--text-muted); }
.field-card-sub { margin-top: .75rem; }
.field-sub-tag {
  display: inline-block; font-size: .72rem; padding: .2rem .6rem;
  border-radius: 20px; margin: .15rem .15rem 0 0;
  background: var(--bg); color: var(--text-muted);
}

/* ─── Concept grid ───────────────��──────────────────��───────────────────────── */
.page-header {
  background: white; border-bottom: 1px solid var(--border);
  padding: 1.5rem; position: sticky; top: var(--nav-h); z-index: 50;
}
.page-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.page-header h2 { font-size: 1.2rem; white-space: nowrap; }

.search-input {
  flex: 1; min-width: 200px; max-width: 400px;
  padding: .55rem 1rem; border-radius: 50px;
  border: 1.5px solid var(--border); font-size: .9rem;
  font-family: var(--font); outline: none; transition: var(--transition);
  background: var(--bg);
}
.search-input:focus { border-color: var(--accent); background: white; }

.filter-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  padding: .35rem .85rem; border-radius: 20px;
  font-size: .78rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: white;
  color: var(--text-muted); transition: var(--transition);
}
.chip:hover { border-color: var(--field-color, var(--accent)); color: var(--field-color, var(--accent)); }
.chip.active { background: var(--field-color, var(--accent)); border-color: var(--field-color, var(--accent)); color: white; }
.chip-shaky.active { background: #f59e0b; border-color: #f59e0b; color: white; }

.filter-row-2 {
  width: 100%; display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap; margin-top: -.15rem;
}
.diff-select {
  padding: .35rem .75rem; border-radius: 20px;
  border: 1.5px solid var(--border); background: white;
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  font-family: var(--font); outline: none; cursor: pointer;
  transition: var(--transition); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .65rem center;
  padding-right: 1.75rem; background-color: white;
}
.diff-select:focus { border-color: var(--accent); color: var(--text); }

.concepts-grid {
  max-width: 1200px; margin: 0 auto; padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; align-items: start;
}

.concept-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); display: block;
  border-left: 3px solid var(--field-color, #888);
  padding: 1.25rem;
  transition: var(--transition); cursor: pointer;
  position: relative;
}
.concept-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
}
.concept-card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .5rem; margin-bottom: .5rem;
}
.concept-name { font-size: 1rem; font-weight: 700; flex: 1; }
.concept-def {
  font-size: .82rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: .75rem; line-height: 1.5;
}
.concept-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .4rem;
}
.concept-footer-badges { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

.field-badge {
  font-size: .7rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .03em;
  background: var(--field-bg, #f0f0f0); color: var(--field-color, #666);
}
.difficulty-dots { font-size: .75rem; color: var(--text-light); white-space: nowrap; }
.dot-filled { color: var(--field-color, #888); }
.video-count-badge { font-size: .72rem; color: var(--text-light); }

/* ─── Mastery ────────────────────────────────────────────────────────────────── */
.mastery-dot {
  position: absolute; top: .6rem; right: .6rem;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.mastery-dot.mastery-solid { background: var(--mastery-solid); }
.mastery-dot.mastery-shaky { background: var(--mastery-shaky); }

.mastery-badge {
  font-size: .7rem; font-weight: 700; padding: .2rem .6rem;
  border-radius: 20px; display: inline-block;
}
.mastery-badge-solid { background: var(--green-50); color: var(--green-700); border: 1px solid #6ee7b7; }
.mastery-badge-shaky { background: var(--orange-50); color: var(--orange-700); border: 1px solid #fed7aa; }
.mastery-badge-unseen { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.mastery-toggle {
  font-size: .78rem; color: var(--accent); background: none; border: none;
  cursor: pointer; padding: 0; text-decoration: underline;
  font-family: var(--font);
}
.mastery-toggle:hover { color: #4f46e5; }

/* ─── High-yield & Foundational badges ──────────────────────────────────────── */
.high-yield-badge {
  display: inline-block; font-size: .65rem; font-weight: 700;
  padding: .18rem .5rem; border-radius: 20px; text-transform: uppercase;
  letter-spacing: .04em; white-space: nowrap;
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
}
.foundational-badge {
  display: inline-block; font-size: .65rem; font-weight: 700;
  padding: .18rem .5rem; border-radius: 20px; text-transform: uppercase;
  letter-spacing: .04em; white-space: nowrap;
  background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7;
}

/* ─── Concept Detail ─────────────────────────────────────────────────────────── */
.concept-detail-page { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem; }
.breadcrumb {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--text-muted); margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-light); }

.concept-detail-header {
  padding: 2rem; border-radius: var(--radius);
  background: var(--bg-card); box-shadow: var(--shadow-card);
  border-left: 5px solid var(--field-color, #888); margin-bottom: 1.5rem;
}
.concept-detail-header h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.concept-meta {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-top: .75rem;
}

.detail-block {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-card); margin-bottom: 1.25rem;
}
.detail-block h2 {
  font-size: .75rem; font-weight: 700; margin-bottom: .85rem;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
}
.detail-block p { font-size: .95rem; color: var(--text); line-height: 1.7; }

.video-appearance-list { display: flex; flex-direction: column; gap: .75rem; }
.video-appearance {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .75rem; background: var(--bg); border-radius: var(--radius-sm);
}
.video-appearance-info { flex: 1; }
.video-appearance-title { font-size: .9rem; font-weight: 600; }
.video-appearance-meta { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.pedagogy-bar { display: flex; gap: 2px; margin-top: .3rem; }
.pedagogy-bar span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.pedagogy-bar span.filled { background: var(--field-color, var(--accent)); }

.yt-link {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem; border-radius: var(--radius-sm);
  background: #ff0000; color: white; font-size: .78rem; font-weight: 600;
  white-space: nowrap; transition: var(--transition);
}
.yt-link:hover { background: #cc0000; }
.yt-icon { font-size: .95rem; }

.concept-link-list { display: flex; flex-direction: column; gap: .5rem; }
.concept-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .85rem; background: var(--bg);
  border-radius: var(--radius-sm); transition: var(--transition);
  font-size: .88rem; font-weight: 500;
}
.concept-link:hover { background: var(--accent-light); color: var(--accent); }
.concept-link-arrow { margin-left: auto; color: var(--text-light); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.cta-block {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  border-radius: var(--radius); padding: 1.75rem;
  color: white; text-align: center; margin-top: 1.25rem;
}
.cta-block h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.cta-block p { color: rgba(255,255,255,.75); font-size: .88rem; margin-bottom: 1rem; }
.btn-cta {
  display: inline-block; background: white; color: var(--accent);
  padding: .6rem 1.5rem; border-radius: 50px; font-weight: 700; font-size: .9rem;
  transition: var(--transition);
}
.btn-cta:hover { opacity: .92; transform: translateY(-1px); }

.no-results { grid-column: 1/-1; text-align: center; padding: 4rem; color: var(--text-muted); }
.no-results p { font-size: 1.1rem; }

/* ─── Courses ────────────────��──────────────────────────────────────────────── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.course-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
  transition: var(--transition); display: block;
}
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.course-card-banner {
  height: 6px;
  background: linear-gradient(90deg, var(--field-color, #888), var(--field-color2, #aaa));
}
.course-card-body { padding: 1.5rem; }
.course-card-institution {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-light); margin-bottom: .3rem;
}
.course-card-name { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.course-card-stats { display: flex; gap: 1.25rem; }
.course-stat { font-size: .8rem; color: var(--text-muted); }
.course-stat strong { display: block; font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ─── Course Detail ──────────────────────────────────────────────────────────── */
.course-detail-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }
.course-detail-header {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow-card);
  border-top: 5px solid var(--field-color, #888); margin-bottom: 1.5rem;
}
.course-detail-header h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.course-detail-subtitle { font-size: .9rem; color: var(--text-muted); }

.video-list-section { display: flex; flex-direction: column; gap: .85rem; }
.video-row {
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 1rem;
  transition: var(--transition);
}
.video-row:hover { box-shadow: var(--shadow-hover); }
.video-row-num { font-size: .8rem; font-weight: 800; color: var(--text-light); min-width: 2rem; }
.video-row-info { flex: 1; min-width: 0; }
.video-row-title { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-row-meta { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.video-row-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.btn-sm {
  padding: .35rem .8rem; border-radius: var(--radius-sm);
  font-size: .75rem; font-weight: 600; transition: var(--transition);
  display: inline-block;
}
.btn-sm-yt { background: #ff0000; color: white; }
.btn-sm-yt:hover { background: #cc0000; }
.btn-sm-study { background: var(--accent-light); color: var(--accent); }
.btn-sm-study:hover { background: var(--accent); color: white; }

/* ─── Study / Flashcard ─────────────────────────────────────────────────────── */
.study-picker { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem; }
.study-picker h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.study-picker .subtitle { margin-bottom: 2rem; }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.deck-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-card);
  border-top: 3px solid var(--field-color, #888);
  cursor: pointer; transition: var(--transition);
  border-bottom: none; border-left: none; border-right: none;
  text-align: left; width: 100%;
}
.deck-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.deck-card-name { font-weight: 700; margin-bottom: .25rem; font-size: .95rem; }
.deck-card-count { font-size: .8rem; color: var(--text-muted); }
.deck-card-shaky { border-top-color: #f59e0b !important; }

.mastery-mini-stats {
  display: flex; gap: 1rem; font-size: .8rem; align-items: center;
  padding: .5rem .75rem; background: var(--bg); border-radius: var(--radius-sm);
  align-self: center;
}
.ms-solid { color: var(--green-700); font-weight: 600; }
.ms-shaky { color: var(--orange-700); font-weight: 600; }

.flashcard-view {
  max-width: 680px; margin: 0 auto; padding: 2rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
}
.flashcard-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
}
.flashcard-counter { font-size: .85rem; color: var(--text-muted); }

.progress-bar {
  width: 100%; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .3s ease;
}

/* Card flip */
.card-scene {
  width: 100%; max-width: 600px; height: 300px; perspective: 1000px; cursor: pointer;
}
.card-3d {
  width: 100%; height: 100%;
  position: relative; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.card-3d.flipped { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1.75rem; text-align: center;
  box-shadow: var(--shadow);
}
.card-front {
  background: var(--bg-card);
  border-top: 4px solid var(--field-color, var(--accent));
}
.card-back {
  background: linear-gradient(135deg, var(--field-color, var(--accent)) 0%, var(--field-color2, #7c3aed) 100%);
  transform: rotateY(180deg); color: white;
}
.card-type-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-light); margin-bottom: .85rem;
}
.card-front .card-type-label { color: var(--field-color, var(--text-light)); }
.card-back .card-type-label { color: rgba(255,255,255,.65); }
.card-question { font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.card-answer { font-size: .9rem; line-height: 1.6; }
.card-tap-hint {
  position: absolute; bottom: 1rem;
  font-size: .72rem; color: var(--text-light);
}
.card-back .card-tap-hint { color: rgba(255,255,255,.5); }
.card-mastery-hint {
  position: absolute; bottom: 2.5rem;
  font-size: .68rem; font-weight: 600;
  padding: .18rem .6rem; border-radius: 20px;
}
.card-mastery-hint.mastery-solid { background: rgba(16,185,129,.25); color: #d1fae5; }
.card-mastery-hint.mastery-shaky { background: rgba(245,158,11,.25); color: #fef3c7; }

/* Rating buttons */
.fc-rating-area { height: 52px; display: flex; justify-content: center; align-items: center; width: 100%; }
.fc-rating-row { display: flex; gap: .75rem; }
.fc-shaky {
  background: var(--orange-50); color: var(--orange-700);
  border: 1.5px solid #fed7aa; border-radius: 50px;
  padding: .5rem 1.25rem; font-size: .88rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: var(--transition);
}
.fc-shaky:hover { background: #fed7aa; }
.fc-solid {
  background: var(--green-50); color: var(--green-700);
  border: 1.5px solid #6ee7b7; border-radius: 50px;
  padding: .5rem 1.25rem; font-size: .88rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: var(--transition);
}
.fc-solid:hover { background: #6ee7b7; }

.flashcard-controls { display: flex; align-items: center; gap: .75rem; }
.fc-btn {
  padding: .6rem 1.4rem; border-radius: 50px;
  font-size: .88rem; font-weight: 600; transition: var(--transition);
  border: 1.5px solid var(--border);
}
.fc-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.fc-btn:disabled { opacity: .35; pointer-events: none; }
.fc-btn-flip {
  background: var(--accent); color: white; border-color: var(--accent); padding: .6rem 2rem;
}
.fc-btn-flip:hover { background: #4f46e5; border-color: #4f46e5; color: white; }

.kb-hint { font-size: .72rem; color: var(--text-light); text-align: center; }
.kb-hint kbd {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: .1rem .4rem; font-family: var(--font-mono); font-size: .7rem;
}

.deck-done {
  text-align: center; padding: 3rem 2rem;
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); width: 100%; max-width: 600px;
}
.deck-done h2 { font-size: 1.4rem; margin-bottom: .5rem; }
.deck-done p { margin-bottom: .75rem; }

.btn-accent {
  display: inline-block; background: var(--accent); color: white;
  padding: .65rem 1.75rem; border-radius: 50px;
  font-weight: 700; font-size: .92rem; transition: var(--transition); margin: .25rem;
}
.btn-accent:hover { background: #4f46e5; transform: translateY(-1px); }
.btn-outline {
  display: inline-block; background: white; color: var(--accent);
  border: 1.5px solid var(--accent); padding: .65rem 1.75rem;
  border-radius: 50px; font-weight: 700; font-size: .92rem;
  transition: var(--transition); margin: .25rem;
}
.btn-outline:hover { background: var(--accent-light); }

/* ─── Resume card ────────────────────���───────────────────────────────────────── */
.resume-card {
  position: relative; background: var(--bg-card);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem; display: flex; flex-direction: column; gap: .4rem;
}
.resume-dismiss {
  position: absolute; top: .75rem; right: .75rem;
  background: none; border: none; font-size: 1.1rem;
  color: var(--text-muted); cursor: pointer; padding: .25rem; line-height: 1;
}
.resume-dismiss:hover { color: var(--text); }
.resume-label { font-size: .72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.resume-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.resume-sub   { font-size: .8rem; color: var(--text-muted); }
.resume-bar   { height: 4px; background: var(--border); border-radius: 2px; margin: .15rem 0; }
.resume-fill  { height: 100%; background: var(--accent); border-radius: 2px; }
.btn-resume {
  display: inline-block; margin-top: .35rem; padding: .5rem 1.25rem;
  background: var(--accent); color: white; border-radius: 50px;
  font-size: .85rem; font-weight: 700; transition: var(--transition);
  align-self: flex-start;
}
.btn-resume:hover { background: #4f46e5; }

/* ─── Footer ──────��───────────────────────────���──────────────────────────────── */
.footer { background: white; border-top: 1px solid var(--border); padding: 1.25rem 1.5rem; }
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.25rem;
}
.footer-brand { font-weight: 800; font-size: .9rem; color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.footer-links a { font-size: .82rem; font-weight: 500; color: var(--text-muted); transition: var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-note { margin-left: auto; font-size: .74rem; color: var(--text-light); }
@media (max-width: 640px) {
  .footer-note { margin-left: 0; flex-basis: 100%; }
}

/* full disclaimer/about page */
.disclaimer { font-size: .75rem; color: var(--text-light); line-height: 1.6; }
.disclaimer strong { color: var(--text-muted); }
.about-page { max-width: 780px; margin: 0 auto; padding: 3rem 1.5rem; }
.about-page h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: -1px; margin-bottom: .4rem; }
.about-lede { font-size: 1.08rem; line-height: 1.7; margin-bottom: 2.5rem; }
.about-step { display: flex; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--border); }
.about-step-ic { font-size: 1.8rem; flex-shrink: 0; }
.about-step h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: .3rem; }
.about-step p { font-size: .92rem; line-height: 1.65; }
.about-card {
  margin-top: 2.5rem; background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: 1.5rem 1.6rem; box-shadow: var(--shadow-card);
}
.about-card h2 { font-size: 1.15rem; font-weight: 800; margin-bottom: .7rem; }
.about-card p { font-size: .9rem; line-height: 1.7; margin-bottom: .7rem; }
.about-card p:last-child { margin-bottom: 0; }

/* ─── Learning Paths ────��────────────────────────────────────────────────────── */
.learn-picker { max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem; }
.learn-picker-sub {
  font-size: 1rem; color: var(--text-muted); line-height: 1.7;
  max-width: 600px; margin-bottom: 2rem;
}
.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.journey-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); display: block; overflow: hidden;
  transition: var(--transition);
}
.journey-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.journey-card-banner { height: 6px; background: var(--field-color, var(--accent)); }
.journey-card-body { padding: 1.5rem; }
.journey-card-field {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--field-color, var(--accent)); font-weight: 700; margin-bottom: .4rem;
}
.journey-card-name { font-size: 1.05rem; font-weight: 800; margin-bottom: .6rem; line-height: 1.3; }
.journey-card-hook { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }
.journey-card-stats { display: flex; gap: .5rem; font-size: .78rem; color: var(--text-light); margin-bottom: 1rem; }
.journey-card-cta { font-size: .85rem; font-weight: 700; color: var(--field-color, var(--accent)); }

.learn-path-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  border-bottom: 3px solid var(--field-color, var(--accent));
  padding: 2.5rem 1.5rem; margin-top: .5rem;
}
.learn-path-hero-inner { max-width: 860px; margin: 0 auto; }
.learn-field-badge {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  color: var(--field-color, var(--accent)); margin-bottom: .6rem; display: block;
}
.learn-path-hero h1 {
  font-size: clamp(1.4rem, 4vw, 2.2rem); font-weight: 900; color: white;
  letter-spacing: -.5px; margin-bottom: .9rem;
}
.learn-hook { color: rgba(255,255,255,.75); font-size: .95rem; line-height: 1.7; max-width: 680px; margin-bottom: 1.25rem; }
.learn-real-world { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.real-world-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); font-weight: 600; }
.real-world-tag { font-size: .72rem; padding: .2rem .65rem; border-radius: 20px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.15); }

.learn-path-body { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem; }
.learn-path-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem;
}
.mode-tabs { display: flex; gap: .2rem; background: white; border-radius: var(--radius-sm); padding: .25rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.mode-tab { padding: .4rem .9rem; border-radius: 6px; font-size: .8rem; font-weight: 600; color: var(--text-muted); transition: var(--transition); cursor: pointer; }
.mode-tab:hover { color: var(--accent); }
.mode-tab.active { background: var(--accent); color: white; }
.path-stats { font-size: .82rem; color: var(--text-muted); font-weight: 600; }

.path-stages { display: flex; flex-direction: column; }
.path-stage { display: flex; gap: 0; padding-bottom: 1.75rem; }
.path-stage-marker { display: flex; flex-direction: column; align-items: center; width: 36px; flex-shrink: 0; padding-top: .15rem; }
.stage-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--field-color, var(--accent)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--field-color, var(--accent)) 20%, transparent); flex-shrink: 0; }
.stage-line { width: 2px; flex: 1; min-height: 30px; margin-top: .3rem; background: linear-gradient(180deg, var(--field-color, var(--accent)) 0%, var(--border) 100%); }
.path-stage:last-child .stage-line { display: none; }
.path-stage-content { flex: 1; background: white; border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); margin-left: .75rem; }
.path-stage-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.stage-num { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--text-light); }
.stage-name { font-size: 1.05rem; font-weight: 800; }
.stage-count { font-size: .72rem; color: var(--text-muted); background: var(--bg); padding: .18rem .55rem; border-radius: 20px; margin-left: auto; }
.stage-hook { font-size: .85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.1rem; font-style: italic; border-left: 3px solid var(--border); padding-left: .75rem; }
.stage-narrative { font-size: .93rem; line-height: 1.85; color: var(--text); margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); max-width: 68ch; }
.path-concepts-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--text-light); margin-bottom: .6rem; }
.path-concepts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.path-concept {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: .75rem .9rem; border-left: 3px solid var(--field-color, var(--accent));
  display: block; transition: var(--transition); position: relative;
}
.path-concept:hover { background: white; box-shadow: var(--shadow-card); transform: translateY(-1px); }
.path-concept-name { font-size: .85rem; font-weight: 700; margin-bottom: .3rem; color: var(--text); }
.path-concept-diff { font-size: .58rem; letter-spacing: 1px; }
.ldot-on { color: var(--field-color, var(--accent)); }
.ldot-off { color: var(--border); }

.path-mastery-dot, .cj-mastery-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.path-mastery-dot.solid, .cj-mastery-dot.mastery-solid { background: var(--mastery-solid); }
.path-mastery-dot.shaky, .cj-mastery-dot.mastery-shaky { background: var(--mastery-shaky); }

/* Custom journey */
.cj-narrative { margin-bottom: 1.6rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--border); max-width: 68ch; }
.cj-narrative-p { font-size: .93rem; line-height: 1.9; color: var(--text); margin-bottom: 1.1rem; }
.cj-narrative-p:last-child { margin-bottom: 0; }
.cj-concepts-bridge { font-size: .75rem; color: var(--text-light); font-style: italic; margin-top: 1rem; margin-bottom: .5rem; }
.cj-concepts-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cj-concept-item { border-bottom: 1px solid var(--border); }
.cj-concept-item:last-child { border-bottom: none; }
.cj-story-list { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0; }
.cj-story-bridge { font-size: .93rem; line-height: 1.9; color: var(--text); margin: 1.1rem 0 .6rem; }
.cj-story-list .cj-concept-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .25rem; }
.cj-story-list .cj-concept-item:last-child { margin-bottom: 0; }
.cj-concept-item > summary { list-style: none; display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; cursor: pointer; background: var(--bg); transition: var(--transition); user-select: none; }
.cj-concept-item > summary::-webkit-details-marker { display: none; }
.cj-concept-item > summary::marker { display: none; }
.cj-concept-item > summary:hover { background: white; }
.cj-concept-item[open] > summary { background: white; border-bottom: 1px solid var(--border); border-left: 3px solid var(--field-color, var(--accent)); padding-left: calc(1rem - 3px); }
.cj-summary-chevron { font-size: 1rem; color: var(--text-light); transition: transform .15s ease; flex-shrink: 0; line-height: 1; display: inline-block; }
.cj-concept-item[open] > summary .cj-summary-chevron { transform: rotate(90deg); }
.cj-concept-name { font-size: .9rem; font-weight: 700; color: var(--text); flex: 1; }
.cj-concept-dots { font-size: .6rem; letter-spacing: 1px; flex-shrink: 0; }
.cj-concept-body { padding: 1rem 1.1rem 1rem 2.4rem; background: white; }
.cj-concept-note { font-size: .9rem; line-height: 1.8; color: var(--text); margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.cj-concept-full-def { font-size: .83rem; line-height: 1.65; color: var(--text-muted); margin-bottom: .85rem; font-style: italic; }
.cj-concept-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cj-concept-courses { font-size: .73rem; color: var(--text-muted); font-style: italic; }
.cj-concept-deeplink { font-size: .73rem; font-weight: 700; color: var(--field-color, var(--accent)); text-decoration: none; flex-shrink: 0; }
.cj-concept-deeplink:hover { text-decoration: underline; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: white; border-bottom: 1px solid var(--border); padding: .5rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .two-col { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .card-scene { height: 260px; }
  .flashcard-controls { flex-wrap: wrap; justify-content: center; }
  .page-header-inner { gap: .6rem; }
  .search-input { max-width: 100%; }
  .btn-resume { width: 100%; text-align: center; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .fc-rating-row { flex-direction: column; align-items: stretch; gap: .5rem; }
  .fc-rating-area { height: auto; padding: .5rem 0; }
  .learn-path-controls { flex-direction: column; align-items: flex-start; }
  .learn-path-body { padding: 1.5rem 1rem; }
  .mode-tab { padding: .35rem .65rem; font-size: .75rem; }
  .path-concepts-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ─── Highlight & misc ──────────────────────────────────────────────────────── */
mark { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }
.empty-state { text-align: center; padding: 5rem 2rem; color: var(--text-muted); }
.empty-state h2 { font-size: 1.2rem; margin-bottom: .5rem; }

/* ─── Inline definition links (PG-04) ──────────────────────────────────────── */
.def-link { color: var(--accent); text-decoration: underline dotted; text-underline-offset: 2px; }
.def-link:hover { text-decoration: underline solid; }

/* ─── Card concept deep-link (SS-02) ────────────────────────────────────────── */
.card-concept-link {
  position: absolute; bottom: 2.8rem; left: 50%; transform: translateX(-50%);
  font-size: .68rem; font-weight: 600; color: rgba(255,255,255,.65);
  white-space: nowrap; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,.35);
  padding-bottom: 1px; z-index: 1;
}
.card-concept-link:hover { color: white; border-bottom-style: solid; }

/* ─── Rated state on rating buttons ────────────────────────────────────────── */
.fc-shaky.fc-rated { background: #fed7aa; border-color: #f59e0b; font-weight: 800; box-shadow: 0 0 0 2px #f59e0b; }
.fc-solid.fc-rated { background: #6ee7b7; border-color: #10b981; font-weight: 800; box-shadow: 0 0 0 2px #10b981; }

/* ─── Filter chip count ─────────────────────────────────────────────────────── */
.chip-count {
  font-size: .68rem; font-weight: 600; opacity: .75;
  background: rgba(0,0,0,.08); border-radius: 8px;
  padding: 0 .3rem; margin-left: .2rem;
}

/* ─── Story Courses ──────────────────────────────────────────────────────────── */
.story-page { max-width: 860px; margin: 0 auto; padding: 1.5rem; }
.story-page h1 { margin-bottom: .35rem; }

button.btn-accent, button.btn-outline { border: none; cursor: pointer; font-family: inherit; }
button.btn-outline { border: 1.5px solid var(--accent); }

.story-loading { text-align: center; padding: 5rem 1rem; color: var(--text-muted); }
.story-loading-pulse {
  width: 44px; height: 44px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--accent); opacity: .35; animation: storyPulse 1.1s ease-in-out infinite;
}
@keyframes storyPulse { 0%,100% { transform: scale(.8); opacity:.25 } 50% { transform: scale(1.1); opacity:.55 } }

/* picker */
.story-course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.story-course-card {
  display: block; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); border-top: 4px solid var(--story-color, var(--accent));
  padding: 1.25rem; box-shadow: var(--shadow); transition: var(--transition);
}
.story-course-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.story-course-title { font-weight: 800; font-size: 1.05rem; margin-bottom: .3rem; }
.story-course-meta { font-size: .8rem; color: var(--text-muted); margin-bottom: .6rem; }
.story-theme-row { display: flex; gap: .35rem; }
.story-theme-chip {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
.story-theme-chip-off { opacity: .3; filter: grayscale(1); }
.story-course-progress { margin-top: .7rem; font-size: .78rem; font-weight: 700; color: var(--mastery-solid); }

/* landing */
.story-hero { padding: 1.25rem 0 .75rem; border-bottom: 3px solid var(--story-color, var(--accent)); margin-bottom: 1.25rem; }
.story-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .85rem; margin-bottom: 1.75rem; }
.story-theme-card {
  text-align: left; background: var(--story-skin-bg, var(--bg-card));
  color: var(--story-skin-text, var(--text));
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem; cursor: pointer; transition: var(--transition); font-family: inherit;
  display: flex; flex-direction: column; gap: .3rem;
}
.story-theme-card:hover:not(:disabled) { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.story-theme-active { border-color: var(--story-skin-accent, var(--accent)); box-shadow: 0 0 0 3px var(--accent-light, rgba(99,102,241,.18)); }
.story-theme-locked { opacity: .55; cursor: not-allowed; }
.story-theme-icon { font-size: 1.5rem; }
.story-theme-name { font-weight: 800; font-size: .95rem; }
.story-theme-tagline { font-size: .78rem; opacity: .8; line-height: 1.45; }
.story-theme-status { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .7; margin-top: .25rem; }

.story-chapter-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.story-chapter-progress { font-size: .8rem; font-weight: 700; color: var(--text-muted); }
.story-chapter-list { display: flex; flex-direction: column; gap: .5rem; }
.story-chapter {
  display: grid; grid-template-columns: 28px auto 1fr auto; gap: .6rem; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .75rem 1rem; transition: var(--transition);
}
a.story-chapter:hover { box-shadow: var(--shadow-hover); }
.story-chapter-icon { font-size: 1rem; text-align: center; color: var(--text-light); }
.story-chapter-mastered .story-chapter-icon { color: var(--mastery-solid); }
.story-chapter-read .story-chapter-icon { color: var(--accent); }
.story-chapter-num { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); white-space: nowrap; }
.story-chapter-title { font-weight: 700; font-size: .92rem; }
.story-chapter-meta { font-size: .76rem; color: var(--text-muted); white-space: nowrap; }
.story-chapter-pending { opacity: .5; }

/* reader */
.story-reader-header { margin: 1rem 0 1.25rem; }
.story-chapter-label { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--story-skin-accent, var(--accent)); margin-bottom: .4rem; }
.story-mastered-badge { color: var(--mastery-solid); margin-left: .5rem; }
.story-read-badge { color: var(--accent); margin-left: .5rem; }
.story-hook { font-size: 1.02rem; color: var(--text-muted); font-style: italic; margin-top: .5rem; line-height: 1.6; }
.story-narrative { margin-bottom: 1.5rem; }
.story-narrative-p, .story-bridge-p {
  font-family: var(--story-skin-font, inherit);
  font-size: .98rem; line-height: 1.85; margin-bottom: 1rem; color: var(--text);
}
.story-bridge-p { border-left: 3px solid var(--story-skin-accent, var(--accent)); padding-left: 1rem; color: var(--text-muted); }
.story-concepts { margin-bottom: 2rem; }
.story-concept-item { margin-bottom: 1.25rem; }

/* divider between storyline and concept sections */
.story-divider {
  border: none; height: 1px; margin: 2rem 0;
  background: linear-gradient(90deg, transparent, var(--border) 15%, var(--border) 85%, transparent);
}

/* concept section: name as title, bridge text as normal body, folded "learn more" */
.story-concept-block { margin-bottom: 2rem; }
.story-concept-title {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.3px;
  padding-left: .8rem; border-left: 4px solid var(--field-color, var(--accent));
  margin-bottom: .75rem;
}
.story-concept-name { color: var(--text); }
.story-concept-text { margin-bottom: .9rem; }
.story-concept-p {
  font-family: var(--story-skin-font, inherit);
  font-size: .98rem; line-height: 1.85; margin-bottom: 1rem; color: var(--text);
}
.story-concept-p:last-child { margin-bottom: 0; }
.story-learn-more { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.story-learn-more-summary {
  list-style: none; display: flex; align-items: center; gap: .55rem;
  padding: .7rem 1rem; cursor: pointer; user-select: none;
  background: var(--bg); font-size: .88rem; font-weight: 700; color: var(--accent);
  transition: var(--transition);
}
.story-learn-more-summary::-webkit-details-marker { display: none; }
.story-learn-more-summary::marker { content: ''; }
.story-learn-more-summary:hover { background: var(--accent-light); }
.story-learn-more[open] > .story-learn-more-summary {
  background: white; border-bottom: 1px solid var(--border);
}
.story-learn-more[open] > .story-learn-more-summary .cj-summary-chevron { transform: rotate(90deg); }
.story-deepdives { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .6rem 0; }
.story-deepdive-label { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.story-deepdive-link {
  font-size: .78rem; font-weight: 600; color: var(--accent);
  background: var(--bg); border: 1px solid var(--border); border-radius: 50px; padding: .25rem .7rem;
}
.story-reader-footer { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.story-check-btn { width: 100%; text-align: center; padding: .9rem; font-size: 1rem; }
.story-check-count { font-weight: 500; opacity: .8; font-size: .85rem; }
.story-reader-nav { display: flex; justify-content: space-between; margin-top: .75rem; }

/* checkpoint */
.story-ck-header { margin: 1rem 0 1.5rem; }
.story-ck-counter { font-size: .8rem; font-weight: 700; color: var(--text-muted); margin-top: .4rem; }
.story-ck-difficulty { font-size: .7rem; color: var(--story-skin-accent, var(--accent)); margin-bottom: .5rem; letter-spacing: .15em; }
.story-ck-stem { font-size: 1.05rem; font-weight: 600; line-height: 1.65; margin-bottom: 1.1rem; }
.story-ck-choices { display: flex; flex-direction: column; gap: .6rem; }
.story-ck-choice {
  display: grid; grid-template-columns: 32px 1fr; gap: .7rem; align-items: center; text-align: left;
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: .8rem 1rem; font-size: .92rem; line-height: 1.5; cursor: pointer;
  transition: var(--transition); font-family: inherit; color: var(--text);
}
.story-ck-choice:hover:not(:disabled) { border-color: var(--story-skin-accent, var(--accent)); }
.story-ck-choice:disabled { cursor: default; opacity: .75; }
.story-ck-letter {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 8px; font-weight: 800; font-size: .8rem;
}
.story-ck-right { border-color: var(--mastery-solid) !important; background: rgba(16,185,129,.08); opacity: 1 !important; }
.story-ck-wrong { border-color: #ef4444 !important; background: rgba(239,68,68,.07); }
.story-ck-explain {
  margin-top: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius-sm);
  border-left: 4px solid var(--mastery-solid); background: var(--bg-card); box-shadow: var(--shadow);
}
.story-ck-explain-wrong { border-left-color: #ef4444; }
.story-ck-verdict { font-weight: 800; margin-bottom: .4rem; }
.story-ck-explain p { font-size: .9rem; line-height: 1.7; margin-bottom: .75rem; }
.story-ck-done { text-align: center; padding: 2.5rem 1.5rem; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); }
.story-ck-score { font-size: 3rem; font-weight: 900; color: var(--mastery-solid); }
.story-ck-failed .story-ck-score { color: var(--mastery-shaky); }
.story-ck-done h2 { margin-bottom: .5rem; }
.story-ck-missed-label { font-weight: 700; margin-top: 1rem; }
.story-ck-missed { list-style: none; margin: .5rem 0 1rem; font-size: .88rem; line-height: 2; }
.story-ck-done-nav { margin-top: 1.5rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }

/* ─── Theme skins ────────────────────────────────────────────────────────────── */
[data-theme-skin="theme-detective"] {
  --story-skin-accent: #b45309;
  --story-skin-font: Georgia, 'Times New Roman', serif;
}
.story-reader[data-theme-skin="theme-detective"] .story-narrative-p::first-letter { font-size: 1.4em; font-weight: 700; }
[data-theme-skin="theme-historical"] {
  --story-skin-accent: #7c2d12;
  --story-skin-font: Georgia, 'Iowan Old Style', serif;
}
[data-theme-skin="theme-scifi"] {
  --story-skin-accent: #0891b2;
  --story-skin-font: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}
[data-theme-skin="theme-everyday"] {
  --story-skin-accent: #059669;
  --story-skin-font: inherit;
}
.story-theme-card[data-theme-skin="theme-detective"] { --story-skin-bg: #1c1917; --story-skin-text: #e7e5e4; border-color: #44403c; }
.story-theme-card[data-theme-skin="theme-historical"] { --story-skin-bg: #fef3c7; --story-skin-text: #451a03; }
.story-theme-card[data-theme-skin="theme-scifi"] { --story-skin-bg: #0c1929; --story-skin-text: #bae6fd; border-color: #164e63; }
.story-theme-card[data-theme-skin="theme-everyday"] { --story-skin-bg: #ecfdf5; --story-skin-text: #064e3b; }

@media (max-width: 640px) {
  .story-chapter { grid-template-columns: 22px 1fr auto; }
  .story-chapter-num { display: none; }
}

/* home story strip + journey upgrade banner */
.qa-card.qa-story { border-top: 3px solid #7c3aed; }
.story-upgrade-banner {
  max-width: 1200px; margin: 1rem auto 0; padding: .8rem 1.25rem;
  background: linear-gradient(90deg, rgba(124,58,237,.08), rgba(99,102,241,.06));
  border: 1px solid rgba(124,58,237,.25); border-radius: var(--radius-sm);
  font-size: .88rem; line-height: 1.6;
}
.story-upgrade-banner a { font-weight: 700; color: #7c3aed; margin-left: .35rem; }

/* ─── Stories Landing Page ──────────────────────────────────────────────────── */
.lp { --lp-ink: #0f1024; --lp-violet: #7c3aed; --lp-indigo: #6366f1; }

/* Hero */
.lp-hero {
  position: relative; overflow: hidden;
  min-height: min(88vh, 720px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 5rem 1.25rem 4rem;
  background: radial-gradient(120% 90% at 50% -10%, #1e1b4b 0%, #14132e 45%, #0b0a1f 100%);
  color: #fff;
}
.lp-hero-bg { position: absolute; inset: 0; pointer-events: none; }
.lp-orb {
  position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55;
  animation: lpFloat 14s ease-in-out infinite;
}
.lp-orb-1 { width: 340px; height: 340px; top: -60px; left: -40px;
  background: radial-gradient(circle, #7c3aed, transparent 70%); }
.lp-orb-2 { width: 300px; height: 300px; bottom: -80px; right: -30px;
  background: radial-gradient(circle, #2563eb, transparent 70%); animation-delay: -5s; }
.lp-orb-3 { width: 240px; height: 240px; top: 30%; right: 22%;
  background: radial-gradient(circle, #db2777, transparent 70%); opacity: .4; animation-delay: -9s; }
@keyframes lpFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(24px,-30px) scale(1.08); }
  66%     { transform: translate(-20px,18px) scale(.96); }
}

.lp-hero-inner { position: relative; max-width: 760px; z-index: 1; }
.lp-eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #c4b5fd; margin-bottom: 1.1rem;
  padding: .35rem .85rem; border: 1px solid rgba(196,181,253,.3); border-radius: 50px;
  background: rgba(124,58,237,.12);
  opacity: 0; animation: lpFadeUp .7s ease .05s forwards;
}
.lp-title { font-size: clamp(2.1rem, 6.5vw, 4rem); font-weight: 900; letter-spacing: -1.8px; line-height: 1.05; }
.lp-title-line { display: block; opacity: 0; animation: lpFadeUp .8s cubic-bezier(.2,.7,.3,1) forwards; }
.lp-title-line:nth-child(1) { animation-delay: .12s; }
.lp-title-accent {
  animation-delay: .26s;
  background: linear-gradient(100deg, #c4b5fd 0%, #f0abfc 55%, #93c5fd 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lp-lede {
  color: rgba(255,255,255,.72); font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.7; max-width: 600px; margin: 1.4rem auto 2rem;
  opacity: 0; animation: lpFadeUp .8s ease .4s forwards;
}
.lp-cta-row {
  display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap;
  opacity: 0; animation: lpFadeUp .8s ease .54s forwards;
}
.lp-cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .85rem 1.6rem; border-radius: 50px; font-weight: 700; font-size: .98rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.lp-cta-primary {
  background: linear-gradient(100deg, #7c3aed, #6366f1); color: #fff;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.lp-cta-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(99,102,241,.55); }
.lp-cta-ghost { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.22); }
.lp-cta-ghost:hover { background: rgba(255,255,255,.16); }
.lp-cta-lg { padding: 1rem 2.2rem; font-size: 1.08rem; }

.lp-hero-pillars {
  display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap;
  margin-top: 2.6rem; opacity: 0; animation: lpFadeUp .8s ease .7s forwards;
}
.lp-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  padding: .5rem .95rem; border-radius: 50px; font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.85);
}
.lp-pill-ic { font-size: 1.05rem; }
.lp-pill-arrow { color: rgba(255,255,255,.4); font-weight: 700; }

.lp-scroll-hint {
  position: absolute; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  width: 24px; height: 38px; border: 2px solid rgba(255,255,255,.35); border-radius: 14px;
}
.lp-scroll-hint span {
  position: absolute; top: 7px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  background: rgba(255,255,255,.7); border-radius: 2px; animation: lpScroll 1.8s ease-in-out infinite;
}
@keyframes lpScroll { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 80%,100% { opacity: 0; transform: translateY(12px); } }

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

/* Scroll-reveal */
.lp-reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.lp-reveal.in { opacity: 1; transform: translateY(0); }
.lp-step.lp-reveal { transition-delay: calc(var(--i, 0) * 110ms); }

/* Sections */
.lp-section { max-width: 1100px; margin: 0 auto; padding: 4.5rem 1.5rem; }
.lp-section-head { max-width: 640px; margin: 0 auto 2.5rem; text-align: center; }
.lp-kicker { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--lp-violet); margin-bottom: .6rem; }
.lp-section-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; letter-spacing: -.8px; margin-bottom: .7rem; }
.lp-section-head p { font-size: 1.02rem; line-height: 1.7; }

/* How */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.lp-step {
  position: relative; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem 1.5rem 1.6rem; box-shadow: var(--shadow-card);
}
.lp-step-num {
  position: absolute; top: -14px; left: 1.5rem; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c3aed, #6366f1); color: #fff;
  border-radius: 50%; font-weight: 800; font-size: .9rem;
}
.lp-step-ic { font-size: 2rem; margin-bottom: .7rem; }
.lp-step h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: .5rem; }
.lp-step p { font-size: .92rem; line-height: 1.65; }

/* What / stats */
.lp-what { background: linear-gradient(180deg, transparent, rgba(124,58,237,.04)); border-radius: 24px; }
.lp-statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; max-width: 820px; margin: 0 auto; }
.lp-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.4rem 1rem; text-align: center; box-shadow: var(--shadow-card);
}
.lp-stat strong { display: block; font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 900; color: var(--lp-indigo); line-height: 1; }
.lp-stat span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-light); }

/* Catalog */
.lp-story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.lp-story-card {
  display: flex; flex-direction: column; gap: .9rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 5px solid var(--story-color, var(--accent));
  border-radius: 16px; padding: 1.6rem; box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
}
.lp-story-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.lp-story-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.4px; }
.lp-story-meta { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }
.lp-story-themes { display: flex; flex-wrap: wrap; gap: .4rem; }
.lp-story-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 50px; padding: .3rem .7rem;
}
.lp-story-chip.off { opacity: .4; filter: grayscale(1); }
.lp-story-progress { font-size: .82rem; font-weight: 800; color: var(--mastery-solid); margin-top: auto; }
.lp-story-go { font-size: .88rem; font-weight: 700; color: var(--story-color, var(--accent)); margin-top: auto; }

/* Final CTA */
.lp-final { padding-top: 1rem; }
.lp-final-card {
  max-width: 760px; margin: 0 auto; text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, #1e1b4b, #0b0a1f);
  color: #fff; border-radius: 24px; padding: 3.5rem 1.75rem;
}
.lp-final-card h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 900; letter-spacing: -.8px; margin-bottom: .7rem; }
.lp-final-card p { color: rgba(255,255,255,.72); margin-bottom: 1.8rem; font-size: 1.02rem; }

/* Mobile */
@media (max-width: 780px) {
  .lp-steps { grid-template-columns: 1fr; }
  .lp-statgrid { grid-template-columns: repeat(2, 1fr); }
  .lp-section { padding: 3.5rem 1.25rem; }
}
@media (max-width: 640px) {
  .lp-hero { min-height: 82vh; padding: 4rem 1.1rem 3.5rem; }
  .lp-cta-row { flex-direction: column; align-items: stretch; }
  .lp-cta { width: 100%; }
  .lp-hero-pillars { gap: .4rem; }
  .lp-pill { font-size: .78rem; padding: .4rem .7rem; }
  .lp-story-grid { grid-template-columns: 1fr; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lp-orb { animation: none; }
  .lp-scroll-hint span { animation: none; }
  .lp-eyebrow, .lp-title-line, .lp-lede, .lp-cta-row, .lp-hero-pillars { opacity: 1; animation: none; }
  .lp-reveal { transition: none; }
}
