:root{--bg:#10151f;--panel:#171e2b;--raised:#202a3a;--line:#2d394a;--text:#e0e8f1;--muted:#95a5b9;--accent:#73ded0;--blue:#a9c4fd;--red:#ff9c9c}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px system-ui,-apple-system,sans-serif}button,input,select{font:inherit}button,select{border:1px solid var(--line);border-radius:5px;background:var(--raised);color:var(--text);padding:8px 12px}button{cursor:pointer;white-space:nowrap}button:hover{border-color:#6b839e;background:#2a384b}button:disabled{opacity:.4;cursor:default}.primary{background:var(--accent);color:#0e2828;border-color:transparent;font-weight:650}.primary:hover{background:#95eadd;color:#0e2828}button.active{background:#263d49;border-color:var(--accent);color:var(--accent)}input{background:#111924;border:1px solid var(--line);color:var(--text);padding:8px;border-radius:4px;max-width:100%}input[type=number]{width:68px}input[type=checkbox]{accent-color:var(--accent)}input[type=range]{padding:0;width:100%}label{color:var(--muted);font-size:12px}p{line-height:1.6}header{height:86px;display:flex;align-items:center;gap:26px;padding:0 26px;border-bottom:1px solid var(--line);background:#141c27}.brand{display:flex;align-items:center;gap:20px;text-decoration:none;color:var(--text)}.brand b{font:900 34px system-ui;letter-spacing:-2px}.brand b span{color:var(--accent)}.brand div{font-size:12px;letter-spacing:2px;border-left:1px solid var(--line);padding-left:20px}.brand small{display:block;font-size:11px;letter-spacing:.3px;color:var(--muted);margin-top:6px}.server{margin-left:auto;color:var(--muted);font-size:12px;display:flex;align-items:center;gap:8px}.server i{width:7px;height:7px;background:#d9aa65;border-radius:50%}.server i.ok{background:var(--accent)}.menubar{display:flex;align-items:center;height:39px;gap:24px;padding:0 26px;border-bottom:1px solid var(--line);font-size:12px}.menubar details{position:relative}.menubar summary{cursor:pointer;list-style:none}.menubar details div{position:absolute;top:26px;left:0;z-index:30;min-width:225px;padding:7px;background:var(--panel);border:1px solid var(--line);box-shadow:0 12px 30px #0008;display:grid;gap:4px}.menubar details div button{text-align:left;background:none;border:0}.menubar details div label{padding:8px}.plain{border:0;background:none;padding:0;font-size:12px}.version{margin-left:auto;color:var(--muted);font-size:11px}.workspace{display:flex;min-height:calc(100vh - 154px)}.project{width:220px;flex-shrink:0;background:#141c27;border-right:1px solid var(--line);padding:22px 14px;display:flex;flex-direction:column;gap:13px}.sectiontitle{font-size:10px;font-weight:750;letter-spacing:1.4px;color:var(--muted);display:flex;align-items:center;justify-content:space-between;gap:10px}.sectiontitle button{padding:1px 7px}.project #projectName{font-weight:600;font-size:12px;width:100%}#files{display:grid;gap:4px}#files button{text-align:left;display:flex;align-items:center;gap:6px;border:0;background:none;padding:10px 8px;font-size:12px;overflow:hidden;max-width:190px}#files button.active{background:#24343f;color:var(--accent)}.filedelete{margin-left:auto;opacity:.5}.projectbottom{margin-top:auto;display:grid;gap:14px;padding-top:60px}.projectbottom label{display:flex;align-items:center;justify-content:space-between}.projectbottom select{font-size:11px;padding:4px}.projectbottom p,.hint{font-size:11px;line-height:1.6;color:var(--muted)}.projectbottom strong{color:var(--text);font-size:11px}main{flex:1;min-width:0;display:flex;flex-direction:column}.toolbar{height:64px;display:flex;align-items:center;justify-content:space-between;padding:0 22px;background:#151d29;border-bottom:1px solid var(--line);gap:12px}.views,.build{display:flex;gap:8px}.views button{background:none;border:0;font-size:12px;padding:10px 15px}.views button.active{background:#263b43;color:var(--accent)}.build button{font-size:12px}.view{flex:1;min-height:420px}.filetab{height:39px;background:#171f2c;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 22px;gap:18px;font-size:12px}.filetab span:first-child{color:var(--accent)}#edited{color:var(--muted);font-size:10px}#setEntry{margin-left:auto;font-size:10px;padding:3px 7px}.editorwrap{height:calc(100vh - 480px);min-height:330px;display:flex;overflow:hidden;position:relative;background:#101721;padding-top:23px}.codearea{position:relative;flex:1;min-width:0;overflow:hidden}#lineNumbers{width:62px;text-align:right;padding-right:20px;color:#56667c;user-select:none;overflow:hidden;font:13px/23px ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre}#editor,#highlight{position:absolute;inset:0;margin:0;padding:0 32px 100px 0;border:0;font:13px/23px ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre;tab-size:4;letter-spacing:0;border-radius:0;overflow:auto;width:100%;height:100%;resize:none}#editor{background:transparent;color:transparent;caret-color:#fff;outline:none;-webkit-text-fill-color:transparent}#editor::selection{background:#70a4d94d}#editor::placeholder{color:#64768d;-webkit-text-fill-color:#64768d}#highlight{color:#d5e2f0;pointer-events:none}#highlight .kw{color:#79dddb;font-weight:bold}#highlight .str{color:#e3c78d}#highlight .comment{color:#7caa8b}#highlight .num{color:#d5b1f7}.editorstatus{display:flex;justify-content:space-between;padding:7px 22px;border-top:1px solid var(--line);font-size:10px;color:var(--muted)}.output{border-top:1px solid var(--line);background:#141c27;height:211px;flex-shrink:0}.outputtabs{display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--line);height:39px;padding:0 16px}.outputtabs button{font-size:11px;background:none;border:0;border-radius:0;height:100%}.outputtabs button.active{border-bottom:2px solid var(--accent);color:var(--accent)}.outputcontent{padding:12px 24px;overflow:auto;height:169px;font-size:12px}.outputcontent p{margin:4px 0}.outputcontent h3{margin:0 0 6px;font-size:15px;color:var(--accent)}.outputcontent pre{white-space:pre-wrap}.muted{color:var(--muted)}.error{color:var(--red);cursor:pointer;padding:8px 0;border-bottom:1px solid var(--line)}#busy{margin-left:auto;font-size:11px;color:var(--muted)}footer{height:29px;background:#192736;display:flex;align-items:center;justify-content:space-between;padding:0 20px;font-size:10px;color:#a6b6c7}.paneheading{display:flex;justify-content:space-between;align-items:center;padding:22px 25px 16px;gap:16px}h1{font-size:22px;margin:0;letter-spacing:-.5px}.paneheading p{margin:4px 0 0;font-size:12px;color:var(--muted)}.graphictools,.audiobar{padding:0 25px 17px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.graphictools button,.audiobar button{font-size:11px}.graphicbody{display:flex;gap:15px;padding:0 25px}.tools{width:150px;display:flex;flex-direction:column;gap:7px;flex-shrink:0}.tools button{font-size:11px;text-align:left}.tools .sectiontitle{margin-bottom:5px}.tools hr{border:0;border-top:1px solid var(--line);width:100%}.tools label{padding:3px 0}.canvasarea{flex:1;min-width:0;min-height:380px;background:#0b111a;border:1px solid var(--line);display:flex;align-items:center;justify-content:center;flex-direction:column;overflow:auto;padding:20px;gap:14px}canvas{image-rendering:pixelated;touch-action:none;border:1px solid #566177;flex-shrink:0}#graphicInfo{font-size:10px;color:var(--muted)}.colors{width:160px;flex-shrink:0}#palette{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:15px}#palette button{padding:0;aspect-ratio:1;border:2px solid transparent;font-size:10px}#palette button.active{border-color:var(--accent);outline:1px solid white}#colorName{font-size:11px}#slotLabel select{width:100%;margin-top:7px;font-size:11px}.frames{padding:16px 25px 20px}.frames .sectiontitle{justify-content:start}.frames .sectiontitle label{letter-spacing:0;font-weight:400;margin-left:10px}.frames button{font-size:11px}#frameList{display:flex;gap:8px;margin:12px 0}#frameList button{padding:5px;width:55px}#frameList canvas{width:40px;height:35px;display:block;margin:auto}.audiobar label{display:flex;align-items:center;gap:8px;margin-left:8px}.audiobar input[type=range]{width:70px}.audiobody{display:flex;gap:18px;padding:0 25px 25px}.clips{width:200px;flex-shrink:0}.clips input{font-size:11px;margin:12px 0;width:100%}#clipList{display:grid;gap:6px;max-height:370px;overflow:auto}#clipList button{text-align:left;display:flex;flex-direction:column;gap:3px;font-size:11px;border-left:3px solid var(--accent)}#clipList small{font-size:9px;color:var(--muted)}.arrangement{flex:1;min-width:0;overflow:auto}#timeline{display:grid;grid-template-columns:85px repeat(8,minmax(65px,1fr));margin:14px 0;min-width:650px;border-left:1px solid var(--line);border-top:1px solid var(--line)}#timeline .head,#timeline .voice{background:#1d293b;padding:12px 8px;font-size:10px;color:var(--muted);border-bottom:1px solid var(--line);border-right:1px solid var(--line)}#timeline .voice{display:flex;align-items:center;color:var(--text)}#timeline button{border-radius:0;border:0;border-right:1px solid var(--line);border-bottom:1px solid var(--line);height:88px;padding:8px;font-size:10px;white-space:normal;background:#172232}#timeline button.filled{background:#224344;box-shadow:inset 0 3px 0 #69ccbc}#timeline button.active{outline:2px solid #b6e8dd;outline-offset:-3px}.audiocelltools{display:flex;gap:6px}.audiocelltools button{font-size:10px}.instrument{width:160px;flex-shrink:0}.instrument select{width:100%;font-size:11px}#instrumentFields{display:grid;gap:9px;margin-top:14px}#instrumentFields label{display:flex;justify-content:space-between;align-items:center}#instrumentFields input{width:60px;padding:5px}.notes{display:grid;grid-template-columns:repeat(8,1fr);gap:5px;margin-top:18px;min-width:550px}.notes label{display:grid;gap:6px}.notes input{width:100%;font-size:11px;padding:8px 4px}.arrangement p{font-size:11px;color:var(--muted)}dialog{background:var(--panel);border:1px solid var(--line);border-radius:10px;color:var(--text);padding:26px;width:min(620px,90vw);max-height:85vh}dialog::backdrop{background:#0009}dialog h2{margin-top:0}dialog p{color:var(--muted);font-size:13px}dialog form{display:grid;gap:14px;margin-bottom:20px}dialog label{display:flex;justify-content:space-between;align-items:center}#suggestions{position:absolute;top:30px;left:0;max-height:220px;width:360px;overflow:auto;z-index:20;background:#253246;border:1px solid #59758b}#suggestions button{display:block;width:100%;text-align:left;border:0;border-radius:0;font-size:12px}#suggestions small{display:block;font-size:10px;color:var(--muted)}[hidden]{display:none!important}body.focus .project,body.focus .menubar,body.focus header,body.focus footer{display:none}body.focus .editorwrap{height:calc(100vh - 345px)}@media(max-width:1100px){.project{width:170px}.graphicbody,.audiobody{gap:10px;padding:0 15px}.colors,.instrument{width:125px}.clips{width:160px}.toolbar{padding:0 14px}.views button{padding:9px}.brand small{display:none}.tools{width:120px}}@media(max-width:760px){header{height:72px;padding:0 14px;gap:10px}.brand div{display:none}.server{font-size:10px}header button{font-size:11px}.project{display:none}.menubar{padding:0 14px;gap:19px}.version{display:none}.toolbar{flex-wrap:wrap;height:auto;padding:10px;gap:8px}.build button{padding:7px;font-size:11px}.paneheading{align-items:start;flex-direction:column}.graphicbody,.audiobody{flex-wrap:wrap}.canvasarea{min-width:180px}.tools{width:100px}.colors{width:100%;display:flex;gap:15px;align-items:center}#palette{width:200px;grid-template-columns:repeat(8,1fr)}#palette button{min-width:22px}.frames{overflow:auto}.clips{width:100%}#clipList{display:flex;max-height:90px;overflow:auto}#clipList button{min-width:140px}.arrangement{width:100%}.instrument{width:100%}#instrumentFields{display:flex;flex-wrap:wrap}.editorwrap{height:350px}.output{height:220px}#lineNumbers{width:43px;padding-right:12px}.colors .hint{display:none}}

#suggestions button.selected{background:#365066;color:#fff;box-shadow:inset 3px 0 0 var(--accent)}
#suggestions button.selected small{color:#c4d4e4}

/* Keep the gutter aligned even at the end of a long file. */
#lineNumbers{flex:0 0 62px;align-self:stretch;position:relative;white-space:normal}
#lineNumberContent{will-change:transform}
.line-number{height:23px;line-height:23px;white-space:pre}
.line-number.diagnostic-gutter{color:#ffb5b5;background:#923c3c55;font-weight:750;box-shadow:inset 3px 0 #ff8585}
#diagnosticOverlay{position:absolute;inset:0;overflow:hidden;pointer-events:none;font:13px/23px ui-monospace,SFMono-Regular,Consolas,monospace;z-index:0}
.diagnostic-line{position:absolute;left:0;right:0;background:#ff686822;border-left:2px solid #ff8e8e;box-sizing:border-box}
.diagnostic-underline{position:absolute;bottom:2px;border-bottom:2px dotted #ff9e9e;min-width:1ch}
#highlight{z-index:1}
#editor{z-index:2}
#suggestions{z-index:20}
.diagnostic-location{font-weight:700;color:#ffe2a1;margin:5px 0}
.error small{display:block;color:#aabbd0;font-size:10px}
.error:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(max-width:760px){#lineNumbers{flex-basis:43px}}
.editor-and-preview{display:flex;min-width:0;align-items:stretch}.editor-and-preview .editorwrap{flex:1;min-width:0}
.c64-panel{width:44%;min-width:340px;max-width:680px;border-left:1px solid var(--line);background:#0c131d;display:flex;flex-direction:column;height:calc(100vh - 480px);min-height:480px}
.c64-heading{display:flex;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid var(--line);font-size:12px}.c64-heading span{color:var(--muted);font-size:10px}.c64-heading button{margin-left:auto;padding:1px 7px}
.c64-controls{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:7px 10px}.c64-controls button,.c64-footer button{font-size:10px;padding:5px 7px}.c64-controls label{font-size:10px;display:flex;align-items:center;gap:5px}.c64-controls input[type=range]{width:90px}.c64-controls select{font-size:10px;padding:5px;max-width:235px}
.c64-screen{flex:1;min-height:185px;background:#070b10;position:relative}.c64-screen iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.c64-status{font-size:10px;line-height:1.5;color:var(--muted);padding:4px 12px;margin:0;min-height:38px}.c64-footer{display:flex;justify-content:space-between;align-items:center;padding:6px 10px;border-top:1px solid var(--line);gap:6px}.c64-footer a{font-size:9px;color:var(--muted)}
.c64-panel:fullscreen,.c64-panel:-webkit-full-screen{width:100%;height:100%;max-width:none;border:0}.c64-panel:fullscreen .c64-screen{min-height:0}.build{flex-wrap:wrap;justify-content:flex-end}.toolbar{height:auto;min-height:64px;padding-top:10px;padding-bottom:10px}
@media(max-width:1000px){.editor-and-preview{flex-wrap:wrap}.c64-panel{width:100%;max-width:none;height:510px;border-left:0;border-top:1px solid var(--line)}.editor-and-preview .editorwrap{flex-basis:100%}}

.c64-panel.c64-expanded{position:fixed;inset:0;z-index:10000;width:100%;height:100dvh;max-width:none;min-width:0;min-height:0;box-sizing:border-box;background:#101722;overflow:auto}.c64-expanded .c64-screen{min-height:0;flex:1}.c64-expanded .c64-controls,.c64-expanded .c64-heading{flex-shrink:0}.c64-expanded .c64-controls:first-of-type{position:sticky;top:0;z-index:2;background:#101722}body.c64-fullscreen-open{overflow:hidden}
#programState{font-size:10px;color:var(--accent);margin-left:auto}.c64-heading #c64Close{margin-left:0}#argumentHelp{padding:9px 18px;background:#202e40;border-top:1px solid #52768a;font-size:12px;line-height:1.6}#argumentHelp code{display:block;color:#8ce7dc;white-space:pre-wrap}#argumentHelp pre{white-space:pre-wrap}.memory-summary{overflow:auto}.memory-summary table{border-collapse:collapse}.memory-summary td,.memory-summary th{padding:6px 12px;text-align:left;border-bottom:1px solid var(--line)}#previewDivider{width:8px;flex:0 0 8px;cursor:col-resize;background:#253246;touch-action:none}#previewDivider:focus-visible{outline:2px solid var(--accent)}.editor-and-preview:not(:has(#c64Panel:not([hidden]))) #previewDivider{display:none}.editor-and-preview .c64-panel{width:var(--preview-width,44%);max-width:none;min-width:260px}.editor-and-preview.preview-below{flex-direction:column}.preview-below #previewDivider{display:none}.preview-below .c64-panel{width:100%;height:540px}.c64-panel.c64-expanded{width:100%!important}.menubar button kbd{float:right;margin-left:15px}@media(max-width:1000px){#previewDivider{display:none}.editor-and-preview .c64-panel{width:100%}}
body.focus .menubar{display:flex}body.focus .editorwrap{height:calc(100vh - 280px)}body.hide-project .workspace>.project{display:none}body.hide-output .output{display:none}body.hide-output .editorwrap{height:calc(100vh - 290px)}body.focus.hide-output .editorwrap{height:calc(100vh - 150px)}#leaveFocus{position:fixed;bottom:16px;right:20px;z-index:11000;background:#69d8cb;color:#102329;font-weight:bold}#toolbox{position:fixed;right:22px;top:110px;width:min(820px,94vw);max-height:80vh;overflow:auto;z-index:8000;background:#152030;border:1px solid #56778a;border-radius:9px;box-shadow:0 15px 60px #0009}#toolbox>header{height:auto;min-height:48px;padding:10px 15px;display:flex;justify-content:space-between;position:sticky;top:0;background:#1f2e42;z-index:2}#toolboxTabs{display:flex;flex-wrap:wrap;padding:9px;gap:4px}#toolboxTabs [aria-pressed=true]{background:#35586a;color:#8ff1e5}#toolboxBody{padding:0 16px 18px;font-size:13px;line-height:1.6}#toolboxBody label{display:inline-flex;gap:6px;align-items:center;margin:4px}#toolboxBody input{max-width:130px}#toolboxBody textarea{display:block;width:100%;box-sizing:border-box;margin:12px 0;font:13px/1.6 ui-monospace,monospace}.tb-palette{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.tb-palette button{min-height:65px}.tb-grid{display:grid;grid-template-columns:repeat(40,1fr);aspect-ratio:40/25;margin:12px 0;background:#09121c}.tb-grid button{min-width:0;min-height:0;padding:0;border:1px solid #3a5265;border-radius:0;background:transparent}.tb-grid button:nth-child(40n+1){border-left-color:#81e2d6}.tb-grid button.selected{background:#5fc8b9}.tb-keyboard>div{display:flex;gap:3px;margin:4px 0}.tb-keyboard button{flex:1;min-width:0;padding:8px 2px;font-size:10px}.tb-table{max-height:340px;overflow:auto}.tb-table table{border-collapse:collapse;width:100%}.tb-table td,.tb-table th{padding:5px 9px;text-align:left;border-bottom:1px solid #35465a}.sticky-note{position:fixed;z-index:7000;background:#f5e797;color:#302a10;border:1px solid #c4aa44;border-radius:4px;box-shadow:0 8px 25px #0006;display:flex;flex-direction:column;resize:both;overflow:auto;min-width:220px;min-height:160px;max-width:95vw;max-height:85vh;box-sizing:border-box}.sticky-head{display:flex;align-items:center;justify-content:space-between;cursor:move;padding:6px 9px;background:#edda79;touch-action:none}.sticky-note button{background:#ead77a;color:#302a10;border-color:#c6ad4d;padding:3px 6px;font-size:11px}.sticky-note .sticky-link{text-align:left;border:0}.sticky-note textarea{background:transparent;color:#302a10;border:0;outline:none;resize:none;flex:1;width:100%;min-height:70px;box-sizing:border-box;padding:10px;font:14px/1.5 sans-serif}body.focus header:not(#toolbox>header){display:none}@media(max-width:760px){#toolbox{right:3vw;top:70px}.tb-keyboard{overflow-x:auto}.tb-keyboard>div{min-width:620px}}
.menubar{position:relative;z-index:12000}.menubar details>div{z-index:12001}
.tb-axis{display:grid;grid-template-columns:repeat(40,1fr);font-size:9px;text-align:center;color:#9fc7d5}.tb-grid button{font-size:9px;color:#9fc7d5}
#toolboxBody textarea{background:#0c1725;color:#d9e6ed;border:1px solid #41586b;border-radius:4px;padding:9px}

#onlineVersion{display:inline-block;font-size:10px;letter-spacing:0;color:#77e1d5;border:1px solid #365d65;border-radius:4px;padding:2px 6px;margin-left:7px;vertical-align:middle}

#graphicSurface{position:relative;flex-shrink:0;line-height:0;outline:1px solid #566177}#graphicSurface #canvas{display:block;border:0;max-width:none}#graphicGrid{position:absolute;inset:0;pointer-events:none;fill:#65778a;fill-opacity:.55;shape-rendering:crispEdges;overflow:hidden}

.warning{padding:12px 0;border-bottom:1px solid var(--line);color:#f5cc68;cursor:pointer}.warning p{margin:5px 0}.warning small{display:block;color:#cbbb91;font-size:10px}.warning:focus-visible{outline:2px solid #f5cc68;outline-offset:3px}.warning .diagnostic-location{color:#f9d77f}.line-number.diagnostic-gutter.warning-gutter{color:#ffdb80;background:#9b741d33;box-shadow:inset 3px 0 #edbf53}.diagnostic-line.warning-line{background:#d9a92d18;border-left-color:#f5cc68}.warning-line .diagnostic-underline{border-bottom-color:#f5cc68}[data-output=warnings]{color:#e7c571}[data-output=diagnostics]{color:#ffa1a1}

.outputtabs button[data-output=warnings].active{color:#f5cc68;border-bottom-color:#f5cc68}

/* Menu rows override the transparent dropdown button background. */
.menubar details>div>button:not(:disabled):hover,
.menubar details>div>button:not(:disabled):focus-visible,
.menubar details>div>label:hover,
.menubar details>div>label:focus-within{
 background:#30465b;color:#ffffff;box-shadow:inset 3px 0 0 var(--accent);
}
.menubar details>div>label{border-radius:5px;cursor:pointer}
.menubar details>div>button:focus-visible,
.menubar summary:focus-visible,.menubar>.plain:focus-visible{
 outline:2px solid var(--accent);outline-offset:2px;
}
.menubar summary:hover,.menubar details[open]>summary,
.menubar>.plain:hover{color:var(--accent);background:#263b43;border-radius:4px}

.menubar details>div.examples-dropdown{width:350px;max-width:85vw;max-height:75vh;overflow:auto;display:block;padding:10px}
.examples-intro{margin:0 0 8px;color:var(--text);font-weight:650}
.examples-dropdown label{display:block!important;padding:0!important;box-shadow:none!important;background:none!important}
#exampleSearch{width:100%;margin:5px 0}
#exampleCount{font-size:11px;color:var(--muted);margin:4px 0 8px}
#exampleList h3{font-size:11px;letter-spacing:.5px;color:var(--accent);margin:16px 7px 6px}
.menubar #exampleList button{display:block;width:100%;text-align:left;white-space:normal;background:transparent;border:0;font-size:12px;margin:2px 0;padding:9px 10px}
.menubar #exampleList button:hover,.menubar #exampleList button:focus-visible{background:#30465b;color:white;box-shadow:inset 3px 0 var(--accent);outline:2px solid var(--accent);outline-offset:-2px}
#exampleList [hidden]{display:none!important}
#lessonGuide{padding:12px 22px;background:#192b36;border-bottom:1px solid #3f6471;font-size:12px}
#lessonGuide[hidden]{display:none}
.lesson-heading{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}
.lesson-heading strong{color:var(--accent)}
.lesson-heading button{font-size:11px;padding:5px 8px}
#lessonGuide p{margin:6px 0 0;line-height:1.45}
.lesson-exercise{color:#f5cc68}

/* Primary coding actions remain distinguishable by text and icon as well as color. */
#compile{background:#245dcc;border-color:#5b8aee;color:#fff;font-weight:700;box-shadow:0 0 0 1px #245dcc33}
#compile:not(:disabled):hover{background:#3270e4;border-color:#a4c3ff}
#compileRun{background:#43d394;border-color:#72e6b1;color:#082b1c;font-weight:700}
#compileRun:not(:disabled):hover{background:#72e6b1;border-color:#a3f2cf}
#compile:focus-visible,#compileRun:focus-visible{outline:2px solid white;outline-offset:3px}
#c64Stop:not(:disabled){background:#48252b;border-color:#c26b78;color:#ffbbc5}
.about{max-width:470px}.about h2{margin-top:0}.about dl{display:grid;grid-template-columns:max-content 1fr;gap:10px 22px;margin:22px 0}
.about dt{color:var(--muted)}.about dd{margin:0}.about-free{color:var(--accent)}.about a{color:#9cc6ff}

:root{--editor-size:13px;--editor-line:23px}
#editor,#highlight,#lineNumbers,#diagnosticOverlay{font-size:var(--editor-size);line-height:var(--editor-line)}
.line-number{height:var(--editor-line);line-height:var(--editor-line)}
.font-controls{display:inline-flex;align-items:center;gap:5px;margin-left:auto;white-space:nowrap}
.font-controls button{padding:3px 7px;font-size:12px}.font-controls output{font-size:10px;color:var(--muted);min-width:32px;text-align:center}
.filetab{gap:12px;flex-wrap:wrap;height:auto;min-height:39px;padding-top:6px;padding-bottom:6px}
#zipStatus{font-size:10px;color:var(--muted)}#edited{font-size:10px}
#suggestions{width:min(480px,100%);max-height:300px}
#suggestions button{white-space:normal;padding:9px 12px}
.suggestion-description{display:block;color:#e0e8f1;font-size:11px;line-height:1.4;margin-top:4px}
.suggestion-example{display:block;white-space:pre-wrap;font:10px/1.4 ui-monospace,monospace;color:#97e3d6;margin-top:5px}

/* A lightweight CSS monitor: the emulator remains an untouched interactive iframe. */
.c64-display-options{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:5px 10px 9px;flex-shrink:0}
.c64-display-options label{display:flex;align-items:center;gap:6px;font-size:10px}
.c64-display-options select{font-size:10px;padding:4px 6px}
.c64-monitor{flex:1;min-height:180px;display:flex;flex-direction:column;padding:10px 14px 6px;background:radial-gradient(ellipse at center,#27313b,#0c131d 75%)}
.monitor-shell{flex:1;min-height:0;display:flex;flex-direction:column;padding:12px 12px 0;border:1px solid #a69d86;border-radius:13px 13px 9px 9px;background:linear-gradient(130deg,#e0d8c2 0%,#bfb59a 48%,#d0c6ae 85%,#a79d83);box-shadow:inset 2px 2px 1px #f7f1dc,inset -3px -3px 2px #877d64,0 10px 22px #0008}
.monitor-bezel{flex:1;min-height:120px;position:relative;display:flex;padding:9px;border:1px solid #928875;border-radius:11px;background:linear-gradient(135deg,#24231f,#45423a 55%,#24231f);box-shadow:inset 3px 3px 8px #000b,0 1px 1px #ece3cc}
.c64-monitor .c64-screen{min-height:120px;border-radius:7px;overflow:hidden;background:#050706;box-shadow:0 0 0 1px #070807}
.monitor-chin{height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 4px;color:#383a35}
.monitor-brand{font:600 12px/1 system-ui,sans-serif;letter-spacing:-.4px;white-space:nowrap;text-shadow:0 1px #eee5ce}.monitor-brand b{margin-left:5px;font-size:10px;letter-spacing:.5px;font-weight:500}.commodore-mark{font:bold 17px/1 Georgia,serif;margin-right:4px;font-style:normal}
.monitor-hardware{display:flex;align-items:center;gap:12px}.monitor-vents{width:40px;height:12px;background:repeating-linear-gradient(0deg,#766e5c 0 1px,transparent 1px 3px);opacity:.7}.monitor-power{width:5px;height:5px;border-radius:50%;background:#73a65f;box-shadow:0 0 3px #a1d273,inset 0 0 1px #132909}
.monitor-foot{width:60%;height:7px;margin:0 auto;border-radius:0 0 5px 5px;background:linear-gradient(#756e5f,#a69c84);box-shadow:0 4px 9px #0008}
.crt-overlay{display:none;position:absolute;inset:9px;z-index:1;border-radius:7px;pointer-events:none;background:repeating-linear-gradient(0deg,#0002 0 1px,transparent 1px 3px),radial-gradient(ellipse at center,transparent 55%,#0005);box-shadow:inset 0 0 22px #0005}
.monitor-crt .crt-overlay{display:block}
.monitor-clean{padding:0;background:#070b10}.monitor-clean .monitor-shell{padding:0;border:0;border-radius:0;background:none;box-shadow:none}.monitor-clean .monitor-bezel{padding:0;border:0;border-radius:0;background:none;box-shadow:none}.monitor-clean .c64-screen{border-radius:0;box-shadow:none}.monitor-clean .monitor-chin,.monitor-clean .monitor-foot{display:none}.monitor-clean .crt-overlay{inset:0;border-radius:0}
.c64-expanded .c64-monitor{padding:0;background:#000}.c64-expanded .monitor-shell{padding:0;border:0;border-radius:0;background:none;box-shadow:none}.c64-expanded .monitor-bezel{padding:0;border:0;border-radius:0;background:none;box-shadow:none}.c64-expanded .c64-screen{border-radius:0;box-shadow:none}.c64-expanded .monitor-chin,.c64-expanded .monitor-foot{display:none}.c64-expanded .crt-overlay{inset:0;border-radius:0}
.c64-panel .c64-controls,.c64-panel .c64-footer,.c64-panel .c64-heading{flex-shrink:0}
/* Preserve a CRT screen's proportions instead of flattening it in a short panel. */
.c64-panel:not(.c64-expanded){height:auto}
.c64-monitor{flex:0 0 auto;min-height:0}
.monitor-shell{flex:0 0 auto}
.monitor-bezel{flex:0 0 auto;aspect-ratio:4/3;min-height:0}
.c64-monitor .c64-screen{min-height:0}
.c64-expanded .c64-monitor,.c64-expanded .monitor-shell,.c64-expanded .monitor-bezel{flex:1;min-height:0}
.c64-expanded .monitor-bezel{aspect-ratio:auto}

/* Curved CRT television housing and glass; overlays never intercept input. */
.monitor-shell{padding:15px 15px 0;border-color:#47433c;border-radius:24px 24px 18px 18px;background:linear-gradient(125deg,#655d4f,#39372f 48%,#514b40);box-shadow:inset 2px 2px 2px #8d8370,inset -4px -4px 3px #25231e,0 12px 25px #0009}
.monitor-bezel{border-radius:15% / 11%;padding:11px;background:linear-gradient(145deg,#191c1c,#434947 55%,#111515);border-color:#201f1a;box-shadow:inset 4px 4px 12px #000,0 1px #8b816b}
.c64-monitor:not(.monitor-clean) .c64-screen{border-radius:12% / 9%;box-shadow:inset 0 0 15px #000,0 0 0 2px #080c0b}
.monitor-bezel::after{content:'';position:absolute;inset:11px;border-radius:12% / 9%;pointer-events:none;z-index:3;background:radial-gradient(ellipse at 40% 15%,#fff1,transparent 45%),radial-gradient(ellipse at center,transparent 52%,#0008);box-shadow:inset 0 0 18px #0008,inset 0 2px 2px #ffffff24}
.monitor-chin{height:49px;color:#ded6c3;padding:0 7px}.monitor-brand{font-size:11px;letter-spacing:2px;text-shadow:0 1px #000}.monitor-brand b{font-size:8px;color:#b4ad99;letter-spacing:1px}.tv-dial{display:block;width:22px;height:22px;border-radius:50%;background:linear-gradient(100deg,#24251f 45%,#a69d85 46% 51%,#24251f 52%);border:2px solid #77705e;box-shadow:1px 2px 3px #0008}.monitor-foot{background:#292a24;height:8px}
#c64Noise{position:absolute;inset:11px;width:calc(100% - 22px);height:calc(100% - 22px);border-radius:12% / 9%;z-index:2;pointer-events:none;opacity:.23;image-rendering:pixelated}
.crt-overlay{inset:11px;border-radius:12% / 9%}
.monitor-clean .monitor-bezel::after,.c64-expanded .monitor-bezel::after{display:none}
.monitor-clean #c64Noise,.c64-expanded #c64Noise{inset:0;width:100%;height:100%;border-radius:0}
.c64-expanded .c64-monitor .c64-screen{border-radius:0;box-shadow:none}

#studioFullscreen{font-size:11px;padding:6px 9px}#studioFullscreen[aria-pressed=true]{color:var(--accent);border-color:var(--accent)}
:root:fullscreen,:root:-webkit-full-screen{background:var(--bg);overflow:auto}

/* Viewport-based workbench: only the editor and panel contents scroll. */
html{height:100%;overflow:hidden}body{height:100vh;height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden}
body>header{height:70px;flex:0 0 70px}body>.menubar{flex:0 0 39px;min-height:39px}body>footer{flex:0 0 26px;height:26px}
.workspace{flex:1;min-height:0;overflow:hidden}.workspace>main{min-height:0;overflow:hidden}.project{min-height:0;overflow:auto}.projectbottom{padding-top:20px}
.toolbar{flex:0 0 auto;min-height:58px;padding-top:8px;padding-bottom:8px}.build{align-items:center}.build #programState{align-self:center;display:inline-flex;align-items:center;justify-content:center;min-height:32px;margin:0 3px 0 0;padding:6px 10px;font-size:12px;line-height:1.3;max-width:210px;text-align:center;background:#21383966;border:1px solid #3b686555;border-radius:5px}
.view{min-height:0;overflow:auto}#codeView{display:flex;flex-direction:column;overflow:hidden;min-height:0}.filetab,.editorstatus,#argumentHelp,#lessonGuide{flex:0 0 auto}
.editor-and-preview{flex:1;min-height:0;overflow:hidden;align-items:stretch}.editor-and-preview .editorwrap,body.focus .editorwrap,body.hide-output .editorwrap,body.focus.hide-output .editorwrap{height:auto;min-height:0;flex:1}
.editor-and-preview .c64-panel{height:auto;min-height:0;overflow:hidden}.c64-monitor{flex:1;min-height:0;align-items:center;justify-content:center;overflow:hidden;width:100%}.monitor-shell{max-width:100%;flex:0 0 auto}.monitor-bezel{aspect-ratio:4/3}.monitor-foot{flex-shrink:0}
.output{height:clamp(110px,19dvh,190px);min-height:0;display:flex;flex-direction:column}.outputtabs{flex:0 0 39px}.outputcontent{height:auto;flex:1;min-height:0;overflow:auto}
.editor-and-preview.preview-below{flex-direction:row}.preview-below .c64-panel{height:auto;width:44%}.preview-below #previewDivider{display:block}
.c64-expanded .c64-monitor{align-items:stretch}.c64-expanded .monitor-shell,.c64-expanded .monitor-bezel{flex:1;min-height:0}.c64-expanded .monitor-bezel{aspect-ratio:auto}
/* Molded dark plastic, recessed glass and curved edge reflections. */
.monitor-shell{background:linear-gradient(115deg,#716c60 0%,#514e44 9%,#34372f 48%,#4e5145 91%,#242720);border:1px solid #777a65;border-radius:25px 25px 19px 19px;box-shadow:inset 2px 3px 2px #b0aa8c55,inset -5px -5px 3px #161b15,0 10px 18px #0008}
.monitor-bezel{background:linear-gradient(135deg,#171b17,#080e0b 28%,#3c4738 75%,#5c6250);box-shadow:inset 4px 5px 8px #000,0 1px #afb29a55;border-color:#181d16}
.monitor-bezel::after{background:radial-gradient(ellipse at 35% 0%,#e4f5e01c 0%,transparent 49%),linear-gradient(120deg,#e1f9e20a,transparent 30% 80%,#c8dcc708),radial-gradient(ellipse at center,transparent 54%,#0008);box-shadow:inset 0 0 18px #000a,inset 2px 3px 3px #e5ffe324}
.monitor-vents{height:15px;width:38px;background:repeating-linear-gradient(0deg,#11180e 0 1px,#7a7d6344 1px 2px,transparent 2px 3px);opacity:1}.tv-dial{box-shadow:inset 1px 1px 2px #c4c5a455,2px 3px 4px #000a}
@media(max-width:1000px){.editor-and-preview{flex-wrap:nowrap}.editor-and-preview .editorwrap{flex-basis:auto}.editor-and-preview .c64-panel{width:42%;min-width:235px}.c64-controls{padding:4px 7px}.c64-display-options{padding:4px 7px;gap:7px}.c64-status{min-height:26px}.build{gap:5px}}
@media(max-width:650px){body>header{height:54px;flex-basis:54px}.menubar{gap:12px;overflow-x:auto;overflow-y:visible}.toolbar{padding:6px 8px}.build #programState{font-size:10px;max-width:125px}.editor-and-preview{flex-direction:column}.editor-and-preview .c64-panel{width:100%;flex:1;min-height:0}.editor-and-preview .editorwrap{flex:1}.c64-monitor{min-height:0}.output{height:110px}}
.output{height:clamp(100px,14dvh,145px)}
.c64-heading{padding:7px 10px}.c64-controls{padding:4px 8px}.c64-display-options{padding:4px 8px;gap:10px}.c64-status{min-height:28px;padding:3px 10px}.c64-footer{padding:4px 8px}
.monitor-chin{gap:4px;padding:0 3px}.monitor-hardware{gap:5px;flex-shrink:0}.monitor-brand{font-size:9px;letter-spacing:1px}.monitor-brand b{font-size:7px;margin-left:3px}.monitor-vents{width:24px}
.editor-and-preview.preview-below{flex-direction:column}.preview-below .editorwrap{flex:1}.preview-below .c64-panel{flex:1;min-height:0;width:100%}.preview-below #previewDivider{display:none}

:root:fullscreen,:root:-webkit-full-screen{overflow:hidden}

#suggestions.compact-suggestions{width:min(260px,100%);max-height:220px}#suggestions.compact-suggestions button{padding:6px 10px;white-space:nowrap}

/* A fixed stage with a centered, measured television. The housing cannot resize its parent. */
.c64-panel .c64-monitor{position:relative;display:block;flex:1 1 0;min-height:0;overflow:hidden}
.c64-monitor .monitor-shell{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);max-width:none;display:flex;flex-direction:column;min-height:0}
.c64-monitor .monitor-bezel{flex:1 1 0;min-height:0;aspect-ratio:auto}
.c64-monitor .c64-screen{min-height:0;min-width:0;flex:1 1 0}
.c64-monitor .monitor-foot{display:none}
.c64-monitor .monitor-chin{flex:0 0 49px}
.c64-monitor.monitor-clean .monitor-chin,.c64-expanded .c64-monitor .monitor-chin{display:none}

/* Keep the emulator rendering viewport stable; scale only its visual output. */
.c64-screen #c64Frame{width:384px!important;height:272px!important;max-width:none;max-height:none;transform-origin:0 0}

.workspace>.project{width:var(--project-panel-width,220px)}.output{height:var(--output-panel-height,130px)}
.panel-divider{background:#253246;touch-action:none;flex-shrink:0;position:relative}.panel-divider.vertical{width:7px;cursor:col-resize}.panel-divider.horizontal{height:7px;cursor:row-resize}
.panel-divider:hover,.panel-divider:focus-visible,#previewDivider:hover{background:#4f9caa;outline:none}.panel-divider:focus-visible{box-shadow:inset 0 0 0 1px #a4f2e7}
body.hide-project #projectDivider,body.focus #projectDivider,body.hide-output #outputDivider{display:none}
body.resizing-panels{user-select:none}body.resizing-panels iframe{pointer-events:none}
@media(max-width:760px){#projectDivider{display:none}.panel-divider.horizontal{height:10px}}

/* Expanded player owns a separate layer above Studio and its dropdown menus. */
body>.c64-panel.c64-expanded{position:fixed;inset:0;z-index:30000;width:100%!important;height:100dvh!important;max-width:none;min-height:0;display:flex;flex-direction:column;overflow:hidden}
body.c64-fullscreen-open>.menubar,body.c64-fullscreen-open>#leaveFocus{visibility:hidden;pointer-events:none}
.c64-expanded .c64-display-options,.c64-expanded .c64-heading,.c64-expanded .c64-controls{position:relative;z-index:10;flex-shrink:0}

.c64-panel.c64-expanded{position:fixed!important;inset:0!important;z-index:30000!important;width:100%!important;height:100dvh!important;max-width:none!important;min-height:0!important;overflow:hidden!important;display:flex;flex-direction:column}

/* Photographic CRT cabinet. Live iframe remains attached during all layout changes. */
.c64-monitor:not(.monitor-clean) .monitor-shell{padding:0;border:0;border-radius:0;background: url("assets/television-crt.webp") center/100% 100% no-repeat;box-shadow:none;display:block}
.c64-monitor:not(.monitor-clean) .monitor-bezel{position:absolute;left:13.8%;top:11%;width:70.4%;height:68.5%;padding:0;border:0;border-radius:10% / 9%;background:#050505;box-shadow:none;display:block;overflow:hidden}
.c64-monitor:not(.monitor-clean) .c64-screen{position:absolute;inset:0;width:100%;height:100%;border-radius:10% / 9%;box-shadow:none}
.c64-monitor:not(.monitor-clean) .monitor-chin{display:none}
.c64-monitor:not(.monitor-clean) .monitor-bezel::after{display:block;inset:0;border-radius:10% / 9%;background:linear-gradient(165deg,#ffffff12,transparent 16% 87%,#ffffff05);box-shadow:inset 0 0 8px #0007;z-index:3}
.c64-monitor:not(.monitor-clean) .crt-overlay{inset:0;border-radius:10% / 9%;background:repeating-linear-gradient(0deg,#0002 0 1px,transparent 1px 3px);box-shadow:none}

/* Convex glass: the displacement bends the live image, not just its frame. */
.c64-monitor:not(.monitor-clean) #c64Frame{filter:url(#crt-bulge)}
.c64-monitor:not(.monitor-clean) .monitor-bezel::after{background:radial-gradient(ellipse 80% 16% at 50% 0%,#ffffff39 0%,#ffffff0d 36%,transparent 75%),linear-gradient(118deg,#ffffff0b 0%,transparent 25% 85%,#b8d3dc09 100%);box-shadow:inset 0 0 5px #0008,inset 0 0 18px #0004,inset 0 2px 3px #ffffff48,inset 2px 0 3px #ffffff15;border:1px solid #ffffff14}
.c64-monitor:not(.monitor-clean) .monitor-bezel::before{content:'';position:absolute;inset:0;z-index:4;pointer-events:none;border-radius:10% / 9%;background:radial-gradient(ellipse 33% 6% at 26% 2%,#ffffff40,transparent 80%),radial-gradient(ellipse 19% 4% at 83% 3%,#ffffff20,transparent 85%);opacity:.75}

/* Fit the photograph's whole glass opening; retain only the physical cabinet bezel. */
.c64-monitor:not(.monitor-clean) .monitor-bezel{left:13.1%;top:10.5%;width:72.1%;height:69.4%;border-radius:10% / 9%}
.c64-screen #c64Frame{position:absolute}

/* Confirmation already offers Cancel; avoid a duplicate Close action. */
#dialog:has(#lessonCancel) #closeDialog,#dialog:has(#cancelFileOpen) #closeDialog{display:none}
