.c-mental-model { margin-top: 20px; margin-bottom: 0; }
.c-mental-model p { margin: 8px 0 0; }
.c-lesson__flowchart { min-height: 560px; margin-top: 20px; overflow: hidden; }
.c-lesson__flowchart [data-flowchart-react-host] { min-height: 560px; }
.flowchart-lesson-mode .flowchart-filebar,
.flowchart-lesson-mode .flowchart-examples,
.flowchart-lesson-mode .flowchart-palette,
.flowchart-lesson-mode .flowchart-inspector,
.flowchart-lesson-mode .flowchart-edge-insert__plus,
.flowchart-lesson-mode .flowchart-edge-insert__menu { display: none !important; }
.flowchart-lesson-mode .react-flow__node { pointer-events: none; }
.flowchart-lesson-mode .flowchart-workspace { margin-top: 0; }
.c-callstack__toolbar,
.c-arrayviz__toolbar,
.c-stringviz__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0; }
.c-callstack__steps { min-height: 220px; }
.c-callstack__step { border: 1px solid rgba(20, 36, 60, .12); border-radius: 12px; padding: 18px; background: rgba(20, 36, 60, .025); }
.c-callstack__step[hidden],
.c-arrayviz__step[hidden],
.c-stringviz__step[hidden] { display: none; }
.c-callstack__frames { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.c-callstack__frame { border: 1px solid rgba(20, 36, 60, .14); border-radius: 10px; padding: 14px; background: #fff; box-shadow: 0 7px 18px rgba(20, 36, 60, .05); }
.c-callstack__frame-title { font-weight: 800; margin-bottom: 10px; }
.c-callstack__vars { display: flex; flex-wrap: wrap; gap: 8px; }
.c-callstack__vars span { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: rgba(20, 36, 60, .06); }
.c-callstack__vars code { font-weight: 700; }
.c-callstack__return { margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-arrayviz__steps { min-height: 330px; }
.c-arrayviz__step { border: 1px solid rgba(20, 36, 60, .12); border-radius: 14px; padding: 18px; background: rgba(20, 36, 60, .025); }
.c-arrayviz__step-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.c-arrayviz__step-head h3 { margin-bottom: 6px; }
.c-arrayviz__target { flex: 0 0 auto; padding: 8px 11px; border: 1px solid currentColor; border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-arrayviz__cells { display: flex; align-items: flex-end; justify-content: center; gap: 10px; min-height: 230px; margin: 22px 0 16px; overflow-x: auto; padding: 16px 6px 8px; }
.c-arrayviz__cell { position: relative; flex: 0 0 76px; display: grid; grid-template-rows: auto 150px auto; gap: 6px; align-items: end; text-align: center; border: 1px solid rgba(20, 36, 60, .13); border-radius: 12px; padding: 8px; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.c-arrayviz__index { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; opacity: .65; }
.c-arrayviz__bar-wrap { height: 150px; display: flex; align-items: flex-end; justify-content: center; }
.c-arrayviz__bar { display: block; width: 72%; min-height: 14px; height: calc(var(--array-value) * 14px); max-height: 140px; border-radius: 7px 7px 3px 3px; background: currentColor; opacity: .42; transition: height .2s ease, opacity .2s ease; }
.c-arrayviz__value { font-size: 1.1rem; }
.c-arrayviz__cell.is-primary { transform: translateY(-8px); box-shadow: 0 0 0 3px currentColor; }
.c-arrayviz__cell.is-primary .c-arrayviz__bar { opacity: .9; }
.c-arrayviz__cell.is-secondary { box-shadow: inset 0 0 0 2px currentColor; }
.c-arrayviz__cell.is-candidate::after { content: "★"; position: absolute; top: -14px; right: -7px; font-size: 1rem; }
.c-arrayviz__cell.is-locked { background: rgba(20, 36, 60, .09); }
.c-arrayviz__cell.is-locked .c-arrayviz__index { opacity: 1; font-weight: 800; }
.c-arrayviz__metrics { display: flex; flex-wrap: wrap; gap: 10px; }
.c-arrayviz__metrics span { min-width: 110px; display: grid; gap: 2px; padding: 9px 12px; border-radius: 9px; background: rgba(20, 36, 60, .06); }
.c-arrayviz__metrics small { opacity: .7; }
.c-arrayviz__metrics strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-stringviz__steps { min-height: 245px; }
.c-stringviz__step { border: 1px solid rgba(20, 36, 60, .12); border-radius: 14px; padding: 18px; background: rgba(20, 36, 60, .025); }
.c-stringviz__cells { display: flex; justify-content: center; gap: 10px; margin-top: 22px; overflow-x: auto; padding: 10px 5px 15px; }
.c-stringviz__cell { position: relative; flex: 0 0 92px; display: grid; gap: 6px; justify-items: center; padding: 12px 10px; border: 1px solid rgba(20, 36, 60, .15); border-radius: 12px; background: #fff; transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease; }
.c-stringviz__index { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; opacity: .62; }
.c-stringviz__char { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 9px; background: rgba(20, 36, 60, .07); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.35rem; }
.c-stringviz__cell small { opacity: .68; }
.c-stringviz__cell.is-active { transform: translateY(-6px); box-shadow: 0 0 0 3px currentColor; }
.c-stringviz__cell.is-read { background: rgba(14, 181, 130, .10); }
.c-stringviz__cell.is-read .c-stringviz__char { box-shadow: inset 0 -4px 0 currentColor; }
.c-stringviz__cell.is-terminator { border-style: dashed; }
.c-stringviz__cell.is-terminator::after { content: "END"; position: absolute; top: -10px; right: -5px; padding: 2px 5px; border-radius: 999px; background: #fff; font-size: .65rem; font-weight: 800; }
.c-lab { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 20px; margin-top: 20px; }
.c-lab__code, .c-lab__console { min-width: 0; border: 1px solid rgba(20, 36, 60, .12); border-radius: 12px; overflow: hidden; }
.c-lab__label, .c-lab__console > label { display: block; padding: 10px 14px; font-weight: 700; }
.c-lab__label { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.c-code-sync { font-size: .84rem; font-weight: 600; opacity: .72; }
.c-code-sync[data-state="modified"] { opacity: 1; font-weight: 800; }
.c-source-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 14px; border-top: 1px solid rgba(20, 36, 60, .10); border-bottom: 1px solid rgba(20, 36, 60, .10); background: rgba(20, 36, 60, .035); }
.c-source-toolbar .tutor-btn { padding: 7px 11px; }
.c-source-toolbar__note { margin-left: auto; font-size: .8rem; opacity: .72; }
.c-lab__code pre, .c-lab__output, .c-lab__diagnostics { margin: 0; padding: 18px; overflow: auto; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-lab__code pre { min-height: 310px; max-height: 420px; background: #111827; color: #f8fafc; white-space: normal; font-size: 14px; line-height: 1.35; }
.c-source code { display: block; min-width: max-content; white-space: normal; line-height: inherit; }
.c-source-editor { display: block; width: 100%; min-height: 310px; max-height: 560px; margin: 0; padding: 18px; border: 0; border-radius: 0; resize: vertical; background: #111827; color: #f8fafc; caret-color: #f8fafc; font: 14px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 4; white-space: pre; overflow: auto; }
.c-source-editor[hidden] { display: none; }
.c-source-editor:focus { outline: 2px solid rgba(14, 181, 130, .8); outline-offset: -2px; }
.c-code-line { display: grid; grid-template-columns: 3rem minmax(0, 1fr); min-height: 1.35em; line-height: 1.35; margin: 0 -18px; padding: 0 18px; transition: background-color .16s ease, box-shadow .16s ease; }
.c-code-line__number { user-select: none; text-align: right; padding-right: 14px; opacity: .42; line-height: inherit; }
.c-code-line__text { white-space: pre; line-height: inherit; }
.c-code-line.is-flowchart-current { background: rgba(14, 181, 130, .22); box-shadow: inset 4px 0 0 currentColor; }
.c-code-line.is-calltrace-current { background: rgba(118, 91, 204, .28); box-shadow: inset 4px 0 0 currentColor; }
.c-code-line.is-arraytrace-current { background: rgba(224, 152, 62, .28); box-shadow: inset 4px 0 0 currentColor; }
.c-code-line.is-stringtrace-current { background: rgba(61, 137, 205, .28); box-shadow: inset 4px 0 0 currentColor; }
.c-code-line.is-flowchart-current.is-calltrace-current,
.c-code-line.is-flowchart-current.is-arraytrace-current,
.c-code-line.is-flowchart-current.is-stringtrace-current { background: rgba(58, 156, 176, .30); }
.c-code-line.is-flowchart-current .c-code-line__number,
.c-code-line.is-calltrace-current .c-code-line__number,
.c-code-line.is-arraytrace-current .c-code-line__number,
.c-code-line.is-stringtrace-current .c-code-line__number { opacity: 1; font-weight: 700; }
.c-lab__console { padding-bottom: 14px; }
.c-lab__console textarea { display: block; width: calc(100% - 28px); min-height: 95px; margin: 0 14px 14px; padding: 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-lab__actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 14px 14px; }
.c-lab__status { margin: 0 14px 14px; padding: 10px 12px; border-radius: 8px; background: rgba(20, 36, 60, .06); }
.c-lab__status[data-state="success"] { font-weight: 700; }
.c-lab__status[data-state="error"] { font-weight: 700; }
.c-lab__output, .c-lab__diagnostics { min-height: 80px; margin: 0 14px; border-radius: 8px; background: #111827; color: #f8fafc; }
.c-lab__diagnostics { white-space: pre-wrap; }
.c-practice { display: grid; gap: 12px; margin-top: 20px; }
.c-practice__choice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid rgba(20, 36, 60, .14); border-radius: 10px; cursor: pointer; }
.c-practice__choice input { margin: 0; }
.c-feedback { margin-top: 24px; }
.c-lesson__nav { display: flex; justify-content: space-between; gap: 14px; margin: 28px 0; }
@media (max-width: 900px) {
    .c-lab { grid-template-columns: 1fr; }
    .c-lesson__flowchart, .c-lesson__flowchart [data-flowchart-react-host] { min-height: 500px; }
    .c-callstack__toolbar, .c-arrayviz__toolbar, .c-stringviz__toolbar { flex-wrap: wrap; }
    .c-arrayviz__step-head { flex-direction: column; }
    .c-arrayviz__cells, .c-stringviz__cells { justify-content: flex-start; }
    .c-source-toolbar__note { width: 100%; margin-left: 0; }
}
