:root {
  color-scheme: light;
  --paper: #f5f4f0;
  --surface: #fff;
  --ink: #20231f;
  --muted: #81847d;
  --line: #e8e7e1;
  --green: #355f4b;
  --green-dark: #284936;
  --green-soft: #eaf0e9;
  --code: #202720;
  --orange: #c17a3e;
  font-family: "DM Sans", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, a { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 252px; padding: 31px 21px 24px;
  display: flex; flex-direction: column; background: #fbfaf7; border-right: 1px solid var(--line); z-index: 2;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 7px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--green); color: white; font-family: "DM Mono", monospace; font-size: 19px; font-weight: 500; }
.brand-mark span { color: #b7cf9f; }
.brand-copy { display: grid; gap: 4px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.3px; }
.brand-copy small { color: var(--muted); font-size: 10px; letter-spacing: 1.2px; }
.sidebar-label { margin: 51px 9px 13px; color: #92958d; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.lesson-nav { display: grid; gap: 6px; }
.lesson-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: #62675f; text-align: left; cursor: pointer; transition: background .16s, color .16s; }
.lesson-link:hover { background: #f0efe9; }
.lesson-link.active { background: var(--green-soft); color: var(--green-dark); }
.nav-number { color: #969991; font: 11px "DM Mono", monospace; }
.lesson-link.active .nav-number { color: var(--green); }
.nav-title { flex: 1; font-size: 13px; font-weight: 600; }
.nav-check { width: 8px; height: 8px; border: 1px solid #d5d6cf; border-radius: 50%; }
.lesson-link.completed .nav-check { border-color: var(--green); background: var(--green); }
.sidebar-bottom { margin-top: auto; padding: 17px 9px 0; border-top: 1px solid var(--line); }
.progress-label { display: flex; justify-content: space-between; color: #656a62; font-size: 11px; }
.progress-label span:last-child { color: var(--green); font-family: "DM Mono", monospace; }
.progress-track { height: 4px; margin-top: 11px; border-radius: 4px; background: #e8e9e3; overflow: hidden; }
.progress-fill { width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.sidebar-bottom p { margin: 13px 0 0; color: #92958e; font-size: 11px; }

.main-content { min-height: 100vh; margin-left: 252px; padding: 0 5.2%; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.breadcrumb { color: #81847d; font-size: 11px; }
.breadcrumb span { margin: 0 8px; color: #babbb4; }
.breadcrumb strong { color: #343a34; font-weight: 600; }
.repo-link { color: var(--green); font-size: 11px; font-weight: 600; text-decoration: none; }
.repo-link span { margin-left: 4px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 660px) minmax(235px, 280px); gap: clamp(24px, 4vw, 58px); max-width: 1080px; margin: 0 auto; padding: 44px 0 30px; align-items: start; }
.lesson-heading { margin-bottom: 27px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #7d8277; font-size: 9px; font-weight: 700; letter-spacing: 1.4px; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #88a67c; }
h1 { margin: 12px 0 8px; font-size: clamp(29px, 3.2vw, 39px); line-height: 1.25; letter-spacing: -1.2px; }
.lesson-intro { max-width: 590px; margin: 0; color: #74786f; font-size: 13px; line-height: 1.85; }
.tag-row { display: flex; align-items: center; gap: 11px; margin-top: 14px; }
.tag { padding: 4px 9px; border-radius: 5px; background: #e9eee7; color: #52705a; font-size: 10px; font-weight: 600; }
.read-time { color: #999b95; font-size: 10px; }
.concept-card, .exercise-card { padding: 20px 21px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.section-title { display: flex; align-items: center; gap: 9px; }
.section-title h2 { margin: 0; font-size: 13px; font-weight: 700; }
.section-icon { color: #729077; font-size: 14px; }
.concept-card > p { margin: 13px 0 15px; color: #62675f; font-size: 12px; line-height: 1.85; }
.goal-box { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e9ece5; border-radius: 7px; background: #f7f8f5; }
.goal-label { color: #85907e; font-size: 10px; font-weight: 700; }
.goal-box code { color: #374b3b; font: 12px "DM Mono", monospace; }
.code-section { margin: 25px 0; }
.code-title { margin: 0 0 11px; }
.code-title .section-icon { font: 12px "DM Mono", monospace; }
.copy-button { margin-left: auto; padding: 6px 9px; border: 1px solid #e6e7e1; border-radius: 6px; background: white; color: #656b62; font-size: 10px; cursor: pointer; }
.copy-button:hover, .prompt-button:hover { border-color: #9eaf9f; }
.code-card { overflow: hidden; border-radius: 10px; background: var(--code); box-shadow: 0 5px 15px #1c271c10; }
.code-toolbar { height: 35px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid #ffffff13; color: #bdc5bb; font-size: 10px; }
.file-dot { width: 7px; height: 7px; border-radius: 50%; background: #8faa7a; }
.code-language { margin-left: auto; color: #798477; font: 9px "DM Mono", monospace; letter-spacing: .6px; }
pre { margin: 0; padding: 15px 16px 17px; overflow-x: auto; color: #e4e9e1; font: 11px/1.85 "DM Mono", monospace; tab-size: 2; }
.code-caption { margin: 8px 0 0; color: #898d85; font-size: 10px; line-height: 1.7; }
.code-caption code { color: #536e59; font-family: "DM Mono", monospace; }
.exercise-card { padding: 19px 20px; }
.exercise-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.exercise-heading .eyebrow { font-size: 9px; }
.exercise-heading h2 { margin: 6px 0 0; font-size: 13px; line-height: 1.6; }
.exercise-badge { padding: 4px 8px; border-radius: 5px; background: #f3efe8; color: #a07342; font-size: 9px; white-space: nowrap; }
.answer-options { display: grid; gap: 7px; margin: 14px 0 0; }
.answer-option { width: 100%; padding: 9px 11px; border: 1px solid #e9e9e4; border-radius: 7px; background: white; color: #585e56; text-align: left; cursor: pointer; font-size: 11px; transition: border-color .15s, background .15s; }
.answer-option:hover, .answer-option.selected { border-color: #829984; background: #f3f7f1; }
.answer-option code { font: 10px "DM Mono", monospace; }
.answer-option.correct { border-color: #83a889; background: #edf5ec; color: #355f4b; }
.answer-option.incorrect { border-color: #d3a18e; background: #fbf0eb; }
.exercise-feedback { min-height: 18px; margin-top: 9px; color: var(--green); font-size: 10px; line-height: 1.6; }
.exercise-feedback.error { color: #a34f3c; }
.exercise-actions { display: flex; align-items: center; gap: 16px; }
.check-button { padding: 9px 13px; border: 0; border-radius: 6px; background: var(--green); color: white; font-size: 11px; font-weight: 600; cursor: pointer; }
.check-button:hover, .complete-button:hover { background: var(--green-dark); }
.check-button span { margin-left: 9px; }
.text-button { padding: 7px 0; border: 0; background: transparent; color: #778071; font-size: 10px; cursor: pointer; }
.lesson-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 19px; }
.complete-button { padding: 9px 13px; border: 0; border-radius: 6px; background: var(--green); color: white; font-size: 10px; font-weight: 600; cursor: pointer; }
.complete-button span { margin-left: 7px; }
.complete-button.done { background: #e7eee6; color: var(--green-dark); }
.next-button { padding: 8px 0 8px 12px; border: 0; background: transparent; color: #636b61; font-size: 10px; cursor: pointer; }
.next-button span { margin-left: 8px; }

.tutor-column { display: grid; gap: 13px; padding-top: 92px; }
.tutor-card, .notation-card { padding: 17px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; }
.tutor-heading { display: flex; align-items: center; gap: 9px; }
.tutor-avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: #e9f0e7; color: #557859; font-size: 15px; }
.tutor-heading h2 { margin: 0; font-size: 12px; }
.tutor-heading p { margin: 3px 0 0; color: #8b8e86; font-size: 9px; }
.online-dot { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #7caa7b; box-shadow: 0 0 0 3px #7caa7b20; }
.tutor-message { margin-top: 15px; padding: 12px; border: 1px solid #e9ece5; border-radius: 8px; background: white; }
.message-label { color: #71866e; font-size: 9px; font-weight: 700; letter-spacing: .6px; }
.tutor-message p { margin: 7px 0 0; color: #666b63; font-size: 11px; line-height: 1.8; }
.tutor-divider { height: 1px; margin: 14px 0 11px; background: var(--line); }
.ai-instructions { margin: 0; color: #797d75; font-size: 10px; line-height: 1.75; }
.prompt-button { width: 100%; margin-top: 12px; padding: 9px 8px; border: 1px solid #dce5d9; border-radius: 7px; background: #f5f8f3; color: #49674d; font-size: 10px; font-weight: 600; cursor: pointer; }
.prompt-button span { margin-right: 5px; }
.privacy-note { margin: 9px 0 0; color: #9a9c95; font-size: 9px; line-height: 1.6; }
.notation-card { padding: 15px 16px; }
.notation-card .section-title { margin-bottom: 12px; }
.notation-card .section-icon { font-size: 13px; }
.notation-card dl { display: grid; gap: 8px; margin: 0; }
.notation-card dl div { display: flex; align-items: center; gap: 10px; }
.notation-card dt { display: grid; place-items: center; width: 29px; height: 24px; border-radius: 5px; background: #edeee9; color: #516750; }
.notation-card dt code { font: 12px "DM Mono", monospace; }
.notation-card dd { margin: 0; color: #747970; font-size: 10px; }
.page-footer { max-width: 1080px; margin: 8px auto 0; padding: 15px 0 20px; border-top: 1px solid var(--line); color: #999b94; font-size: 9px; }
.page-footer span { margin: 0 5px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; padding: 10px 14px; border-radius: 8px; background: #27382b; color: white; font-size: 11px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1500px) { .main-content { padding-right: 7%; padding-left: 7%; } }
@media (max-width: 1020px) {
  .sidebar { width: 215px; padding-right: 15px; padding-left: 15px; }
  .main-content { margin-left: 215px; padding-right: 4%; padding-left: 4%; }
  .content-grid { grid-template-columns: minmax(0, 1fr) 235px; gap: 22px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; height: auto; padding: 13px 16px 11px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .lesson-nav { display: flex; gap: 6px; margin-top: 13px; overflow-x: auto; }
  .lesson-link { min-height: 35px; flex: 0 0 auto; gap: 7px; padding: 0 9px; border: 1px solid #edede7; }
  .nav-number { font-size: 9px; }
  .nav-title { font-size: 10px; }
  .nav-check { display: none; }
  .main-content { margin-left: 0; padding: 0 17px; }
  .topbar { height: 48px; }
  .content-grid { display: flex; flex-direction: column; gap: 22px; padding-top: 28px; }
  .lesson-column, .tutor-column { width: 100%; }
  .tutor-column { padding-top: 0; }
  .tutor-card, .notation-card { max-width: none; }
  .page-footer { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
