/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}:root{--bg: #101318;--bg-2: #14181f;--panel: #1a1f27;--panel-2: #20262f;--code-bg: #12161c;--border: #2a313c;--border-strong: #39424f;--text: #cbd2da;--heading: #e8ecf1;--muted: #7d8794;--accent: #d97757;--accent-strong: #e08a6d;--accent-soft: rgba(217, 119, 87, .16);--ok: #6fbf7d;--ok-strong: #8fd19a;--ok-soft: rgba(111, 191, 125, .13);--fail: #d98079;--fail-strong: #e89a93;--fail-soft: rgba(217, 128, 121, .12);--hint: #d3a94f;--hint-strong: #e0bc6e;--hint-soft: rgba(211, 169, 79, .12);--shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);--shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 6px 20px rgba(0, 0, 0, .3);--radius: 12px;--radius-sm: 8px}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:linear-gradient(180deg,var(--bg-2) 0%,var(--bg) 100%) fixed;color:var(--text);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,sans-serif;font-size:14px;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}.app{display:flex;flex-direction:column;height:100%}.topbar{display:flex;align-items:center;gap:24px;padding:14px 24px;background:#101318d9;-webkit-backdrop-filter:saturate(1.1) blur(8px);backdrop-filter:saturate(1.1) blur(8px);border-bottom:1px solid var(--border)}.topbar h1{font-size:17px;margin:0;font-weight:700;letter-spacing:-.01em;color:var(--heading);display:flex;align-items:center;gap:9px}.topbar h1:before{content:"🌱";font-size:18px}.topbar nav{display:flex;gap:4px}.topbar nav button{background:transparent;color:var(--muted);border:1px solid transparent;padding:7px 14px;border-radius:999px;cursor:pointer;font:inherit;font-weight:500;transition:color .15s ease,background .15s ease}.topbar nav button:hover{color:var(--accent-strong);background:var(--accent-soft)}.topbar nav button.active{color:var(--accent-strong);background:var(--accent-soft);border-color:var(--accent-soft)}.workspace{display:flex;flex:1;min-height:0}.sidebar{width:268px;flex-shrink:0;background:#161a218c;border-right:1px solid var(--border);padding:20px 14px;overflow-y:auto}.sidebar h2{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 12px 8px;font-weight:700}.sidebar ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:3px}.lesson{width:100%;display:flex;align-items:center;gap:11px;background:transparent;border:1px solid transparent;color:var(--text);padding:10px 11px;border-radius:var(--radius-sm);cursor:pointer;text-align:left;font:inherit;transition:background .15s ease,border-color .15s ease}.lesson:hover{background:var(--panel);border-color:var(--border);box-shadow:var(--shadow-sm)}.lesson.active{background:var(--panel);border-color:var(--border-strong);box-shadow:var(--shadow-sm)}.lesson .check{width:16px;color:var(--muted);font-size:13px}.lesson.done .check{color:var(--ok)}.lesson.active .lesson-title{color:var(--heading);font-weight:600}.lesson-title{flex:1;line-height:1.35}.lesson-main{flex:1;min-width:0;overflow-y:auto;padding:26px 32px 40px;display:flex;flex-direction:column;gap:20px}.instructions{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:6px 26px 22px;line-height:1.65;box-shadow:var(--shadow)}.instructions h1,.instructions h2,.instructions h3{color:var(--heading);letter-spacing:-.01em}.instructions h1{font-size:21px}.instructions a{color:var(--accent-strong)}.instructions code{background:var(--code-bg);color:var(--accent-strong);padding:1px 6px;border-radius:5px;font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:.9em}.instructions pre{background:var(--code-bg);border:1px solid var(--border);padding:14px 16px;border-radius:var(--radius-sm);overflow-x:auto}.instructions pre code{background:transparent;color:var(--text);padding:0}.editor-area{display:flex;flex-direction:column;gap:14px}.editor-area .cm-editor{border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}.editor-area .cm-editor.cm-focused{border-color:var(--accent);box-shadow:var(--shadow),0 0 0 3px var(--accent-soft)}.run-term-wrap{display:flex;flex-direction:column;gap:6px}.run-term-caption{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}.run-term{height:240px;background:var(--code-bg);border:1px solid var(--border);border-radius:var(--radius);padding:12px;overflow:hidden;box-shadow:var(--shadow)}.run-term:focus-within{border-color:var(--accent);box-shadow:var(--shadow),0 0 0 3px var(--accent-soft)}.toolbar{display:flex;gap:10px;flex-wrap:wrap}.btn{border:1px solid var(--border-strong);background:var(--panel);color:var(--text);padding:9px 18px;border-radius:999px;cursor:pointer;font:inherit;font-weight:600;box-shadow:var(--shadow-sm);transition:transform .1s ease,box-shadow .15s ease,border-color .15s ease,background .15s ease}.btn:hover:not(:disabled){transform:translateY(-1px);box-shadow:var(--shadow)}.btn:active:not(:disabled){transform:translateY(0)}.btn:disabled{opacity:.55;cursor:default}.btn.run{background:var(--accent);border-color:var(--accent);color:#fff}.btn.run:hover:not(:disabled){background:var(--accent-strong);border-color:var(--accent-strong)}.btn.check{background:var(--ok-soft);border-color:#6fbf7d59;color:var(--ok-strong)}.btn.check:hover:not(:disabled){border-color:var(--ok)}.btn.hint{background:var(--hint-soft);border-color:#d3a94f59;color:var(--hint-strong)}.btn.hint:hover:not(:disabled){border-color:var(--hint)}.btn.stop{background:var(--fail-soft);border-color:#d9807959;color:var(--fail-strong)}.btn.stop:hover:not(:disabled){border-color:var(--fail)}.btn.solution{background:var(--panel-2);border-color:var(--border-strong);color:var(--muted)}.btn.solution:hover:not(:disabled){color:var(--text);border-color:var(--muted)}.output{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px;display:flex;flex-direction:column;gap:14px;min-height:60px;box-shadow:var(--shadow)}.output.muted,.muted{color:var(--muted)}.banner{padding:11px 15px;border-radius:var(--radius-sm);font-weight:600;line-height:1.45}.banner.ok{background:var(--ok-soft);color:var(--ok-strong);border:1px solid rgba(111,191,125,.35)}.banner.fail{background:var(--fail-soft);color:var(--fail-strong);border:1px solid rgba(217,128,121,.35)}.out-block{display:flex;flex-direction:column;gap:6px}.out-label{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700}.out-pre{margin:0;background:var(--code-bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px 14px;overflow-x:auto;font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--text)}.out-pre.error{color:var(--fail-strong);background:var(--fail-soft);border-color:#d9807959}.hint-block{border-top:1px solid var(--border);padding-top:12px}.hint-text{margin:0;color:var(--hint-strong);line-height:1.6;white-space:pre-wrap}.error-text{color:var(--fail-strong)}.glossary-view{flex:1;min-height:0;padding:24px 32px;overflow-y:auto;max-width:980px}.glossary-view .instructions{overflow:visible}.shell-view{flex:1;min-height:0;padding:24px 32px;overflow:hidden}.repl{height:100%;display:flex;flex-direction:column;gap:12px}.repl-hint{margin:0;color:var(--muted);font-size:13px}.repl-term{flex:1;min-height:320px;background:var(--code-bg);border:1px solid var(--border);border-radius:var(--radius);padding:12px;overflow:hidden;box-shadow:var(--shadow)}*{scrollbar-width:thin;scrollbar-color:var(--border-strong) transparent}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:999px;border:3px solid transparent;background-clip:padding-box}button:focus-visible,a:focus-visible{outline:2px solid var(--accent, #b06000);outline-offset:2px}.layoutbar{display:flex;align-items:center;gap:8px;padding:8px 16px;border-top:1px solid var(--border);background:#101318eb;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.layoutbar-label{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700;margin-right:4px}.layoutbar button{background:transparent;color:var(--muted);border:1px solid var(--border);padding:5px 13px;border-radius:999px;cursor:pointer;font:inherit;font-size:12.5px;font-weight:600;transition:color .15s ease,background .15s ease,border-color .15s ease}.layoutbar button:hover{color:var(--text);border-color:var(--border-strong)}.layoutbar button.active{color:var(--accent-strong);background:var(--accent-soft);border-color:transparent}.layoutbar-note{margin-left:auto;color:var(--muted);font-size:12px}.lesson-picker{display:flex;align-items:center;gap:6px;margin-left:auto}.lesson-picker select{background:var(--panel);color:var(--text);border:1px solid var(--border-strong);border-radius:var(--radius-sm);padding:6px 10px;font:inherit;font-size:13px;max-width:320px}.lesson-picker .nav-arrow{background:var(--panel);color:var(--text);border:1px solid var(--border-strong);border-radius:var(--radius-sm);padding:6px 10px;cursor:pointer;font:inherit}.lesson-picker .nav-arrow:disabled{opacity:.4;cursor:default}.layout-split .lesson-main{flex-direction:row;align-items:stretch;gap:20px;overflow:hidden}.layout-split .instructions{width:40%;min-width:320px;overflow-y:auto;align-self:stretch}.layout-split .editor-area{flex:1;min-width:0;overflow-y:auto;padding-right:2px}.layout-focus .lesson-main{max-width:880px;margin:0 auto;width:100%}.layout-ide .lesson-main{overflow:hidden}.layout-ide .editor-area{flex:1;min-height:0;overflow-y:auto}.layout-ide .run-term{height:300px}.layout-ide .docs-wrap{position:fixed;top:0;right:0;bottom:42px;width:min(560px,92vw);z-index:30;transform:translate(102%);transition:transform .22s ease;display:flex;flex-direction:column;background:var(--panel);border-left:1px solid var(--border-strong);box-shadow:-12px 0 40px #00000073}.layout-ide .docs-wrap.open{transform:translate(0)}.layout-ide .docs-wrap .instructions{flex:1;overflow-y:auto;border:none;border-radius:0;box-shadow:none}.docs-close{display:none}.layout-ide .docs-close{display:flex;align-items:center;justify-content:space-between;padding:12px 18px;border-bottom:1px solid var(--border);color:var(--heading);font-weight:700}.layout-ide .docs-close button{background:transparent;border:1px solid var(--border-strong);color:var(--muted);border-radius:var(--radius-sm);padding:4px 10px;cursor:pointer;font:inherit}.layout-ide .docs-close button:hover{color:var(--text)}.layout-wide .lesson-main{flex-direction:row;align-items:stretch;gap:20px;overflow:hidden}.layout-wide .instructions{width:36%;min-width:320px;overflow-y:auto}.layout-wide .editor-area{flex:1;min-width:0;overflow-y:auto;padding-right:2px}.layout-wide .run-term{height:280px}.lesson-num{min-width:20px;text-align:right;color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums;font-weight:600}.lesson.active .lesson-num{color:var(--accent-strong)}
