:root {
  --ink: #17231f;
  --muted: #68736f;
  --paper: #f6f8f7;
  --surface: #ffffff;
  --line: #dce3df;
  --green: #176b52;
  --green-soft: #dcefe8;
  --amber: #d9932d;
  --shadow: 0 16px 45px rgba(25, 49, 41, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
.topbar { min-height: 72px; padding: 0 max(24px, calc((100vw - 1120px)/2)); display: flex; align-items: center; gap: 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); }
.brand { margin-right: auto; display: flex; align-items: center; gap: 10px; font-weight: 750; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: white; font-family: Georgia, serif; }
nav { display: flex; gap: 24px; }
nav a, .link-button { color: #44504c; text-decoration: none; font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; }
nav a:hover, .link-button:hover { color: var(--green); }
.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.page-heading, .detail-hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 32px; }
.page-heading h1, .detail-hero h1 { margin: 4px 0 0; font: 700 clamp(2rem, 5vw, 3.8rem)/1.05 Georgia, serif; letter-spacing: -.035em; }
.eyebrow { color: var(--green); font-size: .8rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.muted, .heading-note { color: var(--muted); }
.heading-note { max-width: 280px; margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 48px; }
.metrics article { min-height: 140px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.metrics strong { display: block; color: var(--green); font: 700 2.6rem/1 Georgia, serif; }
.metrics span { display: block; margin-top: 15px; color: var(--muted); }
.content-section, .topic-tree, .knowledge-tree, .reading-card, .login-card, .comment-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; align-items: center; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.section-heading h2, .reading-card h2 { margin: 0; font: 700 1.35rem Georgia, serif; }
.section-heading a, .back-link { color: var(--green); font-weight: 700; }
.lesson-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--line); text-decoration: none; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover, .topic-row:hover { background: #f9fbfa; }
.lesson-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-row strong, .lesson-row small { display: block; }
.lesson-row small { margin-top: 3px; color: var(--muted); }
.empty-state { padding: 36px 26px; color: var(--muted); text-align: center; }
.notice-card, .goal-note { margin: -12px 0 28px; padding: 16px 20px; border: 1px solid #bcd8ce; border-radius: 13px; background: var(--green-soft); color: #245846; }
.secondary-button, .primary-button { display: inline-flex; justify-content: center; padding: 11px 18px; border-radius: 11px; text-decoration: none; font-weight: 750; }
.secondary-button { border: 1px solid var(--green); color: var(--green); }
.primary-button { border: 0; background: var(--green); color: white; cursor: pointer; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 170px; align-items: center; min-height: 62px; padding: 11px 22px; border-bottom: 1px solid var(--line); text-decoration: none; }
.topic-row:last-child { border-bottom: 0; }
.topic-name { padding-left: calc(var(--depth, 0) * 26px); font-weight: 650; }
.depth-0 { --depth: 0; background: #eef5f2; }
.depth-0 .topic-name { font-family: Georgia, serif; font-size: 1.15rem; }
.level-dots { display: flex; gap: 6px; }
.level-dots i { width: 17px; height: 7px; border-radius: 8px; background: #d6ddda; }
.level-1 i:nth-child(-n+1), .level-2 i:nth-child(-n+2), .level-3 i:nth-child(-n+3), .level-4 i:nth-child(-n+4) { background: var(--green); }
.level-label { color: var(--muted); font-size: .9rem; }
.topic-parent .level-label { grid-column: 3; }
.knowledge-node { border-bottom: 1px solid var(--line); }
.knowledge-node:last-child { border-bottom: 0; }
.knowledge-children { margin-left: 28px; border-left: 2px solid #e4ebe8; }
.knowledge-children .knowledge-node:last-child { border-bottom: 0; }
.knowledge-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 150px 205px; gap: 12px; align-items: center; min-height: 64px; padding: 10px 22px; text-decoration: none; }
.knowledge-row:hover { background: #f9fbfa; }
.knowledge-title { min-width: 0; color: var(--ink); font-weight: 650; text-decoration: none; }
.knowledge-title:hover { color: var(--green); }
.knowledge-level { color: var(--muted); font-size: .88rem; text-align: right; }
.compact-progress { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: #dce3df; }
.compact-progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.tree-chevron { color: var(--green); font-size: 1.5rem; line-height: 1; transition: transform .16s ease; }
.knowledge-branch > details > summary { cursor: pointer; list-style: none; }
.knowledge-branch > details > summary::-webkit-details-marker { display: none; }
.knowledge-branch > details[open] > summary .tree-chevron { transform: rotate(90deg); }
.knowledge-tree > .knowledge-branch > details > summary { background: #eef5f2; }
.knowledge-tree > .knowledge-branch > details > summary .knowledge-title { font: 700 1.12rem Georgia, serif; }
.leaf-mark { width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #a8b7b1; }
.back-link { display: inline-block; margin-bottom: 28px; text-decoration: none; }
.detail-hero { align-items: center; }
.level-card { min-width: 190px; padding: 20px 24px; border-radius: 17px; background: var(--green); color: white; }
.level-card span, .level-card small, .level-card strong { display: block; }
.level-card strong { margin: 4px 0; font: 700 2rem Georgia, serif; }
.level-card small { opacity: .8; }
.reading-card { padding: 28px; }
.reading-card h2 { margin-bottom: 18px; }
.prose { max-width: 820px; }
.prose h3 { margin-top: 26px; }
.prose a { color: var(--green); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.comment-card { margin-bottom: 18px; padding: 22px 28px; border-left: 5px solid var(--amber); }
.comment-card p { margin: 0; }
.lesson-topic, .file-link { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.lesson-topic:last-child, .file-link:last-child { border: 0; }
.file-link { color: var(--ink); text-decoration: none; font-weight: 650; }
.file-link span { color: var(--green); }
.program-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.program-card { position: relative; min-height: 180px; padding: 25px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); text-decoration: none; }
.program-card span, .program-card strong, .program-card small { display: block; }
.program-card span { color: var(--green); font-weight: 800; }
.program-card strong { margin-top: 15px; font: 700 1.55rem Georgia, serif; }
.program-card small { margin-top: 6px; color: var(--muted); }
.program-card i { position: absolute; right: 25px; bottom: 22px; color: var(--green); font-style: normal; font-size: 1.5rem; }
.program-card em { display: inline-block; margin-bottom: 12px; padding: 4px 8px; border-radius: 99px; background: var(--green); color: white; font-size: .75rem; font-style: normal; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.target-program { border-color: #82b6a4; background: var(--green-soft); }
.target-program span { color: #10533f; }
.target-level-card { box-shadow: 0 0 0 5px var(--green-soft); }
.standalone-heading { margin-bottom: 14px; padding: 0; border: 0; }
.standalone-heading h2 { margin: 4px 0 0; }
.other-programs-heading { margin-top: 46px; }
.program-empty { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 16px; background: white; }
.login-card { width: min(440px, 100%); margin: 8vh auto; padding: 34px; }
.login-card h1 { margin: 5px 0 5px; font: 700 2.6rem Georgia, serif; }
.stack-form { display: grid; gap: 10px; margin-top: 26px; }
.stack-form input { width: 100%; padding: 12px; border: 1px solid #bdc8c3; border-radius: 9px; font: inherit; }
.stack-form .primary-button { margin-top: 10px; }
.alert { margin-top: 20px; padding: 12px; border-radius: 9px; background: #fff0ec; color: #9c3827; }

@media (max-width: 760px) {
  .topbar { padding: 12px 18px; flex-wrap: wrap; gap: 14px; }
  .brand { width: 100%; }
  nav { gap: 14px; font-size: .9rem; }
  .page-shell { width: min(100% - 26px, 1120px); padding-top: 34px; }
  .page-heading, .detail-hero { align-items: start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article { min-height: 120px; padding: 18px; }
  .program-grid, .two-column { grid-template-columns: 1fr; }
  .topic-row { grid-template-columns: minmax(0, 1fr) 80px; padding: 12px 14px; }
  .level-label { grid-column: 1 / -1; padding-left: calc(var(--depth, 0) * 26px); }
  .knowledge-children { margin-left: 14px; }
  .knowledge-row { grid-template-columns: 18px minmax(0, 1fr) 84px; gap: 8px; padding: 11px 12px; }
  .knowledge-level { grid-column: 2 / -1; text-align: left; }
  .lesson-row { grid-template-columns: 1fr auto; gap: 8px; }
  .lesson-row time { grid-column: 1 / -1; }
}
