/* ==========================================================================
   debug.css — bottom dock (resizable) with Debugger, Logic analyzer and
   Oscilloscope.
   ========================================================================== */
:root { --dock-h: 260px; }
.dock { flex: none; height: 38px; position: relative; background: #fff; border-top: 1px solid var(--border); display: flex; flex-direction: column; z-index: 22; container: dock / inline-size; box-shadow: 0 -4px 12px -10px rgba(20,32,48,.25); }
.app.dock-open .dock { height: var(--dock-h); }
.splitter-dock { position: absolute; left: 0; right: 0; top: -5px; height: 9px; width: auto; margin: 0; cursor: row-resize; z-index: 41; }
.splitter-dock::before { top: 4px; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }
.splitter-dock::after { top: 2px; left: 50%; margin: 0 0 0 -18px; width: 36px; height: 5px; }
.splitter-dock:hover::before, .splitter-dock:focus-visible::before, .splitter-dock.dragging::before { width: auto; left: 0; height: 3px; top: 3px; }
.dock-head { height: 37px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; }
.app.dock-open .dock-head { border-bottom: 1px solid var(--border); }
.dock-tabs { display: flex; gap: 2px; }
.dtab { display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 12.5px; position: relative; white-space: nowrap; flex: none; }
.dtab:hover { background: var(--surface-3); color: var(--text); }
.app.dock-open .dtab.active { background: var(--accent-50); color: var(--accent-600); }
.dtab-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.app.sim-paused .dtab-dot { background: #F5A524; box-shadow: 0 0 0 3px rgba(245,165,36,.2); }
.dock-hint { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.dock-toggle .ic { transition: transform .15s; }
.app.dock-open .dock-toggle .ic { transform: rotate(180deg); }
.dock-body { flex: 1; min-height: 0; display: none; }
.app.dock-open .dock-body { display: flex; }
.dpane { display: none; flex: 1; min-width: 0; min-height: 0; }
.dpane.active { display: flex; }

/* ---------- Debugger ---------- */
.dbg { display: grid; grid-template-columns: minmax(300px, 1.15fr) 1fr 1fr; flex: 1; min-height: 0; }
.dbg-col { border-right: 1px solid var(--border); padding: 10px 12px; overflow: auto; min-width: 0; }
.dbg-col:last-child { border-right: 0; }
.dbg-tools { display: flex; gap: 5px; flex-wrap: wrap; }
.dbg-btn { display: inline-flex; gap: 5px; align-items: center; height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; font-weight: 600; font-size: 12px; color: var(--text); white-space: nowrap; }
.dbg-btn:hover:not(:disabled) { border-color: var(--text-2); }
.dbg-btn.go { background: var(--accent); color: #fff; border-color: var(--accent); }
.dbg-btn.go:hover:not(:disabled) { background: var(--accent-600); }
.dbg-btn.danger { color: var(--red); }
.dbg-btn:disabled { opacity: .42; cursor: default; }
.dbg-status { display: flex; align-items: center; gap: 7px; margin: 10px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.dbg-status i { width: 8px; height: 8px; border-radius: 50%; background: #C3C9D1; }
.dbg-status.running i { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dbg-status.running { color: #15803D; }
.dbg-status.paused { color: #B45309; }
.dbg-status.paused i { background: #F5A524; box-shadow: 0 0 0 3px rgba(245,165,36,.25); }
.dbg-sec { margin-top: 8px; }
.dbg-h { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 2px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.link { border: 0; background: none; color: var(--accent-600); font-weight: 600; font-size: 11px; text-transform: none; letter-spacing: 0; padding: 0; }
.dbg-loc { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.dbg-loc .muted { font-size: 12px; }
.app:not(.sim-paused) .dbg-loc { background: var(--surface-2); border-color: var(--border); }
.loc-block { display: flex; gap: 6px; align-items: center; cursor: pointer; color: #92400E; }
.loc-block b { font-weight: 700; color: var(--text); }
.loc-path { font-size: 11.5px; color: var(--text-2); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.loc-path span { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.loc-path i { color: var(--muted); font-style: normal; }
.loc-meta { display: flex; gap: 10px; font: 11px var(--mono); color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }
.dbg-bps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dbg-bps li { display: flex; align-items: center; gap: 7px; font-size: 12px; padding: 5px 8px; background: var(--surface-2); border-radius: 8px; }
.dbg-bps li i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex: none; }
.dbg-bps li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.dbg-bps li button { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; }
.dbg-bps li.empty { background: none; padding: 2px 0; display: block; line-height: 1.5; }
.watch-wrap { overflow: auto; }
.watch { width: 100%; border-collapse: collapse; font-size: 12px; }
.watch th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.watch td { padding: 5px 6px; border-bottom: 1px solid #F0F2F5; white-space: nowrap; }
.watch .val { font: 12px var(--mono); color: var(--text); }
.watch tr.changed td { background: #FFF6D6; transition: background .6s; }
.watch td.empty { padding: 14px 6px; border: 0; white-space: normal; }
.lvl { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #C3C9D1; margin-right: 6px; vertical-align: 1px; }
.lvl.hi { background: var(--green); box-shadow: 0 0 4px var(--green); }

/* ---------- Logic analyzer & oscilloscope ---------- */
.la, .scope { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.scope-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: 12px; flex: none; }
.tool-btn { height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--border-strong); background: #fff; font-weight: 600; font-size: 12px; color: var(--text); white-space: nowrap; }
.tool-btn:hover { border-color: var(--text-2); }
.tool-btn.active { background: #1E2329; color: #fff; border-color: #1E2329; }
.tool-btn.held { background: var(--red); border-color: var(--red); color: #fff; }
.select.sm { height: 26px; padding: 0 6px; font-size: 12px; width: auto; border-radius: 7px; }
.scope-lbl { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 600; font-size: 11.5px; white-space: nowrap; }
.scope-lbl output { font: 11px var(--mono); min-width: 44px; }
.scope-read { font: 11px var(--mono); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.grow { flex: 1; }
.la-main { flex: 1; min-height: 0; display: flex; overflow-y: auto; overflow-x: hidden; }
.la-names { width: 96px; flex: none; padding-top: 20px; border-right: 1px solid var(--border); background: #fff; align-self: flex-start; min-height: 100%; }
.la-name { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; font: 600 12px var(--mono); color: var(--text); }
.la-name i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.la-name button { margin-left: auto; border: 0; background: none; color: var(--muted); opacity: 0; font-size: 14px; }
.la-name:hover button { opacity: 1; }
.la-empty { font-size: 11.5px; color: var(--muted); padding: 8px 10px; line-height: 1.45; }
.la-cv { flex: 1; min-width: 0; }
.la-cv canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.scope-main { flex: 1; min-height: 0; padding: 6px 10px 0; }
.scope-main canvas { width: 100%; height: 100%; display: block; border-radius: 8px; cursor: crosshair; }
.scope-meas { display: flex; gap: 16px; padding: 6px 12px 7px; font-size: 11.5px; color: var(--text-2); flex-wrap: wrap; flex: none; }
.scope-meas i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 4px; }
.scope-meas em { font-style: normal; color: var(--muted); }
.ch-pick { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; font-size: 11px; color: var(--text-2); }
.ch-pick i { width: 12px; height: 3px; border-radius: 2px; background: var(--c); }
.ch-pick .select.sm { max-width: 118px; }
.trig input[type=range] { width: 86px; height: 5px; }

/* narrow workspace: drop the shortcut hint before the tabs wrap */
@container dock (max-width: 640px) { .dock-hint { display: none; } }
/* protocol decoders */
.la-dec { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--border); font: 600 11px var(--font); color: var(--muted); }
.la-raw { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; font: 500 11.5px var(--font); color: var(--text-2); cursor: pointer; }
.la-name.lane { background: #EEF4FB; } .la-name.lane i { background: #3E9BE0; border-radius: 2px; } .la-name.lane small { margin-left: auto; color: var(--muted); font: 600 10px var(--mono); }
/* ---------- Debug advanced: registers ---------- */
.rg { display: flex; flex-direction: column; height: 100%; min-height: 0; font-family: var(--font); }
.rg-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex: none; flex-wrap: wrap; }
.rg-bar .grow { flex: 1; }
.rg-src { font: 700 11px var(--font); padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.rg-src.hw { background: #ECFDF3; color: #067647; } .rg-src.sim { background: #EFF4FB; color: #2A6BB0; }
.rg-note { font-size: 11px; color: var(--muted); }
.rg-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.rg-left { flex: 1; min-width: 0; overflow: auto; padding: 8px 10px; }
.rg-prog { width: 240px; flex: none; border-left: 1px solid var(--border); padding: 8px 12px; overflow: auto; font-size: 12px; }
.rg-prog h4 { margin: 10px 0 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rg-prog dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; } .rg-prog dt { color: var(--muted); } .rg-prog dd { margin: 0; font-weight: 600; }
.rg-prog .m, .rg .m { font-family: var(--mono); }
.rg-vars { width: 100%; border-collapse: collapse; } .rg-vars td { padding: 2px 4px; border-bottom: 1px solid var(--surface-3); }
.rg-pinmat { border-collapse: collapse; font: 600 10px var(--mono); margin-bottom: 10px; }
.rg-pinmat th, .rg-pinmat td { border: 1px solid #E6EAEE; padding: 2px 3px; min-width: 24px; text-align: center; height: 18px; }
.rg-pinmat th { background: var(--surface-2); color: var(--text-2); } .rg-pinmat th.own { background: var(--accent-50); color: var(--accent-600); }
.rg-pinmat tr > th:first-child { text-align: left; padding: 0 6px; }
.rg-pinmat td.f5 { background: #EEF2F7; } .rg-pinmat td.f4 { background: #FFF1E6; color: #C2410C; } .rg-pinmat td.f3 { background: #E8F1FB; color: #1D5FA8; }
.rg-pinmat td.f1 { background: #F1ECFB; color: #6941C6; } .rg-pinmat td.f2 { background: #E7F7F2; color: #0E7C66; } .rg-pinmat td.f6, .rg-pinmat td.f7 { background: #FDF2FA; color: #B42371; }
.rg-pinmat td.hi { background: #DCFCE7; color: #15803D; } .rg-pinmat td.o { color: var(--accent-600); }
.rg-tab { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rg-tab th { text-align: left; font: 700 10px var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.rg-tab td { padding: 3px 6px; border-bottom: 1px solid var(--surface-3); white-space: nowrap; }
.rg-tab td.v { color: #1D5FA8; font-weight: 600; } .rg-tab td.b { color: #7B8794; font-size: 10.5px; }
.rg-tab tr.chg td { animation: rgFlash 1s ease-out; } @keyframes rgFlash { from { background: #FFF1B8; } }
.la-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; }
/* v9 logic analyzer: transaction list, trigger, GP labels */
.la-body { flex: 1; min-height: 0; display: flex; }
.la-body .la-main { flex: 1; min-width: 0; }
.la-tx { width: 340px; flex: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.la-tx[hidden] { display: none; }
.la-tx-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); }
.la-tx-l { overflow-y: auto; flex: 1; min-height: 0; }
.la-tx-r { display: grid; grid-template-columns: 70px 44px 1fr; gap: 2px 6px; padding: 4px 10px; border-bottom: 1px solid #F0F2F5; font: 10.5px var(--mono); cursor: pointer; }
.la-tx-r:hover { background: #F3F7FC; }
.la-tx-r .t { color: var(--muted); }
.la-tx-r .b { font-weight: 700; color: #3E9BE0; } .la-tx-r .b.spi { color: #C56FA3; }
.la-tx-r .s { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.la-tx-r .n { grid-column: 2 / 4; color: #5B6573; font: 500 10.5px var(--font); }
.la-name small { margin-left: 2px; color: var(--muted); font: 600 9.5px var(--mono); }
.la-trig select.select.sm { max-width: 92px; }
/* v9 oscilloscope: channel settings + measurements */
.scope-cfg { display: flex; gap: 14px; padding: 5px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); flex: none; }
.scope-cfg[hidden] { display: none; }
.sc-c { display: inline-flex; align-items: center; gap: 6px; } .sc-c b { color: var(--c); }
.sc-c input[type=color] { width: 24px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: none; }
.sc-c input[type=number] { width: 46px; font: 11px var(--mono); padding: 1px 3px; border: 1px solid var(--border); border-radius: 4px; }
.scope-meas .sc-m { white-space: nowrap; }
.scope-meas .sc-cur { font: 11px var(--mono); color: #6C6FD8; white-space: nowrap; }
.scope-lbl.trig select.select.sm { max-width: 74px; }
