:root {
  --bg: #f5f7f4;
  --paper: #ffffff;
  --ink: #17202a;
  --text: #334155;
  --muted: #6b7280;
  --line: #d9e2e4;
  --blue: #2563eb;
  --green: #0f9f6e;
  --yellow: #f2b84b;
  --red: #dc5b5b;
  --purple: #7157d9;
  --teal: #00899a;
  --shadow: 0 18px 42px rgba(23, 32, 42, 0.08);
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  line-height: 1.72;
  letter-spacing: 0;
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
}

img,
svg {
  max-width: 100%;
}

p,
h1,
h2,
h3,
h4 {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.18;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(36px, 5vw, 64px);
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(25px, 3vw, 38px);
}

h3 {
  margin-bottom: 8px;
  font-size: 21px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid rgba(23, 32, 42, 0.1);
  background: rgba(245, 247, 244, 0.92);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.tool-button,
.choice-button {
  max-width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.primary-button,
.tool-button {
  padding: 10px 15px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.secondary-button,
.ghost-button {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.tool-button:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.tool-button:focus-visible,
.choice-button:focus-visible,
.route-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.home {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.home-hero {
  min-height: min(760px, calc(100svh - 92px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.8fr);
  gap: 20px;
  align-items: stretch;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(24px, 5vw, 54px);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: 6px 6px 0 var(--ink);
}

.hero-text {
  max-width: 720px;
  color: var(--text);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.eyebrow {
  width: fit-content;
  margin-bottom: 12px;
  padding: 5px 9px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: #eaf2ff;
  color: #17469c;
  font-size: 13px;
  font-weight: 900;
}

.hero-board {
  min-height: 540px;
  display: grid;
  align-content: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17202a;
  color: white;
  box-shadow: var(--shadow);
}

.signal-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  opacity: 0.26;
}

.signal-grid span {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.04);
}

.thinking-card {
  position: relative;
  z-index: 1;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.thinking-card strong {
  display: block;
  color: #ffd166;
  font-size: 24px;
}

.thinking-card p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
}

.course-intro {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.course-intro article,
.map-card,
.info-card,
.model-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.course-intro article {
  min-height: 176px;
  padding: 20px;
}

.course-intro p,
.map-card p,
.info-card p,
.model-card p,
.mini-card p {
  margin-bottom: 0;
  color: var(--text);
}

.course-map-section {
  margin-top: 50px;
}

.section-title {
  margin-bottom: 16px;
}

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

.map-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  min-height: 154px;
  padding: 18px;
}

.map-card > div:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.map-no,
.lesson-number {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.map-card.is-done .map-no {
  background: var(--green);
}

.map-card.is-locked {
  opacity: 0.68;
}

.map-card h3 {
  margin-bottom: 6px;
}

.map-action {
  max-width: 100%;
  width: max-content;
  margin-top: 14px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #eef6f7;
  color: #15545d;
  font-size: 14px;
  font-weight: 900;
}

.map-action[aria-disabled="true"] {
  color: var(--muted);
  background: #f1f3f4;
}

.learn-shell {
  width: min(var(--max), calc(100% - 32px));
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin: 0 auto;
  padding: 24px 0 54px;
}

.lesson-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100svh - 108px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.progress-panel {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f6fafb;
  border: 1px solid var(--line);
}

.progress-panel strong {
  display: block;
  margin-bottom: 8px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde8ea;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--yellow));
  transition: width 0.25s ease;
}

.route-nav {
  display: grid;
  gap: 7px;
}

.route-link {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #415164;
  text-align: left;
  font-weight: 800;
}

.route-link span:first-child {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
}

.route-link.is-active {
  border-color: rgba(37, 99, 235, 0.25);
  background: #eaf2ff;
  color: #163b80;
}

.route-link.is-done span:first-child {
  border-color: rgba(15, 159, 110, 0.25);
  background: #e9fff4;
  color: #0a7a54;
}

.route-link.is-locked {
  opacity: 0.56;
  cursor: not-allowed;
}

.sidebar-note {
  margin-top: 14px;
  padding: 12px;
  border-left: 4px solid var(--yellow);
  border-radius: 0 8px 8px 0;
  background: #fff8e7;
  color: #5a4511;
  font-size: 13px;
}

.lesson-main {
  min-width: 0;
}

.lesson-hero {
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.56fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 26px;
}

.lesson-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(24px, 4vw, 44px);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: 6px 6px 0 var(--ink);
}

.lesson-hero-copy p:last-child {
  margin-bottom: 0;
}

.lesson-visual {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  overflow: hidden;
}

.visual-stack {
  width: 100%;
  display: grid;
  gap: 12px;
}

.visual-pill {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.visual-pill strong {
  color: #ffd166;
}

.lesson-section {
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.lesson-section:first-of-type {
  border-top: 0;
}

.wide-text {
  max-width: 820px;
  color: var(--text);
  font-size: 17px;
}

.two-col,
.three-col,
.four-col {
  display: grid;
  gap: 14px;
}

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

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

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

.info-card,
.model-card,
.mini-card {
  min-width: 0;
  padding: 17px;
}

.info-card {
  border-top: 5px solid var(--accent, var(--blue));
}

.mini-card strong,
.model-card strong {
  display: block;
  margin-bottom: 5px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag-row span,
.model-tag {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef6f7;
  color: #15545d;
  font-size: 13px;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 12px;
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-left: 6px solid var(--accent, var(--blue));
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.timeline-item time {
  font-weight: 900;
  color: var(--accent, var(--blue));
}

.practice,
.callout,
.check-panel,
.locked-panel {
  border-radius: 8px;
  padding: 18px;
}

.practice {
  border: 2px solid var(--ink);
  background: #fffdf5;
  box-shadow: 5px 5px 0 var(--ink);
}

.callout {
  border-left: 5px solid var(--yellow);
  background: #fff8e7;
  color: #5b4514;
}

.check-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.locked-panel {
  border: 2px solid var(--ink);
  background: #fffdf5;
  box-shadow: 5px 5px 0 var(--ink);
}

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

.choice-set {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-button {
  min-width: 88px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: #263548;
}

.choice-button.is-correct {
  border-color: rgba(15, 159, 110, 0.5);
  background: #e9fff4;
}

.choice-button.is-wrong {
  border-color: rgba(220, 91, 91, 0.48);
  background: #fff0f0;
}

.feedback {
  min-height: 42px;
  margin-top: 10px;
  color: var(--text);
  font-weight: 700;
}

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

.sample-button {
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.sample-button[aria-pressed="true"] {
  border-color: rgba(15, 159, 110, 0.5);
  background: #ecfff6;
  box-shadow: inset 0 0 0 2px rgba(15, 159, 110, 0.12);
}

.shape-row {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.shape {
  display: inline-block;
  border: 2px solid rgba(23, 32, 42, 0.72);
  background: var(--shape, #ffd166);
}

.shape.circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.shape.rect {
  width: 42px;
  height: 24px;
  border-radius: 6px;
}

.shape.tall {
  width: 22px;
  height: 34px;
  border-radius: 7px;
}

.result-box {
  min-height: 132px;
  padding: 14px;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
}

.result-box strong {
  display: block;
  margin-bottom: 6px;
  color: #ffd166;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #405064;
  font-size: 14px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.output-box {
  min-height: 190px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #253349;
  white-space: pre-wrap;
}

.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.site-footer {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
  color: var(--muted);
  font-size: 14px;
}

.standalone {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 54px;
}

.standalone-hero {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 44px);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: 6px 6px 0 var(--ink);
}

.standalone-hero p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1000px) {
  .home-hero,
  .lesson-hero,
  .learn-shell {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
  }

  .hero-board {
    min-height: 360px;
  }

  .lesson-sidebar {
    position: sticky;
    top: 68px;
    z-index: 15;
    max-height: none;
    padding: 12px;
  }

  .route-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .route-link {
    width: 210px;
    flex: 0 0 210px;
  }

  .sidebar-note {
    display: none;
  }

  .course-intro,
  .course-map,
  .interaction-grid,
  .three-col,
  .four-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .field-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

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

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand small {
    display: none;
  }

  .home,
  .learn-shell,
  .standalone,
  .site-footer {
    width: min(100% - 24px, var(--max));
  }

  .hero-copy,
  .lesson-hero-copy,
  .standalone-hero {
    padding: 22px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .hero-board {
    min-height: 320px;
  }

  .lesson-sidebar {
    top: 125px;
  }

  .course-intro,
  .course-map,
  .two-col,
  .three-col,
  .four-col,
  .interaction-grid,
  .sample-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .map-card,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .lesson-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .lesson-nav a,
  .lesson-nav button {
    width: 100%;
  }
}
