:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #5b5ce2;
  --accent-600: #4f46e5;
  --accent-soft: #eef2ff;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --sidebar: #0f172a;
  --sidebar-2: #1f2937;
  --sidebar-3: #374151;
  --green-bg: #ecfdf5;
  --green-br: #10b981;
  --green-tx: #065f46;
  --red-bg: #fef2f2;
  --red-br: #ef4444;
  --red-tx: #991b1b;
  --sidebar-w: 320px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: #fff;
  padding: 24px;
  overflow: auto;
}
.content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  padding: 32px;
}

.brand { font-size: 24px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 6px; }
.brand-sub { color: #9ca3af; font-size: 14px; line-height: 1.5; margin-bottom: 24px; }

/* ---------- Sidebar nav ---------- */
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-module summary { list-style: none; }
.nav-module summary::-webkit-details-marker { display: none; }

.module-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--sidebar-3); background: var(--sidebar-2);
  color: #fff; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: background 0.15s;
}
.module-btn:hover { background: var(--sidebar-3); }
.module-btn.active { background: var(--sidebar-3); border-color: #4b5563; }
.chevron { font-size: 13px; transition: transform 0.15s; }
.nav-module[open] .chevron { transform: rotate(90deg); }

.cat-list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0 4px; }
.cat-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #d1d5db;
  transition: background 0.15s, color 0.15s;
}
.cat-link:hover { background: var(--sidebar-2); color: #fff; }
.cat-link.active { background: var(--sidebar-3); color: #fff; font-weight: 700; }
.badge {
  flex-shrink: 0; font-size: 12px; background: #4b5563; color: #fff;
  padding: 2px 8px; border-radius: 999px;
}

.quiz-cta { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--sidebar-3); }
.quiz-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--sidebar-3); background: var(--sidebar-2);
  color: #fff; font-weight: 700; font-size: 16px; transition: background 0.15s;
}
.quiz-btn:hover { background: var(--sidebar-3); }
.quiz-btn.active { background: var(--accent-600); border-color: var(--accent-600); }

/* ---------- Page header ---------- */
.page-head { margin-bottom: 24px; }
.eyebrow {
  font-size: 12px; font-weight: 900; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-600); margin-bottom: 8px;
}
.page-head h1 { font-size: 36px; font-weight: 900; letter-spacing: -0.02em; margin: 0; }
.lede { color: var(--muted); margin-top: 8px; }

/* ---------- Shared buttons ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 12px 16px; border-radius: 8px; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: #f3f4f6; }
.btn-primary {
  background: var(--accent-600); border-color: var(--accent-600); color: #fff;
}
.btn-primary:hover { filter: brightness(0.95); background: var(--accent-600); }

/* ---------- Flashcards ---------- */
.flashcards { max-width: 768px; margin: 0 auto; }
.card-wrap { perspective: 1200px; }
.flashcard {
  position: relative; display: block; width: 100%; min-height: 384px;
  border: none; background: transparent; padding: 0; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.5s;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute; inset: 0; padding: 48px; border-radius: 24px;
  background: #fff; border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.flashcard .back { transform: rotateY(180deg); }
.flashcard .term { font-size: 48px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.2; margin: 16px 0 28px; }
.flashcard .answer { font-size: 24px; line-height: 1.6; max-width: 36rem; }
.flashcard .hint { color: var(--muted); font-size: 14px; margin-top: 28px; }
.warn {
  margin-top: 28px; background: var(--warn-bg); color: var(--warn);
  border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 700;
}

.controls { max-width: 768px; margin: 24px auto 0; }
.progress-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.progress-track { width: 100%; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-600); transition: width 0.2s; }
.control-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 24px; }
.control-row .spacer { flex: 1; }
.deck-stats { text-align: center; color: var(--muted); font-size: 14px; margin-top: 16px; }

/* ---------- Sales frameworks ---------- */
.sales { display: flex; flex-direction: column; gap: 24px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; max-width: 896px; margin: 0 auto; width: 100%; }
.chip {
  white-space: nowrap; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: #374151;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: border-color 0.15s;
}
.chip:hover { border-color: #cbd5e1; }
.chip.active { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }

.lesson {
  background: #fff; border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06); padding: 32px; max-width: 896px;
  margin: 0 auto; width: 100%;
}
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.lesson-head h2 { font-size: 36px; font-weight: 900; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.lesson-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cell { border: 1px solid var(--border); border-radius: 16px; padding: 20px; background: #f9fafb; }
.cell.wide { grid-column: span 2; }
.cell.example { background: #eff6ff; border-color: #c7d2fe; }
.cell.takeaway { background: #f8fafc; }
.cell .eyebrow { margin-bottom: 8px; }
.cell p { margin: 0; font-size: 16px; line-height: 1.6; color: #374151; }

.quiz-panel {
  border: 1px solid #c7d2fe; background: #eff6ff; border-radius: 16px;
  padding: 28px; max-width: 896px; margin: 0 auto; width: 100%;
}
.quiz-panel .scenario { font-size: 20px; font-weight: 700; line-height: 1.5; margin: 10px 0 16px; }
.option {
  display: block; width: 100%; text-align: left; border: 1px solid var(--border);
  background: #fff; border-radius: 16px; padding: 14px; font-size: 16px; line-height: 1.5;
  color: #374151; cursor: pointer; margin-bottom: 10px; transition: border-color 0.15s;
}
.option:hover:not(:disabled) { border-color: #818cf8; }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--green-br); background: var(--green-bg); color: var(--green-tx); }
.option.wrong { border-color: var(--red-br); background: var(--red-bg); color: var(--red-tx); }
.explain { margin-top: 16px; padding: 14px; border-radius: 16px; font-size: 14px; line-height: 1.6; }
.explain.correct { background: var(--green-bg); color: var(--green-tx); }
.explain.wrong { background: var(--red-bg); color: var(--red-tx); }

.sales-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 896px; margin: 0 auto; width: 100%; }
.sales-actions .group { display: flex; gap: 8px; }

/* ---------- Objection flashcards ---------- */
.objection-flashcard { min-height: 440px; }
.objection-flashcard .objection-term { font-size: 32px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; margin: 16px 0 20px; }
.objection-flashcard .back {
  text-align: left; align-items: stretch; justify-content: flex-start;
  overflow-y: auto; padding: 36px 40px;
}
.objection-flashcard .back .eyebrow { text-align: left; }
.objection-flashcard .back .hint { margin-top: 24px; text-align: center; }
.variants { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.variant { font-size: 12px; color: var(--muted); background: #f3f4f6; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.response-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.response-steps li { display: flex; gap: 12px; }
.response-steps p { margin: 2px 0 0; font-size: 16px; line-height: 1.6; color: #374151; }
.step-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-600);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.note { margin-top: 16px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 12px 16px; font-size: 14px; line-height: 1.6; }

/* ---------- Master quiz ---------- */
.quiz { display: flex; gap: 16px; max-width: 672px; margin: 0 auto; }
.quiz-rail { width: 4px; background: #e5e7eb; border-radius: 999px; overflow: hidden; flex-shrink: 0; align-self: stretch; min-height: 420px; }
.quiz-rail-fill { width: 100%; background: var(--accent-600); transition: height 0.3s; }
.quiz-main { flex: 1; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.quiz-counter { font-size: 14px; font-weight: 600; color: var(--muted); }
.quiz-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 24px; margin-bottom: 16px; }
.qtype { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-600); margin-bottom: 8px; }
.qtext { font-size: 18px; font-weight: 700; line-height: 1.4; margin: 0 0 16px; }
.qoption {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 12px; font-size: 14px; font-weight: 500; color: #374151; cursor: pointer;
  margin-bottom: 8px; transition: all 0.15s;
}
.qoption:hover:not(:disabled) { border-color: #a5b4fc; background: var(--accent-soft); }
.qoption:disabled { cursor: default; }
.qoption.chosen { border-color: var(--accent-600); background: var(--accent-soft); color: #312e81; }
.qoption.dim { background: #f9fafb; color: var(--muted); }
.qletter { flex-shrink: 0; width: 20px; height: 20px; border-radius: 999px; border: 1px solid currentColor; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.feedback { border-left: 4px solid; padding: 16px; border-radius: 4px; }
.feedback.correct { background: var(--green-bg); border-color: var(--green-br); }
.feedback.wrong { background: var(--red-bg); border-color: var(--red-br); }
.feedback-title { font-size: 18px; font-weight: 900; margin-bottom: 12px; }
.feedback.correct .feedback-title { color: var(--green-tx); }
.feedback.wrong .feedback-title { color: var(--red-tx); }
.feedback .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.feedback .val { font-size: 14px; color: #1f2937; line-height: 1.6; margin-bottom: 12px; }

/* Results */
.results { border: 1px solid; border-radius: 16px; padding: 32px; text-align: center; }
.results.tier-excellent { background: var(--green-bg); border-color: #a7f3d0; color: var(--green-tx); }
.results.tier-good { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.results.tier-pass { background: #fefce8; border-color: #fde68a; color: #a16207; }
.results.tier-fail { background: var(--red-bg); border-color: #fecaca; color: var(--red-tx); }
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 999px; background: #fff; margin-bottom: 16px; font-size: 32px; font-weight: 900; }
.results h2 { font-size: 30px; font-weight: 900; margin: 0 0 8px; }
.results .msg { font-size: 14px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.stat { background: #fff; border-radius: 8px; padding: 12px; }
.stat .n { font-size: 24px; font-weight: 900; }
.stat .n.ok { color: var(--accent-600); } .stat .n.bad { color: #dc2626; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 4px; }
.results-actions { display: flex; gap: 12px; }
.results-actions .btn { flex: 1; }

/* Review */
.review { max-width: 672px; margin: 0 auto; }
.review h3 { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 16px; }
.review-item { border: 1px solid; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.review-item.ok { border-color: #a7f3d0; background: var(--green-bg); }
.review-item.bad { border-color: #fecaca; background: var(--red-bg); }
.review-item summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.review-item summary::-webkit-details-marker { display: none; }
.review-num { flex-shrink: 0; width: 20px; height: 20px; border-radius: 999px; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.review-item.ok .review-num { background: #a7f3d0; color: var(--green-tx); }
.review-item.bad .review-num { background: #fecaca; color: var(--red-tx); }
.review-your { font-size: 14px; font-weight: 500; color: #374151; }
.review-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid #d1d5db; font-size: 13px; color: #374151; }
.review-detail strong { display: block; color: #111827; margin-top: 8px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .content { margin-left: 0; width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .cell.wide { grid-column: span 1; }
}

/* ---------- Access gate ---------- */
.gate-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate { width: 100%; max-width: 420px; }
.gate-card {
  background: #fff; border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); padding: 40px;
}
.gate-form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.gate-input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; outline: none; transition: border-color 0.15s;
}
.gate-input:focus { border-color: var(--accent-600); }
.gate-submit { width: 100%; }
.gate-error { color: var(--red-tx); background: var(--red-bg); border: 1px solid #fecaca; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
