:root {
  --ink: #152a30;
  --muted: #5b6d73;
  --soft: #f5f7f8;
  --card: #ffffff;
  --line: #d7e0e3;
  --line-strong: #b7c5ca;
  --teal: #0d7b70;
  --teal-dark: #075f57;
  --coral: #c7533d;
  --violet: #6554a8;
  --amber: #b56d1c;
  --sky: #177a9b;
  --ok: #187a5d;
  --bad: #b03a32;
  --code-bg: #132127;
  --code-ink: #e8f2f0;
  --shadow: 0 10px 28px rgba(28, 51, 58, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

code,
pre,
textarea {
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

svg.lucide {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
}

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: max-content;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--ink);
  border-radius: 8px;
}

.brand-mark svg.lucide {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 15px;
}

.brand-text small {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.main-nav a {
  color: #3f545a;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  white-space: nowrap;
}

.main-nav a:hover {
  background: #eaf1f1;
  color: var(--ink);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.engine-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #ffffff;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b8c2c5;
}

.engine-status.ready {
  color: var(--teal-dark);
  border-color: #a9d3cb;
  background: #f0faf8;
}

.engine-status.ready .status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 123, 112, 0.15);
}

.engine-status.loading .status-dot {
  background: var(--amber);
  animation: status-blink 1s infinite;
}

.engine-status.error {
  color: var(--bad);
  border-color: #e6b5b0;
  background: #fff4f2;
}

.engine-status.error .status-dot {
  background: var(--bad);
}

@keyframes status-blink {
  50% {
    opacity: 0.35;
  }
}

.save-btn,
.btn,
.ghost-btn,
.run-btn,
.lab-action,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
}

.save-btn {
  padding: 8px 12px;
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--ink);
  font-size: 13px;
}

.save-btn:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.btn {
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary {
  color: #ffffff;
  background: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--coral);
  color: #983c2b;
}

.ghost-btn {
  padding: 7px 10px;
  border-color: var(--line);
  background: #ffffff;
  color: #44575d;
  font-size: 12.5px;
}

.ghost-btn:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.run-btn {
  padding: 9px 13px;
  color: #ffffff;
  background: var(--violet);
  font-size: 13px;
  font-weight: 600;
}

.run-btn:hover {
  background: #50408d;
}

.overview {
  padding: 58px 0 42px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8faf9 78%, var(--soft) 100%);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.72fr);
  gap: 36px;
  align-items: center;
}

.eyebrow,
.kicker,
.board-kicker {
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}

.overview h1 {
  margin: 12px 0 14px;
  font-size: 39px;
  line-height: 1.25;
  max-width: 780px;
}

.overview-lead {
  margin: 0;
  color: #44575d;
  font-size: 16.5px;
  max-width: 760px;
}

.progress-block {
  margin-top: 26px;
  max-width: 560px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
}

.progress-meta strong {
  color: var(--ink);
}

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

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #4ba89b);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.course-board {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.board-kicker {
  margin: 0 0 12px;
  color: var(--sky);
}

.course-touch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.course-touch-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}

.touch-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #eaf5f3;
  color: var(--teal);
}

.course-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 2px;
  background: #f5f7f7;
  border-radius: 6px;
}

.stat strong {
  font-size: 17px;
  line-height: 1.25;
}

.stat span {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 46px;
}

.roadmap-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.roadmap-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.roadmap-card:nth-child(1) {
  border-top: 3px solid var(--coral);
}

.roadmap-card:nth-child(2) {
  border-top: 3px solid var(--teal);
}

.roadmap-card:nth-child(3) {
  border-top: 3px solid var(--violet);
}

.roadmap-card:nth-child(4) {
  border-top: 3px solid var(--amber);
}

.roadmap-no {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  background: var(--ink);
}

.roadmap-card:nth-child(1) .roadmap-no {
  background: var(--coral);
}

.roadmap-card:nth-child(2) .roadmap-no {
  background: var(--teal);
}

.roadmap-card:nth-child(3) .roadmap-no {
  background: var(--violet);
}

.roadmap-card:nth-child(4) .roadmap-no {
  background: var(--amber);
}

.roadmap-card h2 {
  margin: 0 0 5px;
  font-size: 16px;
  line-height: 1.3;
}

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

.roadmap-card em {
  color: var(--teal-dark);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.lesson {
  scroll-margin-top: 78px;
  padding: 52px 0;
}

.lesson-a {
  background: #ffffff;
}

.lesson-b {
  background: #f6faf9;
  border-top: 1px solid var(--line);
}

.lesson-c {
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.lesson-d {
  background: #f4f6f7;
  border-top: 1px solid var(--line);
}

.lesson-check {
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.lesson-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 26px;
}

.lesson-head h2 {
  margin: 5px 0 8px;
  font-size: 27px;
  line-height: 1.35;
  max-width: 860px;
}

.lesson-head > div > p:last-child {
  margin: 0;
  color: var(--muted);
  max-width: 840px;
}

.lesson-a .kicker {
  color: var(--coral);
}

.lesson-b .kicker {
  color: var(--teal);
}

.lesson-c .kicker {
  color: var(--violet);
}

.lesson-d .kicker {
  color: var(--amber);
}

.course-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 300px;
  color: #3d5258;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.lesson-a .course-tag {
  border-left: 3px solid var(--coral);
}

.lesson-b .course-tag {
  border-left: 3px solid var(--teal);
}

.lesson-c .course-tag {
  border-left: 3px solid var(--violet);
}

.lesson-d .course-tag {
  border-left: 3px solid var(--amber);
}

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

.shape-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 3px 12px rgba(28, 51, 58, 0.04);
}

.shape-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  margin-bottom: 10px;
}

.shape-head svg.lucide {
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.shape-head h3 {
  margin: 0;
  font-size: 14.5px;
}

.shape-card:nth-child(1) .shape-head,
.shape-card:nth-child(1) .shape-head svg.lucide {
  color: var(--coral);
}

.shape-card:nth-child(3) .shape-head,
.shape-card:nth-child(3) .shape-head svg.lucide {
  color: var(--sky);
}

.shape-card:nth-child(4) .shape-head,
.shape-card:nth-child(4) .shape-head svg.lucide {
  color: var(--violet);
}

.shape-sample {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f0f3f4;
  color: #21444d;
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  line-height: 1.45;
  margin-bottom: 9px;
}

.shape-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.55;
}

.decision-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  background: #fafcfc;
  border-radius: 8px;
  padding: 16px;
}

.guide-item {
  display: flex;
  gap: 11px;
}

.guide-index {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.guide-item strong {
  display: block;
  margin-bottom: 2px;
}

.guide-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12.8px;
}

.quick-judge {
  margin-top: 18px;
  border: 1px solid #efd5d0;
  background: #fffbfa;
  border-radius: 8px;
  padding: 16px;
}

.quick-judge-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--coral);
  font-size: 14px;
  margin-bottom: 13px;
}

.quick-judge-head svg.lucide {
  width: 18px;
  height: 18px;
}

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

.quick-item {
  border: 1px solid #eadcd8;
  background: #ffffff;
  border-radius: 8px;
  padding: 13px;
}

.quick-item p {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
}

.quick-item p code {
  color: var(--coral);
}

.choice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-pills button {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #385056;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}

.choice-pills button:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.choice-pills button.correct {
  background: #e6f5ef;
  border-color: var(--ok);
  color: var(--ok);
}

.choice-pills button.wrong {
  background: #fdebe8;
  border-color: var(--bad);
  color: var(--bad);
}

.quick-feedback {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.quick-feedback.good {
  color: var(--ok);
}

.quick-feedback.bad {
  color: var(--bad);
}

.workbench {
  margin-top: 22px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

.workbench-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f9f9;
}

.workbench-caption {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  min-width: 0;
}

.workbench-caption svg.lucide {
  color: var(--teal);
}

.bench-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.18fr) minmax(0, 0.9fr);
  min-width: 0;
}

.wb-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.wb-pane + .wb-pane {
  border-left: 1px solid var(--line);
}

.wb-title {
  display: block;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.payload-input,
.code-editor,
.output {
  width: 100%;
  border: 0;
  outline: none;
  min-height: 235px;
  padding: 12px;
  margin: 0;
  font-size: 12.7px;
  line-height: 1.6;
  resize: vertical;
}

.payload-input {
  background: #ffffff;
}

.code-editor {
  color: #dff2ef;
  background: var(--code-bg);
  tab-size: 4;
}

.code-editor:focus {
  box-shadow: inset 3px 0 0 var(--violet);
}

.output {
  flex: 1;
  color: #d9e8e5;
  background: #101d22;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  resize: vertical;
}

.output.error {
  color: #ffd9d3;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 16px;
}

.mini-flow,
.file-hint {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
}

.mini-flow {
  display: grid;
  gap: 12px;
}

.flow-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.flow-step > span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e2f2ef;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.flow-step strong {
  display: block;
  font-size: 13.5px;
}

.flow-step p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.file-hint-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--sky);
  margin-bottom: 8px;
}

.file-hint p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 13px;
}

.file-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.file-button {
  padding: 8px 11px;
  background: var(--sky);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
}

.file-button:hover {
  background: #0f6580;
}

.file-controls input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mini-code {
  display: block;
  margin: 0;
  color: #dce9e7;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 11px;
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
}

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

.library-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--violet);
  border-radius: 8px;
  padding: 13px;
}

.library-card:nth-child(2) {
  border-top-color: var(--teal);
}

.library-card:nth-child(3) {
  border-top-color: var(--sky);
}

.library-card:nth-child(4) {
  border-top-color: var(--coral);
}

.library-card:nth-child(5) {
  border-top-color: var(--amber);
}

.lib-icon {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #f0edf9;
  color: var(--violet);
  margin-bottom: 9px;
}

.library-card:nth-child(2) .lib-icon {
  background: #e5f2ef;
  color: var(--teal);
}

.library-card:nth-child(3) .lib-icon {
  background: #e5f0f5;
  color: var(--sky);
}

.library-card:nth-child(4) .lib-icon {
  background: #fbecdf;
  color: var(--coral);
}

.library-card:nth-child(5) .lib-icon {
  background: #fdf0df;
  color: var(--amber);
}

.library-card h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.library-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.library-card em {
  color: #52666c;
  background: #f4f6f6;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 10.5px;
  font-style: normal;
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.5fr);
  gap: 16px;
}

.device-console,
.lab-pipeline {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.device-console {
  border-top: 3px solid var(--amber);
  display: flex;
  flex-direction: column;
}

.console-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.console-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin-right: auto;
}

.console-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  font-weight: 700;
  font-size: 13px;
}

.device-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--muted);
  font-size: 12px;
}

.device-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aab6ba;
}

.device-console.collecting .device-state {
  color: var(--ok);
}

.device-console.collecting .device-state::before {
  background: var(--ok);
  animation: status-blink 1.1s infinite;
}

.round-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.round-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.round-btn.active {
  color: #ffffff;
  background: var(--ok);
  border-color: var(--ok);
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.live-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 8px;
  text-align: center;
  min-width: 0;
}

.live-name {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.live-item strong {
  display: inline-block;
  font-size: 17px;
  line-height: 1.3;
}

.live-item em {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
}

.thresholds {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
}

.threshold-title,
.feed-title,
.panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #42575d;
}

.threshold-title svg.lucide,
.feed-title svg.lucide,
.panel-title svg.lucide {
  color: var(--amber);
}

.threshold-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}

.threshold-fields label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.threshold-fields input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 6px;
  font-size: 12px;
}

.threshold-fields input:focus {
  border-color: var(--amber);
  outline: none;
}

.raw-feed {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.raw-feed pre {
  flex: 1;
  min-height: 84px;
  max-height: 150px;
  margin: 8px 0 0;
  overflow: auto;
  color: #e7d9c3;
  background: #20271f;
  border-radius: 6px;
  padding: 10px;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.pipeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 14px;
  padding: 8px 4px;
  overflow-x: auto;
}

.pipe-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #f7f9f9;
  color: #3e545a;
  font-size: 11.5px;
  white-space: nowrap;
}

.pipe-step svg.lucide {
  width: 15px;
  height: 15px;
}

.pipe-step.done {
  color: var(--ok);
  border-color: #9dd1c5;
  background: #eaf7f3;
}

.pipe-arrow {
  color: #a3b1b5;
  flex: 0 0 auto;
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 13px;
}

.lab-action {
  padding: 8px 11px;
  background: #ffffff;
  border-color: var(--line-strong);
  color: #365057;
  font-size: 12.5px;
  font-weight: 600;
}

.lab-action:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.lab-action svg.lucide {
  color: var(--teal);
}

.record-panel,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  max-height: 176px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid #e8eeee;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  background: #eef4f4;
  color: #375158;
  z-index: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: #8a999d;
  text-align: center;
}

.actuator-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.actuator {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 7px;
  border: 1px solid var(--line);
  background: #f8faf9;
  border-radius: 6px;
  padding: 9px 10px;
}

.actuator svg.lucide {
  width: 18px;
  height: 18px;
  grid-row: 1 / span 2;
  color: #94a2a6;
}

.actuator span {
  color: var(--muted);
  font-size: 11px;
}

.actuator strong {
  font-size: 12px;
  color: #52666b;
}

.actuator.on {
  border-color: #89cdc0;
  background: #eaf7f4;
}

.actuator.on svg.lucide {
  color: var(--teal);
}

.actuator.on strong {
  color: var(--teal-dark);
}

.chart-panel {
  margin-bottom: 0;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 230px;
  margin-top: 8px;
}

.py-plot {
  width: 100%;
  border-radius: 6px;
  margin-top: 8px;
}

.quiz-list {
  display: grid;
  gap: 10px;
}

.quiz-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.quiz-item:hover {
  border-color: #9dc9c1;
}

.quiz-item.has-answer {
  border-color: #9dc9c1;
  background: #f9fcfb;
}

.quiz-item.correct {
  border-color: #8bc8b3;
}

.quiz-item.wrong {
  border-color: #e0a49e;
}

.quiz-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

.quiz-item p {
  margin: 0 0 8px;
  font-weight: 600;
}

.quiz-item .choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 5px;
  padding: 5px 8px;
  color: #43575d;
  font-size: 12px;
  cursor: pointer;
}

.choice input {
  accent-color: var(--teal);
  margin: 0;
}

.choice.correct {
  border-color: var(--ok);
  color: var(--ok);
  background: #ebf7f2;
}

.choice.wrong {
  border-color: var(--bad);
  color: var(--bad);
  background: #fdf0ee;
}

.quiz-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.quiz-foot strong {
  font-size: 14px;
}

.quiz-foot strong.good {
  color: var(--ok);
}

.quiz-foot strong.bad {
  color: var(--bad);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.footer-inner p {
  margin: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  color: #ffffff;
  background: var(--ink);
  border-radius: 6px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(21, 42, 48, 0.24);
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #7f2f28;
}

@media (max-width: 1100px) {
  .roadmap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .library-card:nth-child(n + 4) {
    border-top-color: var(--sky);
  }

  .workbench-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wb-pane.wb-output {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .wb-pane + .wb-pane {
    border-left: 0;
  }

  .wb-pane:nth-child(2) {
    border-left: 1px solid var(--line);
  }

  .output {
    min-height: 160px;
  }

  .lab-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .topbar-inner {
    gap: 12px;
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    margin-left: 0;
    padding-bottom: 2px;
  }

  .main-nav a {
    flex: 0 0 auto;
  }

  .header-tools {
    margin-left: auto;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .course-board {
    max-width: 620px;
  }

  .overview h1 {
    font-size: 34px;
  }

  .lesson-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .course-tag {
    max-width: none;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .engine-status {
    font-size: 0;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }

  .engine-status span:last-child {
    display: none;
  }

  .save-btn {
    padding: 8px;
  }

  .save-btn span {
    display: none;
  }

  .overview {
    padding: 38px 0 30px;
  }

  .overview h1 {
    font-size: 29px;
  }

  .overview-lead {
    font-size: 15px;
  }

  .roadmap-grid,
  .shape-grid,
  .library-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .wb-pane + .wb-pane {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .wb-pane:nth-child(2) {
    border-left: 0;
  }

  .workbench-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .bench-actions {
    justify-content: flex-start;
  }

  .payload-input,
  .code-editor,
  .output {
    min-height: 180px;
  }

  .lesson {
    padding: 40px 0;
  }

  .lesson-head h2 {
    font-size: 23px;
  }

  .decision-guide {
    grid-template-columns: 1fr;
  }

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

  .lab-pipeline,
  .device-console {
    padding: 12px;
  }

  .threshold-fields {
    grid-template-columns: 1fr 1fr;
  }

  .quiz-item {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .brand-text small {
    display: none;
  }

  .overview h1 {
    font-size: 26px;
  }

  .lesson-head h2 {
    font-size: 21px;
  }

  .live-grid,
  .actuator-grid {
    grid-template-columns: 1fr;
  }

  .live-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .live-item strong {
    order: 2;
  }

  .live-item em {
    order: 3;
  }

  .live-name {
    order: 1;
  }

  .actuator {
    grid-template-columns: auto 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
