@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');
:root {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 13px;
  color: #303735;
  background: #eef0f2;
  --green: #19765a;
  --line: #e6e8eb;
  --muted: #7b8387;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
main {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #dfe3e5;
  border-radius: 6px;
  background: #fff;
  color: #44504b;
  padding: 9px 13px;
  font-weight: 500;
}
button:hover:not(:disabled) {
  background: #eef4f0;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid #57a78a;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover:not(:disabled) {
  background: #115c45;
}
.toolbar {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  background: #fafafa;
  border-bottom: 1px solid #e1e4e6;
}
.brand {
  text-decoration: none;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #263d32;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.6px;
}
.logo {
  background: #19765a;
  color: #fff;
  border-radius: 6px;
  width: 26px;
  height: 27px;
  text-align: center;
  font-family: Georgia;
  font-style: italic;
  font-size: 26px;
  line-height: 23px;
}
.toolbar-divider {
  height: 21px;
  width: 1px;
  background: #dce1de;
}
.toolbar-spacer {
  flex: 1;
}
.demo-badge {
  color: #89908e;
  font-size: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.demo-badge i {
  width: 5px;
  height: 5px;
  background: #75a288;
  border-radius: 50%;
}
.library {
  position: relative;
}
.library summary {
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}
.library nav {
  position: absolute;
  left: 0;
  top: 32px;
  width: 250px;
  z-index: 10;
  background: white;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px #17291c20;
}
nav button {
  width: 100%;
  border: 0;
  display: block;
  text-align: left;
  padding: 12px;
  background: transparent;
  font-size: 12px;
}
nav button span {
  color: #9ba39c;
  margin-right: 12px;
}
nav button.active {
  background: #edf4ef;
  color: #1c7856;
}
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.explanation,
.visualization {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #dee2e5;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 41px;
  flex-shrink: 0;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  font-size: 12px;
}
.panel-subtitle {
  font-size: 10px;
  color: #929a9c;
  font-weight: 400;
}
.explanation-body,
.viz-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #cbd2cf transparent;
}
.explanation-body {
  padding: 22px 24px;
}
.viz-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.lab-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 0 0 20px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #8e9992;
}
h2 {
  font-size: 23px;
  letter-spacing: -0.6px;
  margin: 8px 0 0;
  font-weight: 600;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tags span {
  border-radius: 4px;
  background: #f3f5f4;
  color: #7b847e;
  padding: 4px 7px;
  font-size: 9px;
  white-space: nowrap;
}
.tags .verified {
  display: none;
}
h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
}
p {
  line-height: 1.8;
}
#description {
  font-size: 12px;
  color: #707a74;
  margin: 0 0 18px;
}
.input-drawer {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 17px;
  background: #fafbfa;
}
.input-drawer > summary {
  cursor: pointer;
  padding: 11px 12px;
  font-size: 11px;
  color: #78857c;
  list-style: none;
}
.input-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
}
.input-card {
  padding: 12px;
}
.input-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tabs {
  display: flex;
  gap: 5px;
}
.tabs button {
  font-size: 10px;
  border: 0;
  background: transparent;
  padding: 7px;
}
.tabs button.selected {
  background: #e9f1eb;
  color: #2e7650;
}
#inputHint {
  font-size: 9px;
  color: #939c97;
  max-width: 150px;
  line-height: 1.6;
}
textarea {
  width: 100%;
  padding: 12px 0;
  border: 0;
  resize: vertical;
  background: transparent;
  min-height: 70px;
  line-height: 1.8;
  font-size: 12px;
  color: #4d5c53;
  outline-color: #8dbb9e;
}
.input-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.input-bottom > span {
  font-size: 9px;
  line-height: 1.6;
  color: #96a092;
}
.input-bottom button {
  font-size: 10px;
  white-space: nowrap;
}
#inputFeedback:not(:empty) {
  font-size: 11px;
  color: #517658;
  margin-top: 12px;
  line-height: 1.7;
}
.learning-path {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 23px;
}
.path-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #a0a6a1;
  font-size: 8px;
  white-space: nowrap;
}
.path-item b {
  font-size: 8px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid #e1e6df;
  border-radius: 50%;
  font-weight: 400;
}
.path-item.active {
  color: #5d8b69;
}
.path-item.active b {
  background: #eef5eb;
  border-color: #d5e5cd;
}
.path-line {
  flex: 1;
  height: 1px;
  background: #e6eae3;
  min-width: 3px;
}
.idea {
  padding: 13px 15px;
  background: #f3f7f0;
  border: 1px solid #e7ede2;
  border-radius: 6px;
}
.idea > span {
  font-size: 11px;
  color: #5b8054;
  font-weight: 500;
}
.idea p {
  font-size: 11px;
  margin: 7px 0 0;
  color: #7d8b73;
}
.section-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #82907c;
  letter-spacing: 0.6px;
  margin: 22px 0 10px;
}
.section-label span {
  color: #a1aa99;
}
ol {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}
ol li {
  counter-increment: step;
  display: flex;
  gap: 13px;
  font-size: 11px;
  color: #7c8876;
  padding: 9px 11px;
  border-radius: 5px;
  line-height: 1.5;
}
ol li:before {
  content: counter(step, decimal-leading-zero);
  color: #a9b0a3;
  font-size: 10px;
}
ol li.active {
  background: #eaf4ef;
  color: #2c7a53;
  box-shadow: inset 3px 0 #438766;
}
.step-explanation {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 18px;
}
.step-explanation > span {
  font-size: 9px;
  color: #629778;
  letter-spacing: 1px;
}
.step-explanation h3 {
  margin: 9px 0;
}
.step-explanation p {
  font-size: 12px;
  margin: 0;
  color: #788874;
}
.left-footer {
  display: none;
}
.text-button {
  border: none;
  padding: 4px;
  background: transparent;
  font-size: 10px;
  color: #7f8983;
  font-weight: 400;
}
.viz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #81907c;
  flex-shrink: 0;
}
#targetBadge {
  padding: 6px 9px;
  background: #f0f5e9;
  border-radius: 4px;
  color: #70875b;
  font-size: 10px;
}
.array-stage {
  flex: 1;
  min-height: 185px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 45px 0 35px;
  margin: 15px 0;
  background-image: radial-gradient(#e0e6df 0.75px, transparent 0.75px);
  background-size: 15px 15px;
}
#array {
  display: flex;
  gap: 7px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}
.cell {
  position: relative;
  flex: 1;
  min-width: 26px;
  max-width: 61px;
  text-align: center;
}
.value {
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid #dae4d3;
  border-radius: 7px;
  background: #f8faf4;
  font-size: 18px;
  font-weight: 500;
  transition: all 0.2s;
}
.cell.active .value {
  background: #227b57;
  border-color: #227b57;
  color: white;
  box-shadow: 0 5px 12px #22835420;
}
.cell.out .value {
  color: #bdc5b7;
  border-color: #edf0e9;
  background: #f3f5f0;
}
.cell.sorted .value {
  background: #eaf3e2;
  color: #718d55;
  border-color: #d9e6ce;
}
.index {
  display: block;
  font-size: 10px;
  margin-top: 11px;
  color: #a1ac99;
}
.pointer {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 100%;
  font-size: 9px;
  white-space: nowrap;
  color: #5b8b66;
}
.legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 9px;
  color: #8d9a84;
  flex-shrink: 0;
}
.legend span {
  display: flex;
  gap: 6px;
  align-items: center;
}
.legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.current {
  background: #287d57;
}
.available {
  background: #e1ead6;
}
.excluded {
  background: #edf0e6;
}
.data-editor {
  margin-top: 23px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  color: #829078;
  flex-shrink: 0;
}
summary {
  cursor: pointer;
}
.data-form {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
  flex-wrap: wrap;
}
.data-form label {
  flex: 1;
  min-width: 80px;
}
.data-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px;
  margin-top: 6px;
}
.data-form button {
  font-size: 10px;
}
.variables-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 22px 0 12px;
  flex-shrink: 0;
}
.variables-heading h3 {
  margin: 0;
}
.variables-heading > span {
  font-size: 9px;
  color: #9da795;
}
#variables {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  flex-shrink: 0;
}
.var {
  padding: 12px;
  border: 1px solid #e3e9dc;
  border-radius: 6px;
  background: #fcfdf9;
}
.name {
  font: 11px monospace;
  color: #7f9073;
}
.change {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 19px;
}
.change b {
  font-weight: 500;
}
.change small {
  font-size: 11px;
  color: #a0ac95;
}
.var.changed {
  background: #f0f7e9;
  border-color: #c7dbb7;
}
.insight {
  display: flex;
  gap: 8px;
  background: #f6f8f2;
  border-radius: 6px;
  padding: 11px;
  margin-top: 17px;
  font-size: 12px;
  color: #90a07d;
  flex-shrink: 0;
}
.insight p {
  font-size: 10px;
  margin: 0;
}
.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 13px 17px;
  flex-shrink: 0;
  background: #fff;
}
.controls button {
  font-size: 11px;
}
.step-count {
  flex: 1;
  color: #8f9d83;
  font-size: 10px;
}
.step-count strong {
  font-weight: 400;
}
.progress {
  height: 3px;
  background: #edf1e7;
  width: 110px;
  margin-top: 7px;
}
.progress i {
  height: 100%;
  background: #7fa66f;
  display: block;
  transition: width 0.2s;
}
.unlock-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 17px;
  border-top: 1px solid var(--line);
  background: #f8faf6;
}
.unlock-icon {
  font-size: 18px;
  color: #8b9f78;
}
.unlock-card > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.unlock-card h3 {
  font-size: 10px;
  margin: 0;
  line-height: 1.6;
  color: #849479;
}
.unlock-card p {
  display: none;
}
.unlock-card button {
  font-size: 10px;
  padding: 8px;
  white-space: nowrap;
}
.quiz-card,
.solution {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 17px;
  margin-top: 22px;
  scroll-margin: 16px;
}
.quiz-card h3 {
  margin-top: 12px;
  line-height: 1.7;
}
#options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#options button {
  text-align: left;
  font-size: 11px;
  line-height: 1.7;
}
#quizFeedback {
  font-size: 11px;
  color: #5f854e;
}
#reviewStep {
  font-size: 10px;
}
.solution-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.solution-top h3 {
  margin: 8px 0;
}
.solution-top label {
  margin-left: auto;
  font-size: 10px;
}
.solution select {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
}
.solution-top button {
  font-size: 10px;
}
.solution pre {
  overflow: auto;
  background: #20382e;
  color: #e3efda;
  border-radius: 6px;
  padding: 17px;
  font-size: 11px;
  line-height: 1.8;
}
.solution p {
  font-size: 10px;
  color: #7d8d70;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1000px) {
  .explanation-body,
  .viz-body {
    padding: 18px;
  }
  .lab-heading {
    display: block;
  }
  .tags {
    justify-content: flex-start;
    margin-top: 10px;
  }
  .path-item {
    font-size: 7px;
    gap: 3px;
  }
  .learning-path {
    gap: 4px;
  }
  .value {
    font-size: 16px;
  }
  .unlock-card h3 {
    font-size: 9px;
  }
  .panel-subtitle {
    display: none;
  }
}
@media (max-width: 650px) {
  .toolbar {
    gap: 12px;
    padding: 0 12px;
  }
  .brand {
    font-size: 15px;
  }
  .library summary {
    font-size: 10px;
  }
  .lab {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 6px;
    padding: 6px;
  }
  .panel-title {
    height: 32px;
    font-size: 11px;
  }
  .explanation-body,
  .viz-body {
    padding: 14px;
  }
  .lab-heading {
    display: flex;
    margin-bottom: 15px;
  }
  h2 {
    font-size: 19px;
  }
  .array-stage {
    min-height: 130px;
    padding: 32px 0 18px;
    margin: 10px 0;
  }
  .value {
    height: 42px;
  }
  .controls {
    padding: 8px 12px;
  }
  .unlock-card {
    padding: 8px 12px;
  }
  .unlock-card h3 {
    display: none;
  }
  .unlock-card > div:nth-child(2) {
    display: none;
  }
  .unlock-card button {
    margin-left: auto;
  }
  .variables-heading {
    margin-top: 15px;
  }
  .toolbar-divider {
    display: none;
  }
}
.ai-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
}
.ai-controls label {
  font-size: 10px;
  color: var(--secondary);
}
.ai-controls select {
  background: var(--raised);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 4px;
}
.service-status {
  font-size: 10px;
  color: var(--quiet);
}
#analysis {
  margin-top: 16px;
  padding: 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
}
#analysis p,
#analysis pre {
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.8;
}
.sample-list {
  margin: 0 0 18px;
  font-size: 11px;
  color: var(--secondary);
}
#samples {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow: auto;
  gap: 5px;
  margin-top: 10px;
}
#samples button {
  text-align: left;
  font-size: 11px;
}
.library nav {
  max-height: 75dvh;
  overflow: auto;
  width: 300px;
}
.structure {
  margin: 16px 0;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}
.structure > div {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
  font-size: 11px;
}
.structure strong {
  min-width: 90px;
  font-weight: 500;
  color: var(--secondary);
}
.structure-item {
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 28px;
  text-align: center;
}
.structure svg {
  width: 100%;
  max-height: 240px;
}
.graph-edge {
  stroke: var(--quiet);
  stroke-width: 2;
}
.graph-node {
  fill: var(--surface);
  stroke: var(--quiet);
  stroke-width: 2;
}
.graph-node.visited {
  fill: var(--selection);
  stroke: var(--accent);
}
.graph-node.active {
  fill: var(--accent);
  stroke: var(--ink);
}
.structure text {
  fill: var(--ink);
  font-size: 13px;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 0.3px;
}
dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 9px;
  max-height: 90dvh;
  max-width: 850px;
  width: 90vw;
  padding: 24px;
  overflow: auto;
}
dialog::backdrop {
  background: #0009;
}
dialog p {
  font-size: 12px;
  color: var(--secondary);
}
dialog label {
  display: block;
  margin: 12px 0;
}
dialog input {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: var(--raised);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.dialog-close {
  float: right;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
#pythonCode {
  background: var(--canvas);
  font-family: monospace;
  padding: 12px;
  border: 1px solid var(--border);
}
#pythonTrace {
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#pythonStatus {
  white-space: pre-wrap;
}
.dialog-actions button {
  font-size: 11px;
}
#accountStatus {
  white-space: pre-wrap;
}
.var {
  overflow-wrap: anywhere;
}
.var .change {
  flex-wrap: wrap;
}
.sample-list summary {
  padding: 4px 0;
}
@media (max-width: 800px) {
  .theme-picker > span,
  .demo-badge {
    display: none;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar button {
    font-size: 9px;
  }
  .brand {
    font-size: 13px;
  }
  .library summary {
    font-size: 9px;
  }
}
.graph-node.active + text {
  fill: var(--accent-ink);
  stroke: none;
}
.structure-item.highlighted {
  background: var(--selection);
  border-color: var(--accent);
  color: var(--ink);
}
#analysis label {
  display: block;
  color: var(--secondary);
  font-size: 11px;
  margin-top: 12px;
}
#analysis textarea,
#analysis input {
  display: block;
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px;
  margin-top: 6px;
}
#analysisData {
  font-family: monospace;
}
#analysisError {
  color: #d7886d;
}
.matrix-grid {
  width: 100%;
  border-spacing: 7px;
  table-layout: fixed;
}
.matrix-grid td {
  border: 1px solid var(--border);
  border-radius: 5px;
  text-align: center;
  padding: 13px 3px;
  background: var(--surface);
}
.matrix-grid strong {
  display: block;
  font-size: 20px;
  color: var(--ink);
}
.matrix-grid small {
  display: block;
  font-size: 9px;
  color: var(--secondary);
  margin-top: 7px;
}
.matrix-grid td.highlighted {
  background: var(--selection);
  border-color: var(--accent);
}
.matrix-grid td.removed {
  opacity: 0.35;
}
.structure > p {
  font-size: 11px;
  color: var(--secondary);
}

.problem-form label {
  display: block;
  font-size: 11px;
  color: var(--secondary);
  margin: 10px 0;
}
.problem-form input,
.problem-form select,
.problem-form textarea {
  width: 100%;
  display: block;
  margin-top: 6px;
  padding: 9px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.problem-form fieldset {
  min-width: 0;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.problem-form legend {
  font-size: 11px;
  color: var(--secondary);
}
.problem-form button {
  font-size: 11px;
}
#exampleChecks p {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
#skipSummary {
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--selection);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 5px;
}
#undoSkip {
  align-self: flex-start;
  font-size: 11px;
}
.controls {
  flex-wrap: wrap;
}
#skipSteps {
  font-size: 10px;
}
#analysisExpected {
  font-family: monospace;
}

.locale-picker select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px;
  font-size: 11px;
}
.locale-picker {
  margin-left: 4px;
}
@media (max-width: 650px) {
  .locale-picker select {
    max-width: 80px;
    font-size: 10px;
  }
  .toolbar {
    gap: 6px;
  }
}

.structure:has(.linked-list) {
  overflow-x: auto;
}
.structure .linked-list {
  height: 160px;
}

.library nav {
  width: min(440px, 90vw);
}
.library nav > details {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.library nav > details > summary {
  padding: 8px;
  font-size: 12px;
  cursor: pointer;
}
.library nav p {
  font-size: 11px;
  color: var(--secondary);
  margin: 8px;
}
.library nav button {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
}
.saved-lesson {
  padding: 10px;
  margin: 6px 0;
  background: var(--raised);
  border-radius: 5px;
}
.saved-lesson strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.saved-lesson button {
  font-size: 11px;
}
#analysisGuidance {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 5px;
}
#reanalyze {
  margin: 10px 8px 10px 0;
}

/* Separate scrolling columns keep the right-hand flyout outside the category list. */
.library nav {
  width: 260px;
  max-height: none;
  overflow: visible;
  padding: 6px;
}
.library-categories {
  max-height: min(70dvh, 540px);
  overflow-y: auto;
}
.library nav .library-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px;
}
.library nav .library-category span {
  margin: 0;
  color: inherit;
}
.library-category span:first-child {
  flex: 1;
}
.library-flyout {
  position: absolute;
  left: 100%;
  top: 0;
  width: 340px;
  max-height: min(75dvh, 620px);
  overflow-y: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px #0002;
}
.library-flyout[hidden] {
  display: none;
}
@media (max-width: 760px) {
  .library nav {
    position: fixed;
    top: 50px;
    left: 8px;
    width: 39vw;
  }
  .library-flyout {
    width: calc(61vw - 16px);
  }
  .library nav .library-category {
    font-size: 11px;
    padding: 10px 6px;
  }
}

.study-report {
  margin: 12px 0;
  padding: 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.study-report h4 {
  margin: 12px 0 6px;
  font-size: 12px;
}
.study-report p {
  margin: 7px 0;
}
.study-report ol {
  padding-left: 20px;
  margin: 8px 0;
}
.study-report li {
  margin: 6px 0;
  line-height: 1.5;
}
.study-report strong {
  color: var(--ink);
}

.study-caveat {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  color: var(--secondary);
}

/* Library: topic list on the left, matching exercises on the right. */
.library nav {
  width: 250px;
  padding: 6px;
  overflow: visible;
}
.library-categories {
  max-height: min(64dvh, 520px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.library nav .library-category {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.35;
}
.library nav .library-category:hover,
.library nav .library-category.active {
  background: var(--selection);
  color: var(--ink);
}
.library nav .library-category span {
  margin: 0;
  color: inherit;
}
.library nav .library-category span:last-child {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  color: var(--quiet);
}
.library-flyout {
  left: calc(100% - 8px);
  width: min(370px, calc(100vw - 300px));
  max-height: min(75dvh, 650px);
  padding: 15px 14px;
  background: var(--surface);
  border-color: var(--border);
  border-radius: 0 8px 8px 0;
  scrollbar-width: thin;
}
.library-flyout h3 {
  font-size: 14px;
  margin: 2px 4px 12px;
}
.library .library-section-label {
  margin: 14px 4px 7px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.library-lesson {
  padding: 10px 4px;
  border-top: 1px solid var(--border);
}
.library-lesson h4 {
  margin: 0 8px 7px;
  font-size: 11px;
  color: var(--secondary);
  font-weight: 600;
}
.library-flyout button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}
.library-flyout button:hover,
.library-flyout button:focus-visible {
  background: var(--selection);
}
.library-flyout .saved-lesson {
  margin: 7px 0;
  padding: 10px 8px;
  background: var(--raised);
}
.library-flyout .saved-lesson strong {
  font-size: 11px;
  line-height: 1.5;
}
.library-flyout .saved-lesson small {
  display: block;
  margin-top: 3px;
  color: var(--quiet);
  font-size: 10px;
}
.library-error {
  padding: 10px;
  line-height: 1.5;
}
@media (max-width: 760px) {
  .library nav {
    width: 40vw;
    max-width: 250px;
  }
  .library-flyout {
    width: calc(60vw - 14px);
    max-width: none;
    padding: 10px;
    border-radius: 0 6px 6px 0;
  }
  .library nav .library-category {
    font-size: 10px;
    padding: 9px 7px;
  }
}
`n#inputFeedback:not(:empty) {
  padding: 10px 12px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: var(--raised);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.6;
  scroll-margin: 12px;
}
#inputFeedback[data-state='error'] {
  border-left-color: #c96b60;
}
#inputFeedback[data-state='loading'] {
  border-left-color: var(--accent);
}
#analysis {
  scroll-margin: 12px;
}
`n.analysis-wait {
  width: min(430px, calc(100vw - 32px));
  max-width: none;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 22px 70px #0008;
}
.analysis-wait::backdrop {
  background: rgba(5, 8, 12, 0.72);
}
.analysis-wait-content {
  display: flex;
  align-items: flex-start;
  gap: 17px;
}
.analysis-wait-content h2 {
  font-size: 17px;
  line-height: 1.35;
  margin: 0 0 10px;
}
.analysis-wait-content p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--secondary);
  margin: 0 0 8px;
}
.analysis-wait-content #analysisWaitElapsed {
  font-size: 11px;
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
}
.analysis-wait-spinner {
  display: block;
  flex: none;
  width: 27px;
  height: 27px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: analysis-wait-spin 0.8s linear infinite;
}
.analysis-wait-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
.analysis-wait-actions button {
  min-width: 110px;
}
@keyframes analysis-wait-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .analysis-wait-spinner {
    animation: none;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
  }
}
.verification-notice {
  margin: 12px 0;
  padding: 14px 16px;
  border: 2px solid #927022;
  border-radius: 10px;
  background: #fff8df;
  color: #45330a;
  line-height: 1.6;
  font-weight: 600;
}
.verification-notice[data-state='blocked'] {
  border-color: #b83c3c;
  background: #fff0f0;
  color: #792323;
}
.verification-notice[data-state='examples-matched'] {
  border-color: #357765;
  background: #edf9f3;
  color: #235346;
}
.visualization > .verification-notice {
  flex: 0 0 auto;
  margin: 8px 12px;
}
#contractReviewed {
  width: auto;
  margin-right: 8px;
}
#simulatorContract {
  padding: 12px;
  border: 1px solid currentColor;
  border-radius: 8px;
  line-height: 1.6;
}
