/* NOAI sky blue with Xiaozhan's reading, spacing, and feedback palette. */
:root {
  --sky: #5AAAE0;
  --chart-blue: #4299D0;
  --sky-light: #D6EEFB;
  --blue: #2B579A;
  --blue-hover: #21467F;
  --blue-light: #EEF7FD;
  --teal: #18B2A2;
  --teal-strong: #0D8176;
  --success-ink: #0C776D;
  --teal-light: #EDF6F5;
  --ink: #263238;
  --muted: #63686B;
  --subtle: #616E73;
  --line: #D8E4E6;
  --canvas: #F6FAFA;
  --surface: #FFFFFF;
  --code-bg: #F4F8FA;
  --warning: #96631E;
  --warning-light: #FFF7E8;
  --warning-line: #ECD7B0;
  --error: #AD454B;
  --error-light: #FDF1F1;
  --error-line: #E8C9CB;
  --focus: var(--blue);
  --focus-ring: rgb(90 170 224 / 20%);
  --shadow: rgb(38 50 56 / 10%);
  --backdrop: rgb(38 50 56 / 35%);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --side: 246px;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-size: 16px;
  background: var(--surface);
}

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

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

button {
  cursor: pointer;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button:focus-visible,a:focus-visible,summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

button svg,[data-icon] svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

button:hover {
  filter: none;
}

[hidden] {
  display: none!important;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  background: var(--blue-light);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 18px 17px 0;
  z-index: 40;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--blue);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  padding: 0 9px;
  line-height: 1.1;
}

.brand:hover {
  text-decoration: none;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.brand-lab {
  font-size: 19px;
  font-weight: 450;
  color: var(--muted);
  letter-spacing: -.2px;
}

.xiaozhan-logo {
  display: block;
  width: 140px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.auth-partner {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 9px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.auth-partner .xiaozhan-logo {
  width: 140px;
}

.auth-partner span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.primary-button:hover, .lesson-end button:hover, .input-row button:hover {
  background: var(--blue-hover);
}

.environment-button:hover, .icon-button:hover, .learning-entry:hover {
  background: var(--sky-light);
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.editor-wrap textarea:focus-visible, .exam-editor textarea:focus-visible {
  outline: none;
}

.workspace-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin: 10px 9px 14px;
}

.workspace-label span {
  font-size: 10px;
  letter-spacing: .3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 4px;
  color: var(--blue);
}

.side-label {
  display: flex;
  justify-content: space-between;
  margin: 0 12px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.side-label span {
  font-weight: 400;
  color: var(--muted);
}

.course-row {
  position: relative;
  margin: 3px 0;
}

.course-button {
  width: 100%;
  display: flex;
  align-items: flex-start;
  text-align: left;
  gap: 10px;
  padding: 12px 11px;
  border-radius: 8px;
  margin: 0;
  justify-content: flex-start;
  line-height: 1.65;
  color: var(--ink);
}

.course-button .number {
  flex: 0 0 24px;
  min-height: 48px;
  text-align: center;
  font-size: 12px;
  line-height: 24px;
  color: var(--subtle);
  font-family: var(--mono);
}

.course-button .course-name {
  font-size: 14px;
  max-width: 158px;
}

.course-button small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.course-button.active {
  background: var(--sky-light);
  color: var(--blue);
  box-shadow: inset 3px 0 0 var(--sky);
}

.course-button.active .number {
  color: var(--blue);
}

.course-button:hover:not(.active) {
  background: var(--surface);
}

.course-completion {
  position: absolute;
  left: 11px;
  top: 36px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}

.course-completion::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--subtle);
  border-radius: 50%;
  background: transparent;
}

.course-completion[aria-pressed="true"]::before {
  border-color: var(--teal);
  background: var(--teal);
}

.course-completion:hover::before {
  border-color: var(--teal-strong);
}

.course-completion[aria-busy="true"] {
  opacity: .5;
  cursor: wait;
}

.side-divider {
  margin: 25px 11px 22px;
  border-top: 1px solid var(--line);
}

#toc {
  overflow: auto;
  padding: 0 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

#toc a {
  display: block;
  position: relative;
  border-left: 1px solid var(--line);
  padding: 8px 10px 8px 16px;
  margin-left: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

#toc a:hover {
  color: var(--blue);
  text-decoration: none;
  background: var(--surface);
}

#toc a.active {
  color: var(--blue);
  border-left: 2px solid var(--sky);
  padding-left: 15px;
  background: var(--sky-light);
  font-weight: 600;
}

.sidebar-bottom {
  background: var(--blue-light);
  padding: 8px 5px 18px;
  border-top: 1px solid var(--line);
}

.roadmap-button {
  font-size: 13px;
  width: 100%;
  justify-content: flex-start;
  padding: 12px 6px;
  color: var(--blue);
}

.side-count {
  font: 11px var(--mono);
  color: var(--muted);
  margin-left: auto;
}

.owner {
  display: flex;
  align-items: center;
  gap: 11px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding: 20px 6px 23px;
  font-size: 13px;
  color: var(--ink);
}

.owner small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sky-light);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

.shell {
  margin-left: var(--side);
  background: var(--surface);
  min-height: 100vh;
}

.topbar {
  height: 69px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 35px;
  position: sticky;
  top: 0;
  background: var(--sky-light);
  z-index: 20;
}

.breadcrumb {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 18px;
  align-items: center;
  min-width: 0;
}

.breadcrumb b {
  font-weight: 500;
  color: var(--blue);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.breadcrumb span {
  color: var(--subtle);
}

.breadcrumb .breadcrumb-root {
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 17px;
  flex-shrink: 0;
  margin-left: 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: transparent;
}

.topbar .account-button {
  width: 40px;
  height: 40px;
  padding: 3px;
  border-radius: 50%;
  justify-content: center;
  flex-shrink: 0;
}

.topbar .account-button:hover {
  background: var(--surface);
}

.topbar .avatar {
  background: var(--surface);
  border: 1px solid var(--sky);
  color: var(--blue);
}

.account-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.environment-button {
  font-size: 13px;
  color: var(--blue);
  gap: 9px;
  padding: 7px;
  border-radius: 6px;
}

.environment-button svg {
  width: 16px;
}

.sidebar-bottom .environment-button {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 6px;
}

.sidebar-bottom .local-tag {
  margin-left: auto;
}

.local-tag {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--muted);
  background: var(--surface);
}

.lesson-bar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 0 35px;
  position: sticky;
  top: 69px;
  background: var(--surface);
  z-index: 20;
}

.tabs {
  display: flex;
  gap: 29px;
  height: 100%;
}

.tabs button {
  font-size: 14px;
  font-weight: 550;
  padding: 0 2px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}

.tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

#save-state {
  font-size: 12px;
  color: var(--muted);
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 5px;
}

.icon-button:hover {
  background: var(--blue-light);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0,1fr) 236px;
  max-width: 1450px;
  margin: 0 auto;
  gap: 46px;
  padding: 39px 35px 100px;
}

main {
  min-width: 0;
  outline: none;
}

.lesson-heading {
  margin-bottom: 24px;
}

.eyebrow {
  font: 11px var(--mono);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--blue);
  text-transform: uppercase;
  margin-bottom: 13px;
}

.lesson-heading h1 {
  font-size: 31px;
  letter-spacing: -.4px;
  line-height: 1.5;
  margin: 0 0 14px;
  font-weight: 650;
  color: var(--ink);
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 17px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.lesson-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-meta svg {
  width: 14px;
  height: 14px;
}

.lesson-meta .topic {
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
}

.notebook-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  margin-bottom: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 8px;
}

.kernel-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

#kernel-dot {
  background: var(--subtle);
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

#kernel-dot.ready {
  background: var(--teal);
}

#kernel-dot.busy {
  background: var(--warning);
  animation: pulse 1s infinite;
}

.toolbar-actions {
  display: flex;
  gap: 13px;
}

.toolbar-actions button {
  font-size: 12px;
  padding: 3px 0;
  color: var(--muted);
}

.toolbar-actions button:first-child {
  color: var(--blue);
}

.toolbar-actions svg {
  width: 13px;
  height: 13px;
}

.notebook {
  line-height: 1.95;
  font-size: 16px;
  color: var(--ink);
}

.markdown-cell p {
  margin: 16px 0;
}

.markdown-cell h2,.lecture-view h2 {
  font-size: 21px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -.3px;
  line-height: 1.65;
  margin: 37px 0 14px;
  padding-top: 2px;
  scroll-margin-top: 148px;
}

.markdown-cell h3,.lecture-view h3 {
  font-size: 17px;
  color: var(--ink);
  margin-top: 28px;
  scroll-margin-top: 148px;
}

.notebook strong {
  font-weight: 640;
  color: var(--ink);
}

.notebook code,.answer-content code {
  font-family: var(--mono);
  font-size: .84em;
  padding: 3px 5px;
  background: var(--code-bg);
  border-radius: 4px;
  color: var(--blue);
  overflow-wrap: anywhere;
}

.notebook pre,.answer-content pre {
  background: var(--code-bg);
  padding: 16px 19px;
  border-radius: 8px;
  font: 13px/1.8 var(--mono);
  overflow: auto;
  border-left: 2px solid var(--line);
}

.notebook pre code,.answer-content pre code {
  background: none;
  padding: 0;
  color: var(--ink);
  font: inherit;
  overflow-wrap: normal;
}

.notebook table,.answer-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  display: block;
  overflow: auto;
  margin: 22px 0;
}

.notebook th,.notebook td,.answer-content th,.answer-content td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  min-width: 80px;
}

.notebook th,.answer-content th {
  background: var(--blue-light);
  color: var(--ink);
  font-weight: 600;
}

.notebook blockquote {
  border-left: 3px solid var(--sky);
  padding-left: 18px;
  margin-left: 0;
  color: var(--muted);
}

.code-cell {
  margin: 23px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
  scroll-margin-top: 148px;
  box-shadow: none;
}

.code-cell:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.cell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 39px;
  background: var(--code-bg);
  border-bottom: 1px solid var(--line);
  padding: 0 13px;
  color: var(--muted);
  font-size: 11px;
}

.cell-head .cell-info {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cell-head .cell-info b {
  font: 11px var(--mono);
  color: var(--muted);
  font-weight: 400;
}

.cell-tag {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .2px;
}

.run-cell {
  font-size: 12px;
  color: var(--blue);
  gap: 5px;
}

.run-cell svg {
  width: 12px;
  height: 12px;
}

.cell-editor {
  display: flex;
  background: var(--code-bg);
  min-height: 60px;
  padding: 17px 14px 15px 0;
  align-items: flex-start;
}

.line-numbers {
  white-space: pre;
  width: 44px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 14px;
  font: 13px/1.8 var(--mono);
  color: var(--subtle);
  user-select: none;
}

.editor-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.editor-wrap textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 30px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  caret-color: var(--blue);
  font: 13px/1.8 var(--mono);
  padding: 0;
  margin: 0;
  tab-size: 4;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
}

.editor-wrap textarea::placeholder {
  color: var(--subtle);
}

.cell-output {
  font: 13px/1.85 var(--mono);
  color: var(--ink);
}

.cell-output:not(:empty) {
  border-top: 1px solid var(--line);
  padding: 13px 18px;
  background: var(--surface);
}

.cell-output pre {
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  color: inherit;
  max-height: 450px;
  overflow: auto;
}

.cell-output .error {
  color: var(--error);
}

.cell-output img {
  display: block;
  max-width: 100%;
  height: auto;
}

.cell-output iframe {
  width: 100%;
  border: 0;
  background: var(--surface);
  min-height: 160px;
}

.cell-output audio {
  max-width: 100%;
}

.output-label {
  font: 10px var(--mono);
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 7px;
}

.input-form {
  margin-top: 12px;
  padding: 13px;
  background: var(--blue-light);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.input-form label {
  display: block;
  font: 13px/1.7 -apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;
  color: var(--ink);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 9px;
}

.input-row input {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--sky);
  border-radius: 4px;
  padding: 8px 10px;
  font: 13px var(--mono);
  color: var(--ink);
  outline-color: var(--blue);
}

.input-row button {
  background: var(--blue);
  color: var(--surface);
  border-radius: 6px;
  font: 12px sans-serif;
  white-space: nowrap;
  padding: 8px 11px;
}

.cell-state {
  font-size: 11px;
  color: var(--muted);
  margin-right: 8px;
}

.cell-state.error-state {
  color: var(--error);
}

.code-cell.running {
  border-color: var(--sky);
}

.code-cell.exercise .cell-head {
  background: var(--blue-light);
}

.code-cell.exercise .cell-tag {
  color: var(--blue);
}

.add-cell {
  border: 1px dashed var(--sky);
  width: 100%;
  font-size: 13px;
  color: var(--blue);
  padding: 14px;
  border-radius: 8px;
  margin-top: 23px;
}

.add-cell svg {
  width: 15px;
}

.lesson-end {
  border-top: 1px solid var(--line);
  margin-top: 35px;
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.lesson-end button {
  background: var(--blue);
  color: var(--surface);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
}

.study-rail {
  padding-top: 6px;
  position: sticky;
  top: 152px;
  align-self: start;
  max-height: calc(100vh - 180px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.lesson-toc {
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.lesson-toc summary {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 14px;
  cursor: pointer;
}

.lesson-toc:not([open]) {
  padding-bottom: 0;
}

.lesson-toc summary::marker {
  color: var(--sky);
}

.study-guide {
  min-width: 0;
}

.lesson-project {
  margin-bottom: 26px;
}

.guide-eyebrow {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.4px;
  margin-bottom: 15px;
}

.project-card {
  background: var(--blue-light);
  border-left: 3px solid var(--sky);
  padding: 17px 20px;
  border-radius: 8px;
  color: var(--blue);
}

.project-card .project-icon {
  display: inline-flex;
  color: var(--blue);
  margin-bottom: 10px;
}

.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
  margin: 0 0 6px;
}

.project-card p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}

.project-steps {
  margin-top: 10px;
  font: 12px/2 var(--mono);
  color: var(--blue);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lesson-project .guide-eyebrow {
  color: var(--blue);
  font-size: 12px;
  letter-spacing: 0;
  margin-bottom: 6px;
}

.lesson-project .project-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.lesson-project .project-icon {
  display: inline-flex;
  flex-shrink: 0;
  margin: 1px 0 0;
}

.lesson-project .project-icon svg {
  width: 20px;
  height: 20px;
}

.lesson-project .project-copy {
  min-width: 0;
}

.lesson-project .project-steps {
  line-height: 1.8;
}

.project-steps span:not(:last-child)::after {
  content: " /";
  color: var(--muted);
}

.guide-section {
  padding: 26px 1px 22px;
  border-bottom: 1px solid var(--line);
}

.guide-section h4 {
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 16px;
  font-weight: 650;
}

.guide-section ul {
  padding: 0;
  list-style: none;
  margin: 0;
}

.guide-section li {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  padding-left: 17px;
  position: relative;
  margin: 10px 0;
}

.guide-section li::before {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  left: 0;
  top: 9px;
  background: var(--teal);
  border-radius: 50%;
}

.guide-section .guide-action {
  font-size: 12px;
  color: var(--blue);
  padding: 6px 0;
  justify-content: flex-start;
}

.guide-action svg {
  width: 14px;
  height: 14px;
}

.guide-hint {
  font-size: 12px;
  line-height: 1.95;
  color: var(--muted);
  margin: 20px 0;
}

.guide-hint kbd {
  color: var(--muted);
  border-color: var(--line);
}

.statusbar {
  height: 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--canvas);
  border-top: 1px solid var(--line);
  padding: 0 25px;
  position: fixed;
  left: var(--side);
  right: 0;
  bottom: 0;
  z-index: 30;
  font-size: 11px;
  color: var(--muted);
}

.statusbar>span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.statusbar svg {
  width: 12px;
  height: 12px;
  margin-right: 3px;
}

.statusbar i {
  height: 12px;
  border-left: 1px solid var(--line);
  margin: 0 12px;
}

kbd {
  font: 10px var(--mono);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 2px 4px;
  border-radius: 3px;
}

.mobile-menu {
  display: none;
}

.loading {
  padding: 70px 0;
  color: var(--muted);
}

.banner-error {
  background: var(--error-light);
  border: 1px solid var(--error-line);
  border-radius: 5px;
  padding: 16px;
  color: var(--error);
  font-size: 14px;
}

.banner-error button {
  color: var(--blue);
  margin-left: 14px;
}

.empty-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
}

.output-note {
  font: 12px/1.7 sans-serif;
  color: var(--muted);
  margin: 6px 0;
}

#toast {
  position: fixed;
  bottom: 55px;
  left: calc(50% + 100px);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  border-radius: 8px;
  box-shadow: 0 8px 30px var(--shadow);
  padding: 12px 20px;
  font-size: 13px;
  line-height: 1.7;
  z-index: 100;
  max-width: min(550px,90vw);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

#toast.show {
  opacity: 1;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: min(790px,calc(100vw - 30px));
  max-height: 85vh;
  box-shadow: 0 24px 90px var(--shadow);
  color: var(--ink);
  background: var(--surface);
}

dialog: :backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 27px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.dialog-header h2 {
  font-size: 20px;
  margin: 0;
  font-weight: 600;
}

#dialog-content {
  padding: 24px 27px 30px;
}

.dialog-intro {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
  margin: 0 0 22px;
}

.roadmap-row {
  display: grid;
  grid-template-columns: 32px 1fr 57px;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

.roadmap-row .num {
  color: var(--muted);
  font: 12px var(--mono);
  padding-top: 4px;
}

.roadmap-row h3 {
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  font-weight: 550;
}

.roadmap-row p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin: 6px 0 0;
}

.roadmap-row .badge {
  font-size: 11px;
  padding: 4px 6px;
  background: var(--blue-light);
  color: var(--muted);
  border-radius: 4px;
  text-align: center;
}

.roadmap-row .badge.available {
  color: var(--success-ink);
  background: var(--teal-light);
}

.roadmap-row button {
  text-align: left;
  justify-content: flex-start;
  color: var(--blue);
}

.env-group {
  margin: 22px 0 12px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
}

.package-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font: 13px var(--mono);
}

.package-row .installed {
  color: var(--success-ink);
}

.package-row .not-installed {
  color: var(--muted);
  font: 12px sans-serif;
}

.environment-summary {
  background: var(--blue-light);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
}

.answer-content {
  font-size: 15px;
  line-height: 1.9;
}

.answer-content h1 {
  display: none;
}

.answer-content details {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 13px 0;
  overflow: hidden;
}

.answer-content summary {
  padding: 13px 15px;
  font-size: 14px;
  background: var(--blue-light);
  cursor: pointer;
  color: var(--blue);
}

.answer-content .answer-body {
  padding: 3px 19px 16px;
}

.answer-content h2 {
  font-size: 17px;
}

.lecture-view {
  line-height: 1.95;
}

.lecture-view h1 {
  display: none;
}

.exercise-answer-button {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}

.source-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-top: 22px;
}

.error-details {
  white-space: pre-wrap;
  font-size: 12px;
}

.notebook ul,.notebook ol {
  padding-left: 24px;
}

.notebook li {
  margin: 8px 0;
}

.offline-bar {
  color: var(--warning)!important;
}

@keyframes pulse {
  50% {
    opacity: .4;
  }

}

@media(min-width:1600px) {
  .workspace {
    padding-left: 65px;
    padding-right: 65px;
    gap: 64px;
  }

  .topbar,.lesson-bar {
    padding-left: 55px;
    padding-right: 55px;
  }

}

@media(max-width:1200px) {
  :root {
    --side: 225px;
  }

  .workspace {
    gap: 25px;
    padding-left: 28px;
    padding-right: 28px;
    grid-template-columns: minmax(0,1fr) 220px;
  }

  .project-card {
    padding: 18px 15px;
  }

  .toolbar-actions {
    gap: 10px;
  }

  .lesson-heading h1 {
    font-size: 27px;
  }

  .course-button .course-name {
    max-width: 143px;
  }

  .topbar,.lesson-bar {
    padding-left: 28px;
    padding-right: 28px;
  }

}

@media(max-width:1000px) {
  .workspace {
    grid-template-columns: minmax(0,1fr);
    max-width: 850px;
  }

  .workspace > main {
    grid-row: 2;
  }

  .study-rail {
    grid-row: 1;
    position: static;
    padding-top: 0;
    max-height: none;
    overflow: visible;
  }

  .lesson-toc {
    background: var(--blue-light);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
  }

  .lesson-toc:not([open]) {
    padding-bottom: 14px;
  }

  .lesson-toc summary {
    margin-bottom: 0;
  }

  .lesson-toc[open] summary {
    margin-bottom: 12px;
  }

  .lesson-toc #toc {
    max-height: 220px;
  }

  .study-guide {
    display: none;
  }

  .statusbar>span:last-child {
    font-size: 0;
  }

  .statusbar>span:last-child kbd {
    font-size: 10px;
  }

  .lesson-heading h1 {
    font-size: 29px;
  }

}

@media(max-width:700px) {
  :root {
    --side: 0px;
  }

  .sidebar {
    width: 246px;
    transform: translateX(-100%);
    transition: transform .2s;
    box-shadow: 15px 0 50px var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar {
    height: 59px;
    padding: 0 16px;
    gap: 8px;
  }

  .topbar-actions {
    gap: 7px;
    margin-left: 0;
  }

  .topbar-brand {
    padding: 4px 6px;
  }

  .topbar-brand .xiaozhan-logo {
    width: 120px;
  }

  .breadcrumb {
    font-size: 12px;
    gap: 9px;
    margin-right: auto;
  }

  .mobile-menu {
    display: flex;
  }

  .environment-button {
    font-size: 11px;
    gap: 6px;
  }

  .lesson-bar {
    top: 59px;
    padding: 0 20px;
    height: 51px;
  }

  .bar-actions {
    gap: 5px;
  }

  .tabs {
    gap: 16px;
  }

  .tabs button {
    font-size: 13px;
  }

  .workspace {
    padding: 27px 21px 65px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .lesson-heading h1 {
    font-size: 26px;
    line-height: 1.5;
  }

  .lesson-meta {
    gap: 12px;
    font-size: 11px;
  }

  .notebook {
    font-size: 16px;
  }

  .markdown-cell h2 {
    font-size: 20px;
  }

  .notebook-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
    padding: 12px 0;
  }

  .toolbar-actions {
    width: 100%;
    gap: 22px;
  }

  .cell-editor {
    padding-right: 10px;
  }

  .line-numbers {
    width: 32px;
    padding-right: 10px;
    font-size: 12px;
  }

  .editor-wrap textarea {
    font-size: 12px;
  }

  .statusbar {
    padding: 0 16px;
  }

  .statusbar>span:last-child {
    display: none;
  }

  #toast {
    left: 50%;
    width: max-content;
  }

  .lesson-end {
    align-items: flex-start;
    gap: 15px;
  }

  #dialog-content {
    padding: 20px;
  }

  .dialog-header {
    padding: 20px;
  }

  .roadmap-row {
    gap: 9px;
    grid-template-columns: 25px 1fr 52px;
  }

}

@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior: auto!important;
    animation: none!important;
    transition: none!important;
  }

}

/* Files remain the content source; these styles apply to every imported lesson. */
#courses {
  max-height: none;
  overflow: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.import-button {
  justify-content: flex-start;
  width: 100%;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--blue);
  border: 1px dashed var(--sky);
  border-radius: 8px;
  margin-top: 9px;
  min-height: 38px;
  flex-shrink: 0;
}

.import-button svg {
  width: 15px;
  height: 15px;
}

.file-label {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.file-label svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.markdown-cell h1,.lecture-view h1 {
  display: block;
  font-size: 29px;
  line-height: 1.6;
  letter-spacing: -.6px;
  color: var(--ink);
  margin: 28px 0 18px;
}

.markdown-cell img,.lecture-view img {
  max-width: 100%;
  height: auto;
}

.file-field {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin: 22px 0;
}

.file-field span {
  font-size: 12px;
  color: var(--muted);
  margin-left: 10px;
}

.file-field input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--blue-light);
  border-radius: 6px;
  margin-top: 10px;
  font-size: 13px;
  padding: 13px;
  color: var(--muted);
}

.file-field input::file-selector-button {
  background: var(--sky-light);
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--blue);
  margin-right: 12px;
  cursor: pointer;
}

.import-note {
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
}

.primary-button {
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 8px;
  background: var(--blue);
  color: var(--surface);
  font-weight: 550;
}

#import-error {
  font-size: 13px;
  color: var(--error);
  line-height: 1.8;
}

#content .markdown-cell:first-child>p:first-child {
  margin-top: 0;
}

@media(max-width:700px) {
  .markdown-cell h1,.lecture-view h1 {
    font-size: 25px;
  }

  .file-label {
    font-size: 12px;
  }

}

.review-view {
  container-type: inline-size;
}

.review-heading h1 {
  font-size: 27px;
  line-height: 1.6;
  color: var(--ink);
  letter-spacing: -.5px;
  margin: 0 0 22px;
}

.review-heading h2 {
  font-size: 21px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 7px;
  scroll-margin-top: 148px;
}

.review-heading p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.review-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 18px;
  font-size: 12px;
  color: var(--muted);
}

.review-controls>div {
  display: flex;
  gap: 7px;
}

.review-controls button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue);
  padding: 6px 10px;
  white-space: nowrap;
}

.review-controls button:hover {
  background: var(--blue-light);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 17px;
  align-items: start;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 20px 20px 0;
  min-width: 0;
  overflow: hidden;
}

.review-card h3 {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 12px;
  font-weight: 650;
}

.review-question {
  font-size: 14px;
  line-height: 1.85;
  color: var(--muted);
  padding-bottom: 17px;
}

.review-question p,.review-answer p {
  margin: 0 0 10px;
}

.review-question>:last-child,.review-answer>:last-child {
  margin-bottom: 0;
}

.review-card details {
  border-top: 1px solid var(--line);
  margin: 0 -20px;
}

.review-card summary {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.7;
  color: var(--blue);
  background: var(--blue-light);
}

.review-card summary:hover {
  background: var(--blue-light);
}

.review-card summary:focus-visible {
  outline-offset: -4px;
}

.review-answer {
  padding: 15px 20px 20px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.review-card pre {
  font-size: 12px;
  line-height: 1.8;
  padding: 11px 12px;
  margin: 10px 0;
  border-left: 0;
  background: var(--code-bg);
}

.review-card ul,.review-card ol {
  padding-left: 20px;
  margin: 8px 0;
}

.review-card li {
  margin: 4px 0;
}

@container(max-width:540px) {
  .review-grid {
    grid-template-columns: minmax(0,1fr);
  }

}

@media(max-width:700px) {
  .review-heading h1 {
    font-size: 24px;
  }

  .review-grid {
    grid-template-columns: minmax(0,1fr);
  }

  .tabs {
    gap: 15px;
  }

  .tabs button {
    white-space: nowrap;
  }

}

@media(max-width:520px) {
  #save-state {
    display: none;
  }

  .lesson-bar {
    padding-left: 17px;
    padding-right: 12px;
  }

  .review-controls {
    font-size: 11px;
  }

  .review-controls button {
    padding: 6px 8px;
  }

}

/* Chapter exams share the lesson workspace; student code and reports remain separate. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.exam-hub-button {
  justify-content: flex-start;
  width: 100%;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--blue);
  margin-top: 3px;
  min-height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.exam-hub-button.active,.exam-hub-button:hover {
  background: var(--sky-light);
  color: var(--blue);
}

.course-exam-button {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 11px 12px 12px;
  text-align: left;
  color: var(--blue);
  border-left: 2px solid var(--sky);
  margin: 6px 0 10px 6px;
  max-width: calc(100% - 6px);
  font-size: 12px;
  line-height: 1.7;
  border-radius: 0 5px 5px 0;
}

.course-exam-button svg {
  width: 13px;
  height: 13px;
  margin-top: 4px;
  flex-shrink: 0;
}

.course-exam-button small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.course-exam-button.active {
  background: var(--sky-light);
  color: var(--blue);
}

.course-exam-button:hover {
  background: var(--sky-light);
}

.exam-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}

.exam-bar button {
  font-size: 12px;
  color: var(--blue);
  white-space: nowrap;
}

.exam-bar>span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-exam-entry {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--blue-light);
}

.chapter-exam-entry h3 {
  font-size: 17px;
  margin: 5px 0;
  color: var(--ink);
}

.chapter-exam-entry p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}

.chapter-exam-entry button {
  white-space: nowrap;
  flex-shrink: 0;
}

.exam-mode .statusbar>span:last-child {
  font-size: 0;
}

.exam-mode .statusbar>span:last-child kbd {
  display: none;
}

.exam-mode .statusbar>span:last-child i {
  display: none;
}

.exam-mode .statusbar>span:last-child::after {
  content: '作答自动保存在本机';
  font-size: 11px;
}

.exam-view {
  font-size: 15px;
  line-height: 1.85;
}

.exam-view h1 {
  font-size: 29px;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -.5px;
  margin: 10px 0 15px;
}

.exam-view h2 {
  font-size: 21px;
  line-height: 1.65;
  color: var(--ink);
  margin: 34px 0 16px;
  scroll-margin-top: 146px;
}

.exam-view h3 {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.7;
}

.exam-view p {
  margin: 12px 0;
}

.exam-view pre {
  color: var(--blue);
}

.exam-kicker {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .8px;
}

.exam-heading {
  margin-bottom: 29px;
}

.exam-heading>p {
  font-size: 14px;
  line-height: 1.95;
  color: var(--muted);
}

.exam-heading h1 {
  margin-top: 9px;
}

.exam-list {
  display: grid;
  gap: 20px;
}

.exam-list-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 25px;
  background: var(--surface);
}

.exam-list-card h2 {
  font-size: 20px;
  margin: 10px 0;
}

.exam-list-card>p {
  color: var(--muted);
  font-size: 14px;
}

.exam-list-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exam-list-meta>span {
  background: var(--blue-light);
  color: var(--blue);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}

.exam-inline-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 15px 0 20px;
}

.exam-list-card .exam-latest {
  color: var(--blue);
  font-size: 12px;
}

.exam-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--blue);
  padding: 8px 13px;
  font-size: 13px;
  line-height: 1.7;
}

.exam-secondary:hover {
  background: var(--blue-light);
}

.exam-secondary svg {
  width: 13px;
  height: 13px;
}

.exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 25px 0;
}

.exam-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 26px 0 30px;
  padding: 20px 0;
  background: var(--blue-light);
}

.exam-stats>div {
  text-align: center;
  border-right: 1px solid var(--line);
}

.exam-stats>div:last-child {
  border: 0;
}

.exam-stats b {
  font: 600 25px/1.4 var(--mono);
  color: var(--blue);
  display: block;
}

.exam-stats span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 5px;
}

.exam-notice {
  background: var(--blue-light);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 20px 23px;
  font-size: 14px;
  color: var(--ink);
}

.exam-notice h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.exam-notice ul {
  margin: 0;
  padding-left: 20px;
}

.exam-notice li {
  margin: 7px 0;
}

.exam-topic-tags {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.exam-topic-tags span {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-light);
}

.exam-history {
  border-top: 1px solid var(--line);
}

.exam-history button {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  width: 100%;
  justify-content: space-between;
  text-align: left;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px 4px;
  color: var(--muted);
  font-size: 13px;
}

.exam-history button:hover {
  background: var(--blue-light);
}

.exam-history button b {
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
}

.exam-sources p,.exam-sources li {
  font-size: 12px;
  color: var(--muted);
}

.exam-sources li>span {
  display: block;
  margin-top: 5px;
}

.exam-attempt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.exam-save-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-line);
  border-radius: 8px;
  padding: 15px 18px;
  font-size: 13px;
  margin-bottom: 22px;
}

.exam-question {
  border-top: 1px solid var(--line);
  padding: 28px 0 32px;
  scroll-margin-top: 142px;
}

.exam-question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.exam-question-meta>b {
  font-weight: 500;
  color: var(--muted);
}

.exam-question h2 {
  margin: 10px 0 17px;
  font-size: 20px;
}

.exam-prompt {
  font-size: 15px;
  line-height: 1.95;
}

.exam-prompt pre {
  font-size: 13px;
}

.exam-options {
  border: 0;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.exam-options label {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.exam-options label:has(input:checked) {
  border-color: var(--sky);
  background: var(--blue-light);
  color: var(--blue);
}

.exam-options label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.exam-options input {
  margin-top: 6px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.exam-option-letter {
  font: 12px/2.1 var(--mono);
  color: var(--muted);
  min-width: 12px;
}

.exam-options label>span:last-child {
  min-width: 0;
}

.exam-options p {
  margin: 0;
}

.exam-clear {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  padding: 3px 0;
}

.exam-samples {
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 15px 18px;
  margin: 20px 0;
  border-radius: 8px;
  font-size: 13px;
}

.exam-samples h3 {
  font-size: 13px;
  margin: 0 0 12px;
  color: var(--muted);
}

.exam-samples>div {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.exam-samples>div>b {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.exam-samples p {
  margin: 6px 0;
}

.exam-editor {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--code-bg);
  margin: 20px 0 13px;
}

.exam-editor:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.exam-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  background: var(--blue-light);
  border-bottom: 1px solid var(--line);
  padding: 10px 15px;
}

.exam-editor textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 170px;
  border: 0;
  outline: none;
  background: transparent;
  font: 13px/1.8 var(--mono);
  color: var(--ink);
  padding: 14px 17px;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.exam-editor textarea:disabled {
  color: var(--muted);
}

.exam-run-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.exam-run-controls>span {
  font-size: 11px;
  color: var(--muted);
}

.exam-custom {
  margin: 18px 0;
  font-size: 12px;
  color: var(--muted);
}

.exam-custom summary {
  cursor: pointer;
  color: var(--muted);
}

.exam-custom label {
  display: block;
  font-size: 12px;
  line-height: 1.9;
  margin: 13px 0 7px;
}

.exam-custom textarea {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  font: 12px/1.8 var(--mono);
  color: var(--blue);
  margin: 9px 0;
  resize: vertical;
}

.exam-output:empty {
  display: none;
}

.exam-output {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 15px 18px;
  font-size: 12px;
  color: var(--ink);
}

.exam-output>p {
  margin: 0;
}

.exam-run-result+div {
  border-top: 1px solid var(--line);
  margin-top: 13px;
  padding-top: 13px;
}

.exam-run-result>b {
  font-size: 12px;
  color: var(--success-ink);
  font-weight: 550;
}

.exam-run-result.error>b,.exam-output .error {
  color: var(--error);
}

.exam-run-result p {
  font-size: 12px;
  margin: 7px 0;
}

.exam-output pre {
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  font-size: 12px;
  border: 0;
  background: var(--surface);
  margin: 8px 0;
}

.exam-question-nav {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 8px;
}

.exam-question-nav button {
  border: 1px solid var(--line);
  border-radius: 4px;
  aspect-ratio: 1;
  min-width: 30px;
  color: var(--muted);
  font: 12px var(--mono);
  background: var(--surface);
}

.exam-question-nav button.answered {
  background: var(--teal-light);
  color: var(--success-ink);
  border-color: var(--teal);
}

.exam-guide-copy {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  margin: 15px 0;
}

.exam-submit-section {
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.exam-submit-section>p {
  font-size: 13px;
  color: var(--muted);
}

.exam-confirm {
  margin-top: 23px;
  padding: 20px 23px;
  border: 1px solid var(--sky);
  border-radius: 9px;
  background: var(--blue-light);
  scroll-margin-top: 155px;
}

.exam-confirm h3 {
  font-size: 16px;
  margin: 0 0 13px;
}

.exam-confirm p {
  font-size: 13px;
  color: var(--muted);
}

.exam-confirm .exam-actions {
  margin-bottom: 0;
}

.exam-score-summary {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 20px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--blue-light);
  padding: 24px;
  border-radius: 9px;
  margin: 25px 0 34px;
}

.exam-total-score strong {
  font: 600 42px var(--mono);
  color: var(--blue);
}

.exam-total-score>span {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

.exam-score-summary>div:not(:first-child) {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.exam-score-summary>div:not(:first-child)>span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.exam-score-summary>div:not(:first-child)>b {
  display: block;
  font: 500 17px var(--mono);
  color: var(--blue);
  margin-top: 10px;
}

.exam-topic-report {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 15px;
}

.exam-topic-report>article {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 19px;
  min-width: 0;
}

.exam-topic-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}

.exam-topic-title h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
}

.exam-status {
  font-size: 10px;
  border-radius: 4px;
  padding: 3px 6px;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--blue-light);
  color: var(--muted);
}

.exam-status.good {
  background: var(--teal-light);
  color: var(--success-ink);
}

.exam-status.partial {
  background: var(--warning-light);
  color: var(--warning);
}

.exam-status.weak {
  background: var(--error-light);
  color: var(--error);
}

.exam-topic-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 15px;
}

.exam-topic-score>b {
  font: 12px var(--mono);
  color: var(--blue);
}

.exam-topic-track {
  height: 4px;
  background: var(--teal-light);
  margin-top: 8px;
  border-radius: 2px;
  overflow: hidden;
}

.exam-topic-track>span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.exam-topic-report p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.85;
  margin: 13px 0;
}

.exam-topic-report .exam-missed {
  color: var(--error);
  font-size: 11px;
}

.exam-lesson-link {
  font-size: 11px;
  line-height: 1.8;
  color: var(--blue);
  padding: 4px 0;
  margin-right: 15px;
}

.exam-recommendation {
  border-left: 2px solid var(--sky);
  padding: 2px 0 3px 18px;
  margin: 24px 0;
}

.exam-recommendation h3 {
  font-size: 15px;
  margin: 0;
}

.exam-recommendation p {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0;
}

.exam-result-question {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  margin: 13px 0;
}

.exam-result-question>summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px;
  background: var(--blue-light);
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.exam-result-question>summary>span:first-child::before {
  content: '＋';
  display: inline-block;
  margin-right: 9px;
  color: var(--muted);
}

.exam-result-question[open]>summary>span:first-child::before {
  content: '−';
}

.exam-result-question>summary>span:last-child {
  font-size: 11px;
  white-space: nowrap;
  color: var(--muted);
}

.exam-result-body {
  padding: 9px 21px 23px;
  font-size: 14px;
}

.exam-result-body .exam-prompt {
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.exam-result-body pre {
  font-size: 12px;
  line-height: 1.85;
}

.exam-result-body h3 {
  font-size: 14px;
  margin: 22px 0 10px;
}

.exam-test-results>details {
  border-top: 1px solid var(--line);
}

.exam-test-results summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 12px 0;
}

.exam-test-results summary b {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.exam-test-results>details>div {
  padding: 0 12px 12px;
  background: var(--surface);
  font-size: 12px;
}

.exam-report-notice {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 30px!important;
}

@media(max-width:1200px) {
  .exam-topic-report {
    grid-template-columns: 1fr;
  }

  .exam-question-nav {
    gap: 6px;
  }

  .exam-score-summary {
    gap: 13px;
    padding: 20px;
  }

  .exam-total-score strong {
    font-size: 35px;
  }

  .exam-score-summary>div:not(:first-child) {
    padding-left: 16px;
  }

  .exam-editor-header>span:last-child {
    font-size: 10px;
  }

}

@media(max-width:700px) {
  .exam-hub-button {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .exam-view h1 {
    font-size: 25px;
  }

  .exam-view h2 {
    font-size: 19px;
  }

  .exam-list-card {
    padding: 20px;
  }

  .chapter-exam-entry {
    padding: 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .exam-bar {
    gap: 12px;
    font-size: 12px;
  }

  .exam-bar>span {
    max-width: 48vw;
  }

  .exam-stats {
    padding: 17px 0;
  }

  .exam-stats b {
    font-size: 22px;
  }

  .exam-score-summary {
    padding: 18px 15px;
    gap: 8px;
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .exam-total-score strong {
    font-size: 29px;
  }

  .exam-total-score>span {
    font-size: 10px;
    margin-left: 4px;
  }

  .exam-score-summary>div:not(:first-child) {
    padding-left: 12px;
  }

  .exam-score-summary>div:not(:first-child)>b {
    font-size: 14px;
  }

  .exam-score-summary>div:not(:first-child)>span {
    font-size: 10px;
  }

  .exam-notice {
    padding: 18px;
    font-size: 13px;
  }

  .exam-history button {
    font-size: 11px;
  }

  .exam-editor-header {
    padding: 10px 12px;
    font-size: 10px;
  }

  .exam-editor-header>span:last-child {
    display: none;
  }

  .exam-editor textarea {
    font-size: 12px;
    padding: 13px;
  }

  .exam-result-question>summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 13px 15px;
  }

  .exam-result-body {
    padding: 8px 15px 20px;
  }

  .exam-options label {
    padding: 11px 12px;
    gap: 8px;
  }

  .exam-attempt-meta {
    gap: 11px;
  }

  .exam-confirm {
    padding: 18px;
  }

  .exam-confirm .primary-button {
    font-size: 12px;
  }

  .exam-result-question>summary>span:last-child {
    padding-left: 22px;
  }

}

/* Explicit updates keep saved learning records separate from course originals. */
.source-update-notice {
  margin: 22px 0 8px;
  padding: 19px 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--sky);
  border-radius: 8px;
  background: var(--blue-light);
}

.source-update-notice h2 {
  font-size: 17px;
  margin: 0 0 9px;
  color: var(--blue);
}

.source-update-notice p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin: 7px 0;
}

.source-update-notice .source-update-note {
  font-size: 12px;
  color: var(--muted);
}

.source-update-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 15px;
  font-size: 12px;
}

.source-update-actions button {
  padding: 10px 15px;
  font-size: 13px;
}

.source-backups {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0;
  line-height: 1.9;
}

.source-backups summary {
  cursor: pointer;
}

.source-backups ul {
  padding-left: 20px;
}

.source-version-note {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin: 16px 0 0;
}

.source-example-notice {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 15px;
  background: var(--blue-light);
  font-size: 11px;
  color: var(--muted);
}

.source-example-notice button {
  font-size: 12px;
  color: var(--blue);
}

.source-example-code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.8 var(--mono);
  background: var(--code-bg);
  padding: 18px;
  max-height: 65vh;
  overflow: auto;
}

.embedded-data summary {
  padding: 13px 16px;
  background: var(--blue-light);
  font-size: 12px;
  color: var(--blue);
  cursor: pointer;
}

.embedded-data .cell-editor {
  max-height: 420px;
  overflow: auto;
}

/* Account entry and learning history share the existing type and spacing. */
.auth-pending>.sidebar,.auth-pending>.shell {
  display: none;
}

#auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: var(--blue-light);
}

#auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(430px,100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 36px;
  color: var(--ink);
  box-shadow: 0 12px 40px var(--shadow);
  border-top: 4px solid var(--sky);
}

.auth-card .brand {
  color: var(--blue);
  margin-bottom: 28px;
  padding: 0;
}

.auth-card h1 {
  font-size: 25px;
  margin: 8px 0 12px;
  font-weight: 650;
  line-height: 1.5;
}

.auth-eyebrow {
  font-size: 12px;
  color: var(--blue);
  letter-spacing: .04em;
}

.auth-intro,.auth-note {
  line-height: 1.8;
  color: var(--muted);
  font-size: 14px;
}

.auth-card label {
  display: block;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 600;
}

.auth-card input {
  display: block;
  width: 100%;
  padding: 11px 12px;
  margin-top: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
  color: var(--ink);
}

.auth-card input:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--focus);
}

.auth-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.auth-card .primary-button {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.auth-switch {
  display: block;
  margin: 18px auto 0;
  border: 0;
  background: none;
  color: var(--blue);
  padding: 8px;
  cursor: pointer;
}

#auth-error,#account-error,#review-note-error {
  color: var(--error);
  font-size: 13px;
  line-height: 1.6;
  min-height: 1em;
}

.account-button {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  padding: 0;
}

.account-button b {
  font-weight: 500;
}

.account-button small {
  display: block;
}

.legacy-import {
  margin: 24px 0;
  padding: 18px;
  background: var(--blue-light);
  border-radius: 8px;
}

.account-details p {
  line-height: 1.8;
  color: var(--muted);
}

.learning-entry-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 16px;
  margin: 28px 0;
}

.learning-entry {
  display: block;
  text-align: left;
  background: var(--blue-light);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 22px;
  color: var(--ink);
  cursor: pointer;
}

.learning-entry strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.learning-entry span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 22px;
  margin: 14px 0;
  background: var(--surface);
}

.history-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.history-card p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.history-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 16px;
}

.review-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.review-filters select {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}

.review-note {
  margin: 26px 0;
  padding: 20px;
  background: var(--blue-light);
  border-radius: 9px;
}

.review-note textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
  font: inherit;
  color: var(--ink);
}

.review-note label {
  display: block;
  margin: 10px 0;
  font-size: 14px;
}

@media(max-width:650px) {
  .learning-entry-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 24px;
  }

  .history-card {
    padding: 16px;
  }

}

/* Course list scrolls independently above the local environment controls. */
.sidebar {
  overflow-y: auto;
}

.sidebar .workspace-label {
  margin-bottom: 14px;
}

#courses {
  flex: 1 1 auto;
  min-height: 110px;
}

.sidebar .side-divider {
  margin-top: 12px;
  margin-bottom: 10px;
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 8px;
}

#review-note-error {
  color: var(--muted);
}
