/* ==========================================================================
   Step Into Labs — debugger & assembly view
   ========================================================================== */
.btn-debug svg { width: 15px; height: 15px; }
.btn-debug.running svg { animation: spin .8s linear infinite; }
body.debugging .btn-debug { color: var(--amber); border-color: rgba(255, 198, 92, .35); background: rgba(255, 198, 92, .06); }

/* editor decorations */
.monaco-editor .bp-glyph { cursor: pointer; }
.monaco-editor .bp-glyph::before { content: ""; position: absolute; left: 5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px rgba(255, 107, 122, .18); }
.monaco-editor .margin-view-overlays .cgmr { cursor: pointer; }
.monaco-editor .dbg-line { background: rgba(255, 198, 92, .13); box-shadow: inset 2px 0 0 var(--amber); }
.monaco-editor .dbg-line.crash { background: rgba(255, 107, 122, .16); box-shadow: inset 2px 0 0 var(--red); }
.monaco-editor .dbg-line.caller { background: rgba(124, 156, 255, .10); box-shadow: inset 2px 0 0 var(--blue); }
.monaco-editor .dbg-arrow { margin-left: 2px; }
.monaco-editor .dbg-arrow::before { content: ""; position: absolute; top: 50%; margin-top: -5px; border-left: 7px solid var(--amber); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.monaco-editor .dbg-arrow.crash::before { border-left-color: var(--red); }
.monaco-editor .dbg-arrow.caller::before { border-left-color: var(--blue); }
.monaco-editor .asm-src-hl { background: rgba(90, 242, 166, .09); }
.bp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin: 0 4px 0 2px; }

/* toolbar must never push Run out of view */
.pane-ide, .console, .console-body, .cpanel { min-width: 0; }
.ide-toolbar { container-type: inline-size; min-width: 0; }
.file-tab { min-width: 0; overflow: hidden; white-space: nowrap; flex-shrink: 1; }
.toolbar-actions { flex: none; }
@container (max-width: 640px) { .ide-toolbar .backend-badge { display: none; } }
@container (max-width: 520px) { .btn-debug .lbl, .ide-toolbar [data-act="reset"] .lbl { display: none; } }

/* debugger panel */
.dbg { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.dbg-intro { padding: 16px; display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.dbg-intro-text { display: flex; flex-direction: column; gap: 6px; max-width: 640px; color: var(--text-2); font-size: 13px; }
.dbg-intro-text b { color: var(--text); }
.dbg-intro .btn kbd { font-size: 10.5px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .18); margin-left: 4px; }
.dbg-why { color: var(--amber); }
.dbg-done { color: var(--accent); }
.dbg-compile { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.dbg-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--bg-1); flex: none; flex-wrap: wrap; }
.dbg-btns { display: flex; align-items: center; gap: 2px; }
.dbg-btns .icon-btn { width: 30px; height: 30px; border-radius: 7px; }
.dbg-btns .icon-btn svg { width: 16px; height: 16px; }
.dbg-btns .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.dbg-btns .icon-btn.danger { color: var(--red); }
.dbg-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.dbg-scrub { flex: 1; min-width: 120px; accent-color: var(--amber); }
.dbg-pos { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.dbg-bar > .icon-btn { width: 30px; height: 30px; }
.dbg-bar > .icon-btn svg { width: 15px; height: 15px; }
/* timeline: the whole run; the line is the call depth */
.dbg-timeline { height: 38px; flex: none; border-bottom: 1px solid var(--line); background: #090b10; cursor: pointer; outline: none; touch-action: none; }
.dbg-timeline:focus-visible { box-shadow: inset 0 0 0 1px var(--line-2); }
.dbg-timeline svg { width: 100%; height: 100%; display: block; }
.tl-past { fill: rgba(255, 255, 255, .025); }
.tl-depth { fill: none; stroke: #4d5a72; stroke-width: 1.4; }
.tl-out { fill: var(--accent); opacity: .8; }
.tl-bp { fill: var(--red); }
.tl-crash { fill: var(--red); opacity: .6; }
.tl-head { stroke: var(--amber); stroke-width: 2; }
.dbg-status { flex: 1; min-width: 180px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbg-status .dim { color: var(--muted); }
.dbg-status b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.dbg-status .bad { color: var(--red); }
.dbg-status .good { color: var(--accent); }
.dbg-status .warn { color: var(--amber); }
.dbg-grid { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.05fr) minmax(0, .95fr) minmax(0, 1fr); }
.dbg-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.dbg-col:last-child { border-right: 0; }
.dbg-col > .dbg-box { flex: 1; border-right: 0; }
.dbg-col > .dbg-box + .dbg-box { border-top: 1px solid var(--line); }
.dbg-stackcol { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 0; }
.dbg-stackcol > .dbg-box { flex: 1; border-right: 0; }
.dbg-stackcol > .dbg-box + .dbg-box { border-top: 1px solid var(--line); }
.dbg-box { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.dbg-box:last-child { border-right: 0; }
.dbg-box h6 { margin: 0; padding: 5px 10px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; flex: none; display: flex; align-items: center; gap: 8px; min-height: 30px; }
.dbg-box h6 .dbg-fn { font-family: var(--mono); text-transform: none; letter-spacing: 0; color: var(--violet); font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.seg.mini button { font-size: 10.5px; padding: 2px 8px; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.dbg-box.code { position: relative; }
.dbg-graph { flex: 1; min-height: 0; position: relative; }
.dbg-box h6 small { text-transform: none; letter-spacing: 0; font-family: var(--mono); }
.dbg-box-body { flex: 1; min-height: 0; overflow: auto; padding: 0 4px 10px; font-family: var(--mono); font-size: 12.5px; }
.dbg-none { color: var(--muted); padding: 4px 8px; font-family: var(--sans); font-size: 12.5px; }
.dbg-table { width: 100%; border-collapse: collapse; }
.dbg-table td { padding: 2px 6px; vertical-align: top; white-space: nowrap; }
.dbg-table td.n { color: var(--blue); width: 1%; }
.dbg-table td.n i { font-style: normal; font-size: 10px; color: var(--muted); margin-left: 5px; }
.dbg-table td.v { color: #dce3ee; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 99%; }
.dbg-table td.d { color: var(--muted); font-size: 11.5px; text-align: left; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 60%; }
.dbg-table td.h { width: 1%; padding: 0 2px; }
.dbg-table td.h button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; display: grid; opacity: 0; }
.dbg-table tr:hover td.h button { opacity: 1; }
.dbg-table td.h button:hover { color: var(--amber); background: var(--bg-3); }
.dbg-table td.h svg { width: 13px; height: 13px; }
.dbg-table .sym { color: var(--violet); }
.dbg-table .str { color: #a5e3b6; }
.dbg-table .ptr { color: #8a94a8; }
.dbg-table .mark { color: var(--amber); }
.rg-sub { font-family: var(--sans); font-size: 10.5px; color: var(--muted); padding: 6px 6px 3px; letter-spacing: .02em; }
.rg-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; padding: 0 6px; font-size: 11.5px; }
.rg-all .rg { display: flex; gap: 6px; color: #9aa4b6; white-space: nowrap; overflow: hidden; }
.rg-all .rg b { color: var(--blue); font-weight: 500; min-width: 26px; }
.rg-all .rg.chg { color: var(--amber); }
.dbg-table.regs td.v, .dbg-table.stack td.v { width: auto; max-width: none; }
.dbg-table.vars td.v { width: 70%; }
.dbg-table .hz { color: var(--muted); }
.dbg-table tr.chg td { background: rgba(255, 198, 92, .10); }
.dbg-table tr.chg td.v, .dbg-table tr.chg td.d { color: var(--amber); }
.flags { display: flex; gap: 4px; padding: 6px 6px 0; flex-wrap: wrap; }
.flag { font-size: 11px; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); }
.flag.on { color: var(--accent); border-color: rgba(90, 242, 166, .45); background: var(--accent-soft); }
.flag.chg { box-shadow: 0 0 0 1px var(--amber); }
.dbg-frames { list-style: none; margin: 0; padding: 0; }
.dbg-frames li { padding: 4px 8px; border-radius: 6px; display: flex; flex-direction: column; }
.dbg-frames li[data-frame] { cursor: pointer; }
.dbg-frames li[data-frame]:hover { background: var(--bg-3); }
.dbg-frames li.sel { background: var(--bg-4); }
.dbg-frames li b { font-weight: 500; color: var(--text); }
.dbg-frames li span { font-size: 11px; color: var(--muted); }
.dbg-frames li.lib b { color: var(--muted); }
.dbg-out { margin: 0; padding: 4px 8px; white-space: pre-wrap; word-break: break-word; color: #cfd6e2; }
.dbg-out mark { background: rgba(90, 242, 166, .16); color: var(--accent); border-radius: 2px; }
.dbg-code { padding: 0 2px; }
.dbg-code .fn { color: var(--violet); padding: 2px 6px; }
.dbg-code .ins { display: grid; grid-template-columns: 14px 34px minmax(0, 92px) max-content; gap: 6px; padding: 0 6px 0 0; border-radius: 4px; white-space: pre; cursor: pointer; }
.dbg-code .ins::before { content: ""; }
.dbg-code .ins.cur::before { content: "\25B6"; color: var(--amber); font-size: 10px; text-align: center; }
.dbg-code .ins.line { background: rgba(255, 198, 92, .06); }
.dbg-code .src { color: #8a94a8; padding: 6px 6px 1px 20px; font-family: var(--mono); white-space: pre; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.dbg-code .src .sl { color: #566074; display: inline-block; min-width: 30px; }
.dbg-code .src:hover { color: var(--text); }
.dbg-code .ins:hover { background: var(--bg-3); }
.dbg-code .ins .a { color: var(--muted); text-align: right; overflow: hidden; }
.dbg-code .ins .b { color: #5e6a80; overflow: hidden; text-overflow: ellipsis; }
.dbg-code .ins.cur { background: rgba(255, 198, 92, .14); box-shadow: inset 2px 0 0 var(--amber); }

/* assembly view */
.asm-panel { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.asm-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--bg-1); flex: none; flex-wrap: wrap; }
.asm-bar .spacer { flex: 1; }
.asm-bar .icon-btn { width: 30px; height: 30px; }
.asm-bar .icon-btn svg { width: 15px; height: 15px; }
.asm-panel.busy .asm-bar .icon-btn svg { animation: spin .8s linear infinite; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text-2); font-size: 12px; padding: 4px 10px; cursor: pointer; font-family: var(--mono); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { color: var(--text); background: var(--bg-3); }
.seg button.on { color: var(--accent-ink); background: var(--accent); }
.seg-label { font-size: 12.5px; color: var(--text-2); }
.asm-cmd { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.asm-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.asm-list { padding: 6px 0 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.asm-empty { color: var(--muted); padding: 8px 16px; font-family: var(--sans); font-size: 13px; }
.asm-empty.bad { color: var(--red); }
.asm-compile { font-size: 12.5px; white-space: pre-wrap; padding: 0 16px; font-family: var(--mono); }
.al { display: grid; grid-template-columns: 4px 34px 1fr; gap: 10px; padding-right: 12px; white-space: pre; min-height: 20px; }
.asm-list.objdump .al:not(.label):not(.gap) { grid-template-columns: 4px 34px 44px minmax(0, 150px) 1fr; }
.al[data-l] .g { background: hsl(var(--h) 70% 62% / .55); }
.al[data-l] { cursor: pointer; }
.al[data-l]:hover, .al.on { background: hsl(var(--h) 70% 62% / .10); }
.al.on .g { background: hsl(var(--h) 75% 66%); }
.al .ln { color: var(--muted); text-align: right; font-size: 11px; }
.al .ad { color: var(--muted); text-align: right; }
.al .by { color: #5e6a80; overflow: hidden; text-overflow: ellipsis; }
.al.gap { min-height: 10px; }
.tk-op { color: var(--cyan); }
.tk-reg { color: #e6c07b; }
.tk-num { color: var(--violet); }
.tk-kw { color: var(--muted); }
.tk-lbl { color: var(--accent); }
.tk-cm { color: var(--muted); font-style: italic; }

@media (max-width: 980px) {
  .dbg-grid, .dbg-grid.asm { grid-template-columns: 1fr 1fr; overflow: auto; }
  .dbg-col { min-height: 260px; }
  .dbg-box { border-bottom: 1px solid var(--line); min-height: 140px; }
}
@media (max-width: 560px) {
  .dbg-grid, .dbg-grid.asm { grid-template-columns: 1fr; }
  .dbg-pos { min-width: 0; }
}

/* legal pages */
.legal { max-width: 760px; padding: 64px 0 40px; }
.legal h1 { font-size: clamp(32px, 4vw, 46px); letter-spacing: -.035em; line-height: 1.08; margin: 16px 0 8px; font-weight: 800; }
.legal-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 0 0 28px; }
.legal .prose h2 { font-size: 19px; margin-top: 34px; }
.legal .prose h2::before { content: none; }
.legal .prose p, .legal .prose li { color: var(--text-2); }

/* assembly view: follow mode + function picker */
.asm-follow { padding: 6px 12px; font-size: 12.5px; color: var(--text-2); background: rgba(255, 198, 92, .06); border-bottom: 1px solid rgba(255, 198, 92, .18); flex: none; }
.asm-follow b { color: var(--amber); font-family: var(--mono); font-weight: 500; }
.asm-fn { background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 7px; font-family: var(--mono); font-size: 12px; padding: 3px 6px; }
.asm-graph { position: absolute; inset: 0; }
.asm-list .dbg-code { padding: 6px 4px; }
.tk-op.flow { color: #f0a65a; }

/* flow graph (IDA-style) */
:root { --g-true: #3fcf8e; --g-false: #ff6b7a; --g-jump: #7c9cff; }
.fg-viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab;
  background: radial-gradient(circle, rgba(255, 255, 255, .045) 1px, transparent 1px) 0 0 / 18px 18px, #080a0e; }
.fg-viewport.dragging { cursor: grabbing; }
.fg-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fg-svg { display: block; overflow: visible; }
.fg-edge { fill: none; stroke-width: 1.6; }
.fg-edge.back { stroke-dasharray: 5 4; }
.fg-block { box-sizing: border-box; height: 100%; background: #10141c; border: 1px solid #2a3344; border-radius: 6px; padding: 8px 10px;
  font-family: var(--mono); font-size: 12px; line-height: 17px; color: #d5dbe6; white-space: pre; overflow: hidden; }
.fg-block.cur { border-color: rgba(255, 198, 92, .7); box-shadow: 0 0 0 1px rgba(255, 198, 92, .25); }
.fg-title { color: var(--accent); }
.fg-row { cursor: pointer; border-radius: 3px; margin: 0 -4px; padding: 0 4px; }
.fg-row:hover { background: rgba(255, 255, 255, .05); }
.fg-row.line { background: rgba(255, 198, 92, .08); }
.fg-row.cur { background: rgba(255, 198, 92, .22); box-shadow: inset 2px 0 0 var(--amber); }
.fg-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.fg-tools button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 14px; line-height: 1; }
.fg-tools button:hover { color: var(--text); background: var(--bg-3); }

/* debugger focus mode: the IDE takes the whole width while debugging */
body.dbg-focus .lesson-view { grid-template-columns: 0 0 minmax(0, 1fr); }
body.dbg-focus .pane-lesson, body.dbg-focus .gutter-v { visibility: hidden; overflow: hidden; }
.dbg-focus-btn { height: 28px; font-size: 12px; white-space: nowrap; }

/* accounts */
.acct-slot { display: flex; align-items: center; }
.acct-signin { height: 30px; }
.acct-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); padding: 0; overflow: hidden; cursor: pointer; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.acct-btn img { width: 100%; height: 100%; object-fit: cover; }
.acct-btn:hover { border-color: var(--text-2); }
.signin { text-align: center; padding: 6px 4px 2px; }
.signin-mark { border-radius: 9px; }
.signin h3 { margin: 14px 0 6px; }
.signin-sub { color: var(--text-2); font-size: 14px; margin: 0 0 18px; }
.signin-error { background: rgba(255, 107, 122, .08); border: 1px solid rgba(255, 107, 122, .3); color: #ffb3bb; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; text-align: left; margin-bottom: 16px; }
.signin-providers { display: flex; flex-direction: column; gap: 10px; }
.signin-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-weight: 600; font-size: 14.5px; }
.signin-btn:hover { background: var(--bg-3); text-decoration: none; border-color: #3a4558; }
.signin-btn svg { width: 19px; height: 19px; }
.signin-dev { margin-top: 16px; text-align: left; }
.signin-dev label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.signin-dev div { display: flex; gap: 8px; }
.signin-dev input { flex: 1; height: 32px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--text); padding: 0 10px; font: inherit; font-size: 13.5px; }
.signin-legal { font-size: 12px; color: var(--muted); margin: 18px 0 0; }
.acct-menu .acct-head { display: flex; gap: 12px; align-items: center; }
.acct-menu .acct-head img { width: 42px; height: 42px; border-radius: 50%; }
.acct-menu .acct-head div { display: flex; flex-direction: column; }
.acct-menu .acct-head span { color: var(--muted); font-size: 13px; }
.acct-note { color: var(--text-2); font-size: 13.5px; }
