﻿:root {
  --ink: #14304a;
  --muted: #5a748f;
  --primary: #166a9f;
  --primary-dark: #0f4d74;
  --accent: #1a9b7e;
  --primary-light: #e8f5ff;
  --accent-light: #e8fbf5;
  --border: #d1dfeb;
  --bg: #f2f7f6;
  --sidebar-bg: #e3ecea;
  --card: #ffffff;
  --shadow-sm: 0 3px 12px rgba(16, 56, 86, 0.06);
  --shadow-md: 0 10px 30px rgba(12, 38, 58, 0.12);
  --header-h: 64px;
  --sidebar-w: 336px;
  --serif: "Merriweather", Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

::selection {
  background: #d6ecff;
  color: #0e3b5c;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1500px 600px at 92% -8%, #d7ece7 0%, var(--bg) 60%);
  line-height: 1.68;
  overflow: hidden;
}

.header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(248, 252, 251, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.brand span {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.last-updated {
  font-size: 12px;
  color: var(--muted);
}

.btn-reveal {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-reveal:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: none;
  border: 0;
  background: none;
  padding: 8px;
  cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  width: 24px;
  height: 2px;
  background: var(--ink);
  display: block;
  transition: all 0.25s ease;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

.menu-open .hamburger {
  background: transparent;
}

.menu-open .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.menu-open .hamburger::after {
  transform: rotate(-45deg);
  top: 0;
}

.app-container {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #d9e3e2 78%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
}

.nav-scroll-wrap {
  flex: 1;
  overflow-y: auto;
  padding-top: 18px;
}

.nav-group {
  border-bottom: 1px solid transparent;
}

.nav-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  font-weight: 800;
  padding: 12px 24px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-header::after {
  content: ">";
  color: var(--primary);
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.nav-header:hover {
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
}

.nav-group.collapsed .nav-header::after {
  transform: rotate(0deg);
}

.sub-nav-header {
  padding-left: 30px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-links-container {
  padding-bottom: 10px;
}

.nav-group.collapsed .nav-links-container {
  display: none;
}

.nav-links-container .nav-links-container {
  margin-left: 24px;
  border-left: 2px solid #c8d9e5;
  background: rgba(255, 255, 255, 0.24);
}

.nav-item,
.nav-sub {
  display: flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  min-height: 42px;
  border-left: 3px solid transparent;
}

.nav-item {
  padding: 10px 24px 10px 32px;
  font-size: 14px;
  font-weight: 650;
  color: #1c3d5b;
}

.nav-sub {
  padding: 7px 24px 7px 47px;
  font-size: 13px;
  color: #4c6782;
}

.nav-item:hover,
.nav-sub:hover {
  background: rgba(255, 255, 255, 0.5);
}

.nav-item.active,
.nav-sub.active,
.challenge-btn.active {
  background: var(--primary-light);
  border-left-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 700;
}

.sidebar-cta-wrap {
  border-top: 1px solid #c3d3de;
  padding: 10px;
  background: #1f3e5b;
}

.challenge-btn {
  width: 100%;
  border: 0;
  border-left: 4px solid #33d8b5;
  border-radius: 6px;
  background: linear-gradient(90deg, #1c3650, #1a3248);
  color: #e3f3ff;
  padding: 13px 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.main {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.content-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 46px 62px 58px;
  flex: 1;
}

.content-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.content-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1,
h2 {
  margin-top: 0;
  color: #0f2740;
}

h1 {
  font-family: var(--serif);
  font-size: 34px;
  margin-bottom: 18px;
}

h3 {
  margin: 30px 0 10px;
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 800;
}

p {
  margin: 0 0 16px;
}

.title-page {
  text-align: center;
  padding-top: 46px;
}

.tp-title {
  font-family: var(--serif);
  font-size: 50px;
  font-weight: 900;
  line-height: 1.15;
  color: #0f243b;
}

.tp-divider {
  width: 74px;
  height: 4px;
  border-radius: 999px;
  margin: 28px auto;
  background: var(--accent);
}

.tp-subtitle {
  color: var(--muted);
  font-size: 21px;
  margin-bottom: 44px;
}

.tp-author {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.engagement-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 32px 0 20px;
}

.action-pill {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary-dark);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.progress-card,
.activity-card,
.game-card,
.plan-card,
.question-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.interactive-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.interactive-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #bcd2e3;
}

.progress-card {
  padding: 18px;
  margin-top: 10px;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.progress-grid label {
  font-size: 14px;
  color: #335572;
}

.graph-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 12px 0 20px;
}

.graph-card {
  padding: 14px;
}

.graph-card h4 {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 15px;
}

.graph-card svg {
  width: 100%;
  height: auto;
  border: 1px solid #d5e3ef;
  border-radius: 10px;
  background: #fbfeff;
  padding: 8px;
}

.graph-card text {
  fill: #3d5f7a;
  font-size: 12px;
  font-family: var(--mono);
}

.axis {
  stroke: #5d7891;
  stroke-width: 2;
}

.curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
}

.fbd-wrap {
  padding: 16px;
  border: 1px solid #d5e3ef;
  border-radius: 12px;
  background: #fbfeff;
  margin: 10px 0 18px;
}

.fbd-wrap svg {
  width: 100%;
  height: auto;
  border: 1px solid #d5e3ef;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.fbd-wrap text {
  font-family: var(--mono);
  fill: #2f5371;
  font-size: 13px;
}

.fbd-block {
  fill: #e9f2fb;
  stroke: #4e708d;
  stroke-width: 2;
}

.fbd-arrow {
  stroke: #166a9f;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.unit-intro {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 18px 22px;
  margin-bottom: 26px;
}

.section-intro {
  color: #46617b;
  line-height: 1.75;
}

.concept-note {
  background: #f4fbff;
  border: 1px solid #d4e7f4;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  color: #2b5676;
  margin: 12px 0 14px;
}

.planning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.planning-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.plan-card {
  padding: 18px;
}

.plan-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--primary-dark);
}

.plan-card p {
  margin: 0;
  color: #44627e;
  font-size: 14px;
}

.plan-card.accent-left {
  border-left: 4px solid var(--accent);
}

.check-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #365773;
}

.check-list li {
  margin-bottom: 8px;
}

.check-list.compact li {
  margin-bottom: 6px;
}

.syllabus-table,
.equation-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 22px 0 26px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(17, 54, 82, 0.06);
}

.syllabus-table thead,
.equation-table thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.syllabus-table th,
.equation-table th {
  text-align: left;
  color: #fff;
  padding: 13px 15px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.syllabus-table td,
.equation-table td {
  padding: 13px 15px;
  border-bottom: 1px solid #e3edf5;
  font-size: 14px;
  color: #284a66;
  vertical-align: top;
  line-height: 1.6;
}

.equation-table th:nth-child(1),
.equation-table td:nth-child(1) {
  width: 28%;
}

.equation-table td:first-child {
  font-family: var(--mono);
  font-size: 14px;
  color: #1f4a6e;
  white-space: normal;
  overflow-wrap: anywhere;
}

.equation-table td:first-child mjx-container {
  margin: 0 !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.equation-table td:first-child mjx-container[jax="CHTML"] {
  font-size: 110% !important;
}

.syllabus-table tbody tr:nth-child(even),
.equation-table tbody tr:nth-child(even) {
  background: #f8fcff;
}

.equation-table tbody tr:hover {
  background: #eef8ff;
}

.callout {
  background: #f0faf7;
  border: 1px solid #caeadf;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  color: #2f5b55;
  margin: 16px 0 10px;
}

.activity-card {
  padding: 16px;
  margin-top: 10px;
}

.activity-grid {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.activity-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.activity-grid.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.activity-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #385a76;
  font-weight: 600;
}

.activity-grid input[type="number"] {
  border: 1px solid #c8d8e6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #214866;
  background: #fcfeff;
}

.activity-output {
  margin-top: 10px;
  background: #f5fbff;
  border: 1px dashed #bfd7e8;
  border-radius: 8px;
  padding: 10px 12px;
  color: #2f5675;
  font-size: 14px;
}

.question-bank {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.question-item {
  padding: 14px;
}

.question-item p {
  margin: 0 0 10px;
  color: #2a4e6c;
}

.answer {
  display: none;
  margin-top: 10px;
  background: #eaf8f3;
  border: 1px solid #c6e8dc;
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  padding: 10px 12px;
  color: #2a5d54;
}

.game-card {
  padding: 18px;
}

.choice-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.choice-btn {
  border: 1px solid #c6d8e5;
  background: #fff;
  color: #2a4f6d;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.choice-btn:hover {
  border-color: var(--primary);
  background: #f4faff;
}

.choice-btn.correct {
  border-color: #2aa17f;
  background: #eaf9f3;
  color: #1f6d58;
}

.choice-btn.wrong {
  border-color: #c76565;
  background: #fff1f1;
  color: #8a3030;
}

.game-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.doc-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 28px 62px;
}

.footer-content {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
  font-weight: 700;
}

.footer-links a:hover {
  color: var(--primary);
}

@media (max-width: 1180px) {
  .content-container {
    max-width: 900px;
    padding: 38px 34px 52px;
  }

  .activity-grid.four-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .menu-toggle {
    display: block;
  }

  .last-updated,
  .print-btn {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.26s ease;
    box-shadow: 6px 0 30px rgba(11, 33, 50, 0.24);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .content-container {
    padding: 30px 20px 40px;
  }

  .tp-title {
    font-size: 36px;
  }

  .tp-subtitle {
    font-size: 17px;
  }

  .planning-grid,
  .planning-grid.three-col,
  .graph-gallery,
  .activity-grid.three-col,
  .activity-grid.two-col {
    grid-template-columns: 1fr;
  }

  .equation-table td:first-child {
    white-space: normal;
  }

  .doc-footer {
    padding: 24px 20px;
  }

  .footer-content {
    flex-direction: column;
    gap: 9px;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0 14px;
  }

  .brand {
    font-size: 15px;
  }

  .brand span {
    display: none;
  }

  .content-container {
    padding: 24px 14px 34px;
  }

  h1 {
    font-size: 28px;
  }

  h3 {
    font-size: 18px;
  }

  .tp-title {
    font-size: 32px;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .syllabus-table th,
  .syllabus-table td,
  .equation-table th,
  .equation-table td {
    padding: 10px 11px;
    font-size: 12px;
  }

  .graph-card {
    padding: 12px;
  }

  .activity-grid.four-col {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    overflow: visible;
    height: auto;
    background: #fff;
  }

  .header,
  .sidebar,
  .menu-toggle,
  .challenge-btn,
  .print-btn,
  .engagement-strip,
  .btn-reveal {
    display: none !important;
  }

  .app-container {
    padding-top: 0;
    height: auto;
    display: block;
  }

  .main {
    overflow: visible;
  }

  .content-container {
    max-width: 100%;
    padding: 0;
  }

  .content-section {
    display: block !important;
    page-break-after: always;
    margin-bottom: 34px;
  }

  .answer {
    display: block !important;
  }

  .doc-footer {
    border-top: none;
    padding: 0;
  }
}
