:root {
  font: 15px/1.65 system-ui, "Microsoft YaHei", sans-serif;
  color: #202633;
  background: #f5f6f9;
  --muted: #515c70;
  --line: #dde2eb;
  --paper: #fff;
  --accent: #5241bc;
  --accent-bg: #efebff;
  --code: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #7462f0; outline-offset: 3px; }
button:disabled { cursor: default; color: #646d80; background: #eef0f4; border-color: #dfe3eb; }
button { border: 1px solid var(--line); background: white; color: #292e3b; padding: 7px 12px; border-radius: 8px; font-weight: 650; }
button:not(:disabled):hover { border-color: #9d8fe1; }
code, pre, .mono { font-family: var(--code); }
p, h1, h2, h3 { margin: 0; }
.topbar { background: #1e2232; color: #faf9ff; }
.top-content { max-width: 1392px; margin: auto; min-height: 65px; padding: 10px 32px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; letter-spacing: .01em; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; background: #b8aafa; color: #251948; border-radius: 9px; font: 800 18px var(--code); }
.brand-divider { width: 1px; height: 20px; background: #555a70; }
.brand-sub { font-size: 13px; color: #d8d9e5; }
.index-button { background: #303549; border-color: #525970; color: white; white-space: nowrap; }
.index-button span { margin-right: 3px; color: #cbbaff; }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.header-link { color: #efebff; padding: 6px 8px; white-space: nowrap; }
.top-content:has(.top-actions) { flex-wrap: wrap; }
.topbar:has(#open-lesson-ide) { position: sticky; top: 0; z-index: 5; }
.layout { width: min(100%, 1392px); margin: auto; padding: 30px 32px 42px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; }
.sidebar { align-self: start; padding: 4px 0; }
.side-heading { display: grid; gap: 1px; margin: 0 0 15px 9px; }
.side-heading span, .eyebrow { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.side-heading b { font-size: 19px; }
#route { display: grid; gap: 6px; }
.nav-button { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 9px; width: 100%; text-align: left; background: transparent; border-color: transparent; padding: 10px 7px; }
.nav-button[aria-current="step"] { background: var(--accent-bg); border-color: #d9d0ff; }
.nav-button b, .nav-button small { display: block; }
.nav-button small { color: var(--muted); font-size: 12px; font-weight: 450; }
.number { height: 28px; border: 1px solid var(--line); background: white; border-radius: 8px; display: grid; place-items: center; font: 700 12px var(--code); }
.nav-button[aria-current="step"] .number { color: white; background: var(--accent); border-color: var(--accent); }
.progress { margin: 20px 9px 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
progress { display: block; width: 100%; height: 7px; border-radius: 99px; margin-top: 8px; accent-color: var(--accent); }
.side-note { margin: 11px 9px; font-size: 12px; color: var(--muted); }
main { min-width: 0; }
.hero { padding: clamp(18px, 3vw, 31px); border: 1px solid #dad4f5; border-radius: 16px; margin-bottom: 16px; background: linear-gradient(119deg,#eeebff,#f5f2ff 63%,#e9f0fa); }
.hero-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: #504875; font-size: 12px; font-weight: 700; }
.pill { color: #44349b; padding: 2px 8px; border-radius: 20px; background: #e2dbff; white-space: nowrap; }
.hero h1 { font-size: clamp(23px, 3.4vw, 32px); letter-spacing: -.035em; line-height: 1.3; margin: 8px 0 6px; }
.hero p { color: #41465c; max-width: 49rem; }
.card, .learn-box { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; min-width: 0; }
.card { padding: 17px; }
.card h2 { font-size: 17px; }
.muted { color: var(--muted); font-size: 13px; }
.learn-box { margin-bottom: 14px; padding: 11px 15px; }
.learn-box summary { cursor: pointer; font-weight: 750; color: #30374b; }
.learn-box[open] summary { margin-bottom: 9px; }
.learn-box p + p { margin-top: 5px; }
.concept-button { padding: 1px 6px; border: 0; color: var(--accent); background: var(--accent-bg); border-radius: 4px; font-size: .92em; }
.grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.28fr); gap: 13px; }
.section-kicker { display: flex; justify-content: space-between; align-items: center; gap: 5px; flex-wrap: wrap; }
.rule-list, .item-list { display: grid; margin: 12px 0 0; gap: 7px; padding: 0; list-style: none; }
.rule-button, .item { width: 100%; font: 600 14px/1.55 var(--code); text-align: left; overflow-wrap: anywhere; }
.rule-button { background: #f8f8fc; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule-button span:last-child { color: var(--accent); font: 700 18px/1 system-ui; }
.rule-button:disabled span:last-child { color: #657084; }
.item { background: #f5f3fe; border: 1px solid #e8e3fc; border-radius: 8px; padding: 8px 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item:first-child { background: #eff1f7; border-color: #e1e5ee; }
.item .dot { color: var(--accent); font-weight: 900; }
.item small { font: 600 11px system-ui; color: var(--muted); white-space: nowrap; }
.icon-button { padding: 0; width: 28px; height: 28px; flex: 0 0 28px; font: 700 20px/1 system-ui; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:not(:disabled):hover { background: #4535a9; }
.feedback { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: #f2f4f8; color: #343d51; font-size: 13px; }
.feedback:empty { display: none; }
.feedback[data-tone="good"] { background: #e4f6ef; color: #1b5947; }
.feedback[data-tone="warn"] { background: #fff1df; color: #743c0c; }
.feedback[data-tone="error"], .exercise-feedback[data-tone="error"] { background: #fff0ee; color: #8c3026; border-color: #e6b2ad; }
.feedback[data-tone="pending"], .exercise-feedback[data-tone="pending"] { background: #f0edff; color: #473678; border-color: #d5c9f7; }
.material-picker { margin: 8px 0 12px; padding: 12px; border: 1px solid #cfc3f5; border-radius: 9px; background: #f4f0ff; }
.material-picker label { display: block; font-weight: 750; color: #463383; }
.material-picker .action-row { margin-top: 7px; }
.material-status { margin-top: 6px; font-size: 13px; color: #4f4570; }
.execution-step { margin: 10px 0; padding: 8px 10px; border: 1px solid #d6ccfa; background: #f5f2ff; border-radius: 8px; font-size: 13px; }
.execution-step p + p { margin-top: 3px; }
.execution-step code { overflow-wrap: anywhere; }
.execution-step button { padding: 2px 6px; }
.instruction-marker { font-weight: 750; color: #493396; }
.next-instruction { outline: 1px dashed #785bc1; outline-offset: -2px; }
.tree-diagram { max-width: 100%; max-height: 34rem; overflow: auto; padding: 10px; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fafafe; }
.tree-diagram ul { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; }
.tree-diagram > ul { justify-content: flex-start; width: max-content; min-width: 100%; }
.tree-diagram li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 13px 5px 0; }
.tree-diagram > ul > li { padding-top: 0; margin-inline: auto; }
.tree-diagram details > ul > li::before, .tree-diagram details > ul > li::after { content: ""; position: absolute; top: 0; width: 50%; height: 13px; border-top: 1px solid #aa9dc9; }
.tree-diagram details > ul > li::before { right: 50%; }
.tree-diagram details > ul > li::after { left: 50%; border-left: 1px solid #aa9dc9; }
.tree-diagram li:first-child::before, .tree-diagram li:last-child::after { border-top: 0; }
.tree-diagram details > ul > li:only-child::before { display: none; }
.tree-diagram-node { display: grid; justify-items: center; border: 1px solid #d8cbf8; border-radius: 7px; background: #f0eaff; padding: 3px 7px; min-width: 3rem; max-width: 16rem; min-height: 1.9rem; font: 13px/1.5 var(--code); color: #443281; text-align: center; }
.tree-diagram-node[data-kind="leaf"] { background: #edf7f3; border-color: #bedbd0; color: #225b4c; }
.tree-diagram-node[data-kind="empty"] { background: #fff; border-style: dashed; color: var(--muted); }
.tree-diagram-node[data-new="true"] { outline: 2px solid #6e56c3; }
.tree-diagram-node button { padding: 2px 5px; color: inherit; background: transparent; border-color: transparent; font: inherit; }
.tree-diagram-node button[aria-pressed="true"] { border-color: #7458c5; background: #ded2ff; }
.tree-diagram-node small { overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.tree-diagram details { text-align: center; align-self: stretch; }
.tree-diagram summary { cursor: pointer; display: inline-block; font-size: 11px; color: #4a3985; padding: 2px 4px; }
.tree-diagram summary::before { content: "+ "; }
.tree-diagram details[open] > summary::before { content: "− "; }
.source-card, .trace-card { margin: 0 0 13px; }
.trace-card { margin: 13px 0 0; }
.editor { margin-top: 10px; padding: 10px 11px; border-radius: 9px; background: #262b40; color: #eeeeff; font: 14px/1.7 var(--code); }
.editor p { white-space: pre-wrap; }
.editor textarea { display: block; width: calc(100% - 16px); min-height: 37px; resize: vertical; margin: 4px 0 4px 16px; padding: 5px 7px; background: #373956; color: #f6f4ff; border: 1px solid #8076b0; border-radius: 6px; font: inherit; }
.tokens { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.token { font: 650 12px/1.55 var(--code); padding: 4px 6px; max-width: 100%; overflow-wrap: anywhere; }
.token small { font-size: 11px; color: var(--muted); }
.token[aria-current="true"] { background: #fff0cb; border-color: #d6a746; }
.compare { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.compare span { background: #f2f4f8; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; padding: 4px 7px; }
.trace-list { display: grid; gap: 5px; max-height: 220px; margin: 10px 0 0; padding: 0; overflow: auto; list-style: none; }
.trace-list li { border-radius: 6px; font-size: 13px; padding: 5px 8px; background: #f2f4f8; }
.trace-list li:first-child { background: #efebff; }
.footer-row { margin-top: 14px; display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; }
dialog { width: min(530px, calc(100vw - 24px)); max-height: calc(100dvh - 28px); margin-right: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; color: #202633; box-shadow: 0 14px 44px #17183138; }
dialog::backdrop { background: #22263c77; }
dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog .dialog-top, dialog .search-label, dialog input[type="search"] { flex-shrink: 0; }
#knowledge-results, #concept-list { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.dialog-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.search-label { display: block; margin-top: 10px; font-size: 13px; font-weight: 650; }
#find-concept { width: 100%; border: 1px solid #aeb7ce; border-radius: 8px; margin: 5px 0 12px; padding: 8px; }
.concept-card { border-top: 1px solid var(--line); padding: 10px 0; }
.concept-card p { margin-top: 4px; }
.concept-card button { font-size: 12px; margin-top: 6px; }
.knowledge-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 650; flex-shrink: 0; }
.knowledge-filter select { min-width: 0; flex: 1 1 10rem; padding: 6px 8px; border: 1px solid #aeb7ce; border-radius: 7px; background: white; color: inherit; font: inherit; }
.knowledge-count { margin: 8px 0; font-size: 12px; flex-shrink: 0; }
.knowledge-chapter-group { border-top: 1px solid var(--line); }
.knowledge-chapter-group > summary { padding: 11px 0; cursor: pointer; font-size: 14px; font-weight: 700; color: #493a7a; }
.knowledge-chapter-group > summary span { margin-left: 7px; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.knowledge-chapter-group .concept-card { padding: 11px 4px; }
.knowledge-location { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.knowledge-format { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; padding: 8px; background: #f5f2ff; border-radius: 7px; font: 13px/1.6 var(--code); }
.undo-icon { color: #515c70; }
@media (max-width: 880px) { .layout { grid-template-columns: 165px minmax(0, 1fr); gap: 17px; padding: 20px; } }
@media (max-width: 715px) {
  .layout { display: block; padding: 12px; }
  .top-content { padding: 8px 12px; }
  .side-heading, .side-note, .progress, .nav-button small { display: none; }
  #route { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
  .nav-button { padding: 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; text-align: center; }
  .number { height: 24px; width: 26px; }
}
@media (max-width: 505px) {
  .brand { gap: 7px; font-size: 15px; }
  .brand-sub, .brand-divider { display: none; }
  .index-button { padding: 5px 7px; font-size: 12px; }
  .hero, .card { padding: 12px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
}
