:root {
  color-scheme: light;
  --ink: #203633;
  --text: #40544f;
  --muted: #5e716a;
  --line: #d9dfd9;
  --quiet: #f1f3ef;
  --paper: #fcfcf9;
  --accent: #126252;
  --wash: #e8f2ec;
  --danger: #a5372b;
  --mono: Consolas, "Courier New", monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f4f5f1;
  color: var(--ink);
  font:
    15px/1.52 "DM Sans",
    "Microsoft YaHei UI",
    "PingFang SC",
    "Noto Sans CJK SC",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
  opacity: 0.42;
}
button {
  border: 0;
  background: none;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #217764;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
svg.ui-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.masthead {
  min-height: 64px;
  background: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1544px) / 2));
  gap: 40px;
  border-bottom: 1px solid var(--line);
}
.brand,
.row,
.project-actions,
.project-title,
.quiet,
.primary,
.icon-button,
.text-button,
.mission-caption {
  display: flex;
  align-items: center;
}
.brand {
  gap: 8px;
  white-space: nowrap;
}
.brand strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand svg {
  width: 36px;
  height: 36px;
}
.masthead nav {
  display: flex;
  align-self: stretch;
  gap: 12px;
}
.masthead nav button {
  padding: 0 12px;
  position: relative;
  color: var(--text);
  font-size: 14px;
}
.masthead nav .nav-active {
  color: var(--accent);
  font-weight: 600;
}
.nav-active:after {
  content: "";
  height: 3px;
  background: var(--accent);
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
}
.masthead nav button:hover,
.quiet:hover,
.icon-button:hover,
.segments button:hover,
.text-button:hover {
  background: var(--quiet);
}
.masthead-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.help-button,
.family-button {
  white-space: nowrap;
}
.family-button { min-width: 0; }
#currentChild {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9em;
}
.family-caret {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.family-body { padding: 18px 20px 22px; }
.family-note { color: var(--muted); font-size: 14px; line-height: 1.6; }
.family-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.family-prompt-setting { display:flex; align-items:center; gap:8px; min-height:44px; margin-top:8px; }
.family-prompt-setting input { width:18px; height:18px; accent-color:var(--accent); }
#familyReceiver { width:100%; margin-block:8px 16px; padding:8px; }
.family-row-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
@media (max-width:520px) {
  .library-item .family-row-actions { flex-direction:column; align-items:flex-end; gap:0; }
}
#familyList { border-block: 1px solid var(--line); margin-top: 14px; }
#familyList:empty { display: none; }
#familyList button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 48px; padding: 10px 12px; text-align: left;
}
#familyList button + button { border-top: 1px solid var(--line); }
#familyList button[aria-current="true"] { background: var(--quiet); color: var(--accent); }
#familyList button:hover { background: var(--quiet); }
#familyList strong { overflow-wrap: anywhere; font-weight: 600; }
#familyList button span { flex: none; font-size: 13px; }
#familyList .family-arrow { color: var(--muted); font-size: 20px; }
#familyError:not(:empty) { margin-top: 12px; }
#familyHint { margin-top: 6px; }
@media (max-width: 850px) {
  #currentChild { max-width: 7em; }
  .masthead-tools { gap: 4px; }
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 28px 28px 32px;
}
.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.project-title {
  gap: 8px;
}
.project-name {
  min-width: 0;
}
.project-title h1 {
  font-size: clamp(26px, 2.3vw, 36px);
  line-height: 1.35;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.project-actions {
  gap: 16px;
  flex-shrink: 0;
  white-space: nowrap;
}
.save-note,
.note,
.frame-count,
.editor-bottom,
.palette-help {
  font-size: 13px;
  color: var(--muted);
}
.save-note {
  white-space: nowrap;
}
.quiet,
.primary,
.icon-button,
.text-button {
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: background-color 0.13s ease;
}
.outlined {
  border: 1px solid var(--line);
  background: var(--paper);
}
.primary {
  color: white;
  background: var(--accent);
  min-height: 40px;
  padding: 8px 20px;
}
.primary:hover {
  background: #0c5144;
}
.icon-button {
  width: 36px;
  height: 36px;
  padding: 8px;
  color: var(--muted);
}
.text-button {
  padding: 4px 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.text-button:hover {
  background: transparent;
  color: #0a493e;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(172px, 0.62fr) minmax(320px, 1.34fr) minmax(336px, 1.2fr);
  gap: 16px;
  align-items: start;
}
.panel {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2,
.sheet-head h2 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}
.panel-head > svg {
  color: var(--muted);
}
.panel-head .row {
  margin: -6px -8px -6px 0;
}
.palette {
  min-height: 540px;
}
.palette-help {
  padding: 16px 16px 8px;
}
.palette-group {
  padding: 8px 16px 12px;
}
.palette-group h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 8px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  min-height: 36px;
  padding: 6px 8px;
  text-align: left;
  border: 1px solid var(--block-border);
  border-left: 4px solid var(--block-stroke);
  border-radius: 6px;
  background: var(--block-bg);
  color: var(--block-ink);
  font-size: 14px;
  font-weight: 500;
  touch-action: pan-y;
}
.palette-item:hover {
  outline: 1px solid var(--block-stroke);
}
.palette-item .sample {
  font: 12px/18px var(--mono);
  background: rgba(255, 255, 255, 0.68);
  border-radius: 4px;
  padding: 0 5px;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-item .insert {
  margin-left: auto;
  opacity: 0.7;
}
.catalog-controls {
  padding: 4px 16px 8px;
}
.catalog-switch {
  width: 100%;
}
.catalog-switch button {
  flex: 1;
  white-space: nowrap;
}
.catalog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.catalog-filter select,
.catalog-filter input {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 4px 8px;
  min-width: 0;
  width: 100%;
}
.catalog-count,
.catalog-empty {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.catalog-empty {
  padding: 8px 16px;
}
.catalog-list > .text-button {
  margin: 0 16px;
}
[data-block-catalog][data-level="all"] > .catalog-list {
  overflow: auto;
  overscroll-behavior: contain;
  max-height: clamp(240px, 53vh, 560px);
  scrollbar-width: thin;
}
.catalog-list .sample-empty {
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
}
.catalog-grip {
  display: none;
}
@media (any-pointer: coarse) {
  [data-block-catalog][data-level="all"] .palette-item {
    touch-action: pan-y;
  }
  [data-block-catalog] .catalog-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-width: 27px;
    margin: -6px -4px -6px -6px;
    touch-action: none;
  }
  #sheet .catalog-grip {
    display: none;
  }
}
.looks {
  --block-bg: #e9edf7;
  --block-border: #c8d4ec;
  --block-stroke: #6782ac;
  --block-ink: #334e70;
}
.math-block {
  --block-bg: #eef1db;
  --block-border: #d2d9af;
  --block-stroke: #798840;
  --block-ink: #475420;
}
.sense-block {
  --block-bg: #e3f1f0;
  --block-border: #bfdbd9;
  --block-stroke: #568c86;
  --block-ink: #2d5754;
}
.list-block {
  --block-bg: #f5e8de;
  --block-border: #e2cebf;
  --block-stroke: #a47957;
  --block-ink: #735334;
}
.music-block {
  --block-bg: #f4e7ec;
  --block-border: #e0c7d0;
  --block-stroke: #a67383;
  --block-ink: #694350;
}
.event-block {
  --block-bg: #f3edd1;
  --block-border: #dfd5a6;
  --block-stroke: #988840;
  --block-ink: #5f5723;
}
.custom-block {
  --block-bg: #e9eaf4;
  --block-border: #cccee6;
  --block-stroke: #8282a7;
  --block-ink: #4b4b6a;
}
.arg-field {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  flex-wrap: wrap;
}
.event-pad {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.event-pad strong {
  font-size: 13px;
  font-weight: 500;
}
.event-pad small {
  width: 100%;
  color: var(--muted);
}
.speech.thought {
  border-style: dashed;
}
.speech.thought::before {
  content: "想　";
  color: var(--muted);
}
.list-samples,
.rhythm-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
}
.list-samples li,
.rhythm-notes li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 13px;
}
.list-samples small,
.rhythm-notes small {
  color: var(--muted);
  font-size: 11px;
  display: block;
}
.mobile-palette .catalog-controls {
  padding: 0 0 8px;
}
.mobile-palette .catalog-filter select,
.mobile-palette .catalog-filter input {
  flex: 1 1 112px;
}
@media (min-width: 851px) {
  .mobile-palette-pane {
    display: none;
  }
}
@media (max-width: 850px) {
  .mobile-palette-pane[data-level="all"] > .catalog-list {
    max-height: 28vh;
  }
  .mobile-palette .catalog-switch {
    max-width: 232px;
  }
  .catalog-filter select,
  .catalog-filter input {
    min-height: 40px;
  }
}
.motion {
  --block-bg: #e4f1e8;
  --block-border: #c4dbcc;
  --block-stroke: #4d846c;
  --block-ink: #274f3e;
}
.draw {
  --block-bg: #e7edf6;
  --block-border: #cad7e7;
  --block-stroke: #6c89af;
  --block-ink: #354e70;
}
.control {
  --block-bg: #f7edd8;
  --block-border: #e6d4ae;
  --block-stroke: #a17b39;
  --block-ink: #695323;
}
.data {
  --block-bg: #f0eaf2;
  --block-border: #ddd0e0;
  --block-stroke: #977b9c;
  --block-ink: #624b67;
}
.editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 540px;
}
.modebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.segments {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--quiet);
  padding: 3px;
}
.segments button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 4px 10px;
  min-height: 28px;
}
.segments button.active {
  background: white;
  box-shadow: 0 1px 3px #20363320;
  color: var(--ink);
  font-weight: 600;
}
#blockEditor {
  padding: 8px 20px 24px;
  overflow-x: auto;
  flex: 1;
  background-color: #fcfcf9;
  background-image: radial-gradient(#bfc9c466 0.85px, transparent 0.85px);
  background-size: 16px 16px;
}
.sequence-start,
.sequence-end {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.start-symbol {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--ink);
  color: white;
  border-radius: 7px;
}
.sequence-start {
  font-weight: 600;
  margin-bottom: 4px;
}
.cancel-step-move {
  margin-left: auto;
  height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  color: var(--ink);
  background-color: #e4eee6;
  font-size: 13px;
}
.sequence-end {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.sequence-end span {
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid #9cac9f;
  border-radius: 50%;
}
.drop-slot {
  position: relative;
  display: block;
  min-height: 12px;
  width: 100%;
  text-align: left;
  padding: 0 4px;
  border: 1px dashed transparent;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.drop-slot:not(.empty) span {
  display: none;
}
/* 插入线只绘制在预留间距内，位置提示不会挤开积木。 */
.drop-slot::before,
.drop-slot::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  background-color: #276447;
}
.drop-slot::before {
  left: 2px;
  right: 2px;
  height: 3px;
  border-radius: 2px;
}
.drop-slot::after {
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.drop-slot.drag-over::before,
.drop-slot.drag-over::after,
#sequence:not(.positioning) .drop-slot:not(.empty):is(:hover, :focus-visible)::before,
#sequence:not(.positioning) .drop-slot:not(.empty):is(:hover, :focus-visible)::after {
  content: "";
}
.drop-slot.empty {
  min-height: 40px;
  background: #f5f7f2;
  border-color: #c7d2c8;
  padding: 8px;
}
.positioning .drop-slot.empty {
  background: transparent;
  border-color: transparent;
}
.positioning .drop-slot.empty span {
  visibility: hidden;
}
.positioning .drop-slot:focus {
  outline: none;
}
.block-shell {
  min-width: 0;
}
.block-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--block-border);
  border-left: 4px solid var(--block-stroke);
  border-radius: 8px;
  background: var(--block-bg);
  color: var(--block-ink);
  min-height: 44px;
  padding: 4px 6px;
}
.block-shell.running > .block-row {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.block-row .block-label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.block-row .handle {
  cursor: grab;
  touch-action: none;
  color: inherit;
  background: none;
  border: 0;
  width: 20px;
  min-height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
}
.block-row .handle svg {
  width: 16px;
}
.args {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.arg {
  border: 1px solid var(--block-border);
  background: #fffffff0;
  color: var(--block-ink);
  border-radius: 5px;
  padding: 3px 5px;
  min-width: 32px;
  max-width: 100%;
  height: 28px;
  text-align: center;
  font-size: 13px;
}
.arg[data-type="text"] {
  width: 100px;
  text-align: left;
}
.arg[data-type="color"] {
  width: 44px;
  padding: 1px;
}
.unit {
  font-size: 12px;
}
.block-more {
  margin-left: auto;
  border-radius: 4px;
  color: inherit;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 32px;
  flex-shrink: 0;
}
.block-more:hover {
  background: #ffffff70;
}
.nested {
  margin: 0 0 0 12px;
  padding: 4px 0 4px 12px;
  border-left: 3px solid var(--block-border);
}
.nest-foot {
  height: 8px;
  width: 32px;
  margin-left: 12px;
  border-radius: 0 0 5px 5px;
  background: var(--block-border);
}
#codeEditor {
  padding: 0 20px 20px;
  flex: 1;
}
#codeEditor label,
.field-label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}
textarea,
input.line-input {
  border: 1px solid #b9c6bc;
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}
#source {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  background: #f4f6f2;
  font:
    15px/1.8 var(--mono),
    "Microsoft YaHei UI",
    sans-serif;
  tab-size: 2;
}
#codeStatus {
  margin: 8px 0 12px;
}
.error {
  color: var(--danger) !important;
}
.editor-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  min-height: 44px;
}
.stage-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.stage-status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-status:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #778b81;
}
.stage-status.live:before {
  background: var(--accent);
}
.chart-wrap {
  position: relative;
  margin: 12px 12px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #daeae6;
}
.chart-wrap canvas {
  display: block;
  width: 100%;
  height: clamp(216px, 20vw, 330px);
}
.speech {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  text-align: center;
  padding: 4px 8px;
  border: 1px solid #bccfc3;
  border-radius: 8px;
  background: #fffef7ee;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
  max-height: 42%;
  overflow: auto;
}
.telemetry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.telemetry > span + span {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.telemetry b {
  font: 500 14px var(--mono);
  margin-left: 6px;
  color: var(--ink);
}
.runbar,
.mission-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.runbar {
  padding: 12px 16px;
}
.runbar .quiet,
.runbar .icon-button {
  min-height: 40px;
}
.frame-count {
  margin-left: auto;
}
.mission {
  padding: 16px 20px;
}
.mission-caption {
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.mission h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0 4px;
}
.mission p,
.sheet-copy {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}
.mission-actions {
  gap: 20px;
}
.feedback {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px !important;
}
.stage-feedback { padding: 0 14px; }
.stage-feedback > :last-child:not([hidden]) { margin-bottom: 10px; }
.stage-feedback .feedback { margin-bottom: 0; line-height: 1.45; font-size: 14px; }
.stage-feedback .mission-route { margin-top: 5px; }
.feedback[data-state="passed"] { color: var(--accent); }
.score-details { margin-top: 6px; font-size: 13px; line-height: 1.45; }
.score-details summary { cursor: pointer; color: var(--accent); }
.score-details p { margin: 4px 0; }
#lessonPath:disabled { color: var(--muted); cursor: default; opacity: 1; }
@media (max-width: 850px) {
  .stage { display: flex; flex-direction: column; }
  .stage > .panel-head { order: -2; }
  .stage > .stage-feedback { order: -1; }
}
.log summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14px;
}
.log summary span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 12px;
}
#logBody {
  padding: 0 16px 16px;
  font-size: 13px;
  color: var(--text);
}
.log-list {
  padding-left: 28px;
  max-height: 200px;
  overflow: auto;
}
.log-list li {
  padding: 3px;
}
.notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: 0 4px 16px #12221b18;
  padding: 8px 16px;
  max-width: 90vw;
  z-index: 5;
  font-size: 14px;
}
.notice:empty {
  display: none;
}
dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: 84vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 60px #14291f28;
}
dialog::backdrop {
  background: #142b2550;
}
.sheet-head {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
#sheetBody {
  padding: 20px;
}
.dialog-actions {
  margin: 12px 0;
}
.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.sheet-row strong {
  font-size: 15px;
  font-weight: 600;
}
.sheet-row small {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.sheet-row:hover {
  background: var(--quiet);
}
.sheet-row .meta {
  white-space: nowrap;
  font-size: 12px;
  color: var(--accent);
}
.sheet-copy p + p {
  margin-top: 12px;
}
.sheet-copy h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 16px 0 4px;
}
.exchange {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font: 13px/1.5 var(--mono);
}
.line-input {
  width: 100%;
}
.library-item {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.library-item .sheet-row {
  min-width: 0;
  border-bottom: 0;
}
.library-item .sheet-row strong {
  overflow-wrap: anywhere;
}
.remove-copy {
  flex-shrink: 0;
  color: var(--muted);
}
.danger-action {
  color: var(--danger);
}
.touch-ghost {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  background: var(--ink);
  color: white;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
}
.mobile-tabs,
#mobileAdd,
#mobileRun {
  display: none;
}
.project-goal {
  font-size: 14px;
  color: var(--text);
  margin-top: 4px;
}
.project-learning,
.task-guide {
  display: flex;
  flex-wrap: wrap;
  column-gap: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
#lessonPath,
.task-position,
.task-level {
  color: var(--accent);
}
.mission-route {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 12px;
}
.mission-route .track-end {
  flex-basis: 100%;
}
.task-board {
  max-width: 1160px;
  margin: 0 auto;
}
.board-header,
.board-filters,
.task-line,
.task-actions,
.copy-line,
.spoken-lines li {
  display: flex;
  align-items: center;
}
.board-header {
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 24px;
}
.board-header h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
}
.board-header p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}
.board-header > button {
  flex-shrink: 0;
  white-space: nowrap;
}
.board-filters {
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
}
.board-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.board-filters select,
.board-filters input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 4px 12px;
}
#boardCount {
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}
.board-filters input {
  width: 13em;
  max-width: 100%;
  min-width: 0;
  font: inherit;
}
#boardRows {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: var(--paper);
}
.task-group + .task-group {
  border-top: 1px solid var(--line);
}
.group-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 24px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.group-heading::-webkit-details-marker { display: none; }
.group-heading::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.task-group[open] > .group-heading {
  background: var(--wash);
  border-bottom: 1px solid var(--line);
}
.task-group[open] > .group-heading::before {
  transform: translateY(-2px) rotate(45deg);
}
.group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.group-heading:focus-visible {
  outline-offset: -3px;
}
.task-line {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 20px 24px;
}
.task-line + .task-line {
  border-top: 1px solid var(--line);
}
.task-info {
  flex: 1 1 300px;
  min-width: 0;
}
.task-info h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0;
}
.task-meta {
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.task-meta span + span {
  border-left: 1px solid var(--line);
  padding-left: 8px;
}
.task-objective {
  font-size: 14px;
  color: var(--text);
}
.task-actions {
  gap: 12px;
  flex-wrap: wrap;
}
.task-status {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.task-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid currentColor;
}
.task-status[data-status="active"] {
  color: var(--accent);
}
.task-status[data-status="active"]::before,
.task-status[data-status="done"]::before {
  background: currentColor;
}
.task-status[data-status="paused"] {
  color: #826124;
}
.task-open {
  min-width: 84px;
}
.task-copies {
  flex: 1 1 100%;
  padding: 4px 12px 0 16px;
  border-left: 3px solid #a0b6a7;
}
.copy-line {
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.copy-line > div {
  flex: 1;
  min-width: 0;
}
.copy-line strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.copy-line small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.board-empty {
  padding: 32px 20px;
  color: var(--muted);
}
.readout {
  padding: 16px 20px;
}
.readout h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.readout > div:not([hidden]) + div:not([hidden]) {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.spoken-lines {
  list-style: none;
  padding: 0;
  margin: 0;
}
.spoken-lines li {
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
}
.spoken-lines li span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.spoken-lines li b {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
  min-width: 0;
}
.variable-values {
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin: 0;
}
.variable-values > div {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--quiet);
  border-radius: 6px;
  padding: 4px 8px;
}
.variable-values dt {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.variable-values dd {
  margin: 0;
  color: var(--accent);
  font: 600 16px var(--mono);
}
.reading-plot {
  margin: 12px 0 0;
}
.reading-plot figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.reading-columns {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.reading-columns li {
  flex: 1;
  min-width: 0;
  font: 12px var(--mono);
  text-align: center;
  overflow-wrap: anywhere;
}
.reading-columns b {
  font-weight: 400;
}
.reading-column {
  height: 52px;
  position: relative;
  background: var(--quiet);
  margin-bottom: 4px;
}
.reading-column::after {
  content: "";
  position: absolute;
  top: clamp(0px, var(--zero), calc(100% - 1px));
  left: 0;
  right: 0;
  border-top: 1px solid #9fac9f;
}
.reading-bar {
  position: absolute;
  left: 28%;
  width: 44%;
  background: #4d826c;
}
@media (max-width: 660px) {
  .board-header {
    padding: 4px 4px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
  }
  .board-header > div {
    display: contents;
  }
  .board-header h1 {
    grid-column: 1;
    grid-row: 1;
  }
  .board-header > button {
    grid-column: 2;
    grid-row: 1;
  }
  .board-header p {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .board-header h1 {
    font-size: 26px;
  }
  .board-filters {
    gap: 12px;
    padding: 12px;
  }
  .board-filters label {
    display: grid;
    gap: 4px;
    flex: 1 1 100px;
  }
  .board-filters .board-search { flex-basis: 100%; }
  .board-filters label { min-width: 0; flex: 1 1 22%; }
  .board-filters label:nth-child(2) { flex-grow: 1.4; flex-basis: 29%; }
  .board-filters select { width: 100%; min-width: 0; padding-inline: 4px; }
  .board-filters input { width: 100%; box-sizing: border-box; }
  #boardCount {
    flex-basis: 100%;
    margin: 0;
  }
  .group-heading { padding-inline: 16px; }
  .task-line {
    display: block;
    padding: 16px;
  }
  .task-actions {
    margin-top: 12px;
  }
  .task-status {
    margin-right: auto;
  }
  .task-copies {
    margin-top: 12px;
  }
  .copy-line {
    gap: 6px;
    flex-wrap: wrap;
  }
  .copy-line > div {
    flex-basis: 100%;
  }
  .task-open,
  .copy-line button {
    min-height: 44px;
  }
}
.mobile-palette-pane {
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.mobile-palette-pane .palette-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.mobile-palette-pane .palette-group h3 {
  width: 76px;
  margin: 0;
}
.mobile-palette-pane .palette-item {
  width: auto;
  margin: 0;
  touch-action: none;
}
.mobile-palette-pane .sample {
  max-width: 8em;
}
.mobile-palette-pane[data-level="all"] .palette-group h3 {
  width: 100%;
}
.mobile-palette-pane .insert {
  display: none;
}
@media (min-width: 1450px) {
  .workbench {
    grid-template-columns: 244px minmax(440px, 1.2fr) minmax(400px, 1fr);
  }
}
@media (max-width: 1120px) and (min-width: 851px) {
  main {
    padding: 20px 16px;
  }
  .workbench {
    grid-template-columns: 156px minmax(280px, 1fr) minmax(292px, 0.98fr);
    gap: 8px;
  }
  .palette-group {
    padding-left: 10px;
    padding-right: 10px;
  }
  .panel-head {
    padding: 12px;
  }
  .modebar,
  #blockEditor {
    padding-left: 12px;
    padding-right: 12px;
  }
  .unit {
    display: none;
  }
  .frame-count {
    font-size: 12px;
  }
  .runbar {
    padding: 12px;
  }
  .masthead {
    gap: 20px;
  }
}
@media (max-width: 850px) {
  .masthead {
    padding: 0 16px;
    gap: 12px;
    min-height: 56px;
    flex-wrap: wrap;
  }
  .brand {
    gap: 4px;
  }
  .brand strong {
    font-size: 17px;
  }
  .brand svg {
    width: 28px;
    height: 28px;
  }
  .masthead nav {
    gap: 0;
  }
  .masthead nav button {
    padding: 12px 8px;
  }
  .help-button {
    padding: 4px;
  }
  .project-head {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
  }
  .project-name { display: contents; }
  .project-name .eyebrow,
  .project-name .project-goal,
  .project-learning { grid-column: 1 / -1; }
  .project-name .eyebrow { grid-row: 1; margin: 0; }
  .project-title, .project-actions { grid-row: 2; }
  .project-title { grid-column: 1; min-width: 0; }
  .project-actions { grid-column: 2; }
  .project-learning { margin-top: 0; }
  .project-actions {
    gap: 4px;
  }
  .save-note {
    display: none;
  }
  main {
    padding: 16px 12px 32px;
  }
  .mobile-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    gap: 12px;
    margin-bottom: 12px;
  }
  .mobile-tabs button {
    padding: 8px 12px;
    min-height: 44px;
    font-weight: 500;
  }
  .mobile-tabs .active {
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
  }
  .workbench {
    display: block;
  }
  .workbench > .palette {
    display: none;
  }
  .workbench[data-view="stage"] > .editor,
  .workbench[data-view="editor"] > .stage-column {
    display: none;
  }
  #mobileAdd,
  #mobileRun {
    display: flex;
  }
  .editor {
    min-height: 420px;
  }
  .editor-bottom {
    position: sticky;
    bottom: 0;
    background: var(--paper);
  }
  .modebar {
    padding: 12px 16px;
  }
  .chart-wrap canvas {
    height: clamp(248px, 50vw, 400px);
  }
  .quiet,
  .icon-button,
  .text-button,
  .palette-item,
  .block-more {
    min-height: 40px;
  }
  .stage-column {
    gap: 12px;
  }
  .palette-item {
    touch-action: pan-y;
  }
  .help-button span {
    display: none;
  }
  .block-row .handle {
    width: 28px;
    min-height: 40px;
  }
  .mobile-palette .palette-group {
    padding: 0 0 10px;
  }
  .mobile-palette .palette-item {
    min-height: 44px;
  }
  .workbench .palette-item {
    touch-action: none;
  }
}
@media (max-width: 620px) {
  .masthead {
    gap: 0;
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .brand {
    min-height: 44px;
  }
  .masthead nav {
    order: 3;
    grid-column: span 2;
    justify-content: space-between;
  }
  .masthead nav button {
    padding: 8px;
    min-height: 40px;
  }
  .masthead-tools {
    grid-column: 2;
    grid-row: 1;
  }
}
@media (max-width: 520px) {
  .project-title h1 {
    font-size: 24px;
  }
  .project-actions button {
    padding: 6px 8px;
  }
  .project-head {
    gap: 4px;
  }
  .panel-head {
    padding: 12px 16px;
  }
  .project-name .icon-button {
    width: 28px;
  }
  .editor-bottom {
    padding: 8px 12px;
  }
  #blockEditor {
    padding: 8px 12px 20px;
  }
  .block-row {
    gap: 4px;
  }
  .nested {
    padding-left: 6px;
    margin-left: 6px;
  }
  .block-row .handle {
    width: 20px;
  }
  .runbar .primary {
    flex: 1;
  }
  .drop-slot {
    min-height: 16px;
  }
  .telemetry {
    margin: 0 12px;
  }
  .block-row .block-label {
    font-size: 13px;
  }
  .arg {
    max-width: 115px;
  }
  .frame-count {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
