:root {
 color-scheme: dark;
 --bg: #111619;
 --panel: #181e22;
 --line: #303a40;
 --text: #e0e6e9;
 --muted: #a3afb7;
 --green: #b4e590;
 --blue: #a0c9f2;
 --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; border: 0; background: none; }
button:hover:not(:disabled) { background-color: #ffffff09; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
button:disabled { cursor: default; color: #a3afb7; }
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3, p { margin-top: 0; }
.dim { color: var(--muted); }
.green { color: var(--green); }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 10; background: var(--green); color: #172218; padding: 10px 16px; border-radius: 6px; }
.skip-link:focus { top: 8px; }
.app-header { min-height: 72px; display: flex; align-items: center; gap: 28px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #151b1f; }
.brand { color: var(--text); font: 700 23px var(--mono); letter-spacing: -1px; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--green); }
.app-tagline { color: var(--muted); font-size: 13px; }
.app-nav { display: flex; gap: 8px; margin-left: auto; }
.app-nav button { min-height: 44px; padding: 8px 14px; border-radius: 6px; font-size: 13px; color: #c6d0d6; }
.app-nav button[aria-expanded="true"] { color: var(--green); background: #b4e5900c; }
.workspace { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.explorer { background: #151b1f; border-right: 1px solid var(--line); padding: 28px 16px; }
.sidebar-heading { padding: 0 10px 22px; }
.sidebar-heading h2 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.sidebar-heading span { font-size: 12px; color: var(--muted); }
.chapter-button { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px; border-radius: 6px; color: #b2bdc5; margin: 4px 0; font-size: 13px; line-height: 1.5; }
.chapter-button.active { color: var(--green); background: #b4e5900c; }
.chapter-num { font: 11px var(--mono); color: var(--muted); }
.chapter-button.active .chapter-num { color: var(--green); }
.chapter-completion { margin-left: auto; font: 11px var(--mono); white-space: nowrap; }
.mission-list { margin: 4px 0 16px 18px; border-left: 1px solid var(--line); padding-left: 12px; }
.mission-link { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 40px; padding: 8px; border-radius: 4px; }
.mission-link.active { color: var(--text); background: #ffffff05; }
.mission-link i { width: 5px; height: 5px; border-radius: 50%; background: #71818c; flex-shrink: 0; }
.mission-link.active i, .mission-link.done i { background: var(--green); }
.sidebar-progress { border-top: 1px solid var(--line); margin: 28px 10px 0; padding-top: 22px; }
.sidebar-progress > div:first-child { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.sidebar-progress b { color: var(--green); }
.progress-track { height: 4px; background: #344047; border-radius: 3px; margin-top: 12px; overflow: hidden; }
.progress-track i { display: block; width: 0; background: var(--green); height: 100%; }
.sidebar-progress p { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.text-button { min-height: 44px; padding: 10px 0; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.sidebar-note { font-size: 12px; color: var(--muted); padding: 12px 10px 0; }
main { padding: 0 28px; min-width: 0; max-width: 1800px; width: 100%; margin: 0 auto; }
.lesson-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; gap: 24px; }
.eyebrow { font-size: 11px; font-weight: 600; color: var(--green); letter-spacing: 1px; }
h1 { font-size: clamp(25px, 2vw, 29px); font-weight: 600; letter-spacing: -1px; line-height: 1.25; margin: 12px 0; }
.lesson-header p { font-size: 14px; color: var(--muted); margin: 0; }
.lesson-counter { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.lesson-counter strong { color: var(--text); font: 24px var(--mono); }
.device-note { display: none; }
.practice-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 310px); grid-template-areas: "editor mission" "editor actions"; gap: 0 24px; align-items: start; }
.mission-pane { grid-area: mission; min-width: 0; padding: 4px 0 20px; }
.step-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.mission-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#mission-duration { font-size: 12px; color: var(--muted); }
h2 { font-size: 22px; line-height: 1.4; letter-spacing: -.4px; font-weight: 600; margin: 18px 0 12px; }
#mission-description { color: #b4bfc7; font-size: 14px; line-height: 1.85; margin-bottom: 22px; }
.objective { border-left: 2px solid var(--green); background: #b4e59006; padding: 14px 16px; }
.objective h3 { font-size: 12px; font-weight: 600; color: var(--green); margin-bottom: 6px; }
.objective p { font-size: 15px; line-height: 1.8; margin: 0; }
.concept { font-size: 13px; color: #b4bfc7; line-height: 1.9; margin: 20px 0 14px; }
kbd { font: 12px/1.5 var(--mono); display: inline-block; border: 1px solid #4b5963; border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: #252e35; color: var(--text); white-space: nowrap; }
#hint-box { border-left: 2px solid #dfbd7e; padding: 12px 14px; background: #dfbd7e09; font-size: 14px; line-height: 1.8; color: #e4cea5; margin: 16px 0; overflow-wrap: anywhere; }
.help-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 10px 0; font-size: 13px; color: #c1cbd2; text-align: left; }
.help-button span { font-size: 12px; color: var(--muted); }
.start-button { border: 1px solid #4b5e49; color: var(--green); border-radius: 6px; min-height: 44px; width: 100%; font-size: 13px; padding: 10px; margin-top: 8px; }
.editor-pane { grid-area: editor; border: 1px solid #37434b; border-radius: 8px; overflow: hidden; background: var(--panel); min-width: 0; min-height: min(680px, calc(100vh - 220px)); align-self: stretch; display: flex; flex-direction: column; }
.file-tabs { min-height: 52px; padding: 10px 16px; display: flex; gap: 12px; border-bottom: 1px solid var(--line); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.file-tab { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); color: #b8c4cc; }
#dirty-dot { font-size: 8px; color: var(--green); visibility: hidden; }
.editor-hint { font-size: 12px; color: var(--muted); padding: 14px 18px 0; }
.editor-hint span { display: block; }
#editor { display: flex; flex: 1; min-height: 0; }
.CodeMirror { height: 100%; width: 100%; flex: 1; background: var(--panel); color: var(--text); font: 15px/1.9 var(--mono); min-height: 380px; }
.CodeMirror-lines { padding: 24px 0; }
.CodeMirror-gutters { background: var(--panel); border: 0; padding: 0 6px; }
.CodeMirror-linenumber { color: #8c9ba5; }
.CodeMirror-cursor { border-left-color: var(--green); }
.cm-fat-cursor .CodeMirror-cursor { background: #b4e590a3; }
.CodeMirror-selected { background: #344450 !important; }
.cm-s-default .cm-comment { color: #9aad9e; }
.cm-s-default .cm-def, .cm-s-default .cm-atom { color: #a5ccec; }
.cm-s-default .cm-number { color: #e2be8f; }
.cm-s-default .cm-string { color: #bddda8; }
.cm-s-default .cm-quote { color: #dfbc95; }
.cm-searching { background: #e6bd5838; outline: 1px solid #e6bd58; }
.CodeMirror-dialog { background: #222b32; color: var(--text); padding: 10px 12px; border-color: #53636e; font: 13px var(--mono); }
.CodeMirror-dialog input { color: var(--green); font: 13px var(--mono); }
.editor-status { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); background: #20282d; min-height: 36px; font-size: 11px; color: #bac6ce; }
.mode { display: inline-flex; align-items: center; justify-content: center; align-self: stretch; min-width: 76px; font: 700 11px var(--mono); background: var(--green); color: #1b2919; }
.mode.insert { background: #a0c9f2; color: #142b43; }
.mode.visual { background: #d3a5f2; color: #351b47; }
#cursor { margin-left: auto; padding-right: 12px; white-space: nowrap; font: 10px var(--mono); }
.terminal { border-top: 1px solid var(--line); padding: 14px 18px; }
.terminal-line { font-size: 12px; color: #b6c2c9; line-height: 1.7; overflow-wrap: anywhere; }
.key-details { margin-top: 8px; color: var(--muted); font-size: 12px; }
.key-details summary { cursor: pointer; padding: 6px 0; }
#key-history { display: flex; gap: 5px; flex-wrap: wrap; padding: 10px 0 4px; font-size: 12px; }
.mission-actions { grid-area: actions; padding-top: 18px; border-top: 1px solid var(--line); }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 46px; border-radius: 6px; padding: 12px 16px; background: var(--green); color: #1d2d16; font-size: 14px; font-weight: 650; margin-top: 12px; }
.primary:hover:not(:disabled) { background: #c4efa5; }
#result { font-size: 14px; line-height: 1.7; }
#result:not(:empty) { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; }
#result.good { color: var(--green); background: #b4e59008; }
#result.bad { color: #e8c68d; background: #e8c68d08; }
.below-editor { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 0; margin-top: 28px; border-top: 1px solid var(--line); }
.below-editor h2 { margin: 0 0 4px; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.below-editor p { color: var(--muted); font-size: 13px; margin: 0; }
.below-editor button { border: 1px solid var(--line); border-radius: 6px; font-size: 13px; padding: 10px 16px; min-height: 44px; white-space: nowrap; }
.below-editor button:not(:disabled) { color: var(--green); }
footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; padding: 18px 0; font-size: 11px; color: var(--muted); gap: 8px 20px; }
.workspace.sidebar-hidden { grid-template-columns: minmax(0, 1fr); }
.sidebar-hidden .explorer { display: none; }
dialog { background: #1b2329; color: var(--text); border: 1px solid #53636e; border-radius: 10px; padding: 24px; max-width: 650px; width: calc(100% - 32px); max-height: 85vh; box-shadow: 0 24px 80px #0008; }
dialog::backdrop { background: #070b0ed9; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.modal-header h2 { margin: 0 0 18px; }
.modal-header button { font-size: 27px; align-self: flex-start; min-width: 44px; min-height: 44px; }
.reference-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.reference-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); line-height: 1.7; }
.reference-table td:first-child { color: var(--green); font-family: var(--mono); overflow-wrap: anywhere; }
#modal-content p { color: #bac6ce; line-height: 1.8; font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.stat-grid > div { background: #253139; padding: 18px 12px; border-radius: 6px; font-size: 12px; color: #bac6ce; }
.stat-grid strong { display: block; font: 26px var(--mono); color: var(--green); margin-bottom: 8px; }
.modal-list { list-style: none; padding: 0; font-size: 14px; }
.modal-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.quiz-choice { font: 13px var(--mono); border: 1px solid #53636e; padding: 12px; min-height: 44px; border-radius: 6px; text-align: left; }
.quiz-choice.chosen { border-color: var(--green); background: #b4e59015; color: var(--green); }
.practice-layout.is-quiz { grid-template-columns: minmax(0, 660px); grid-template-areas: "mission" "actions"; }
.is-quiz .editor-pane { display: none; }
@media (max-width: 1200px) {
 .workspace { grid-template-columns: 205px minmax(0, 1fr); }
 main { padding: 0 24px; }
 .practice-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 0 20px; }
 .explorer { padding: 24px 10px; }
 #mode-description { font-size: 10px; }
 #cursor { display: none; }
}
@media (max-width: 1050px) {
 .workspace, .workspace.sidebar-hidden { grid-template-columns: minmax(0, 1fr); }
 .explorer { display: none; }
 .workspace.sidebar-open { grid-template-columns: 220px minmax(0, 1fr); }
 .sidebar-open .explorer { display: block; }
 .sidebar-open .practice-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mission" "editor" "actions"; gap: 20px; }
 .sidebar-open .is-quiz { grid-template-areas: "mission" "actions"; }
}
@media (max-width: 700px) {
 .app-header { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
 .app-tagline { display: none; }
 .brand { font-size: 20px; }
 .app-nav { gap: 0; }
 .app-nav button { font-size: 12px; padding: 8px; }
 main { padding: 0 20px; }
 .lesson-header { padding: 26px 0 20px; }
 .lesson-counter { display: none; }
 .eyebrow { font-size: 10px; }
 h1 { font-size: 27px; }
 .device-note { display: block; font-size: 12px; color: var(--muted); border-left: 2px solid #5a6b76; padding-left: 12px; margin-bottom: 28px; }
 .practice-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mission" "editor" "actions"; gap: 20px; }
 .practice-layout.is-quiz { grid-template-areas: "mission" "actions"; }
 .mission-pane { padding: 0; }
 .editor-pane { min-height: 0; }
 #editor { flex: none; }
 .CodeMirror { height: 290px; min-height: 290px; font-size: 13px; }
 .editor-hint { padding: 12px 14px 0; }
 .editor-status { gap: 8px; }
 #mode-description { font-size: 10px; padding: 4px 8px 4px 0; }
 .below-editor { align-items: flex-start; flex-direction: column; gap: 14px; }
 .below-editor button { width: 100%; }
 .workspace.sidebar-open { grid-template-columns: minmax(0, 1fr); }
 .sidebar-open main { display: none; }
 .sidebar-open .explorer { padding: 24px; }
 .mission-link { min-height: 44px; }
 .stat-grid { gap: 6px; }
 .stat-grid > div { padding: 14px 8px; }
 .stat-grid strong { font-size: 22px; }
}

.storage-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border: 1px solid #8a714a; border-radius: 6px; background: #e8c68d08; color: #e8c68d; padding: 14px 18px; margin-top: 24px; font-size: 14px; }
.storage-banner p { margin: 0; }
.storage-banner button { border: 1px solid #8a714a; border-radius: 4px; padding: 8px; white-space: normal; color: inherit; }
#learn-button { display: block; text-align: left; color: var(--green); }
