:root {
  --bg: #0a0e14;
  --surface: #111720;
  --surface-2: #1a2230;
  --border: #253044;
  --text: #e6edf7;
  --muted: #8899b0;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1400px 700px at 15% -5%, #16203a 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px 80px; }
a { color: inherit; }

/* ---------- NAV ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,20,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.site-nav-inner {
  max-width: 900px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-logo { font-weight: 800; font-size: 15px; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; }
.site-logo .dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.site-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.site-links > a {
  text-decoration: none; color: var(--muted); padding: 7px 11px; border-radius: 999px; white-space: nowrap;
}
.site-links > a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.site-links > a.active { color: #fff; background: rgba(124,92,255,.18); border: 1px solid rgba(124,92,255,.4); }
.site-links > a.important { color: var(--bad); font-weight: 700; border: 1px solid rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.site-links > a.important:hover { color: #fff; background: rgba(239,68,68,.2); }
.site-links > a.important.active { color: #fff; background: rgba(239,68,68,.28); border-color: rgba(239,68,68,.6); }

/* ---------- NAV DROPDOWNS ---------- */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  font: inherit; cursor: pointer; text-decoration: none; color: var(--muted);
  padding: 7px 11px; border-radius: 999px; white-space: nowrap;
  background: none; border: none; display: inline-flex; align-items: center; gap: 5px;
}
.nav-dropdown-toggle:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-dropdown-toggle .caret { font-size: 9px; opacity: .7; transition: transform .15s ease; }
.nav-dropdown.current > .nav-dropdown-toggle { color: #fff; background: rgba(124,92,255,.18); border: 1px solid rgba(124,92,255,.4); }
.nav-dropdown.open > .nav-dropdown-toggle .caret { transform: rotate(180deg); }

.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 230px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow); flex-direction: column; gap: 2px;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
  text-decoration: none; color: var(--muted); font-size: 13.5px; padding: 9px 12px; border-radius: 8px; white-space: nowrap;
}
.nav-dropdown-menu a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-dropdown-menu a.active { color: #fff; background: rgba(124,92,255,.2); }
.nav-dropdown-menu .menu-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #5b6b85; font-weight: 700;
  padding: 8px 12px 4px;
}

/* ---------- HERO / PAGE HEAD ---------- */
.page-hero {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(34,211,238,.06) 55%, transparent);
  border-radius: 20px; padding: 30px 28px; margin: 20px 0 30px; box-shadow: var(--shadow);
}
.lesson-tag {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-2); border: 1px solid rgba(34,211,238,.35); background: rgba(34,211,238,.08);
  padding: 5px 13px; border-radius: 999px; margin-bottom: 14px; font-weight: 700;
}
.lesson-tag.plan {
  color: var(--good); border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.08);
}
h1 { margin: 0 0 12px; font-size: clamp(24px, 4.5vw, 36px); line-height: 1.15; letter-spacing: -.02em; }
h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-sub { color: var(--muted); font-size: 16px; margin: 0; max-width: 720px; }

section { margin: 40px 0; }
h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; width: 4px; height: 21px; border-radius: 3px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
h3 { font-size: 16px; margin: 22px 0 8px; }
p { font-size: 15px; color: #d7deea; }
.lede { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }

/* ---------- TEACHER VOICE COMPONENTS ---------- */
.teach {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 18px 20px; margin: 16px 0; box-shadow: var(--shadow); position: relative;
}
.teach::before { content: "👋"; position: absolute; left: -14px; top: -14px; font-size: 24px; background: var(--bg); border-radius: 50%; padding: 4px; }
.teach p:last-child { margin-bottom: 0; }

.term {
  border: 1px solid rgba(34,211,238,.3); border-radius: 10px; background: rgba(34,211,238,.06);
  padding: 14px 18px; margin: 14px 0; font-size: 14.5px;
}
.term .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); font-weight: 800; margin-bottom: 4px; }
.term strong { color: #fff; }

.recap {
  border: 1px solid rgba(34,197,94,.3); border-radius: var(--radius); background: rgba(34,197,94,.06);
  padding: 18px 20px; margin: 20px 0;
}
.recap .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--good); font-weight: 800; margin-bottom: 8px; }
.recap ul { margin: 0; padding-left: 18px; }
.recap li { margin-bottom: 5px; font-size: 14px; }

.qa {
  border-left: 3px solid var(--accent); background: rgba(124,92,255,.06); border-radius: 0 10px 10px 0;
  padding: 14px 18px; margin: 16px 0; font-size: 14.5px;
}
.qa .q { font-weight: 700; color: #fff; margin-bottom: 4px; }

/* ---------- CALLOUTS ---------- */
.callout { border-left: 4px solid var(--warn); background: rgba(245,158,11,.07); border-radius: 0 10px 10px 0; padding: 16px 20px; margin: 18px 0; font-size: 14.5px; }
.callout.danger { border-left-color: var(--bad); background: rgba(239,68,68,.07); }
.callout.info { border-left-color: var(--accent-2); background: rgba(34,211,238,.06); }
.callout.good { border-left-color: var(--good); background: rgba(34,197,94,.06); }
.callout strong { color: #fff; }

/* ---------- CARDS ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.card .q { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.card .a { font-size: 16.5px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.card p { margin: 0 0 8px; font-size: 13.5px; color: #cbd5e1; }
.risk-tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 9px; border-radius: 999px; margin-bottom: 10px; }
.risk-low { background: rgba(34,197,94,.14); color: var(--good); border: 1px solid rgba(34,197,94,.35); }
.risk-med { background: rgba(245,158,11,.14); color: var(--warn); border: 1px solid rgba(245,158,11,.35); }
.risk-high { background: rgba(239,68,68,.14); color: var(--bad); border: 1px solid rgba(239,68,68,.35); }

/* ---------- STATS ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.stat .value.small { font-size: 16px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- TABLE ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 13.5px; }
thead th { background: #141c28; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(37,48,68,.6); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(124,92,255,.05); }
.pname { font-weight: 700; color: #fff; white-space: nowrap; }
ul.tight { margin: 0; padding-left: 16px; } ul.tight li { margin-bottom: 4px; }

/* ---------- TIMELINE / STEPS ---------- */
.steps { display: grid; gap: 14px; }
.step {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.step-num {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #05070c; font-weight: 800; font-size: 14px;
}
.step-title { font-weight: 800; font-size: 15.5px; color: #fff; margin-bottom: 4px; }
.step p { margin: 0; font-size: 13.5px; color: #cbd5e1; }

/* ---------- CALCULATOR ---------- */
.calc { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(160deg, rgba(124,92,255,.09), transparent 55%), var(--surface); padding: 24px; box-shadow: var(--shadow); }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.field label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.field select, .field input[type=number] { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; }
.field select:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.15); }
.calc-result { margin-top: 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; border-top: 1px solid var(--border); padding-top: 20px; }
.calc-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.calc-box .l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.calc-box .v { font-size: 20px; font-weight: 800; margin-top: 5px; }
.calc-box .v.total { color: var(--accent-2); } .calc-box .v.good { color: var(--good); }

/* ---------- INDEX / TOC ---------- */
.toc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.toc-card {
  display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.toc-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.toc-num { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 6px; }
.toc-title { font-size: 17px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.toc-desc { font-size: 13.5px; color: var(--muted); }

/* ---------- PAGE NAV (prev/next) ---------- */
.page-nav {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 50px; padding-top: 24px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.page-nav a {
  flex: 1; min-width: 200px; text-decoration: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: border-color .15s ease;
}
.page-nav a:hover { border-color: var(--accent); }
.page-nav .dir { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.page-nav .ttl { font-size: 14.5px; font-weight: 700; color: #fff; margin-top: 4px; }
.page-nav .next { text-align: right; }

footer { margin-top: 60px; border-top: 1px solid var(--border); padding-top: 20px; color: var(--muted); font-size: 12.5px; }
footer a { color: var(--accent-2); text-decoration: none; }
.src-list { font-size: 13px; color: #cbd5e1; } .src-list li { margin-bottom: 6px; }
.src-list a { color: var(--accent-2); text-decoration: none; } .src-list a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .site-links { display: none; }
}
