:root {
  --ink: #1e1a16;
  --ink-soft: #4e463e;
  --ink-muted: #7c7166;
  --bg: #f6f1e7;
  --card: #fffdf9;
  --border: rgba(145, 118, 86, 0.22);
  --cinnabar: #b53426;
  --cinnabar-dark: #8e2318;
  --gold: #c6912c;
  --gold-soft: rgba(198, 145, 44, 0.14);
  --jade: #246c5e;
  --jade-soft: rgba(36, 108, 94, 0.12);
  --shadow: 0 12px 32px rgba(42, 30, 18, 0.08);
  --shadow-sm: 0 4px 14px rgba(42, 30, 18, 0.06);
  --font-sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: radial-gradient(circle at 12% 0%, #fffaf0 0%, var(--bg) 52%, #ebe2d2 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Sticky Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background: rgba(252, 248, 241, 0.90);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--cinnabar), var(--cinnabar-dark));
  color: #fff6e6;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255, 224, 160, 0.45), 0 4px 12px rgba(181, 52, 38, 0.25);
  flex-shrink: 0;
}

.brand h1 {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.2;
}

.brand p {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

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

.nas-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--jade);
  background: var(--jade-soft);
  border: 1px solid rgba(36, 108, 94, 0.25);
  padding: 5px 11px;
  border-radius: 999px;
}

.btn-outline {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.2px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-outline:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
}

/* Main Layout */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 22px 64px;
}

/* Student Learning Dashboard Strip */
.dash-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-label {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-weight: 600;
}

.dash-value {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.dash-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* Featured Course Hero */
.hero-card {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.hero-media {
  position: relative;
  min-height: 320px;
  background: #e9dfd0;
  overflow: hidden;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-media-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(28, 22, 16, 0.8);
  color: #fcebc4;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.hero-content {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 11px;
}

.kicker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.kicker {
  display: inline-flex;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cinnabar);
  background: rgba(181, 52, 38, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}

.kicker.cross {
  color: #2b5c8f;
  background: rgba(43, 92, 143, 0.11);
}

.hero-content h2 {
  font-family: var(--font-serif);
  font-size: 27px;
  line-height: 1.25;
}

.hero-desc {
  font-size: 13.6px;
  line-height: 1.68;
  color: var(--ink-soft);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--gold-soft);
  color: #855a0e;
}

.hero-progress {
  font-size: 12.4px;
  color: var(--jade);
  background: var(--jade-soft);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  background: linear-gradient(135deg, var(--cinnabar), #cc452f);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13.8px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(181, 52, 38, 0.24);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--border);
  padding: 10px 15px;
  border-radius: 12px;
  font-size: 13.2px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--gold);
  background: #fffaf0;
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h3 {
  font-family: var(--font-serif);
  font-size: 21px;
}

.section-head p {
  font-size: 12.8px;
  color: var(--ink-muted);
  margin-top: 3px;
}

/* Subject Hall Wall (Level 1 Taxonomy) */
.subject-wall {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.subject-tile {
  border: 1.5px solid var(--border);
  background: var(--card);
  border-radius: 15px;
  padding: 13px 11px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.18s ease;
  position: relative;
}

.subject-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.subject-tile.active {
  border-color: var(--sub-color, var(--cinnabar));
  background: var(--sub-soft, rgba(181, 52, 38, 0.08));
  box-shadow: 0 6px 18px rgba(36, 26, 16, 0.09);
}

.sub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-icon {
  font-size: 20px;
}

.sub-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(30, 26, 22, 0.07);
  color: var(--ink-soft);
}

.subject-tile.active .sub-count {
  background: var(--sub-color, var(--cinnabar));
  color: #fff;
}

.sub-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.sub-meta {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.35;
}

/* Cascading Level-2 Filter Workbench */
.filter-workbench {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

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

.fw-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fw-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-right: 4px;
}

.cat-pill {
  border: 1px solid var(--border);
  background: #faf6ee;
  color: var(--ink-soft);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
}

.cat-pill:hover {
  border-color: var(--cinnabar);
  color: var(--ink);
}

.cat-pill.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.search-input {
  border: 1px solid var(--border);
  background: #faf6ee;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  width: 240px;
}

.search-input:focus {
  outline: 2px solid rgba(181, 52, 38, 0.25);
  background: #fff;
}

/* Course Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 34px;
}

.course-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.course-card.live:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.course-card.planned {
  border-style: dashed;
  background: rgba(255, 253, 249, 0.8);
}

.course-thumb {
  height: 158px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #efe7d8, #e0d3bd);
}

.course-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  text-align: center;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.thumb-placeholder .ph-icon {
  font-size: 30px;
}

.thumb-placeholder strong {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
}

.thumb-placeholder small {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.status-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--jade);
  color: #fff;
}

.status-chip.planned {
  background: rgba(76, 68, 60, 0.76);
}

.format-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.course-body {
  padding: 14px 16px 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.course-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.subj-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.cat-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f2ece0;
  color: var(--ink-soft);
}

.cross-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(43, 92, 143, 0.12);
  color: #2b5c8f;
}

.course-body h4 {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.3;
}

.course-body p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  flex: 1;
}

.exam-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.exam-tag {
  font-size: 10.5px;
  color: var(--ink-muted);
  background: #f7f2e8;
  border: 1px solid rgba(145, 118, 86, 0.18);
  padding: 1px 7px;
  border-radius: 999px;
}

.course-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 9px;
  margin-top: 2px;
  border-top: 1px dashed var(--border);
  font-size: 11.8px;
  color: var(--ink-muted);
}

.course-link {
  text-decoration: none;
  color: var(--cinnabar);
  font-weight: 700;
}

/* 5-Chapter Quick Strip */
.chapter-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 30px;
}

.chap-jump-card {
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.16s ease;
}

.chap-jump-card:hover {
  transform: translateY(-2px);
  border-color: var(--cinnabar);
  box-shadow: var(--shadow-sm);
}

.chap-jump-card strong {
  font-size: 13px;
  color: var(--cinnabar);
}

.chap-jump-card span {
  font-size: 11.8px;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(24, 18, 12, 0.54);
  backdrop-filter: blur(6px);
  display: none;
  place-items: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: grid;
}

.modal-card {
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-head h3 {
  font-family: var(--font-serif);
  font-size: 20px;
}

.modal-close {
  border: 1px solid var(--border);
  background: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.guide-steps {
  padding-left: 18px;
  font-size: 13.2px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.guide-code {
  margin-top: 12px;
  background: #231e19;
  color: #f8ecd5;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 11.8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

@media (max-width: 1080px) {
  .subject-wall { grid-template-columns: repeat(4, 1fr); }
  .course-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .dash-strip { grid-template-columns: repeat(2, 1fr); }
  .hero-card { grid-template-columns: 1fr; }
  .subject-wall { grid-template-columns: repeat(2, 1fr); }
  .chapter-strip { grid-template-columns: repeat(2, 1fr); }
  .course-grid { grid-template-columns: 1fr; }
  .nas-pill { display: none; }
}
