.ide { max-width: 1560px; margin: auto; padding: 18px clamp(10px, 2vw, 26px) 36px; }
#return-lesson { color: #efebff; }
.ide-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ide-heading h1 { font-size: 24px; line-height: 1.35; }
.ide-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #fff; }
.ide-toolbar button { padding: 5px 9px; font-size: 13px; }
#toggle-inspector { margin-left: auto; }
#toggle-inspector[aria-expanded="true"] { background: var(--accent-bg); color: var(--accent); border-color: #d6ccff; }
.ide-grid { display: grid; grid-template-columns: 188px minmax(0, 1fr); align-items: start; background: #f1f2f7; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden; }
.ide-grid:has(.inspector:not([hidden])) { grid-template-columns: 188px minmax(0, 1fr) minmax(285px, .8fr); }
.ide-column { min-width: 0; }
.ide-pane { background: var(--paper); min-width: 0; }
.ide-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
.ide-modules { margin-bottom: 12px; }
.ide-modules summary { cursor: pointer; padding: 9px 12px; font-weight: 700; }
.ide-module-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; margin-top: 8px; }
.ide-module-options label { display: grid; gap: 3px; font-size: 13px; }
.ide-module-options select { min-width: 0; }
.ide-bar h2 { font-size: 14px; overflow-wrap: anywhere; }
.ide-files { padding-bottom: 12px; min-height: 100%; border-right: 1px solid var(--line); background: #f7f7fb; }
.ide-files h2 { color: #40465a; }
.ide-files #file-list { display: grid; gap: 2px; padding: 0 6px 7px; max-height: 40vh; overflow: auto; }
.ide-file { display: flex; align-items: baseline; gap: 8px; min-width: 0; text-align: left; padding: 5px 8px; color: #34384d; background: transparent; border-color: transparent; border-radius: 5px; font: 13px/1.5 var(--code); overflow-wrap: anywhere; }
.ide-file[aria-current="true"] { background: var(--accent-bg); color: #45339b; border-color: #dcd3fb; }
.ide-file span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { color: var(--accent); font-weight: 800; flex: none; }
.file-controls { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px 9px; }
.ide-files .file-controls { display: grid; grid-template-columns: repeat(2, 1fr); }
.file-controls button, .ide-download { font-size: 12px; padding: 4px 7px; }
.ide-download { margin: 7px 9px 0; }
.ide-pane select { min-width: 0; max-width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: inherit; background: #fff; font: inherit; }
.ide-material { display: grid; gap: 5px; margin: 4px 9px 0; padding: 8px 0 3px; border-top: 1px solid var(--line); font-size: 12px; }
.ide-material button { padding: 4px 6px; }
.ide-material label, #history-label { color: var(--muted); font-size: 13px; }
.editor-bar { border-bottom: 1px solid var(--line); background: #fbfaff; }
.editor-bar h2 { font: 650 13px/1.5 var(--code); color: #473888; }
.ide-editor .cm-editor { height: clamp(250px, 46vh, 560px); }
.ide-editor .cm-scroller { font: 14px/1.65 var(--code); overflow: auto; }
.ide-editor .cm-content, .ide-editor .cm-gutter { padding-top: 11px; padding-bottom: 10px; }
.ide-editor .cm-content { padding-inline: 6px; }
.ide-editor .cm-gutters { background: #f9f9fc; color: #6a7284; border-color: #ecedf4; min-width: 38px; }
.ide-editor .cm-activeLine, .ide-editor .cm-activeLineGutter { background: #f1edfc; }
.ide-editor .cm-focused { outline: 2px solid #8170db; outline-offset: -2px; }
.ide-editor .labc-editor-problem { text-decoration: underline wavy #ba3d26; text-underline-offset: 3px; }
.ide-status { padding-block: 4px; color: var(--muted); background: #fafafe; border-top: 1px solid var(--line); font-size: 12px; }
.ide-primary { background: var(--accent); border-color: var(--accent); color: white; }
.ide-save-note { margin: 0 14px 8px; }
.ide-save-note:empty { display: none; }
.console { border-top: 1px solid var(--line); }
.console .ide-bar { border-bottom: 1px solid var(--line); }
.inspector { min-height: 100%; border-left: 1px solid var(--line); }
.ide-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 12px; background: #f7f7fb; border-block: 1px solid var(--line); }
.ide-tabs button { border-color: transparent; background: transparent; padding: 6px 8px; }
.ide-tabs button[aria-selected="true"] { border-color: #d8cdff; color: #4936ac; background: var(--accent-bg); }
.ide-warning { padding: 8px 14px; background: #fff3d9; color: #65420f; font-size: 13px; }
.ide-body { padding: 12px 14px; }
#artifact-panel { min-height: 10rem; max-height: min(58vh, 38rem); overflow: auto; }
.ide-body h3 { font-size: 14px; margin-top: 10px; }
.ide-results { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin: 10px 0 0; }
.ide-results dt { color: var(--muted); font-size: 13px; }
.ide-results dd { margin: 4px 0 0; padding: 6px 8px; border-radius: 6px; background: #f5f4fa; }
.ide-results pre { margin: 0; max-height: 9rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#run-status[data-error="true"] { color: #8b3317; }
.ide-list { padding: 0; margin: 8px 0 0; list-style: none; display: grid; gap: 4px; }
.ide-list[hidden], .ide-location[hidden] { display: none; }
.ide-list button, .ide-tree button { width: 100%; padding: 5px 8px; text-align: left; font: 13px/1.6 var(--code); overflow-wrap: anywhere; }
.ide-list button[data-recent] { border-color: #b6a6f0; background: #f4efff; }
#ide-diagnostics button { background: #fff5ec; color: #6e351e; }
.ide-tree { list-style: none; padding: 0; margin: 6px 0; }
.ide-tree .ide-tree { margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--line); }
.ide-tree li { margin: 3px 0; }
.ide-tree summary { cursor: pointer; font: 13px/1.8 var(--code); overflow-wrap: anywhere; }
.ide-tree .node-link { width: auto; padding: 0 7px; color: var(--accent); }
.ide-location { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.ide-location-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
#location-snippet { margin: 8px 0 0; max-height: 8rem; overflow: auto; padding: 6px 8px; background: #f5f4fa; border-radius: 6px; }
#location-snippet mark { color: #2d215c; background: #e2d6ff; }
.ide-help { margin-top: 13px; font-size: 13px; color: var(--muted); }
.ide-help summary { cursor: pointer; width: fit-content; color: var(--accent); }
.ide-help p { margin-top: 5px; }
.ide-file-dialog { width: min(360px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.ide-file-dialog::backdrop { background: #25243b70; }
.ide-file-dialog input { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.ide-file-dialog h2 { font-size: 17px; margin-bottom: 10px; }
.ide-file-dialog .file-controls { justify-content: flex-end; padding-inline: 0; }
#file-dialog-note { color: #843c26; font-size: 13px; margin-top: 5px; }
@media (max-width: 920px) {
  .ide-grid:has(.inspector:not([hidden])) { grid-template-columns: 160px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  #artifact-panel { max-height: 28rem; }
}
@media (max-width: 540px) {
  .ide-grid, .ide-grid:has(.inspector:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .ide-files { border-right: 0; border-bottom: 1px solid var(--line); }
  .ide-files #file-list { max-height: 7rem; }
  .ide-material { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .ide-files #file-tools:not([hidden]) { display: flex; flex-wrap: wrap; }
  .ide-material { flex: 1 1 15rem; }
  #toggle-inspector { margin-left: 0; }
}
