@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sub: #F1F5F9;
  --bg-stage: #090D16;
  --fg: #0F172A;
  --fg-2: #334155;
  --fg-3: #64748B;
  --fg-stage: #F8FAFC;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --accent: #1E3A8A;
  --accent-hover: #172554;
  --accent-fg: #FFFFFF;

  --phys: #1D4ED8;
  --phys-bg: #EFF6FF;
  --phys-tint: #BFDBFE;
  --chem: #B45309;
  --chem-bg: #FFFBEB;
  --chem-tint: #FDE68A;
  --bio: #047857;
  --bio-bg: #ECFDF5;
  --bio-tint: #A7F3D0;
  --geo: #0369A1;
  --geo-bg: #F0F9FF;
  --geo-tint: #BAE6FD;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);

  --sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1240px;
  --pad: clamp(20px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--phys);
  outline-offset: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); width: 100%; }

/* ---------- Official Education Ribbon & Top Navigation ---------- */
.top-ribbon {
  background: #0F172A;
  color: #CBD5E1;
  font-size: 11.5px;
  border-bottom: 1px solid #1E293B;
}
.top-ribbon-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.top-ribbon-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #F8FAFC;
}
.top-ribbon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38BDF8;
}
.top-ribbon-right {
  color: #94A3B8;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 820px) {
  .top-ribbon-right { display: none; }
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.nav-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16.5px;
  color: var(--fg);
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}
.brand-mark::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 1.8px solid #93C5FD;
  transform: rotate(45deg);
}
.brand-sub {
  color: var(--phys);
  font-weight: 600;
  font-size: 11.5px;
  margin-left: 4px;
  padding: 2px 8px;
  background: var(--phys-bg);
  border: 1px solid var(--phys-tint);
  border-radius: 4px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-2);
}
.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover { background: var(--bg-sub); color: var(--fg); }
.nav-links a.active {
  color: var(--accent);
  background: var(--phys-bg);
  border-color: var(--phys-tint);
}
.nav-gh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  margin-left: 4px;
}
.nav-gh:hover { border-color: var(--fg) !important; color: var(--fg); background: var(--bg-sub); }
@media (max-width: 820px) {
  .brand-sub { display: none; }
  .nav-links a.hide-m { display: none; }
}

/* ---------- Hero Section (Balanced Textbook & Office Grid) ---------- */
.hero {
  padding: clamp(32px, 4vw, 48px) 0;
  border-bottom: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: clamp(24px, 3.5vw, 40px);
  align-items: stretch;
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 32px);
  box-shadow: var(--shadow-sm);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--phys-bg);
  border: 1px solid var(--phys-tint);
  padding: 4px 10px;
  border-radius: 4px;
  width: fit-content;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--phys);
}
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.24;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--fg);
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--phys);
}
.hero-lead {
  font-size: 15px;
  color: var(--fg-2);
  margin: 0 0 22px;
  line-height: 1.68;
  text-align: justify;
  text-justify: inter-word;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--fg); background: var(--bg-sub); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  margin-top: auto;
}
.hero-meta > div {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.45;
  border-right: 1px solid var(--line);
}
.hero-meta > div:last-child { border-right: 0; }
.hero-meta strong {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) {
  .hero-meta { grid-template-columns: 1fr; }
  .hero-meta > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-meta > div:last-child { border-bottom: 0; }
}

/* ---------- Hero 3D Stage ---------- */
.stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}
.stage {
  position: relative;
  flex: 1;
  min-height: 380px;
  width: 100%;
  background: radial-gradient(120% 90% at 50% 25%, #131C31 0%, #090D16 70%);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #1E293B;
  box-shadow: var(--shadow-md);
  color: var(--fg-stage);
  user-select: none;
}
.stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
  z-index: 1;
}
.stage canvas:active { cursor: grabbing; }
.hud-top, .hud-bot {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  font-size: 12px;
}
.hud-top { top: 12px; }
.hud-bot { bottom: 12px; flex-wrap: wrap; }
.hud-pill {
  pointer-events: auto;
  background: rgba(9, 13, 22, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 6px 10px;
  color: #E2E8F0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.hud-pill .live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
}
.hud-ctrl {
  pointer-events: auto;
  background: rgba(9, 13, 22, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #CBD5E1;
}
.hud-ctrl label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.hud-ctrl input[type="range"] {
  width: 80px;
  accent-color: #38BDF8;
  cursor: pointer;
}
.hud-ctrl .val {
  color: #fff;
  min-width: 48px;
  display: inline-block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hud-seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.hud-seg button {
  background: none;
  border: 0;
  color: #94A3B8;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.hud-seg button.on { background: #38BDF8; color: #090D16; font-weight: 700; }
.hud-open {
  pointer-events: auto;
  background: #FFFFFF;
  color: #0F172A;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease;
}
.hud-open:hover { background: #F1F5F9; }
@media (max-width: 560px) {
  .stage { min-height: 300px; }
  .hud-ctrl input[type="range"] { width: 64px; }
  .hud-top .hide-xs { display: none; }
}

/* ---------- Sections (Structured SGK / Office Rubrics) ---------- */
.sec { padding: clamp(40px, 5vw, 64px) 0; border-bottom: 1px solid var(--line-strong); }
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap;
}
.sec-kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--phys);
  margin-bottom: 6px;
}
.sec-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.28;
  color: var(--fg);
}
.sec-sub {
  color: var(--fg-2);
  font-size: 14px;
  max-width: 54ch;
  margin: 0;
  line-height: 1.55;
  text-align: right;
}
@media (max-width: 820px) {
  .sec-sub { text-align: left; }
}

/* ---------- Subject Cards (4-Column Aligned Grid) ---------- */
.sgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 980px) { .sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .sgrid { grid-template-columns: 1fr; } }

.sc {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--phys);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.sc[data-s="phys"] { border-top-color: var(--phys); }
.sc[data-s="chem"] { border-top-color: var(--chem); }
.sc[data-s="bio"]  { border-top-color: var(--bio); }
.sc[data-s="geo"]  { border-top-color: var(--geo); }

.sc:hover {
  border-color: var(--fg-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.sc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.sc-tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.sc[data-s="phys"] .sc-tag { background: var(--phys-bg); color: var(--phys); border: 1px solid var(--phys-tint); }
.sc[data-s="chem"] .sc-tag { background: var(--chem-bg); color: var(--chem); border: 1px solid var(--chem-tint); }
.sc[data-s="bio"]  .sc-tag { background: var(--bio-bg);  color: var(--bio);  border: 1px solid var(--bio-tint); }
.sc[data-s="geo"]  .sc-tag { background: var(--geo-bg);  color: var(--geo);  border: 1px solid var(--geo-tint); }
.sc-count {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.sc h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.sc p {
  font-size: 13.2px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.56;
  min-height: 6.2em;
}
@media (max-width: 540px) { .sc p { min-height: 0; } }
.sc-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-stage);
  border: 1px solid var(--line-strong);
}
.sc-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.sc:hover .sc-thumb img { transform: scale(1.03); }
.sc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ---------- Course Card (Strict Equal-Row Alignment) ---------- */
.cgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 980px) { .cgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .cgrid { grid-template-columns: 1fr; } }

.cc {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.cc:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.cc-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-stage);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.cc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.cc:hover .cc-thumb img { transform: scale(1.03); }
.cc-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.16);
}
.cc-steps {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.84);
  color: #E2E8F0;
  border: 1px solid rgba(255,255,255,0.12);
  font-variant-numeric: tabular-nums;
}
.cc-body {
  padding: 16px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.cc-book {
  font-size: 11.5px;
  color: var(--fg-2);
  background: var(--bg-sub);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.38;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.76em;
}
.cc-q {
  font-size: 13.5px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.56;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.12em;
}
.cc-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  border-top: 1px solid var(--line);
}
.cc-foot a.cc-direct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
}
.cc-foot a.cc-direct:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Filter Bar ---------- */
.fbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.fbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.fpills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fpill {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}
.fpill:hover { color: var(--fg); border-color: var(--fg-2); }
.fpill.on {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.fpill .n {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.82;
  font-variant-numeric: tabular-nums;
}
.fsearch {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 380px;
}
.fsearch input {
  width: 100%;
  padding: 8px 34px 8px 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13.5px;
}
.fsearch input:focus {
  outline: none;
  border-color: var(--phys);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.fsearch .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  pointer-events: none;
  font-size: 13px;
}
.fsearch .kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 4px;
  padding: 1px 6px;
  pointer-events: none;
}
.fsec {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
}
.fsec[hidden] { display: none; }
.fsec select {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
}
.fempty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--fg-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
}

/* ---------- Classroom 4-Step Strip & Methodology 3-Stage Grid ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 920px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.step-num {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--phys);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.step h3 { font-size: 15.5px; font-weight: 700; margin: 0 0 8px; color: var(--fg); }
.step p { font-size: 13.5px; color: var(--fg-2); margin: 0; line-height: 1.6; text-align: justify; text-justify: inter-word; }

.hgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 840px) { .hgrid { grid-template-columns: 1fr; } }
.hcard {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--phys);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.hcard .k {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--phys);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.hcard h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--fg); }
.hcard p { font-size: 13.5px; color: var(--fg-2); margin: 0; line-height: 1.62; text-align: justify; text-justify: inter-word; }

/* ---------- Footer (Structured Institutional Footer) ---------- */
.foot {
  padding: 36px 0 44px;
  color: var(--fg-2);
  font-size: 13px;
  background: var(--bg-card);
  border-top: 1px solid var(--line-strong);
}
.foot-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; font-weight: 500; }
.foot-links a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Course Detail Page (/c/<slug>/) ---------- */
.crumb {
  padding: 18px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.crumb a:hover { color: var(--accent); text-decoration: underline; }

.ch-head {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(20px, 2.8vw, 28px);
  margin: 14px 0 24px;
  box-shadow: var(--shadow-sm);
}
.ch-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.badge {
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--bg-sub);
  color: var(--fg-2);
  font-weight: 600;
}
.badge-s[data-s="phys"] { background: var(--phys-bg); color: var(--phys); border-color: var(--phys-tint); font-weight: 700; }
.badge-s[data-s="chem"] { background: var(--chem-bg); color: var(--chem); border-color: var(--chem-tint); font-weight: 700; }
.badge-s[data-s="bio"]  { background: var(--bio-bg);  color: var(--bio);  border-color: var(--bio-tint);  font-weight: 700; }
.badge-s[data-s="geo"]  { background: var(--geo-bg);  color: var(--geo);  border-color: var(--geo-tint);  font-weight: 700; }
.badge-v { color: #047857; border-color: #A7F3D0; background: #ECFDF5; font-weight: 600; }

.ch-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.24;
  color: var(--fg);
}
.ch-q {
  font-size: clamp(15px, 1.35vw, 17.5px);
  color: var(--fg-2);
  margin: 0;
  line-height: 1.6;
}

.ch-main {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 24px;
  align-items: stretch;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line-strong);
}
@media (max-width: 920px) { .ch-main { grid-template-columns: 1fr; } }

.pv-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.pv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--fg-2);
}
.pv-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.pv-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pv-mode-btn {
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pv-mode-btn:hover { border-color: var(--fg); color: var(--fg); }
.pv-mode-btn.on {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.pv {
  position: relative;
  flex: 1;
  min-height: 360px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-stage);
  border: 1px solid #1E293B;
  display: block;
  box-shadow: var(--shadow-md);
}
.pv img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.pv:hover img { transform: scale(1.02); filter: brightness(0.92); }
.pv-cta {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(9, 13, 22, 0.24) 0%, rgba(9, 13, 22, 0.58) 100%);
  pointer-events: none;
}
.pv-btn {
  pointer-events: auto;
  background: #FFFFFF;
  color: #090D16;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
  border: 0;
  cursor: pointer;
}
.pv:hover .pv-btn { transform: scale(1.02); background: #F8FAFC; }
.pv-btn .play {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
}
.pv-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg-stage);
}

.pv-act {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--phys);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  box-shadow: var(--shadow-sm);
}
.pv-act h2 {
  font-size: 12.5px;
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--phys);
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pv-act .btn { justify-content: center; width: 100%; }
.pv-act-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pv-spec {
  margin: auto 0 0;
  padding: 8px 0 0;
  border-top: 2px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  font-size: 12.5px;
}
.pv-spec dt, .pv-spec dd {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.pv-spec dt:last-of-type, .pv-spec dd:last-of-type { border-bottom: 0; }
.pv-spec dt { color: var(--fg-2); font-weight: 500; }
.pv-spec dd {
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ch-sec { padding: 36px 0; border-bottom: 1px solid var(--line-strong); }
.ch-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap;
}
.ch-sec h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 18px;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.ch-sec-head h2 { margin: 0; }

/* ---------- Stepwise Inquiry Track (Balanced 2-Col + Full-Width Odd Final Step) ---------- */
.track {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: stretch;
}
@media (max-width: 760px) { .track { grid-template-columns: 1fr; } }
.track li {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.track li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.track .n {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--phys);
  background: var(--phys-bg);
  border: 1px solid var(--phys-tint);
  border-radius: 4px;
  padding: 3px 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.track li > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.track .t {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--fg);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.track .q {
  font-size: 13.5px;
  color: var(--fg-2);
  font-weight: 500;
  line-height: 1.55;
}
.track .step-eq {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--bg-sub);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 10px;
  width: fit-content;
  max-width: 100%;
  line-height: 1.45;
}
.track .step-eq span { color: var(--fg-2); font-family: var(--sans); font-size: 11.5px; }
.track .step-concl {
  margin-top: 8px;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.58;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
  text-align: justify;
  text-justify: inter-word;
}
.track .step-concl strong { color: var(--fg); font-weight: 700; }

/* ---------- Causal Chain, 3D Units & AEO FAQ ---------- */
.ch-chain {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ch-chain-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--phys);
  margin-right: 4px;
}
.ch-chain-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-sub);
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  color: var(--fg-2);
}
.ch-chain-pill b { color: var(--fg); font-weight: 700; }
.ch-chain-sep { color: var(--fg-3); font-family: var(--mono); font-size: 12px; font-weight: 700; }

.ugrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.ucard {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.ucard-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.ucard-no {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--phys);
}
.ucard-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}
.ucard-brief {
  font-size: 13px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.55;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.faq-item[open] {
  border-left: 3px solid var(--accent);
}
.faq-item summary {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-3);
  flex-shrink: 0;
}
.faq-item[open] summary::after { content: "−"; color: var(--phys); }
.faq-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--fg-2);
  line-height: 1.65;
  text-align: justify;
  text-justify: inter-word;
}
.faq-body p { margin: 0 0 6px; }
.faq-body p:last-child { margin-bottom: 0; }
.faq-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--phys);
  background: var(--phys-bg);
  border: 1px solid var(--phys-tint);
  border-radius: 4px;
  padding: 2px 7px;
  margin-right: 8px;
}

/* ---------- SGK Curriculum Alignment Table Box ---------- */
.sgk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 780px) { .sgk-grid { grid-template-columns: 1fr; } }
.sgk-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}
.sgk-cell:last-child { border-right: 0; }
@media (max-width: 780px) {
  .sgk-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .sgk-cell:last-child { border-bottom: 0; }
}
.sgk-k {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--phys);
  margin-bottom: 6px;
}
.sgk-v {
  font-size: 13.5px;
  color: var(--fg-2);
  line-height: 1.55;
}
.sgk-v strong { color: var(--fg); }

.tbook {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--fg-2);
  box-shadow: var(--shadow-sm);
}
.tbook strong { color: var(--fg); }

/* ---------- Official 2-Column Documentation Pages (/guide, /how, /about) ---------- */
.doc-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) var(--pad);
  width: 100%;
}
.doc-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 920px) {
  .doc-grid { grid-template-columns: 1fr; }
}
.doc-side {
  position: sticky;
  top: 84px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.doc-side-title {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--phys);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.doc-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.doc-meta dt { color: var(--fg-3); }
.doc-meta dd {
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--fg-2);
}
.doc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.doc-nav a {
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--fg-2);
  font-weight: 500;
  border: 1px solid transparent;
}
.doc-nav a:hover { background: var(--bg-sub); color: var(--fg); }
.doc-nav a.on {
  background: var(--phys-bg);
  color: var(--phys);
  border-color: var(--phys-tint);
  font-weight: 600;
}

.doc-sheet {
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(24px, 3.5vw, 44px);
  box-shadow: var(--shadow-sm);
}
.prose-head {
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--line);
}
.prose-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
  margin: 6px 0 12px;
  line-height: 1.24;
  color: var(--fg);
  text-wrap: balance;
}
.prose-head p {
  font-size: 15.5px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.65;
  text-align: justify;
  text-justify: inter-word;
}
.prose h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19.5px;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  letter-spacing: -0.01em;
  color: var(--fg);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 20px 0 6px;
  color: var(--fg);
}
.prose p, .prose li {
  font-size: 14.8px;
  color: var(--fg-2);
  line-height: 1.72;
  text-align: justify;
  text-justify: inter-word;
}
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.prose code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-sub);
  border: 1px solid var(--line-strong);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
}
.callout {
  background: var(--phys-bg);
  border: 1px solid var(--phys-tint);
  border-left: 4px solid var(--phys);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.65;
  text-align: justify;
  text-justify: inter-word;
}
.callout strong { color: var(--fg); }

.kbd-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
@media (max-width: 560px) { .kbd-list { grid-template-columns: 1fr; } }
.kbd-item {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
}
.kbd-item kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--accent);
}

/* ---------- Share details popover ---------- */
.act-share { position: relative; }
.act-share summary { list-style: none; }
.act-share summary::-webkit-details-marker { display: none; }
.share-pop {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--fg-2);
}
.share-pop code {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 7px 9px;
  border-radius: 4px;
  word-break: break-all;
  margin: 6px 0 8px;
  color: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
