:root {
  --bg: #0b0f14; --bg2: #10151c; --panel: #141a22; --panel2: #1a212b; --panel3: #202834;
  --line: #232c38; --line2: #2e3947; --text: #dbe3ee; --muted: #8492a6; --faint: #5d6b7e;
  --accent: #ffa928; --accent-ink: #1d1304; --accent2: #4cc9f0; --danger: #ff5470; --ok: #3ddc97; --warn: #ffcc55;
  --r: 8px; --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.site { flex: 1; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); }
kbd { font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel3); border-color: #3b4757; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { background: #ffb94f; }
.btn.danger { color: var(--danger); border-color: #4a2531; }
.btn.danger:hover { background: #2a1219; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn.lg { padding: 11px 22px; font-size: 16px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel3); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.input { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line2); background: #0d1218; color: var(--text); font: inherit; }
.input:focus { border-color: var(--accent2); outline: none; }
textarea.input { resize: vertical; min-height: 60px; }
.input.code { font-family: var(--mono); font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field.check { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
.field.check > span { color: var(--text); font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); display: block; }
.color { width: 34px; height: 28px; padding: 0; border: 1px solid var(--line2); border-radius: 6px; background: none; cursor: pointer; }
.sw { width: 22px; height: 22px; border-radius: 5px; border: 2px solid rgba(255,255,255,.12); cursor: pointer; padding: 0; }
.sw.on, .sw:hover { border-color: #fff; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent2); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel3); color: var(--muted); border: 1px solid var(--line2); }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.inline .input { width: auto; padding: 4px 8px; }

/* ---------- toasts, modal, menu ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; align-items: center; }
.toast { background: #1d2530; border: 1px solid var(--line2); color: var(--text); padding: 9px 16px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.45); font-size: 13.5px; max-width: min(560px, 92vw); animation: tin .18s ease-out; }
.toast.ok { border-color: #1f6b4c; } .toast.warn { border-color: #6b5520; } .toast.error { border-color: #7a2536; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
dialog.modal { border: 1px solid var(--line2); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(480px, 94vw); max-height: 88vh; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.modal.wide { width: min(820px, 96vw); }
dialog.modal::backdrop { background: rgba(4,7,10,.62); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; }
.modal-head h2 { margin: 0; font: 600 16px/1.3 var(--display); }
.modal-body { padding: 6px 20px 14px; overflow: auto; max-height: calc(88vh - 120px); }
.modal-body p { margin: 4px 0 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.ctxmenu { position: fixed; margin: 0; inset: auto; min-width: 210px; padding: 5px; border-radius: 9px; border: 1px solid var(--line2); background: #171e27; color: var(--text); box-shadow: 0 16px 44px rgba(0,0,0,.55); z-index: 900; }
.ctxmenu.open { display: block; }
.ctxmenu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; font-size: 13px; }
.ctxmenu button:hover:not(:disabled) { background: var(--panel3); }
.ctxmenu button:disabled { opacity: .4; }
.ctxmenu .lbl { flex: 1; } .ctxmenu kbd { font-size: 10.5px; }
.ctxmenu .ic-sp { width: 15px; } .ctxmenu .sep { height: 1px; background: var(--line); margin: 4px 6px; }
.quickadd { position: fixed; margin: 0; inset: 90px auto auto 50%; transform: translateX(-50%); width: min(460px, 92vw); padding: 10px; border-radius: 12px; border: 1px solid var(--line2); background: #151c25; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.qa-list { margin-top: 8px; display: flex; flex-direction: column; }
.qa-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.qa-item small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.qa-item.sel, .qa-item:hover { background: var(--panel3); }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; margin: 8px 0; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; text-align: left; }
.pick:hover { border-color: var(--line2); background: var(--panel3); }
.pick small { color: var(--muted); margin-left: auto; font-size: 12px; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
table.tt { border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; margin: 4px auto; }
.tt th, .tt td { padding: 3px 10px; border: 1px solid var(--line); text-align: center; }
.tt th.in { color: var(--accent2); } .tt th.out { color: var(--accent); }
.tt td.on { color: var(--text); } .tt td { color: var(--faint); } .tt td.o { background: #121820; } .tt td.o.on { color: var(--accent); font-weight: 700; }
.tt-wrap { max-height: 60vh; overflow: auto; }

/* ---------- editor layout ---------- */
.app-editor { position: fixed; inset: 0; }
.editor { display: grid; grid-template-columns: 250px minmax(0, 1fr) 272px; grid-template-rows: 50px minmax(0, 1fr); height: 100%; background: var(--bg); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 12px; background: #0f141b; border-bottom: 1px solid var(--line); min-width: 0; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none !important; flex: none; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #ff6b35); color: #1d1304; }
.logo-text { font: 700 16px/1 var(--display); letter-spacing: .02em; } .logo-text b { color: var(--accent); font-weight: 700; }
.proj { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.proj-title { border: 0; background: none; font: 600 15px/1.2 var(--display); padding: 5px 8px; border-radius: 6px; cursor: pointer; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-title:hover { background: var(--panel2); }
.owner { font-size: 12.5px; color: var(--muted); }
.save-ind { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-ind.unsaved { color: var(--warn); } .save-ind.error { color: var(--danger); } .save-ind.saving { color: var(--accent2); }
.simctl { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); flex: none; }
.tb-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tb-btn:hover { background: var(--panel3); color: var(--text); }
.tb-btn.on { background: var(--accent); color: var(--accent-ink); }
.tb-btn.toggle.on { background: #1e3a48; color: var(--accent2); }
.speed { background: #0d1218; color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 6px; font: 12.5px var(--mono); }
.hz { font: 12px var(--mono); color: var(--muted); min-width: 64px; text-align: right; padding-right: 6px; }
.hz.run { color: var(--ok); }
.tb-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel2); font-size: 12px; cursor: pointer; color: var(--muted); }
.chip-btn:hover { color: var(--text); }

.leftbar, .rightbar { background: var(--panel); border-right: 1px solid var(--line); min-height: 0; display: flex; flex-direction: column; }
.rightbar { border-right: 0; border-left: 1px solid var(--line); overflow: auto; padding: 4px 14px 20px; }
.side-tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.side-tabs button { flex: 1; padding: 7px 4px 8px; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 550; font-size: 13px; border-bottom: 2px solid transparent; }
.side-tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.side-body { flex: 1; overflow: auto; min-height: 0; }
.pane { padding: 10px; }
.search { margin-bottom: 8px; }
.pal-cat { margin-bottom: 6px; }
.pal-cat > summary { cursor: pointer; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: 6px 2px; list-style: none; }
.pal-cat > summary::before { content: '▸ '; } .pal-cat[open] > summary::before { content: '▾ '; }
.pal-cat .hint { display: inline; text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 400; }
.pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.pal-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg2); cursor: grab; touch-action: none; min-width: 0; }
.pal-item:hover { border-color: var(--line2); background: var(--panel3); }
.pal-item span { font-size: 10.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-ic { width: 56px; height: 36px; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chip-row { display: flex; align-items: center; border-radius: 7px; }
.chip-row.active { background: var(--panel3); }
.chip-row:hover { background: var(--panel2); }
.chip-open { flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; cursor: pointer; text-align: left; min-width: 0; }
.cname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cmeta { font: 11px var(--mono); color: var(--faint); }
.main-badge { font-size: 10px; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: #3a2c10; color: var(--accent); }
.side-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 14px 0 6px; }
.lib-list { list-style: none; margin: 0 0 8px; padding: 0; }
.lib-list li { display: flex; align-items: center; }
.lib-item { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13px; min-width: 0; }
.lib-item:hover:not(:disabled) { background: var(--panel3); }
.lib-item small { margin-left: auto; color: var(--faint); font-size: 11px; }
.lib-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; align-items: flex-end; gap: 2px; padding: 6px 8px 0; background: #0f141b; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: thin; }
.tab { display: flex; align-items: center; border-radius: 7px 7px 0 0; background: transparent; border: 1px solid transparent; border-bottom: 0; flex: none; }
.tab.active { background: var(--bg); border-color: var(--line); margin-bottom: -1px; }
.tab-open { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--muted); }
.tab.active .tab-open { color: var(--text); }
.tab-x { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 3px 6px; border-radius: 4px; display: grid; place-items: center; }
.tab-x:hover { color: var(--text); background: var(--panel3); }
.tab-new { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 5px 8px; border-radius: 6px; margin-bottom: 3px; }
.tab-new:hover { background: var(--panel2); color: var(--text); }
.crumbs { display: none; align-items: center; gap: 6px; padding: 6px 12px; background: #13202a; border-bottom: 1px solid #1d3442; font-size: 13px; flex: none; }
.crumbs.show { display: flex; }
.crumb-note { display: inline-flex; align-items: center; gap: 5px; color: var(--accent2); font-weight: 600; margin-right: 6px; }
.crumb { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.crumb:hover { color: var(--text); background: var(--panel3); } .crumb.cur { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--faint); } .crumbs .btn { margin-left: auto; }
.board-wrap { position: relative; flex: 1; min-height: 0; }
.board-host { position: absolute; inset: 0; overflow: hidden; }
.board { display: block; touch-action: none; outline: none; }
.hotbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; border-radius: 11px; background: rgba(16,21,28,.88); border: 1px solid var(--line); backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.hot { position: relative; width: 48px; height: 40px; border-radius: 7px; border: 1px solid transparent; background: var(--bg2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.hot:hover { border-color: var(--line2); } .hot.active { border-color: var(--accent); background: #2a1f0c; }
.hot kbd { position: absolute; top: 1px; left: 2px; border: 0; background: none; padding: 0; font-size: 9px; color: var(--faint); }
.hot canvas { width: 40px; height: 26px; }
.statusbar { display: flex; gap: 16px; align-items: center; padding: 3px 12px; font: 11.5px var(--mono); color: var(--faint); background: #0f141b; border-top: 1px solid var(--line); flex: none; white-space: nowrap; overflow: hidden; }
.st-prob { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.st-prob.warn { color: var(--warn); }

/* ---------- properties ---------- */
.props { margin-top: 10px; }
.props-h { font: 600 14px/1.3 var(--display); margin: 8px 0 6px; }
.props .desc { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.pins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; font-size: 12.5px; }
.pins b { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 3px; }
.pin-row { display: flex; justify-content: space-between; padding: 2px 6px; background: var(--bg2); border-radius: 4px; margin-bottom: 2px; font-family: var(--mono); font-size: 11.5px; }
.pin-row small { color: var(--faint); }
.stats { font: 11.5px var(--mono); color: var(--faint); }
.tips { padding-left: 16px; margin: 4px 0; font-size: 12.5px; color: var(--muted); }
.tips li { margin-bottom: 5px; } .tips b { color: var(--text); font-weight: 600; }

/* ---------- bottom panel ---------- */
.bottom { flex: none; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; position: relative; }
.b-resize { position: absolute; top: -4px; left: 0; right: 0; height: 7px; cursor: ns-resize; z-index: 2; display: none; }
.bottom.open .b-resize { display: block; }
.b-tabs { display: flex; align-items: center; gap: 2px; padding: 3px 8px; }
.b-tabs button[role=tab] { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 0; background: none; color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.b-tabs button[role=tab]:hover { background: var(--panel2); color: var(--text); }
.b-tabs button[aria-selected=true] { background: var(--panel3); color: var(--text); }
.b-tabs .count { background: var(--warn); color: #1c1403; border-radius: 99px; font-size: 10px; padding: 0 5px; font-weight: 700; }
.b-tabs .count:empty { display: none; }
.b-body { overflow: hidden; height: 0; }
.bottom.open .b-body { border-top: 1px solid var(--line); }
.mem-pane, .wave-pane, .prob-pane { height: 100%; overflow: auto; padding: 6px 12px; }
.mem-grid { font: 12px/1.55 var(--mono); }
.mrow { display: flex; gap: 7px; } .mrow .addr { color: var(--faint); width: 36px; } .mrow span { color: #56657a; }
.mrow span.nz { color: var(--text); } .mrow span.cur { background: var(--accent); color: var(--accent-ink); border-radius: 3px; font-weight: 700; }
.mrow .ascii { color: #7da3c0 !important; margin-left: 10px; letter-spacing: .08em; }
.dis-list { font: 12px/1.6 var(--mono); }
.dis { display: grid; grid-template-columns: 50px 70px 1fr; } .dis .addr { color: var(--faint); } .dis .hex { color: #6f7f94; } .dis .asm { color: var(--text); }
.dis.cur { background: #2a1f0c; } .dis.cur .asm { color: var(--accent); font-weight: 700; } .dis.cur .addr::before { content: '▶ '; color: var(--accent); }
.wave-cv { width: 100%; display: block; }
.prob { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; font-size: 13px; }
.prob.error { color: var(--danger); } .prob.warn { color: var(--warn); } .prob.info { color: var(--muted); }
.prob-items { margin: 0 0 6px 28px; padding: 0; list-style: none; font-size: 12.5px; }

/* assembler */
.asm { display: grid; grid-template-columns: 190px minmax(0, 1fr) 320px; height: 100%; }
.asm-side { border-right: 1px solid var(--line); overflow: auto; padding: 6px 8px; }
.asm-sec { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 8px 2px 4px; font-weight: 650; }
.asm-item { display: flex; align-items: center; border-radius: 6px; }
.asm-item > button:first-child { flex: 1; display: flex; gap: 7px; align-items: center; padding: 5px 7px; border: 0; background: none; cursor: pointer; font-size: 12.5px; text-align: left; color: var(--muted); min-width: 0; }
.asm-item.active { background: var(--panel3); } .asm-item.active > button:first-child { color: var(--text); }
.asm-item:hover { background: var(--panel2); }
.doclink { display: inline-flex; align-items: center; margin: 12px 4px; color: var(--muted); }
.asm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.asm-title { padding: 5px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.asm-right { border-left: 1px solid var(--line); overflow: auto; padding: 4px 12px 12px; }
.asm-controls .field { margin: 6px 0; }
.asm-controls .field.live { padding: 6px 8px; border-radius: 7px; background: #231a08; border: 1px solid #4a3614; }
.asm-scratch { padding: 6px 10px; font-size: 12.5px; background: #13202a; color: #9fc6de; border-bottom: 1px solid #1d3442; }
.asm-scratch svg { vertical-align: -2px; }
.code-btn { margin-left: 4px; }
.asm-status { margin: 10px 0 6px; padding: 7px 10px; border-radius: 6px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.asm-status.ok { background: #0f2a20; color: var(--ok); } .asm-status.err { background: #2b1219; color: var(--danger); }
.asm-errs { margin: 0; padding-left: 18px; font-size: 12.5px; } .asm-errs li { margin-bottom: 4px; }
.asm-warn { font-size: 12px; color: var(--warn); }
.listing { width: 100%; border-collapse: collapse; font: 11.5px/1.5 var(--mono); }
.listing td { padding: 0 6px 0 0; vertical-align: top; white-space: pre; } .listing .a { color: var(--faint); } .listing .w { color: #7da3c0; } .listing .s { color: var(--muted); }
.labels code { display: inline-block; margin: 2px 8px 2px 0; font-size: 11.5px; color: var(--muted); }
.ce { position: relative; flex: 1; display: flex; min-height: 0; background: #0b1016; font: 13px/19px var(--mono); }
.ce-gutter { width: 44px; flex: none; overflow: hidden; color: var(--faint); text-align: right; padding: 8px 8px 8px 0; user-select: none; border-right: 1px solid var(--line); font-size: 11.5px; }
.ce-gutter .ce-mark.err { color: #fff; background: #8a2338; } .ce-gutter .ce-mark.warn { color: #1c1403; background: var(--warn); }
.ce-scroll { position: relative; flex: 1; min-width: 0; }
.ce-hl, .ce-ta { position: absolute; inset: 0; margin: 0; padding: 8px 12px; font: inherit; white-space: pre; overflow: auto; tab-size: 8; border: 0; letter-spacing: 0; }
.ce-hl { color: var(--text); pointer-events: none; overflow: hidden; }
.ce-ta { background: transparent; color: transparent; caret-color: var(--accent); resize: none; outline: none; }
.ce-ta::selection { background: rgba(76,201,240,.28); color: transparent; }
.t-com { color: #62768d; } .t-lbl { color: #ffd166; } .t-dir { color: #c792ea; } .t-op { color: #4cc9f0; font-weight: 600; }
.t-reg { color: #ff9e64; } .t-num { color: #7ee787; } .t-str { color: #f7a8b8; } .t-const { color: #e0c08a; } .t-ph { color: #ff9e64; } .t-arrow { color: var(--accent); font-weight: 700; } .t-id { color: #cfd8e3; }

/* viewer mode */
.editor.viewer .leftbar .pal-item { cursor: not-allowed; opacity: .6; }

/* ---------- site pages ---------- */
.site { min-height: 100%; display: flex; flex-direction: column; }
.site-nav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px; padding: 0 28px; height: 60px; background: rgba(11,15,20,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-nav nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav nav a { display: block; padding: 7px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; text-decoration: none; }
.site-nav nav a:hover, .site-nav nav a.active { color: var(--text); background: var(--panel2); }
.site-nav .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.site main { flex: 1; }
.wrap { width: min(1180px, 100% - 40px); margin: 0 auto; }
.site-foot { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--faint); font-size: 13px; }
.hero { position: relative; overflow: hidden; padding: 72px 0 56px; border-bottom: 1px solid var(--line); }
.hero-bg { position: absolute; inset: 0; opacity: .55; pointer-events: none; }
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font: 700 clamp(36px, 5vw, 60px)/1.02 var(--display); margin: 0 0 18px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: #b8c4d3; max-width: 560px; margin: 0 0 26px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; font: 12.5px var(--mono); color: var(--muted); }
.hero-steps span { padding: 4px 10px; border: 1px solid var(--line2); border-radius: 99px; background: var(--panel); }
.hero-steps span.arrow { border: 0; background: none; padding: 4px 0; color: var(--faint); }
.hero-shot { display: block; border-radius: 14px; border: 1px solid var(--line2); background: #0d1116; box-shadow: 0 30px 80px rgba(0,0,0,.5); overflow: hidden; transition: transform .2s, border-color .2s; }
.hero-shot:hover { transform: translateY(-3px); border-color: #3b4757; }
.hero-shot img { width: 100%; height: auto; display: block; }
.hero .wrap.wide-shot { grid-template-columns: 1fr; gap: 40px; }
.hero .wrap.wide-shot > div:first-child { max-width: 820px; }
.features { padding: 64px 0; }
.features h2, .section-h { font: 700 28px/1.2 var(--display); margin: 0 0 8px; letter-spacing: -.01em; }
.features .sub { color: var(--muted); margin: 0 0 28px; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.fcard { padding: 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.fcard .fic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: #2a1f0c; color: var(--accent); margin-bottom: 12px; }
.fcard h3 { margin: 0 0 6px; font: 600 16px/1.3 var(--display); }
.fcard p { margin: 0; color: var(--muted); font-size: 13.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; color: var(--text); text-decoration: none !important; transition: border-color .15s, transform .15s; }
.pcard:hover { border-color: #3b4757; transform: translateY(-2px); }
.pcard .thumb { aspect-ratio: 16 / 9; background: #0d1116 center / cover no-repeat; border-bottom: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); }
.pcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.pcard h3 { margin: 0; font: 600 15px/1.3 var(--display); }
.pcard .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.pcard .meta .star { display: inline-flex; align-items: center; gap: 3px; }
.pcard p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #1e2a36; color: #9fc2dc; }
.tag.off { background: #2a1f0c; color: var(--accent); }
.page { padding: 36px 0 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font: 700 30px/1.15 var(--display); margin: 0; }
.page-head .grow { flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--panel3); color: var(--text); }
.empty { padding: 40px; text-align: center; border: 1px dashed var(--line2); border-radius: 12px; color: var(--muted); }
.auth { max-width: 400px; margin: 60px auto; padding: 28px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.auth h1 { font: 700 24px/1.2 var(--display); margin: 0 0 6px; }
.auth .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.auth .btn { width: 100%; justify-content: center; margin-top: 8px; }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 24px; }
.avatar { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font: 700 26px var(--display); color: #1d1304; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.user-menu { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.user-menu:hover { background: var(--panel2); }
.loading { display: grid; place-items: center; height: 60vh; color: var(--muted); }

/* ---------- docs ---------- */
.docs { display: grid; grid-template-columns: 260px minmax(0, 1fr) 200px; gap: 32px; width: min(1320px, 100% - 40px); margin: 0 auto; padding: 28px 0 80px; }
.docs-nav { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 13.5px; padding-right: 6px; }
.docs-nav h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 18px 0 6px; }
.docs-nav a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.docs-nav a:hover { color: var(--text); background: var(--panel); }
.docs-nav a.active { color: var(--text); background: var(--panel2); box-shadow: inset 2px 0 0 var(--accent); }
.docs-nav .num { color: var(--faint); font: 11px var(--mono); margin-right: 6px; }
.doc { min-width: 0; max-width: 780px; font-size: 15.5px; line-height: 1.7; color: #c9d4e1; }
.doc h1 { font: 700 34px/1.15 var(--display); color: var(--text); margin: 0 0 8px; letter-spacing: -.015em; }
.doc .kicker { font: 600 12px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.doc h2 { font: 650 22px/1.3 var(--display); color: var(--text); margin: 40px 0 10px; padding-top: 8px; scroll-margin-top: 80px; }
.doc h3 { font: 600 17px/1.35 var(--display); color: var(--text); margin: 28px 0 8px; scroll-margin-top: 80px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 14px; } .doc li { margin-bottom: 5px; }
.doc code { font-size: .88em; padding: 1px 5px; border-radius: 4px; background: #17202a; color: #e6c07b; }
.doc pre { background: #0d1218; border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; overflow: auto; font-size: 13px; line-height: 1.55; margin: 0 0 16px; }
.doc pre code { background: none; padding: 0; color: #cfd8e3; }
.doc table { border-collapse: collapse; margin: 0 0 16px; font-size: 13.5px; width: 100%; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--panel); color: var(--text); font-weight: 600; }
.doc td code { white-space: nowrap; }
.doc blockquote, .doc .note { margin: 0 0 16px; padding: 12px 16px; border-radius: 9px; background: #121c26; border: 1px solid #1f3444; color: #b9cfe0; }
.doc .note.tip { background: #10211a; border-color: #1c3d2e; color: #b5e0c8; }
.doc .note.warn { background: #221b0c; border-color: #43361a; color: #ecd9a8; }
.doc .note b:first-child { color: var(--text); }
.doc .try { display: flex; gap: 10px; align-items: center; margin: 0 0 18px; padding: 12px 16px; border-radius: 10px; border: 1px dashed #3b4757; }
.doc figure { margin: 0 0 18px; } .doc figure svg { width: 100%; height: auto; display: block; border-radius: 10px; background: #0d1218; border: 1px solid var(--line); }
.doc figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; text-align: center; }
.doc .pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.doc .pager a { display: flex; flex-direction: column; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; min-width: 200px; }
.doc .pager a:hover { border-color: var(--line2); }
.doc .pager small { color: var(--faint); font-size: 12px; } .doc .pager span { color: var(--text); font-weight: 600; }
.doc .pager .next { text-align: right; margin-left: auto; }
.doc-toc { position: sticky; top: 76px; align-self: start; font-size: 12.5px; }
.doc-toc b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 6px; }
.doc-toc a { display: block; color: var(--muted); padding: 3px 0; text-decoration: none; }
.doc-toc a:hover { color: var(--text); }
.tt-inline td, .tt-inline th { text-align: center; font-family: var(--mono); }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 210px minmax(0, 1fr) 240px; }
  .docs { grid-template-columns: 220px minmax(0, 1fr); } .doc-toc { display: none; }
  .asm { grid-template-columns: 150px minmax(0, 1fr) 260px; }
}
@media (max-width: 860px) {
  .editor { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .editor .leftbar, .editor .rightbar { display: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 6px 10px; gap: 8px; }
  .proj { order: 3; flex-basis: 100%; }
  .hero .wrap { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .site-nav { padding: 0 14px; gap: 8px; } .site-nav nav a { padding: 6px 8px; }
  .docs { grid-template-columns: 1fr; } .docs-nav { position: static; max-height: none; }
  .asm { grid-template-columns: 1fr; } .asm-side, .asm-right { display: none; }
  .hotbar { display: none; }
}
@media (max-width: 560px) { .site-nav nav { display: none; } .toolbar .input { min-width: 0; flex: 1; } }
