/* ==========================================================
   MG · AP Statistics — Warm Paper Academic Design System
   Self-hosted Montserrat + editorial serif; zero external dependencies.
   ========================================================== */
@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ground: #F5F2EA;
  --surface: #FFFDF8;
  --surface-2: #FAF7F0;
  --line: #E6E0D3;
  --line-soft: #EFEADF;
  --navy: #172A48;
  --navy-2: #223B63;
  --navy-soft: #E9EEF5;
  --navy-text: #C7CEDD;
  --ink: #16203A;
  --ink-2: #4B556B;
  --ink-3: #737B8E;
  --accent: #C86D44;
  --accent-soft: #FBECE4;
  --gold: #B8862D;
  --gold-soft: #FBF1DB;
  --gold-bright: #E8B04A;
  --sage: #1D6B53;
  --sage-soft: #E4F3EC;
  --danger: #B4342F;
  --danger-soft: #FCECEC;
  --serif: "Iowan Old Style", "Palatino Linotype", "Charter", "Georgia", "Songti SC", "STSong", "Noto Serif SC", serif;
  --sans: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(23, 42, 72, 0.04), 0 4px 12px -6px rgba(23, 42, 72, 0.08);
  --shadow-md: 0 2px 6px rgba(23, 42, 72, 0.05), 0 14px 28px -12px rgba(23, 42, 72, 0.14);
  --t: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.18s ease, transform 0.16s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

button, input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2.5px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.skip:focus {
  top: 12px;
}

[hidden] {
  display: none !important;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 242, 234, 0.9);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font: 700 17px/1 var(--serif);
  letter-spacing: -0.04em;
  border: 1px solid rgba(232, 176, 74, 0.35);
  box-shadow: inset 0 -2px 0 rgba(232, 176, 74, 0.45), 0 4px 12px -4px rgba(23, 42, 72, 0.32);
  transition: var(--t);
}

.mark em {
  font-style: normal;
  color: var(--gold-bright);
}

.brand:hover .mark {
  background: var(--navy-2);
  transform: translateY(-1px);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.brand-text small {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.site-nav a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: var(--t);
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  background: var(--navy);
  color: #fff;
}

.site-nav a[aria-current="page"]:hover {
  background: var(--navy-2);
}

/* ---------- Main Container ---------- */
main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 28px 64px;
  flex: 1;
}

/* ---------- Compact Navy Editorial Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 28px 34px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #172A48 0%, #1F365B 68%, #25406A 100%);
  color: #fff;
  box-shadow: 0 14px 30px -16px rgba(23, 42, 72, 0.45);
}

/* Delicate statistical bell-curve + histogram line-art watermark */
.hero::after {
  content: "";
  position: absolute;
  right: 170px;
  bottom: -2px;
  width: 240px;
  height: 120px;
  pointer-events: none;
  opacity: 0.14;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%23E8B04A' stroke-width='1.5'%3E%3Crect x='26' y='94' width='22' height='24' rx='3'/%3E%3Crect x='54' y='72' width='22' height='46' rx='3'/%3E%3Crect x='82' y='44' width='22' height='74' rx='3'/%3E%3Crect x='110' y='28' width='22' height='90' rx='3'/%3E%3Crect x='138' y='46' width='22' height='72' rx='3'/%3E%3Crect x='166' y='76' width='22' height='42' rx='3'/%3E%3Crect x='194' y='96' width='22' height='22' rx='3'/%3E%3C/g%3E%3Cpath d='M10 116 C 64 114, 88 18, 121 18 S 178 114, 232 116' fill='none' stroke='%23FFFFFF' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='121' cy='18' r='4' fill='%23E8B04A'/%3E%3C/svg%3E") no-repeat center / contain;
}

.hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.hero h1 {
  margin: 0;
  font: 600 clamp(26px, 3.2vw, 36px)/1.14 var(--serif);
  letter-spacing: -0.02em;
  color: #fff;
}

.hero-sub {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--navy-text);
  max-width: 560px;
}

.hero-side {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
}

.hero-stat strong {
  font: 600 34px/1 var(--serif);
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.hero-stat span {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--navy-text);
  white-space: nowrap;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: var(--gold-bright);
  color: var(--navy);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: var(--t);
}

.hero-btn:hover {
  background: #f0be60;
  transform: translateY(-1px);
}

/* ---------- Editorial Callout Banner (index) ---------- */
.map-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 15px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow-sm);
  transition: var(--t);
}

.map-banner:hover {
  border-color: #D7CEBC;
  border-left-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.map-banner-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-width: 0;
}

.map-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7D5815;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.map-banner strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.map-banner-desc {
  font-size: 13.5px;
  color: var(--ink-2);
}

.map-arrow {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  transition: var(--t);
}

.map-banner:hover .map-arrow {
  background: var(--navy);
  color: #fff;
}

/* ---------- Filter & Search Toolbar ---------- */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--t);
}

.filter-pill:hover {
  border-color: #CFC6B4;
  color: var(--ink);
  background: #fff;
}

.filter-pill[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.filter-pill .pill-n {
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

.filter-pill[aria-pressed="true"] .pill-n {
  color: var(--gold-bright);
  opacity: 1;
}

.filter-pill.pill-updated[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.filter-pill.pill-updated[aria-pressed="true"] .pill-n {
  color: #fff;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 320px;
  min-width: 200px;
}

.search-ico {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 35px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--ink);
  transition: var(--t);
}

.search-box input::placeholder {
  color: var(--ink-3);
}

.search-box input:focus {
  outline: none;
  background: #fff;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(23, 42, 72, 0.1);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.search-clear:hover {
  background: var(--line);
  color: var(--ink);
}

.toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-2);
}

.result-status {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hw-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--ink-2);
}

.hw-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hw-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.hw-legend .k-ap { background: var(--navy); }
.hw-legend .k-extra { background: var(--accent); }
.hw-legend .k-quiz { background: var(--gold); }
.hw-legend .k-sim { background: var(--sage); }

/* ---------- Unit Section Headings ---------- */
.unit-section {
  margin-bottom: 32px;
  scroll-margin-top: 84px;
}

.unit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.unit-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.unit-head h2 {
  margin: 0;
  font: 600 22px/1.25 var(--serif);
  color: var(--ink);
}

.unit-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.unit-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- Homework Wide-Row Cards ---------- */
.hw-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hw-card {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  padding: 15px 18px 15px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: var(--t);
}

.hw-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3.5px;
  border-radius: 0 3px 3px 0;
  background: var(--line);
}

.hw-card.hw-ap::before { background: var(--navy); }
.hw-card.hw-extra::before { background: var(--accent); }
.hw-card.hw-quiz::before { background: var(--gold); }
.hw-card.simulator-card::before { background: var(--sage); }

.hw-card:hover {
  border-color: #D4CBBA;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.hw-card.is-updated {
  border-color: #E2BFA9;
  background: linear-gradient(90deg, #FDF6F0 0%, #FFFDF8 38%);
}

.hw-card.is-updated:hover {
  border-color: #D4A488;
}

.hw-card.simulator-card.is-updated {
  border-color: #A7D4C4;
  background: linear-gradient(90deg, #EFF9F5 0%, #FFFDF8 40%);
}

.hw-date {
  display: grid;
  place-items: center;
  width: 60px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.hw-card.hw-quiz .hw-date {
  background: var(--gold-soft);
  border-color: #EED9A7;
  color: #7D5815;
}

.hw-card.simulator-card .hw-date {
  background: var(--sage-soft);
  border-color: #BFE3D5;
  color: var(--sage);
}

.hw-body {
  min-width: 0;
}

.hw-head-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.hw-title-en {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.hw-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.45;
}

.hw-title-zh {
  font-weight: 600;
  color: var(--ink-2);
}

.hw-desc {
  color: var(--ink-3);
  font-size: 12.5px;
}

.hw-desc::before {
  content: "·";
  margin-right: 8px;
  color: var(--line);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
}

.badge-ap {
  background: var(--navy-soft);
  color: var(--navy);
}

.badge-extra {
  background: var(--accent-soft);
  color: #9A4825;
}

.badge-quiz {
  background: var(--gold-soft);
  color: #7D5815;
}

.badge-sim {
  background: var(--sage-soft);
  color: var(--sage);
}

.badge-updated {
  background: var(--accent);
  color: #fff;
}

.badge-updated::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.9;
}

.simulator-card .badge-updated {
  background: var(--sage);
}

/* Direct File Actions */
.hw-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  max-width: 470px;
}

.hw-file-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.hw-file-group.is-ak {
  background: #F6F2E9;
}

.hw-file-group.is-sim {
  background: var(--sage-soft);
  border-color: #BFE3D5;
}

.hw-file-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-right: 3px;
  white-space: nowrap;
}

.hw-file-group.is-sim .hw-file-label {
  color: var(--sage);
}

.btn-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: var(--t);
}

.btn-preview {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-preview:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
  color: var(--navy);
}

.btn-download {
  background: var(--navy);
  border: 1px solid var(--navy);
  color: #fff;
}

.btn-download:hover {
  background: var(--navy-2);
  border-color: var(--navy-2);
}

.btn-sim-primary {
  background: var(--sage);
  border: 1px solid var(--sage);
  color: #fff;
}

.btn-sim-primary:hover {
  background: #14523F;
  border-color: #14523F;
}

.btn-sim-secondary {
  background: #fff;
  border: 1px solid #9ECDBD;
  color: var(--sage);
}

.btn-sim-secondary:hover {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

/* ---------- Course Slides Grid (index.html) ---------- */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: var(--t);
}

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

.lesson-card.is-updated {
  border-color: #E2BFA9;
  background: linear-gradient(135deg, #FDF6F0 0%, #FFFDF8 52%);
}

.lesson-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.lesson-num {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy-soft);
  border: 1px solid #D4DFEE;
  color: var(--navy);
  display: grid;
  place-items: center;
  font: 700 15px/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.lesson-card.is-updated .lesson-num {
  background: var(--accent-soft);
  border-color: #ECC2AE;
  color: #9A4825;
}

.lesson-info {
  flex: 1;
  min-width: 0;
}

.lesson-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.lesson-info p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.lesson-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.lesson-view {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  transition: var(--t);
}

.lesson-card:hover .lesson-view {
  background: var(--navy-2);
}

.lesson-view::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
}

.lesson-card:has(.lesson-view:focus-visible) {
  outline: 2.5px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Empty State ---------- */
.empty-state {
  padding: 40px 24px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px dashed var(--line);
  text-align: center;
  color: var(--ink-2);
}

.empty-state strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0 0 14px;
  font-size: 13.5px;
}

.empty-reset {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.empty-reset:hover {
  background: var(--navy-2);
}

/* ---------- Course Map Page ---------- */
.jump-nav {
  position: sticky;
  top: 74px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.jump-nav a {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: var(--t);
}

.jump-nav a:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.map-section {
  margin-bottom: 30px;
  scroll-margin-top: 138px;
}

.map-section h2 {
  position: relative;
  margin: 0 0 12px;
  padding-left: 14px;
  font: 600 20px/1.35 var(--serif);
  color: var(--ink);
}

.map-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25em;
  bottom: 0.25em;
  width: 4px;
  border-radius: 4px;
  background: var(--gold);
}

.table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.55;
}

.table-card th {
  background: var(--navy);
  color: #fff;
  text-align: left;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.table-card th,
.table-card td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.table-card tbody tr:last-child td {
  border-bottom: 0;
}

.table-card tbody tr:nth-child(even) {
  background: var(--surface-2);
}

.table-card tbody tr:hover {
  background: #F4EFE4;
}

.table-card td:first-child {
  width: 58%;
}

.table-card td[style*="right"] {
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-card span[style*="16A34A"] {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage) !important;
  font-size: 12px;
  font-weight: 700;
}

.table-card span[style*="DC2626"] {
  color: var(--danger) !important;
  font-weight: 500;
}

.official-card {
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.official-card ul {
  margin: 0;
  padding-left: 20px;
}

.official-card li {
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.official-card li::marker {
  color: var(--accent);
}

.official-card a {
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 4px;
}

.official-card a:hover {
  color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 28px 36px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.footer-brand strong {
  font: 700 17px/1.2 var(--serif);
  color: var(--navy);
  letter-spacing: -0.02em;
}

.footer-brand strong span {
  margin-left: 8px;
  font: 600 11.5px/1 var(--sans);
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.footer-brand p {
  margin: 5px 0 0;
}

.footer-brand .rights-note {
  margin-top: 2px;
  font-size: 12px;
}

.back-top {
  flex: none;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--t);
}

.back-top:hover {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

/* ---------- Tablet & Small Desktop ---------- */
@media (max-width: 900px) {
  .hero::after {
    right: 120px;
    opacity: 0.1;
  }

  .hw-card {
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
  }

  .hw-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    max-width: none;
    padding-left: 74px;
  }

  .jump-nav {
    top: 68px;
  }
}

@media (max-width: 760px) {
  .lessons-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .header-inner {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .site-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-radius: 14px;
  }

  .site-nav a {
    padding: 8px 4px;
    text-align: center;
    font-size: 13px;
  }

  main {
    padding: 16px 16px 44px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 20px;
    gap: 16px;
    border-radius: 16px;
  }

  .hero::after {
    right: -18px;
    bottom: -8px;
    width: 170px;
    height: 90px;
  }

  .hero-side {
    width: 100%;
    justify-content: space-between;
  }

  .hero-stat {
    flex-direction: row;
    gap: 10px;
    min-width: 0;
    padding: 9px 14px;
  }

  .hero-stat strong {
    font-size: 24px;
  }

  .hero-stat span {
    margin-top: 0;
  }

  .toolbar {
    padding: 12px;
  }

  .search-box {
    max-width: none;
    width: 100%;
  }

  .hw-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 14px 14px 17px;
  }

  .hw-date {
    width: auto;
    height: auto;
    justify-self: start;
    padding: 3px 10px;
    font-size: 12.5px;
  }

  .hw-actions {
    padding-left: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .hw-file-group {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    padding: 5px 6px 5px 11px;
  }

  .btn-act {
    min-height: 36px;
    padding: 0 12px;
  }

  .jump-nav {
    position: static;
    padding: 10px;
  }

  .table-card th,
  .table-card td {
    padding: 10px 12px;
    font-size: 13.5px;
    min-width: 155px;
  }

  .table-card td[style*="right"],
  .table-card th[style*="right"] {
    min-width: 0;
  }

  .site-footer {
    padding: 20px 16px 32px;
    flex-direction: column;
    align-items: flex-start;
  }
}

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

@media print {
  body {
    background: #fff;
  }
  .site-header, .toolbar, .jump-nav, .back-top, .hero::after {
    display: none;
  }
  .hero {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
  }
  .hero h1, .hero-stat strong {
    color: var(--ink);
  }
  .hero-sub, .hero-stat span {
    color: var(--ink-2);
  }
  .hw-card, .lesson-card, .table-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
