/* MixOS 微课站点样式 */
:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --accent: #0969da;
  --accent-soft: #ddf4ff;
  --border: #d0d7de;
  --ok: #1a7f37;
  --pending: #9a6700;
  --mos: #8250df;
  --teal: #0d6b62;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

header.site {
  background: linear-gradient(135deg, #0550ae 0%, #0969da 60%, #218bff 100%);
  color: #fff;
  padding: 2rem 1.25rem;
}

header.site .wrap { padding-top: 0; padding-bottom: 0; }

header.site h1 { margin: 0 0 0.35rem; font-size: 1.75rem; }
header.site p { margin: 0; opacity: 0.92; font-size: 0.95rem; }

nav.top {
  margin-top: 1rem;
  font-size: 0.9rem;
}
nav.top a { color: #fff; margin-right: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  border-left: 4px solid var(--accent);
  padding-left: 0.6rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-mos { background: #fbefff; color: var(--mos); }
.tag-lab { background: #dafbe1; color: var(--ok); }
.tag-sim { background: #ddf4ff; color: #0550ae; }
.tag-pending { background: #fff8c5; color: var(--pending); }
.tag-theory { background: var(--accent-soft); color: var(--accent); }

ul.learn { padding-left: 1.2rem; }
ul.learn li { margin-bottom: 0.35rem; }
.goals-card .goal-summary {
  margin: 0 0 0.75rem;
  line-height: 1.7;
  font-size: 1.02rem;
  color: var(--text);
}
.goals-card ul.learn {
  margin: 0;
}

.practice {
  background: #f6ffed;
  border: 1px solid #82d182;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.check {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.wrap-up-card .check { margin-bottom: 0.85rem; }
.wrap-up-card .wrap-up-sub {
  margin: 0.35rem 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--accent, #0e7490);
}
.wrap-up-card > ul.learn { margin: 0; }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.module-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 2rem 0 0.5rem;
}

.lesson-list { list-style: none; padding: 0; margin: 0; }

.lesson-list li {
  border-bottom: 1px solid var(--border);
}

.lesson-list a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0;
  color: inherit;
  text-decoration: none;
}

.lesson-list a:hover { background: var(--accent-soft); }

.lesson-list .id {
  font-weight: 700;
  color: var(--accent);
  min-width: 2.5rem;
}

.lesson-list .title { flex: 1; }

.lesson-list .mos-ref {
  font-size: 0.75rem;
  color: var(--muted);
}

code, pre {
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.88em;
}

pre:not(.lab-code) {
  background: #161b22;
  color: #e6edf3;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2rem;
}

.muted { color: var(--muted); font-size: 0.92rem; }

.guide-intro {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #f6f8fa;
  border-radius: 8px;
  font-size: 0.92rem;
}

.code-file {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.code-file:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.code-file h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.file-path {
  background: #eaeef2;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.file-summary {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.block-title {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--text);
}

pre.code-block {
  margin: 0.4rem 0 0.5rem;
}

ul.code-explain {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.92rem;
}

ul.code-explain li {
  margin-bottom: 0.3rem;
}

.manifest-box {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 0.9rem;
}

.manifest-box ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

/* 图解、原理与自学 */
.figures-card {
  border-left: 4px solid var(--teal);
}

.figures-grid {
  display: grid;
  gap: 1.25rem;
}

.lesson-figure {
  margin: 0;
  padding: 0.75rem;
  background: #f8faf9;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.lesson-figure img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 auto;
}

.lesson-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.figure-tip {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  text-align: center;
}

.figure-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.self-study-card {
  border-left: 4px solid #6c9bd2;
}

.self-study-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.self-study-steps li {
  margin-bottom: 0.35rem;
}

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

.experiment-card {
  border-left: 4px solid var(--ok);
}

ul.exp-steps {
  margin: 0.4rem 0 0.75rem;
  padding-left: 1.2rem;
}

ul.exp-steps li { margin-bottom: 0.3rem; }

.self-study-tip {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.code-guide p { margin: 0; }

.tag-topic {
  background: #e8f5f3;
  color: var(--teal);
}

/* 旧 MOS 对照样式保留兼容（不再生成） */
.mos-card {
  border-left: 4px solid var(--mos);
}

.mos-chapter {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.mos-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}

@media (max-width: 640px) {
  .mos-cols { grid-template-columns: 1fr; }
}

.mos-sub {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

ul.mos-sections {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
}

ul.mos-sections li { margin-bottom: 0.3rem; }

.mos-en {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92em;
}

.reading-tip {
  margin: 1rem 0 0;
  padding: 0.75rem 0.85rem;
  background: #fbefff;
  border-radius: 8px;
  font-size: 0.92rem;
  border: 1px solid #d8b4fe;
}

.outline-item {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--border);
}

.outline-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.outline-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--accent);
}

.outline-item p {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}
.outline-item p:last-child { margin-bottom: 0; }

dl.glossary {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

dl.glossary dt {
  font-weight: 700;
  font-size: 0.95rem;
}

dl.glossary .term-zh {
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.25rem;
}

dl.glossary dd {
  margin: 0.15rem 0 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent-soft);
  color: var(--text);
  font-size: 0.92rem;
}

.practice-card {
  background: #f6ffed;
  border-color: #82d182;
}

ol.practice-steps {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

ol.practice-steps li {
  margin-bottom: 0.35rem;
}

/* ── MixCO 课内壳：侧栏 + 正文 ── */
.wrap.shell-layout {
  display: grid;
  grid-template-columns: min(280px, 22vw) minmax(0, 1fr);
  min-height: 100vh;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
.wrap.shell-layout.is-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px 16px 32px;
  background: linear-gradient(180deg, rgba(255,253,248,.96), rgba(232,244,238,.92));
  border-right: 1px solid var(--border);
}
.sidebar-inner { position: relative; }
.sidebar-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}
.wrap.is-sidebar-collapsed .sidebar {
  position: fixed;
  width: 0;
  padding: 0;
  border: none;
  overflow: visible;
  pointer-events: none;
}
.wrap.is-sidebar-collapsed .sidebar-inner { display: none; }
.wrap.is-sidebar-collapsed .sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 0;
  pointer-events: auto;
  z-index: 50;
  border-radius: 0 8px 8px 0;
}
.brand {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding-right: 36px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
}
.brand a {
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
}
.brand span {
  display: inline;
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
}
.brand-home img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.nav { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.88rem; }
.nav a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.nav a:hover { background: var(--accent-soft); }
.nav a.is-current {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-l2 { padding-left: 1rem !important; font-size: 0.84rem; }
.nav .tag-lab { display: none; }
.nav-phase { margin: 0.55rem 0 0.15rem; }
.nav-phase-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.45rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
}
.nav-phase-title:hover { background: var(--accent-soft); color: var(--accent); }
.nav-phase-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 0.32em solid transparent;
  border-bottom: 0.32em solid transparent;
  border-left: 0.42em solid currentColor;
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.nav-phase.is-open > .nav-phase-title .nav-phase-caret {
  transform: rotate(90deg);
}
.nav-phase-body { display: none; padding-left: 0.15rem; }
.nav-phase.is-open > .nav-phase-body { display: block; }
main.main.lesson-main {
  max-width: none;
  width: 100%;
  padding: 1.25rem clamp(1rem, 2.5vw, 2.5rem) 3rem;
}
.lesson-head {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.lesson-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
  color: var(--text);
}
.lesson-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.footer-note {
  margin-top: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}
@media (max-width: 720px) {
  .wrap.shell-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    width: min(88vw, 300px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  }
  .wrap.is-sidebar-collapsed .sidebar { width: 0; }
}

.principle-diagram {
  margin-top: 1.25rem;
}
.ppt-topic {
  margin: 0 0 1.85rem;
  padding-bottom: 0.35rem;
}
.ppt-topic > h3 {
  margin: 0 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent, #0e7490);
  font-size: 1.18rem;
}
.ppt-part {
  margin: 0 0 1.35rem;
}
.ppt-part + .ppt-part {
  padding-top: 1rem;
  border-top: 1px solid var(--border, #e2e8f0);
}
.ppt-part p {
  margin: 0 0 0.7rem;
  line-height: 1.75;
}
.ppt-part pre.ppt-code,
.principles-card pre.ppt-code {
  margin: 0.35rem 0 1rem;
  font-size: 0.86rem;
  line-height: 1.5;
}
.ppt-part pre.ppt-code code,
.principles-card pre.ppt-code code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.ppt-points li pre.ppt-code {
  margin: 0.35rem 0;
}
.ppt-part h4,
.ppt-slide h4 {
  margin: 0 0 0.55rem;
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--accent, #0e7490);
}
.ppt-figure img.ppt-fig-img {
  display: block;
  width: 100%;
  max-width: 52rem;
  height: auto;
  margin: 0 auto;
  background: #eef4fa;
  border-radius: 12px;
}
.ppt-figure .principle-diagram {
  margin-top: 0;
  margin-bottom: 0.4rem;
}
.ppt-table-wrap {
  overflow-x: auto;
  margin: 0.45rem 0 0.8rem;
}
.ppt-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.ppt-compare th,
.ppt-compare td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
.ppt-compare th {
  background: #e0f2fe;
  color: #0c4a6e;
  font-weight: 650;
}
.ppt-compare tbody tr:nth-child(even) td {
  background: #f8fafc;
}
.ppt-fig-cap {
  margin: 0.15rem 0 0.2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
ol.ppt-points {
  list-style: none;
  margin: 0.45rem 0 0.85rem;
  padding: 0;
  counter-reset: ppt-pt;
  display: grid;
  gap: 0.45rem;
}
ol.ppt-points > li {
  counter-increment: ppt-pt;
  position: relative;
  margin: 0;
  padding: 0.55rem 0.75rem 0.55rem 2.35rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.6;
}
ol.ppt-points > li::before {
  content: counter(ppt-pt);
  position: absolute;
  left: 0.65rem;
  top: 0.55rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
ul.ppt-points {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.35rem;
}
.ppt-points li { margin-bottom: 0.35rem; }
.ppt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0.5rem;
}
.ppt-chips span {
  background: #e0f2fe;
  color: #0c4a6e;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}
.ppt-pairs {
  display: grid;
  gap: 0.75rem;
  margin: 0.65rem 0 1rem;
}
.ppt-pairs-grid {
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .ppt-pairs-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.ppt-pair {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #0e7490);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
.ppt-pair-idx {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--accent, #0e7490);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.ppt-pair-body { min-width: 0; flex: 1; }
.ppt-pair strong {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1.35;
}
.ppt-pair p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
  font-size: 0.92rem;
}
.ppt-bridge {
  margin: 1rem 0 0.5rem;
}
.principle-diagram {
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0 1rem;
  box-sizing: border-box;
}
.principle-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 12px;
}
.ppt-svg-stage {
  background: #eef4fa;
  border: 1px solid #c5d4e3;
  border-radius: 10px;
  padding: 0.35rem;
  overflow: hidden;
}
.ppt-svg-sim .ppt-live-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
}
.sim-wrap.ppt-svg-sim { margin-top: 0.35rem; }
.ppt-inline-sim {
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0 1rem;
  box-sizing: border-box;
}
.ppt-topic .ppt-inline-sim { border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.4rem 0.55rem 0.55rem; background: #f8fafc; }
