/* Hallmark · genre: modern-minimal · macrostructure: Workbench · theme: Cobalt · enrichment: product UI · nav: N13 · footer: none
 * pre-emit critique: P5 H5 E4 S5 R5 V4
 */
@import url("./tokens.css");

* { box-sizing: border-box; }
html, body { min-height: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button, select { min-height: 44px; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .52; }
button[data-state="loading"] { cursor: wait; }
button[data-state="error"] { border-color: var(--color-error); }
button[data-state="success"] { border-color: var(--color-success); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.3fr) minmax(220px, .8fr);
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: var(--rule-thin) solid var(--color-rule);
  background: var(--color-paper);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  color: var(--color-ink); text-decoration: none; font-family: var(--font-display);
  font-weight: 700; letter-spacing: -.025em; white-space: nowrap;
}
.brand-mark {
  display: grid; place-items: center; min-width: 44px; height: 44px;
  border: var(--rule-thin) solid var(--color-rule-strong); border-radius: var(--radius-sm);
  font-family: var(--font-mono); color: var(--color-accent);
}
.command-search { position: relative; display: flex; align-items: center; }
.command-search input, .command-dialog-inner input {
  width: 100%; min-height: 44px; border: var(--rule-thin) solid var(--color-rule-strong);
  outline: 2px solid transparent; outline-offset: 1px; border-radius: var(--radius-md);
  background: var(--color-paper); color: var(--color-ink); padding: 0 86px 0 var(--space-md);
}
.command-search input::placeholder, .command-dialog-inner input::placeholder { color: var(--color-muted); }
.command-search input:hover, .command-dialog-inner input:hover { background: var(--color-paper-2); }
.command-search kbd {
  position: absolute; right: var(--space-sm); font-family: var(--font-mono); font-size: var(--text-xs);
  border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-xs); color: var(--color-muted); background: var(--color-paper-2);
}
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-sm); }
.save-state { font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }
.quiet-button, .text-button, .icon-button {
  border: var(--rule-thin) solid var(--color-rule); background: var(--color-paper); border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm); cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
.text-button { border-color: transparent; background: transparent; color: var(--color-accent); padding-inline: 0; }
.icon-button { min-width: 44px; font-size: var(--text-lg); }
@media (hover: hover) {
  .quiet-button:hover, .icon-button:hover { background: var(--color-paper-2); transform: translateY(-1px); }
  .text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
}
.quiet-button:active, .icon-button:active, .text-button:active { transform: translateY(1px); }
.workspace {
  height: calc(100dvh - 72px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 39%) minmax(0, 61%);
  overflow: hidden;
}
.coach-panel, .editor-panel { min-width: 0; min-height: 0; }
.coach-panel {
  padding: var(--space-lg);
  background: var(--color-paper);
  border-right: var(--rule-thin) solid var(--color-rule);
  overflow-y: auto;
}
.editor-panel { background: var(--color-code); color: var(--color-code-ink); display: flex; flex-direction: column; overflow-y: auto; }
.panel-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.coach-head { padding-bottom: var(--space-md); border-bottom: var(--rule-thin) solid var(--color-rule); }
.editor-head { padding: var(--space-sm) var(--space-lg); border-bottom: var(--rule-thin) solid var(--color-ink-2); }
h1, h2 { margin: 0; font-family: var(--font-display); font-style: normal; letter-spacing: -.025em; }
h1 { font-size: var(--text-xl); line-height: 1.15; }
h2 { font-size: var(--text-md); line-height: 1.25; }
.overline { margin: 0 0 var(--space-2xs); color: var(--color-muted); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; }
.editor-panel .overline { color: var(--color-code-muted); }
.live-indicator { display: flex; align-items: center; gap: var(--space-xs); color: var(--color-success); font-size: var(--text-sm); white-space: nowrap; }
.live-indicator i { width: 8px; height: 8px; background: var(--color-success); border-radius: 50%; }
.level-picker, .mission, .course-panel, .lesson-panel, .guidance, .feedback, .concept { padding-block: var(--space-lg); border-bottom: var(--rule-thin) solid var(--color-rule); }
.concept { border-bottom: 0; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.section-row > span { color: var(--color-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: var(--space-md); border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-md); overflow: hidden; }
.segmented button {
  border: 0; border-right: var(--rule-thin) solid var(--color-rule); background: var(--color-paper); cursor: pointer; white-space: nowrap;
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-selected="true"] { background: var(--color-ink); color: var(--color-paper); }
@media (hover: hover) { .segmented button:not([aria-selected="true"]):hover { background: var(--color-paper-2); } }

.mission > p, .concept > p { max-width: 58ch; }
.progress-track { height: 4px; background: var(--color-paper-3); margin-top: var(--space-md); overflow: hidden; border-radius: var(--radius-sm); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--color-accent); transition: transform var(--dur-short) var(--ease-out); transform-origin: left; }
.course-list { display: grid; gap: var(--space-xs); margin-top: var(--space-md); }
.curriculum-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xs); margin-top: var(--space-md); }
.curriculum-filters label { display: grid; gap: var(--space-2xs); color: var(--color-muted); font-size: var(--text-xs); }
.curriculum-filters select, .curriculum-filters input { width: 100%; min-height: 44px; border: var(--rule-thin) solid var(--color-rule-strong); border-radius: var(--radius-sm); background: var(--color-paper); color: var(--color-ink); padding: 0 var(--space-sm); color-scheme: light; }
.course-search-label { grid-column: 1 / -1; }
.route-progress { margin-top: var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
.course-list { max-height: 420px; overflow-y: auto; padding-right: var(--space-2xs); }
.course-stage-title { margin: var(--space-sm) 0 0; color: var(--color-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.course-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: var(--space-xs); border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); color: var(--color-ink); padding: var(--space-xs) var(--space-sm); text-align: left; cursor: pointer; }
.course-item span:first-child { min-width: 2em; color: var(--color-muted); font-family: var(--font-mono); }
.course-item.is-active { border-color: var(--color-accent); background: var(--color-accent-soft); }
.course-item.is-complete::after { content: "✓"; margin-left: auto; color: var(--color-success); font-weight: 700; }
.lesson-panel > p { max-width: 65ch; }
.lesson-task { margin-top: var(--space-md); padding: var(--space-sm); border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper-2); }
.lesson-task p { margin: var(--space-xs) 0 0; }
.lesson-metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); margin: var(--space-md) 0; }
.lesson-metadata-grid section, .lesson-detail, .lesson-project { border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper-2); padding: var(--space-sm); }
.lesson-metadata-grid ul, .lesson-detail ol, .lesson-detail ul { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); }
.lesson-detail, .lesson-project { margin-top: var(--space-sm); }
.lesson-detail summary { cursor: pointer; font-weight: 700; }
.lesson-detail li { margin-top: var(--space-xs); line-height: 1.55; }
.lesson-project p { margin: var(--space-xs) 0 0; }
.lesson-detail pre { overflow-x: auto; white-space: pre; background: var(--color-ink); color: var(--color-paper); padding: var(--space-md); border-radius: var(--radius-sm); }
.lesson-test-actions { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); flex-wrap: wrap; }
.lesson-test-actions span { color: var(--color-muted); font-size: .88rem; }
.lesson-test-actions span.is-pass { color: var(--color-success); font-weight: 700; }
.lesson-test-actions span.is-fail { color: var(--color-danger); font-weight: 700; }
.lesson-source { margin-top: var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
.lesson-source summary { cursor: pointer; color: var(--color-accent); }
.lesson-source ul { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); }
.lesson-source a { color: var(--color-accent); }
.lesson-nav { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }
.guidance-steps { margin: var(--space-md) 0; padding-left: var(--space-lg); display: grid; gap: var(--space-xs); }
.guidance-steps li { color: var(--color-muted); padding-left: var(--space-xs); }
.guidance-steps li.is-current { color: var(--color-ink); font-weight: 700; }
.next-action { margin-top: var(--space-lg); padding: var(--space-md); border: 2px solid var(--color-accent); border-radius: var(--radius-md); background: var(--color-paper); }
.next-action h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-md); }
.next-action > p:not(.overline) { margin: var(--space-xs) 0 0; }
.expected-result { color: var(--color-muted); }
.expected-result strong { color: var(--color-ink-2); }
.next-action-buttons { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }
.action-button { min-height: 44px; border: var(--rule-thin) solid var(--color-accent); border-radius: var(--radius-sm); background: var(--color-accent); color: var(--color-accent-ink); padding: 0 var(--space-md); cursor: pointer; white-space: nowrap; }
.action-button:active { transform: translateY(1px); }
.action-button:disabled { cursor: not-allowed; opacity: .52; }
.skip-step-button { min-height: 44px; border: 0; background: transparent; color: var(--color-muted); padding: 0 var(--space-sm); cursor: pointer; white-space: nowrap; text-decoration: underline; text-underline-offset: 4px; }
.skip-step-button:active { transform: translateY(1px); }
.skip-step-button:disabled { cursor: not-allowed; opacity: .52; text-decoration: none; }
.action-feedback { min-height: 1.5em; color: var(--color-accent); font-weight: 700; }
.line-teacher { margin-top: var(--space-lg); }
.line-teacher h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-base); }
.line-help-list { list-style: none; display: grid; gap: var(--space-sm); padding: 0; margin: var(--space-sm) 0 0; }
.line-help-item { padding: var(--space-sm); border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper-2); }
.line-help-code { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-sm); align-items: start; }
.line-help-code span { color: var(--color-accent); font-family: var(--font-mono); font-size: var(--text-xs); white-space: nowrap; }
.line-help-code code { color: var(--color-ink); font-family: var(--font-mono); font-size: var(--text-sm); overflow-wrap: anywhere; white-space: pre-wrap; }
.line-help-item p { margin: var(--space-xs) 0 0; color: var(--color-muted); font-size: var(--text-sm); }
.line-help-item strong { color: var(--color-ink-2); }
.line-help-item.is-guided { outline: 3px solid var(--color-focus); outline-offset: 2px; background: var(--color-accent-soft); }
.coach-question { margin: var(--space-md) 0 0; padding: var(--space-sm); border-radius: var(--radius-sm); background: var(--color-accent-soft); color: var(--color-ink-2); }
.feedback-list { list-style: none; padding: 0; margin: var(--space-md) 0 0; display: grid; gap: var(--space-sm); }
.feedback-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-sm); align-items: start;
  padding: var(--space-sm) 0; border-top: var(--rule-thin) solid var(--color-rule);
}
.feedback-item:first-child { border-top: 0; }
.feedback-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-family: var(--font-mono); font-size: var(--text-sm); background: var(--color-paper-2); }
.feedback-item[data-kind="error"] .feedback-icon { color: var(--color-error); }
.feedback-item[data-kind="warning"] .feedback-icon { color: var(--color-warning); }
.feedback-item[data-kind="success"] .feedback-icon { color: var(--color-success); }
.feedback-item strong { display: block; margin-bottom: var(--space-2xs); }
.feedback-item p { margin: 0; color: var(--color-muted); font-size: var(--text-sm); }
.feedback-line { font-family: var(--font-mono); color: var(--color-accent); font-size: var(--text-xs); }
.hint { padding: var(--space-sm); border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-accent-soft); color: var(--color-ink-2); }
.file-identity { display: flex; align-items: center; gap: var(--space-sm); }
.file-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); }
.editor-actions { display: flex; gap: var(--space-sm); align-items: center; }
select {
  border: var(--rule-thin) solid var(--color-ink-2); outline: 2px solid transparent; outline-offset: 1px;
  border-radius: var(--radius-sm); background: var(--color-code-2); color: var(--color-code-ink); padding: 0 var(--space-lg) 0 var(--space-sm); color-scheme: dark;
}
select option, select optgroup { color: var(--color-code-ink); background: var(--color-code-2); }
.run-button {
  display: flex; align-items: center; gap: var(--space-xs); border: var(--rule-thin) solid var(--color-accent);
  border-radius: var(--radius-sm); background: var(--color-accent); color: var(--color-accent-ink);
  padding: 0 var(--space-md); cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .run-button:hover { transform: translateY(-1px); } }
.run-button:active { transform: translateY(1px); }
.quiet-run-button {
  min-height: 44px; border: var(--rule-thin) solid var(--color-code-muted); border-radius: var(--radius-sm);
  background: var(--color-code-2); color: var(--color-code-ink); padding: 0 var(--space-md); cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .quiet-run-button:hover { transform: translateY(-1px); background: var(--color-ink-2); } }
.quiet-run-button:active { transform: translateY(1px); }
.quiet-run-button:disabled { cursor: not-allowed; opacity: .52; }
.editor-shell { flex: 1; min-height: 420px; display: grid; grid-template-columns: 58px minmax(0, 1fr); background: var(--color-code); }
.line-numbers {
  padding: var(--space-lg) var(--space-sm); text-align: right; white-space: pre; user-select: none;
  color: var(--color-code-muted); background: var(--color-code-2); border-right: var(--rule-thin) solid var(--color-ink-2);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.65;
}
#codeEditor {
  width: 100%; min-height: 420px; resize: none; border: 0; outline: 0; padding: var(--space-lg);
  background: var(--color-code); color: var(--color-code-ink); caret-color: var(--color-accent);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.65; tab-size: 2; white-space: pre; overflow: auto;
}
#codeEditor::selection { background: var(--color-accent); color: var(--color-accent-ink); }
.statusbar { min-height: 34px; display: flex; align-items: center; gap: var(--space-lg); padding: 0 var(--space-lg); border-top: var(--rule-thin) solid var(--color-ink-2); border-bottom: var(--rule-thin) solid var(--color-ink-2); color: var(--color-code-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.statusbar span:nth-child(2) { margin-left: auto; }
.output { padding: var(--space-md) var(--space-lg) var(--space-lg); background: var(--color-code-2); }
.output-head .text-button { color: var(--color-code-muted); }
.output pre { margin: var(--space-sm) 0 0; color: var(--color-code-ink); font-family: var(--font-mono); white-space: pre-wrap; max-height: 125px; overflow: auto; }
dialog {
  position: fixed; inset: 0; margin: auto; width: min(620px, calc(100% - 32px)); max-height: min(80vh, 600px);
  border: var(--rule-thin) solid var(--color-rule-strong); border-radius: var(--radius-lg); background: var(--color-paper); color: var(--color-ink); padding: 0;
}
dialog::backdrop { background: oklch(18% .028 255 / .58); }
.command-dialog-inner { padding: var(--space-lg); display: grid; gap: var(--space-md); }
.command-dialog-inner input { padding-right: var(--space-md); }
.command-results { display: grid; gap: var(--space-xs); max-height: 340px; overflow: auto; }
.command-item { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; border: var(--rule-thin) solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); padding: var(--space-sm); cursor: pointer; }
.command-item small { color: var(--color-muted); }
@media (hover: hover) { .command-item:hover { background: var(--color-paper-2); } }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .command-search { grid-column: 1 / -1; grid-row: 2; }
  .workspace { height: auto; min-height: calc(100dvh - 72px); grid-template-columns: 1fr; overflow: visible; }
  .coach-panel { overflow-y: visible; border-right: 0; border-bottom: var(--rule-thin) solid var(--color-rule); }
  .editor-panel { overflow-y: visible; }
  .editor-shell { min-height: 520px; }
  #codeEditor { min-height: 520px; }
}
@media (max-width: 560px) {
  .topbar, .coach-panel, .editor-head, .output { padding-inline: var(--space-md); }
  .lesson-metadata-grid { grid-template-columns: 1fr; }
  .save-state { display: none; }
  .brand > span:last-child { font-size: var(--text-sm); }
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented button:nth-child(2) { border-right: 0; }
  .segmented button:nth-child(-n+2) { border-bottom: var(--rule-thin) solid var(--color-rule); }
  .editor-head { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; flex-wrap: wrap; }
  .editor-actions select, .editor-actions .run-button, .editor-actions .quiet-run-button { flex: 1; }
  .statusbar { flex-wrap: wrap; gap: var(--space-xs) var(--space-md); padding-block: var(--space-xs); }
  .statusbar span:nth-child(2) { margin-left: 0; }
  .editor-shell { grid-template-columns: 44px minmax(0, 1fr); }
  .line-numbers, #codeEditor { padding-inline: var(--space-sm); font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 150ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; }
}
