:root {
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-input: #0f3460;
    --bg-secondary: #1b2d45;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.3);
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --border: #2d3748;
    --church-gold: #fbbf24;
    --church-blue: #60a5fa;
    --church-green: #4ade80;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.fixed-toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    border-bottom: 2px solid var(--accent);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

header {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
}

header h1 {
    font-size: 1.2rem;
    color: var(--church-gold);
    white-space: nowrap;
    letter-spacing: 1px;
}

header h1 a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

header h1 a:hover {
    opacity: 0.75;
}

.btn-swap-sim {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-swap-sim:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.view-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.btn-view {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    background: var(--bg-panel);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.btn-view.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.back-arrow-btn {
    font-size: 0.85rem;
    padding: 0.3rem 0.55rem;
    margin-right: 0.35rem;
    border-radius: 4px;
    opacity: 0.75;
    align-items: center;
    justify-content: center;
}

.back-arrow-btn:hover {
    opacity: 1;
}

/* ── Sim icon buttons ────────────────────────────────── */
.sim-icon-btn {
    font-size: 1.1rem;
    padding: 0.25rem 0.55rem;
    min-width: 2.2rem;
    line-height: 1;
}

.sim-icon-btn.walk-active {
    background: var(--church-blue) !important;
    border-color: var(--church-blue) !important;
    color: #fff !important;
    box-shadow: 0 0 8px rgba(58,134,255,0.5);
}

/* Fault button — dim when idle, pulse red when a fault fires */
.sim-icon-btn.fault-idle {
    opacity: 0.35;
    filter: grayscale(0.4);
}

@keyframes fault-pulse {
    0%   { background: #b91c1c; border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0); opacity: 1; }
    50%  { background: #ef4444; border-color: #fca5a5; box-shadow: 0 0 14px 5px rgba(239,68,68,0.65); opacity: 1; }
    100% { background: #b91c1c; border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0); opacity: 1; }
}

.sim-icon-btn.fault-alert {
    animation: fault-pulse 0.7s ease-in-out infinite !important;
    color: #fff !important;
    opacity: 1 !important;
    filter: none !important;
    cursor: pointer;
}

/* ── Inline Compile button (Editor toolbar, right of Draft) ─────────── */
.btn-compile-inline {
    background: #1a3a26;
    color: #86efac;
    border: 1px solid #166534;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
}
.btn-compile-inline:hover {
    background: #14532d;
    border-color: #22c55e;
    color: #bbf7d0;
}

/* ── FPGA connection status button (sim toolbar) ─────────────────────── */
.fpga-conn-btn {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    /* default: unknown / not checked yet */
    background: #1e293b;
    color: #64748b;
    border: 1px solid #334155;
}
.fpga-conn-btn.fpga-disconnected {
    background: #2d1a1a;
    color: #f87171;
    border-color: #7f1d1d;
}
.fpga-conn-btn.fpga-connected {
    background: #14532d;
    color: #86efac;
    border-color: #166534;
}
.fpga-conn-btn.fpga-connecting {
    background: #1e3a5f;
    color: #60a5fa;
    border-color: #1d4ed8;
    animation: fpga-pulse 0.8s ease-in-out infinite;
}
@keyframes fpga-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}
.fpga-readbram-btn {
    background: #1a1a2e;
    color: #818cf8;
    border-color: #3730a3;
}
.fpga-readbram-btn:hover {
    background: #1e1b4b;
    color: #a5b4fc;
    border-color: #4338ca;
}
.fpga-bridge-btn {
    background: #0f2a1a;
    color: #34d399;
    border-color: #065f46;
}
.fpga-bridge-btn:hover {
    background: #064e3b;
    color: #6ee7b7;
    border-color: #059669;
}

/* ── Hamburger menu ──────────────────────────────────── */
.ham-wrap {
    position: relative;
}

.ham-btn {
    font-size: 1.05rem;
    padding: 0.25rem 0.6rem;
    letter-spacing: 0;
}

.cr-cycle-btn {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.55rem;
    font-family: var(--font-mono, monospace);
    min-width: 2.5rem;
    text-align: center;
    border-color: rgba(100, 140, 200, 0.35);
    color: #90b8f0;
    position: relative;
}

.cr-cycle-btn:hover {
    border-color: #90b8f0;
    color: #c8e0ff;
    background: rgba(58, 134, 255, 0.12);
}

.cr-cycle-btn.cr-cycle-detail {
    background: rgba(58, 134, 255, 0.18);
    border-color: #3a86ff;
    color: #c8e0ff;
}

.ham-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 9999;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 0.35rem 0.2rem;
    display: grid;
    grid-template-columns: repeat(6, auto);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.ham-group {
    display: flex;
    flex-direction: column;
    min-width: 130px;
    border-right: 1px solid var(--border);
    padding: 0.2rem 0;
}

.ham-group:last-child {
    border-right: none;
}

.ham-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--church-gold);
    padding: 0.35rem 0.85rem 0.2rem;
}

.ham-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0.5rem;
}

.ham-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.4rem 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.ham-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.ham-item:disabled {
    opacity: 0.38;
    cursor: default;
    pointer-events: none;
}

.ham-item.ham-active {
    color: var(--accent);
    font-weight: 600;
}

.sim-exec-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.sim-exec-btns .btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.sim-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex-shrink: 0;
}

.sim-controls .btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.view {
    display: none;
    position: fixed;
    top: 52px;
    left: 0; right: 0; bottom: 0;
    overflow-y: auto;
    padding: 0.5rem;
    transition: top 0.15s ease;
}

.view.active { display: block; }

#editor.view.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#builder.view.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#editor .editor-layout {
    flex: 1;
    min-height: 0;
}

#editor .console-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
}

.panel-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
}
.cr-table th {
    background: var(--bg-input);
    padding: 0.3rem 0.4rem;
    text-align: left;
    font-weight: 600;
    color: var(--church-gold);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.68rem;
}
.cr-table td {
    padding: 0.2rem 0.4rem;
    border-bottom: 1px solid rgba(45,55,72,0.3);
    white-space: nowrap;
}
.cr-null { color: var(--text-secondary); opacity: 0.5; }
.cr-active { color: var(--text-primary); }
.cr-idx { color: var(--church-blue); font-weight: 600; min-width: 24px; }
.cr-name { color: var(--church-blue); font-style: italic; min-width: 70px; }
.cr-gt { color: var(--church-gold); }
.cr-perms { font-size: 0.68rem; }
.cr-type { color: var(--text-secondary); font-size: 0.68rem; }
.cr-flag { text-align: center; color: var(--church-gold); font-weight: 600; }
.cr-m { text-align: center; color: var(--text-secondary); }
.cr-m.cr-m-set { color: #e53e3e; font-weight: 700; }

.cr-clickable { cursor: pointer; }
.cr-clickable:hover { background: rgba(96,165,250,0.12) !important; }

.cr-arch   { border-left: 2px solid #c8a020; }
.cr-system { border-left: 2px solid #e53e3e; background: rgba(229,62,62,0.05); opacity: 0.75; }
.cr-system.cr-active { opacity: 1; }
.cr-privil { border-left: 2px solid #805ad5; background: rgba(128,90,213,0.06); }

.cr-role-badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    white-space: nowrap;
}
.cr-role-arch   { background: rgba(200,160,32,0.18); color: #c8a020; }
.cr-role-prog   { background: rgba(96,165,250,0.10); color: #60a5fa; }
.cr-role-system { background: rgba(229,62,62,0.18);  color: #fc8181; }
.cr-role-privil { background: rgba(128,90,213,0.22); color: #b794f4; }

.cr-separator td {
    padding: 2px 0.4rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}

.clist-clickable { cursor: pointer; transition: background 0.15s; }
.clist-clickable:hover { background: rgba(96,165,250,0.15) !important; }
.clist-selected { background: rgba(96,165,250,0.22) !important; border-left: 2px solid var(--church-blue); }
.clist-detail-row td { padding: 0 !important; background: rgba(10,30,60,0.5); }
.clist-detail {
    padding: 0.75rem;
    border-left: 3px solid var(--church-blue);
    margin: 0.25rem 0;
}
.clist-detail-title {
    color: var(--church-gold);
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.cr-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.cr-detail-section {
    background: rgba(15,52,96,0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
}

.cr-detail-heading {
    color: var(--church-gold);
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
}

.cr-detail-words td:first-child {
    color: var(--church-blue);
    font-weight: 600;
    min-width: 100px;
}

.code-view-table td { font-family: 'Courier New', monospace; }
.code-disasm { color: var(--church-green); }
.code-pc-row { background: rgba(233, 69, 96, 0.2) !important; }
.code-pc-row td { color: var(--text-primary) !important; font-weight: 600; }
.code-decompiled-hdr { color: var(--church-blue); min-width: 120px; }
.br-arrow-hdr { width: 0; padding: 0 !important; border: none; }
.br-arrow-col { padding: 0 !important; vertical-align: middle; border-left: none !important; border-right: none !important; line-height: 0; }
.br-svg { display: block; }
.code-decompiled { font-size: 0.82rem; padding-left: 0.6rem !important; border-left: 2px solid rgba(255,255,255,0.06); }
.code-decompiled-compiler { color: #e0a040; font-style: italic; }
.code-decompiled-user { color: #7ec8e3; }
.code-decompiled-infra { color: #e8b84a; font-style: italic; }
.code-row-compiler { background: rgba(224, 160, 64, 0.07); }
.code-row-infra { background: rgba(232, 184, 74, 0.08); font-style: italic; }
.code-row-infra td { color: #e8b84a !important; }
.code-row-infra td.cr-gt { color: #c9963a !important; }

.reg-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.1rem 0.35rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(45,55,72,0.3);
    line-height: 1.4;
    white-space: nowrap;
}

.reg-row.reg-null { color: var(--text-secondary); opacity: 0.6; }
.reg-row.reg-active { color: var(--text-primary); }

.reg-label { min-width: 140px; color: var(--church-blue); flex-shrink: 0; }
.reg-value { min-width: 90px; color: var(--church-gold); flex-shrink: 0; }
.reg-decimal { color: var(--text-secondary); font-size: 0.68rem; flex-shrink: 0; }

.flag {
    display: inline-block;
    padding: 0.12rem 0.35rem;
    margin: 0 0.1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.flag.flag-set {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.flag-info {
    margin-left: 0.35rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.flag-boot {
    color: var(--church-gold);
    font-weight: 600;
}

.flags-led-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.flags-led-row .flags-bar {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

.hw-led-bar-left {
    flex-shrink: 0;
    margin-bottom: 0;
}

.sim-autoboot-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.sim-autoboot-label:hover {
    opacity: 1;
    color: var(--text-primary);
}

.flags-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.flags-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.3rem;
}

.cap-group-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-right: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cap-bit {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    margin: 0 0.05rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: #555;
    min-width: 1.1rem;
    text-align: center;
}

.cap-bit.cap-on {
    background: #2a6e2a;
    border-color: #3a9a3a;
    color: #b0ffb0;
}

.cap-bit.cap-b.cap-on {
    background: #6e5a2a;
    border-color: #9a8a3a;
    color: #ffe0a0;
}

.cap-bit.cap-f.cap-on {
    background: #2a4e5a;
    border-color: #3a8a9a;
    color: #a0e0ff;
}

.cap-bit.cap-v.cap-on {
    background: #2a4e6e;
    border-color: #3a7a9a;
    color: #a0d0ff;
}

.cap-bit.cap-req {
    border-color: var(--church-gold);
    box-shadow: 0 0 3px var(--church-gold);
}

.cap-bit.cap-fail {
    background: #6e2a2a;
    border-color: #9a3a3a;
    color: #ffb0b0;
}

.cap-sep {
    color: #444;
    font-size: 0.6rem;
    margin: 0 0.1rem;
}

.cap-label {
    font-size: 0.62rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
    font-style: italic;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

.dash-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem;
    background: #0d1b2a;
    border-radius: 6px;
}

.dash-tab {
    padding: 0.5rem 1.2rem;
    font-size: 0.82rem;
    background: #1b2d45;
    color: #e0e0e0;
    border: 2px solid #3a86ff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.dash-tab:hover {
    background: #3a86ff;
    border-color: #3a86ff;
    color: white;
}

.dash-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.4);
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1b2d45;
    color: #e0e0e0;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 0.4rem 0.7rem;
    border-radius: 5px;
    border: 1px solid #3a86ff;
    white-space: normal;
    max-width: 280px;
    min-width: 120px;
    width: max-content;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-tooltip]:hover::after {
    opacity: 1;
}

[data-tooltip].tooltip-below::after,
.fixed-toolbar [data-tooltip]::after,
.example-tabs-row [data-tooltip]::after,
.editor-toolbar [data-tooltip]::after,
.builder-toolbar [data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.dash-panel {
    display: none;
}

.dash-panel.active {
    display: block;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(45,55,72,0.3);
    font-size: 0.68rem;
}

.info-label { color: var(--text-secondary); }
.info-value { color: var(--text-primary); font-family: 'Courier New', monospace; }

.editor-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.editor-layout > .editor-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.editor-divider {
    width: 6px;
    cursor: col-resize;
    background: var(--border);
    border-radius: 3px;
    margin: 0 2px;
    flex-shrink: 0;
}

.editor-divider:hover,
.editor-divider.dragging {
    background: var(--church-gold);
}

.editor-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.code-editor-wrap {
    flex: 1;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.line-numbers {
    width: 3.5rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 0.75rem 0.4rem 0.75rem 0;
    text-align: right;
    user-select: none;
    overflow: hidden;
    white-space: pre;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

#asmEditor {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: none;
    border-radius: 0;
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    resize: none;
    tab-size: 4;
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    min-height: 0;
}

#asmEditor:focus { outline: none; }

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem 0;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.toolbar-phase {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(200, 155, 60, 0.35);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    position: relative;
}

.phase-label {
    font-size: 0.6rem;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    color: #C89B3C;
    opacity: 0.8;
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    background: #141414;
    padding: 0 0.3rem;
    pointer-events: none;
}

.lang-selector {
    background: #1a1a2e;
    color: var(--church-gold);
    border: 1px solid var(--church-gold);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}
.lang-selector:focus {
    outline: 1px solid var(--church-gold);
}

.example-tabs-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
    gap: 0;
}

.example-arrow {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 1.1rem;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
}
.example-arrow:hover { background: var(--bg-input); color: var(--text-primary); }
.example-arrow-left { border-radius: 4px 0 0 4px; }
.example-arrow-right { border-radius: 0 4px 4px 0; }

.example-tabs-scroll {
    display: flex;
    overflow-x: hidden;
    overflow-y: visible;
    gap: 0;
    flex: 1;
    min-width: 0;
    scroll-behavior: smooth;
}

.example-tab {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-left: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.example-tab:first-child { border-left: 1px solid var(--border); }
.example-tab:hover { background: var(--bg-input); color: var(--text-primary); }
.example-tab.active {
    background: var(--church-green);
    color: #000 !important;
    border-color: var(--church-green);
    font-weight: 600;
}

.user-tabs-container {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.user-tab {
    position: relative;
    padding-right: 1.4rem !important;
    border-left: 1px solid var(--border) !important;
    color: #4fc3f7 !important;
}

.user-tab.active {
    color: #000 !important;
}

.user-tab-label {
    cursor: pointer;
}

.user-tab-close {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.5;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.user-tab-close:hover {
    opacity: 1;
    color: #f87171;
}

.new-tab-btn {
    background: var(--bg-secondary);
    color: var(--church-green);
    border: 1px solid var(--border);
    font-size: 1rem;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
    font-weight: bold;
    margin-left: 2px;
}

.new-tab-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.new-tab-dialog {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--church-green);
    border-radius: 6px;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.new-tab-input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    width: 10rem;
    font-family: inherit;
}

.new-tab-input:focus {
    outline: none;
    border-color: var(--church-green);
}

.new-tab-lang {
    font-size: 0.75rem;
    padding: 0.2rem 0.3rem;
}

.new-tab-create {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
}

.new-tab-cancel {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-panel);
    color: var(--text-primary);
}

.btn:hover { border-color: var(--accent); }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    border-color: var(--border);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-primary:hover { background: #d63851; }

.btn-success {
    background: #065f46;
    border-color: var(--success);
    color: var(--success);
}

.btn-success:hover { background: #047857; }

.btn-warning {
    background: #78350f;
    border-color: var(--warning);
    color: var(--warning);
}

.btn-warning:hover { background: #92400e; }

.btn-settings-icon {
    font-size: 1.15rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.35rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.btn-settings-icon:hover {
    opacity: 1;
    color: var(--church-gold);
}

.welcome-slide-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.btn-slide-nav {
    background: transparent;
    border: 1px solid rgba(218,165,32,0.35);
    color: var(--church-gold);
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.15rem 0.45rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-slide-nav:hover {
    background: rgba(218,165,32,0.12);
    border-color: var(--church-gold);
}

.slide-indicator {
    font-size: 0.78rem;
    color: #888;
    min-width: 2.8rem;
    text-align: center;
}

.btn-help-icon {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    margin-left: 0.1rem;
    line-height: 1;
    opacity: 0.65;
    transition: opacity 0.15s, color 0.15s;
    color: var(--church-gold);
    border: 1px solid rgba(218,165,32,0.3);
}
.btn-help-icon:hover {
    opacity: 1;
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.view-help-btn {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    margin-left: 0.25rem;
    opacity: 0.6;
    color: var(--church-gold);
    border: 1px solid rgba(218,165,32,0.25);
    background: transparent;
    transition: opacity 0.15s, border-color 0.15s;
}
.view-help-btn:hover {
    opacity: 1;
    border-color: var(--church-gold);
    background: rgba(218,165,32,0.06);
}

.help-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.help-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    background: #1a1a2e;
    border: 1px solid rgba(218,165,32,0.35);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
    z-index: 9999;
    overflow: hidden;
}
.help-dropdown-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(218,165,32,0.55);
    padding: 0.5rem 0.85rem 0.3rem;
}
.help-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(218,165,32,0.1);
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.help-dropdown-item:hover {
    background: rgba(218,165,32,0.1);
    color: var(--church-gold);
}

.btn-info {
    background: #164e63;
    border-color: #22d3ee;
    color: #22d3ee;
}

.btn-info:hover { background: #155e75; }

/* ── Breakpoint button ───────────────────────────────────────────────────── */
.btn-break {
    background: #1c1a1a;
    border-color: #6b7280;
    color: #6b7280;
    font-size: 0.9rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-break:hover {
    background: #2d1a1a;
    border-color: #ef4444;
    color: #ef4444;
}
.btn-break.break-active {
    background: #2d1a1a;
    border-color: #ef4444;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ── Edit toolbar button ─────────────────────────────────────────────────── */
.btn-edit {
    background: #1a2535;
    border-color: #38bdf8;
    color: #38bdf8;
    font-size: 1rem;
}
.btn-edit:hover { background: #1e3a5f; }

/* ── Patch toolbar button ────────────────────────────────────────────────── */
.btn-patch {
    background: #1a2535;
    border-color: #a78bfa;
    color: #a78bfa;
    font-size: 1rem;
}
.btn-patch:hover { background: #2a1f45; }

/* ── Breakpoint popover ──────────────────────────────────────────────────── */
.break-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.break-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background: #1a1a2e;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
    z-index: 9999;
    padding: 0.55rem 0.75rem 0.6rem;
}
.break-popover-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(239,68,68,0.55);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.break-close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.break-close-btn:hover {
    color: #fff;
}
.break-list {
    min-height: 1.8rem;
    margin-bottom: 0.45rem;
}
.break-empty {
    font-size: 0.75rem;
    color: #4b5563;
    padding: 0.2rem 0;
}
.break-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.15rem 0;
}
.break-addr-label {
    font-size: 0.8rem;
    color: #fca5a5;
    font-family: var(--font-mono, monospace);
}
.break-remove-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 0.7rem;
    padding: 0 0.3rem;
    cursor: pointer;
    line-height: 1;
}
.break-remove-btn:hover { color: #ef4444; }
.break-add-row {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.break-addr-input {
    flex: 1;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 4px;
    color: #f9fafb;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
    padding: 0.2rem 0.45rem;
    outline: none;
}
.break-addr-input:focus { border-color: #ef4444; }
.break-clear-btn {
    width: 100%;
    font-size: 0.72rem;
}

/* ── Run popover ────────────────────────────────────────────────────────── */
.run-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.run-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: #1a1a2e;
    border: 1px solid rgba(74,222,128,0.35);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
    z-index: 9999;
    padding: 0.55rem 0.75rem 0.6rem;
}
.run-popover-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(74,222,128,0.65);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.run-close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.run-close-btn:hover { color: #fff; }
.run-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.3rem;
}
.run-hint {
    font-size: 0.65rem;
    color: #6b7280;
}
.run-batch-select {
    width: 100%;
    background: #111827;
    color: var(--text-primary);
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}
.run-go-btn {
    width: 100%;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── Breakpoint row in code view ─────────────────────────────────────────── */
.code-bp-row {
    background: rgba(239,68,68,0.08);
}
.code-bp-row td { color: #fca5a5 !important; }
.bp-dot {
    color: #ef4444;
    font-size: 0.65rem;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.btn-walk {
    background: #4a1d96;
    border-color: #a78bfa;
    color: #a78bfa;
}

.btn-walk:hover { background: #5b21b6; }

.btn-lazy {
    background: #0f2a1a;
    border-color: #34d399;
    color: #34d399;
}

.btn-lazy:hover { background: #064e3b; }

.btn-deploy {
    background: #1e3a5f;
    border-color: var(--church-blue);
    color: var(--church-blue);
}

.btn-deploy:hover {
    background: #264d73;
    border-color: #93bbfc;
    color: #93bbfc;
}

.editor-panel .panel-title {
    flex-shrink: 0;
    padding-top: 0.4rem;
}

#editorConsole {
    background: #0a0a1a;
    color: var(--church-green);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.4rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.4;
    flex: 1;
    min-height: 0;
}

.next-steps-box {
    background: rgba(218,165,32,0.08);
    border: 1px solid rgba(218,165,32,0.25);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.next-steps-box:empty {
    display: none;
}

.next-steps-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
}

.next-steps-header:hover .next-steps-label {
    color: var(--church-gold);
}

.next-steps-arrow {
    font-size: 0.6rem;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.next-steps-header:hover .next-steps-arrow {
    color: var(--church-gold);
}

.led-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    background: #0a0a12;
    border-bottom: 1px solid #1e1e2e;
    flex-shrink: 0;
}
.led-strip-leds {
    display: flex;
    gap: 7px;
    align-items: flex-end;
}
.led-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.led {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #151520;
    border: 1px solid #2a2a40;
    transition: background 0.12s, box-shadow 0.12s;
}
.led.on {
    background: #e08820;
    border-color: #f0a030;
    box-shadow: 0 0 5px 2px rgba(240,160,30,0.55), 0 0 10px 3px rgba(240,160,30,0.25);
}
.led.boot-complete {
    background: #22cc66;
    border-color: #33ee77;
    box-shadow: 0 0 5px 2px rgba(40,220,100,0.55), 0 0 10px 3px rgba(40,220,100,0.25);
}
.led-lbl {
    font-size: 8px;
    color: #444;
    font-family: 'Courier New', monospace;
    line-height: 1;
}
.led-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.led-mode-tag {
    font-size: 9px;
    font-family: 'Courier New', monospace;
    background: #1a1a28;
    color: #888;
    border: 1px solid #2a2a40;
    border-radius: 3px;
    padding: 1px 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.led-bits-display {
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: #888;
    white-space: nowrap;
}
.led-copy-btn {
    margin-left: auto;
    font-size: 9px;
    background: #1a1a28;
    color: #777;
    border: 1px solid #2a2a40;
    border-radius: 3px;
    padding: 2px 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}
.led-copy-btn:hover {
    background: #252535;
    color: #bbb;
}

.led-dr0-readout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #0d1117;
    border-top: 1px solid #1e2a38;
    font-size: 0.76rem;
    flex-wrap: wrap;
    min-height: 26px;
}

.led-dr0-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

.led-index-chip {
    background: #1b2d45;
    color: var(--church-blue);
    border: 1px solid #2d4a6a;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-family: monospace;
    white-space: nowrap;
}

.dr0-badge {
    display: inline-block;
    border-radius: 4px;
    padding: 1px 7px;
    font-family: monospace;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.dr0-badge-green {
    background: rgba(74, 222, 128, 0.15);
    color: var(--church-green);
    border: 1px solid rgba(74, 222, 128, 0.35);
}

.dr0-badge-grey {
    background: rgba(160, 160, 160, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 160, 0.25);
}

.dr0-badge-red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.dr0-badge-desc {
    color: var(--text-secondary);
    font-size: 0.73rem;
}

.abs-signed-return-section {
    border-left: 3px solid var(--church-blue);
}

.signed-return-chip {
    background: #2a2235;
    color: var(--church-purple, #c084fc);
    border: 1px solid #4a3b5a;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-family: monospace;
    white-space: nowrap;
}

.signed-return-chip-led {
    background: #1b2d45;
    color: var(--church-blue);
    border-color: #2d4a6a;
}

.abs-signed-return {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    flex-wrap: wrap;
}

.hw-led-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.35rem 0.75rem;
    background: #0d1520;
    border: 1px solid #1e2d3e;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    flex-shrink: 0;
}

.hw-led-bar-inline {
    margin-bottom: 0;
    margin-left: auto;
    flex-shrink: 0;
}

.hw-led-bar-panel {
    display: inline-flex;
    margin-bottom: 0.6rem;
    align-self: flex-start;
}

.hw-led-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--church-gold);
    white-space: nowrap;
    margin-right: 0.25rem;
}

.hw-led-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.hw-led {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #111820;
    border: 2px solid #1e2d3e;
    transition: background 0.1s, box-shadow 0.1s, border-color 0.1s;
}

.hw-led-green {
    border-color: #1a3a1a;
}
.hw-led-red {
    border-color: #3a1a1a;
}

.hw-led-green.on {
    background: #22cc55;
    border-color: #33ee66;
    box-shadow: 0 0 6px 2px rgba(40,220,90,0.65), 0 0 12px 4px rgba(40,220,90,0.25);
}
.hw-led-red.on {
    background: #dd2222;
    border-color: #ff3333;
    box-shadow: 0 0 6px 2px rgba(220,40,40,0.65), 0 0 12px 4px rgba(220,40,40,0.25);
}

.hw-led-name {
    font-size: 0.58rem;
    font-family: 'Courier New', monospace;
    color: #666;
    text-align: center;
    line-height: 1.2;
}

.hw-led-role {
    font-size: 0.52rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hw-led-hint {
    font-size: 0.58rem;
    color: #3a4a5a;
    font-style: italic;
    margin-left: auto;
    white-space: nowrap;
}

.next-steps-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--church-gold);
    font-weight: 700;
    margin-bottom: 0;
}

a.next-step-link {
    color: var(--church-gold);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(200, 155, 60, 0.4);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

a.next-step-link:hover {
    color: #e8c84a;
    border-bottom-color: #e8c84a;
    border-bottom-style: solid;
}

.next-steps-box ul {
    margin: 0.3rem 0 0 0;
    padding-left: 1.2rem;
}

.next-steps-box li {
    margin-bottom: 0.25rem;
}

.next-steps-box strong {
    color: var(--text-primary);
}

#codeConsoleContent,
#codeHistoryPanel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#codeHistoryContent {
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}

.ns-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

.ns-table th {
    background: var(--bg-input);
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: var(--church-gold);
    border-bottom: 2px solid var(--border);
}

.ns-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid rgba(45,55,72,0.3);
}

.ns-layout-header {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.25rem 0.6rem 0.4rem;
    border-bottom: 1px solid var(--border);
    font-family: 'Courier New', monospace;
}
.ns-label { color: var(--church-blue); font-style: italic; font-weight: 400; cursor: default; }
.ns-label-col { font-style: italic; }
.ns-flag { text-align: center; color: var(--church-gold); font-weight: 600; }

.ns-entry-tooltip {
    display: none;
    position: fixed;
    z-index: 9000;
    background: var(--bg-dark, #0d1b2a);
    border: 1px solid var(--church-gold, #f4b942);
    border-radius: 7px;
    padding: 0.6rem 0.85rem 0.7rem;
    box-shadow: 0 6px 24px rgba(0,0,0,0.65);
    pointer-events: none;
    min-width: 220px;
    max-width: 340px;
    font-size: 0.78rem;
    line-height: 1.5;
}
.ns-entry-tooltip.visible { display: block; }
.ns-tt-header {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--church-gold, #f4b942);
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}
.ns-tt-label {
    color: #e0e0e0;
    font-style: italic;
    margin-bottom: 0.3rem;
    font-size: 0.83rem;
}
.ns-tt-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.1rem;
    color: var(--text-secondary, #8a9bb0);
}
.ns-tt-row b {
    color: var(--text-primary, #e0e0e0);
    font-weight: 600;
    min-width: 80px;
    flex-shrink: 0;
}
.ns-tt-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 5px;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.ns-tt-badge-inform  { background: #1e40af; color: #93c5fd; }
.ns-tt-badge-abstract{ background: #5b21b6; color: #c4b5fd; }
.ns-tt-badge-outform { background: #065f46; color: #6ee7b7; }
.ns-tt-badge-null    { background: #374151; color: #9ca3af; }
.ns-tt-flag {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 3px;
    background: rgba(244,185,66,0.15);
    color: var(--church-gold, #f4b942);
    border: 1px solid rgba(244,185,66,0.35);
}
.ns-tt-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0.4rem 0;
}
.ns-tt-abs-name {
    color: #c084fc;
    font-weight: 600;
    font-size: 0.81rem;
    margin-bottom: 0.1rem;
}

.boot-image-view {
    padding: 0.4rem 0.6rem 0.8rem;
    font-size: 0.78rem;
}
.boot-image-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--church-gold, #f4b942);
    letter-spacing: 0.02em;
    margin-bottom: 0.15rem;
}
.boot-image-subtitle {
    color: #6b7280;
    font-size: 0.72rem;
    margin-bottom: 0.9rem;
    font-style: italic;
}
.boot-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0.85rem 0 0.35rem;
    border-left: 3px solid var(--church-gold, #f4b942);
    padding-left: 0.5rem;
}
.boot-section-note {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.7rem;
}
.boot-microcode {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 5px;
    padding: 0.5rem 0.7rem;
    font-family: 'Courier New', monospace;
    font-size: 0.74rem;
    line-height: 1.55;
}
.boot-code-blank  { height: 0.5rem; }
.boot-code-comment { color: #4b7c2e; }
.boot-code-step   { color: #e0e0e0; }
.boot-step-kw     { color: #f4b942; font-weight: 700; }
.boot-code-body   { color: #a1a1aa; padding-left: 1.4rem; }

.boot-ns-table th, .boot-clist-table th {
    background: rgba(244,185,66,0.08);
}
.boot-ns-idx   { color: rgba(200,155,60,0.85); font-family: monospace; font-size: 0.73rem; }
.boot-ns-label { color: #93c5fd; font-style: italic; font-size: 0.75rem; }
.boot-ns-addr  { color: #f97316; font-family: monospace; font-size: 0.73rem; }

.thread-layout-view {
    padding: 0 0 0.8rem;
    font-size: 0.78rem;
}

/* Sticky header block — stays pinned while zones scroll */
.thread-layout-sticky {
    position: sticky;
    top: 0;
    z-index: 8;
    background: #0d1b2a;
    padding: 0.45rem 0.6rem 0.3rem;
    border-bottom: 1px solid #1e3a5f;
    margin-bottom: 0.4rem;
}

.thread-layout-header {
    font-size: 0.92rem;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 0.18rem;
    line-height: 1.25;
}
.thread-layout-subhead {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.72rem;
    margin-left: 0.55rem;
}

/* Lump header compact block */
.thread-lump-hdr-block {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    padding: 0.18rem 0 0.05rem;
}
.thread-lump-hdr-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.thread-lump-hdr-note {
    font-size: 0.66rem;
    color: #4b5563;
    font-family: 'Courier New', monospace;
}
.thread-lump-hdr-row {
    display: flex;
    gap: 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    align-items: baseline;
    flex-wrap: wrap;
}
.thread-lump-off  { color: #555; }
.thread-lump-addr { color: #6b7280; }
.thread-lump-hex  { color: rgba(206,145,120,0.9); }
.thread-lump-desc { color: #374151; font-size: 0.66rem; }

.thread-zone-hdr {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0.75rem 0 0.3rem;
    border-left: 3px solid #888;
    padding-left: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.thread-zone-note {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.69rem;
}
.thread-zone-table {
    width: 100%;
    margin-bottom: 0.3rem;
}
.thread-free-empty {
    color: #4b5563;
    font-style: italic;
    font-size: 0.74rem;
    padding: 0.3rem 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    margin-bottom: 0.2rem;
}

.pipeline-wrapper {
    padding: 1rem;
}

.pipeline-mode-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-mode {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mode.active {
    background: var(--church-gold);
    color: var(--bg-dark);
    font-weight: 600;
    border-color: var(--church-gold);
}

.pipeline-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 0.25rem;
}

.pipeline-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.pipeline-stages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.pipeline-stage {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    min-width: 100px;
    text-align: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.pipeline-stage.stage-pending {
    opacity: 0.4;
    border-color: var(--border);
}

.pipeline-stage.stage-done {
    border-color: var(--church-green);
    background: rgba(74, 222, 128, 0.08);
}

.pipeline-stage.stage-active {
    border-color: var(--church-gold);
    background: rgba(251, 191, 36, 0.12);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.pipeline-stage.stage-fused {
    border-style: dashed;
    min-width: 130px;
}

.pipeline-stage.stage-fused.stage-done {
    border-style: solid;
}

.stage-number {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.stage-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stage-desc {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    line-height: 1.3;
}

.stage-substeps {
    margin-top: 0.3rem;
    border-top: 1px solid var(--border);
    padding-top: 0.3rem;
}

.substep {
    font-size: 0.6rem;
    color: var(--church-blue);
    font-family: 'Courier New', monospace;
    line-height: 1.4;
}

.stage-gt {
    font-size: 0.6rem;
    color: var(--church-gold);
    font-family: 'Courier New', monospace;
    margin-top: 0.2rem;
}

.stage-perm {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

.stage-perm.pass { color: var(--church-green); }
.stage-perm.fail { color: var(--error); }

.pipeline-arrow {
    font-size: 1.2rem;
    color: var(--border);
    flex-shrink: 0;
}

.pipeline-arrow.arrow-done {
    color: var(--church-green);
}

.pipeline-info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 6px;
}

.pipeline-current {
    font-weight: 600;
    color: var(--church-gold);
    font-size: 0.85rem;
}

.pipeline-current.pipeline-complete {
    color: var(--church-green);
}

.pipeline-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.pipeline-cycle-comparison {
    margin-top: 1rem;
}

.cycle-bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.cycle-bar {
    height: 28px;
    background: var(--bg-input);
    border-radius: 4px;
    margin-bottom: 0.3rem;
    overflow: hidden;
}

.cycle-bar-old {
    height: 100%;
    background: rgba(248, 113, 113, 0.3);
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
    font-size: 0.7rem;
    color: var(--error);
}

.cycle-bar-new {
    height: 100%;
    background: rgba(74, 222, 128, 0.3);
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
    font-size: 0.7rem;
    color: var(--church-green);
    min-width: 80px;
}

.math-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    position: relative;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.math-mode-tab.overflow-hidden {
    display: none;
}

.sidebar-tab.overflow-hidden {
    display: none;
}

.tab-overflow-btn {
    display: none;
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    line-height: 1;
}

.tab-overflow-btn:hover {
    color: var(--church-gold);
}

.tab-overflow-btn.visible {
    display: block;
}

.tab-overflow-btn.has-active {
    color: var(--church-gold);
}

.tab-overflow-dropdown {
    display: none;
    position: fixed;
    z-index: 200;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    min-width: 140px;
    padding: 0.3rem 0;
}

.tab-overflow-dropdown.open {
    display: block;
}

.tab-overflow-dropdown button {
    display: block;
    width: 100%;
    padding: 0.45rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.tab-overflow-dropdown button:hover {
    background: rgba(251,191,36,0.1);
    color: var(--text-primary);
}

.tab-overflow-dropdown button.active {
    color: var(--church-gold);
}

.math-mode-tab {
    padding: 0.4rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.math-mode-tab:hover {
    color: var(--text-primary);
}

.math-mode-tab.active {
    color: var(--church-gold);
    border-bottom-color: var(--church-gold);
}

#interactiveMathContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#hp35Container {
    flex: 1;
    overflow-y: auto;
}

.repl-layout {
    display: flex;
    height: calc(100vh - 80px);
    padding-top: 1rem;
    gap: 0;
}

.repl-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
    overflow: hidden;
}

.repl-divider {
    width: 6px;
    cursor: col-resize;
    background: var(--border);
    border-radius: 3px;
    margin: 0 2px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.repl-divider:hover,
.repl-divider.dragging {
    background: var(--church-gold);
}

#replOutput {
    flex: 1;
    background: #0a0a1a;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    line-height: 1.5;
}

.math-tool-history {
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    background: rgba(200, 155, 60, 0.05);
    border-left: 2px solid rgba(200, 155, 60, 0.25);
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.math-tool-history p {
    margin: 0 0 0.4rem;
}

.math-tool-history p:last-child {
    margin-bottom: 0;
}

.math-tool-history em {
    color: var(--church-gold);
    font-style: italic;
}

.math-tool-history code {
    background: rgba(0,0,0,0.3);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: var(--church-gold);
    font-size: 0.74rem;
}

.repl-input-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#replInput {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

#replInput:focus { outline: 1px solid var(--accent); }

.symbol-picker-wrap {
    position: relative;
    flex-shrink: 0;
}

.symbol-picker-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--church-gold);
    font-size: 1.1rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.symbol-picker-btn:hover {
    border-color: var(--church-gold);
    background: rgba(251,191,36,0.1);
}

.symbol-picker-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    z-index: 300;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    width: 320px;
    max-height: 360px;
    overflow: hidden;
    display: none;
}

.symbol-picker-dropdown.open {
    display: flex;
    flex-direction: column;
}

.symbol-picker-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.4rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.symbol-cat-btn {
    padding: 0.25rem 0.5rem;
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.symbol-cat-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.symbol-cat-btn.active {
    color: var(--church-gold);
    border-color: var(--church-gold);
    background: rgba(251,191,36,0.1);
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 2px;
    padding: 0.4rem;
    overflow-y: auto;
    flex: 1;
}

.symbol-grid-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 0.35rem;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1.2;
}

.symbol-grid-btn:hover {
    background: rgba(251,191,36,0.15);
    border-color: var(--church-gold);
}

.symbol-tooltip {
    display: none;
    position: fixed;
    z-index: 400;
    background: var(--bg-dark);
    border: 1px solid var(--church-gold);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    pointer-events: none;
    max-width: 240px;
    min-width: 100px;
}

.symbol-tooltip.visible {
    display: block;
}

.symbol-tooltip-sym {
    font-size: 1.4rem;
    color: var(--church-gold);
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.symbol-tooltip-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.symbol-tooltip-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.symbol-tooltip-val {
    font-size: 0.72rem;
    color: var(--church-gold);
    font-family: 'Courier New', monospace;
    margin-top: 0.2rem;
}

.repl-prompt {
    color: var(--church-gold);
    font-family: 'Courier New', monospace;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.repl-input-echo { color: var(--text-secondary); }
.repl-result { color: var(--church-green); font-weight: 600; }
.repl-error { color: var(--error); }
.repl-info { color: var(--church-blue); white-space: pre-wrap; }

.repl-trace {
    margin: 0.25rem 0 0.5rem 1rem;
    padding: 0.25rem 0;
    border-left: 2px solid var(--church-gold);
    padding-left: 0.75rem;
}

.repl-trace-step {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.repl-trace-log {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.repl-trace-entry {
    border-left: 2px solid var(--church-gold);
    padding: 0.4rem 0.6rem;
    background: rgba(251, 191, 36, 0.04);
    border-radius: 0 4px 4px 0;
}

.repl-trace-entry-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--church-gold);
    font-family: monospace;
    margin-bottom: 0.2rem;
}

.repl-trace-entry-result {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-family: monospace;
    margin-bottom: 0.25rem;
}

.repl-trace-entry-step {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: monospace;
    line-height: 1.5;
    padding-left: 0.5rem;
}

.repl-trace-entry-cycles {
    font-size: 0.7rem;
    color: var(--church-gold);
    opacity: 0.7;
    margin-top: 0.2rem;
    text-align: right;
}

.repl-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
    overflow: hidden;
}

.arch-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sidebar-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    position: relative;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.sidebar-tab {
    padding: 0.4rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-tab:hover {
    color: var(--text-primary);
}

.sidebar-tab.active {
    color: var(--church-gold);
    border-bottom-color: var(--church-gold);
}

.history-panel {
    border: 1px solid rgba(218,165,32,0.3);
    overflow-y: auto;
}

.history-story {
    padding: 0.5rem 0 0.5rem 0.75rem;
}

.history-era {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--church-gold);
    font-weight: 600;
    margin-bottom: 0.4rem;
    opacity: 0.8;
}

.history-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.history-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.8rem;
}

.history-question {
    background: rgba(218,165,32,0.08);
    border: 1px solid rgba(218,165,32,0.25);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.5;
    font-style: italic;
}

.history-wiki {
    margin: 0.4rem 0;
    font-size: 0.72rem;
}

.history-wiki a {
    color: var(--church-gold);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.history-wiki a:hover {
    opacity: 1;
    text-decoration: underline;
}

.history-question-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--church-gold);
    font-weight: 700;
    font-style: normal;
    margin-bottom: 0.3rem;
}

#codeSyntaxPanel {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding: 0.3rem 0.5rem;
}

.syntax-ref-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.syntax-ref-section {
    margin-bottom: 0.6rem;
}

.syntax-ref-heading {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--church-gold);
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid rgba(200,155,60,0.2);
    padding-bottom: 0.15rem;
}

.syntax-ref-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.2rem;
}

.syntax-ref-table tr:hover {
    background: rgba(200,155,60,0.06);
}

.syntax-ref-code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: var(--text-primary);
    padding: 0.2rem 0.4rem 0.2rem 0;
    white-space: nowrap;
    vertical-align: top;
}

.syntax-ref-code em {
    color: var(--church-gold);
    font-style: normal;
}

.syntax-ref-desc {
    font-size: 0.68rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
    vertical-align: top;
}

.history-empty {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 1rem;
}

.library-dialog {
    max-width: 780px;
    width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.library-header {
    text-align: center;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(200,155,60,0.3);
    margin-bottom: 0.5rem;
}

.library-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--church-gold);
    letter-spacing: 0.5px;
}

.library-subtitle {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.library-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.library-toolbar .modal-input {
    flex: 1;
}

.library-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.3rem 0;
    min-height: 200px;
    max-height: 50vh;
    align-content: start;
}

.library-card {
    background: rgba(200,155,60,0.06);
    border: 1px solid rgba(200,155,60,0.2);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    cursor: default;
    transition: border-color 0.2s;
}

.library-card:hover {
    border-color: var(--church-gold);
}

.library-card-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.library-card-meta {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.library-lang-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.library-lang-badge.lang-english { background: rgba(79,195,247,0.2); color: #4fc3f7; }
.library-lang-badge.lang-javascript { background: rgba(200,155,60,0.2); color: #C89B3C; }
.library-lang-badge.lang-haskell { background: rgba(167,139,250,0.2); color: #a78bfa; }
.library-lang-badge.lang-symbolic { background: rgba(232,168,124,0.2); color: #e8a87c; }
.library-lang-badge.lang-assembly { background: rgba(74,222,128,0.2); color: #4ade80; }

.library-card-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.3rem;
}

.library-card-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.library-tag {
    font-size: 0.58rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(200,155,60,0.12);
    color: var(--church-gold);
}

.library-card-actions {
    display: flex;
    justify-content: flex-end;
}

.library-card-actions .btn {
    font-size: 0.68rem;
    padding: 0.2rem 0.6rem;
}

.library-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(200,155,60,0.2);
    margin-top: 0.3rem;
}

.library-github-link {
    font-size: 0.72rem;
    color: var(--church-gold);
    text-decoration: none;
    opacity: 0.8;
}

.library-github-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.library-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 2rem;
}

.library-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 2rem;
}

.publish-preview {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 0.5rem;
    margin-top: 0.3rem;
    max-height: 120px;
    overflow-y: auto;
}

.abs-doc-section {
    margin-top: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: rgba(200,155,60,0.05);
    border: 1px solid rgba(200,155,60,0.15);
    border-radius: 6px;
}

.abs-doc-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--church-gold);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.abs-doc-field {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.abs-doc-field strong {
    color: var(--text-primary);
}

@media (max-width: 600px) {
    .library-grid {
        grid-template-columns: 1fr;
    }
    .library-dialog {
        max-width: 100vw;
    }
}

.challenge-panel {
    border: 1px solid rgba(218,165,32,0.3);
}

.challenge-prompt {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.challenge-prompt .challenge-question {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--church-gold);
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(218,165,32,0.08);
    border-radius: 6px;
    text-align: center;
}

.challenge-input-area {
    margin-top: 0.5rem;
}

.challenge-result {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 0;
}

.challenge-result.correct {
    color: var(--church-green);
}

.challenge-result.incorrect {
    color: #e74c3c;
}

.challenge-result.hint {
    color: var(--church-blue);
}

.challenge-explain {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 500px;
    overflow-y: auto;
}

.challenge-explain .code-line {
    display: flex;
    gap: 0.5rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-family: 'Courier New', monospace;
}

.challenge-explain .code-line:last-child {
    border-bottom: none;
}

.challenge-explain .code-hex {
    color: var(--church-gold);
    min-width: 85px;
    flex-shrink: 0;
}

.challenge-explain .code-asm {
    color: var(--church-green);
    min-width: 100px;
    flex-shrink: 0;
}

.challenge-explain .code-desc {
    color: var(--text-secondary);
    flex: 1;
}

.explain-turing {
    border-left: 3px solid rgba(100, 180, 255, 0.6);
    background: rgba(100, 180, 255, 0.06);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
}

.explain-turing .explain-header {
    font-weight: 700;
    color: rgba(130, 200, 255, 0.95);
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
}

.explain-church {
    border-left: 3px solid rgba(218, 165, 32, 0.6);
    background: rgba(218, 165, 32, 0.06);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
}

.explain-church .explain-header {
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
}

.explain-bridge {
    border-left: 3px solid rgba(100, 200, 100, 0.5);
    background: rgba(100, 200, 100, 0.06);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-top: 0.3rem;
}

.explain-bridge p {
    margin: 0 0 0.3rem 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.explain-bridge p:last-child {
    margin-bottom: 0;
}

.explain-bridge strong {
    color: var(--text-primary);
}

.tutorial-wrapper {
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tutorial-header {
    margin-bottom: 1rem;
}

.tutorial-header h2 {
    font-size: 1.1rem;
    color: var(--church-gold);
    margin-bottom: 0.25rem;
}

.tutorial-tagline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.tutorial-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.btn-tutorial {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tutorial:hover:not(:disabled) {
    background: var(--church-gold);
    color: var(--bg-dark);
}

.btn-tutorial:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-run-all {
    margin-left: auto;
    background: var(--church-green);
    color: var(--bg-dark);
    font-weight: 600;
}

.tutorial-progress {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.tutorial-phase-indicators {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.phase-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    min-width: 60px;
}

.phase-indicator.phase-done {
    border-color: var(--church-green);
    background: rgba(74, 222, 128, 0.06);
}

.phase-indicator.phase-active {
    border-color: var(--church-gold);
    background: rgba(251, 191, 36, 0.1);
}

.phase-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--church-gold);
}

.phase-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.phase-connector {
    width: 20px;
    height: 2px;
    background: var(--border);
}

.tutorial-body {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

.tutorial-step-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
}

.tutorial-step-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tutorial-step-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.tutorial-code {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
}

.tutorial-code code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--church-blue);
}

.tutorial-result {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--church-green);
    padding: 0.4rem 0;
    font-weight: 600;
}

.tutorial-cycles {
    font-size: 0.75rem;
    color: var(--church-gold);
    font-family: 'Courier New', monospace;
    margin-top: 0.25rem;
}

.tutorial-error {
    color: var(--error);
    font-size: 0.85rem;
}

.phase-summary {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: 6px;
    border: 1px solid var(--church-gold);
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--church-gold);
    font-family: 'Courier New', monospace;
}

.chain-demo {
    background: var(--bg-dark);
    border: 1px solid var(--church-gold);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.chain-label {
    font-size: 0.8rem;
    color: var(--church-gold);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.chain-sequence {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--church-blue);
    background: var(--bg-input);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.6rem;
}

.chain-flow {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.chain-step {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.chain-entry {
    background: rgba(251, 191, 36, 0.1);
    color: var(--church-gold);
}

.chain-method {
    background: rgba(96, 165, 250, 0.08);
    color: var(--church-blue);
    padding-left: 1.5rem;
}

.chain-exit {
    background: rgba(74, 222, 128, 0.08);
    color: var(--church-green);
}

.chain-cycles {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--church-green);
    font-weight: 600;
}

.comparison-table {
    margin: 1rem 0;
}

.comparison-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 80px;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.comparison-header {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.comp-col {
    font-size: 0.85rem;
}

.comp-phase {
    font-weight: 700;
    color: var(--church-gold);
    font-size: 1rem;
}

.comp-cycles {
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.comp-reduction {
    color: var(--church-green);
    font-weight: 700;
}

.phase-1-row .comp-cycles { color: var(--error); }
.phase-2-row .comp-cycles { color: var(--warning); }
.phase-3-row .comp-cycles { color: var(--church-green); }

.comparison-insight {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid var(--church-gold);
    border-radius: 8px;
}

.insight-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 0.4rem;
}

.insight-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.comparison-bars {
    margin-top: 1rem;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    width: 55px;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
}

.bar-phase1 { background: rgba(248, 113, 113, 0.3); color: var(--error); }
.bar-phase2 { background: rgba(251, 191, 36, 0.3); color: var(--warning); }
.bar-phase3 { background: rgba(74, 222, 128, 0.3); color: var(--church-green); min-width: 80px; }

.var-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(45,55,72,0.3);
}

.var-entry.var-highlight {
    background: rgba(251, 191, 36, 0.12);
    border-left: 3px solid var(--church-gold);
    padding-left: 0.5rem;
}

.var-name { color: var(--church-blue); }
.var-value { color: var(--text-primary); font-weight: 600; }

.vars-empty {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.ns-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.modal-overlay {
    position: fixed;
    top: 52px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 320px;
    max-width: 420px;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 1rem;
}

.modal-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.modal-input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.perm-checks {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.perm-checks label {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.intro-dialog {
    max-width: 680px;
    min-width: 340px;
    width: 90vw;
}

.intro-body-wrap {
    position: relative;
}

.intro-scroll-arrow {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(transparent, var(--bg-secondary) 80%);
    pointer-events: none;
    transition: opacity 0.3s;
}

.intro-scroll-arrow.hidden {
    opacity: 0;
}

.intro-scroll-arrow span {
    font-size: 1.2rem;
    color: var(--church-gold);
    animation: intro-bounce 1.5s infinite;
    padding-bottom: 2px;
}

.intro-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.intro-header .modal-title {
    font-size: 1.15rem;
}

.intro-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.intro-close:hover {
    color: var(--text-primary);
}

.intro-body {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0.75rem 0 1rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: 1.5rem;
}

.intro-body p {
    margin: 0 0 0.75rem;
}

.intro-body .intro-highlight {
    color: var(--church-gold);
    font-weight: 600;
}

.intro-body .intro-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    margin: 0.5rem 0 0.75rem;
    white-space: pre-wrap;
}

.intro-body .intro-tip {
    background: rgba(200, 155, 60, 0.12);
    border-left: 3px solid var(--church-gold);
    padding: 0.5rem 0.75rem;
    border-radius: 0 4px 4px 0;
    margin: 0.5rem 0 0.75rem;
    font-size: 0.85rem;
}

.intro-body .intro-next-step {
    background: rgba(200, 155, 60, 0.18);
    border-left: 4px solid var(--church-gold);
    padding: 0.6rem 0.85rem;
    margin-top: 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.intro-footer {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
    gap: 0.75rem;
}

.settings-gear-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.settings-gear-btn:hover {
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.intro-dismiss-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
}

#welcomeModal {
    z-index: 10001;
}

.welcome-dialog {
    max-width: 700px;
    min-width: 340px;
    width: 92vw;
}

.welcome-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.popup-dismiss-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.popup-dismiss-check input[type="checkbox"] {
    accent-color: var(--church-gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.popup-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
}

.welcome-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.welcome-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--church-gold);
    color: var(--bg-dark);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.welcome-step-text {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.5;
}

.family-intro {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(200, 155, 60, 0.06);
    border: 1px solid rgba(200, 155, 60, 0.15);
    border-radius: 8px;
}

.family-intro-qr {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
}

.family-intro-qr svg {
    width: 56px;
    height: 56px;
}

.family-intro-text {
    flex: 1;
    min-width: 0;
}

.family-intro-text p {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 0.3rem;
}

.family-intro-text p:last-child {
    margin-bottom: 0;
}

.family-intro-text strong {
    color: var(--church-gold);
}

.family-role-select {
    width: auto;
    min-width: 90px;
    flex: none;
}

.family-member-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.6rem;
    padding: 0.5rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.family-member-top {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.family-member-row .modal-input {
    flex: 1;
    margin-top: 0;
}

.family-member-row .family-role {
    width: 80px;
    font-size: 0.75rem;
    color: var(--church-gold);
    font-weight: 600;
    flex-shrink: 0;
}

.family-member-row .btn-remove-member {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.3rem;
    line-height: 1;
}

.family-member-row .btn-remove-member:hover {
    color: #e74c3c;
}

.btn-add-member {
    background: none;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    transition: color 0.2s, border-color 0.2s;
}

.btn-add-member:hover {
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.gt-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: var(--text-secondary);
    background: rgba(200,155,60,0.1);
    border: 1px solid rgba(200,155,60,0.3);
    border-radius: 3px;
    padding: 1px 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.gt-badge.gt-owner {
    color: var(--church-gold);
    background: rgba(200,155,60,0.15);
    border-color: var(--church-gold);
    font-weight: 700;
}

.gt-perms-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 4px 0 0;
}

.gt-perm-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
}

.gt-perm-label:hover {
    color: var(--text-primary);
}

.gt-perm-cb {
    accent-color: var(--church-gold);
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.settings-dialog {
    max-width: 580px;
    min-width: 340px;
    width: 90vw;
}

.settings-fullpage {
    padding: 0;
    background: var(--bg-dark);
}

.settings-page {
    background: var(--bg-dark);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-page-header .modal-title {
    margin: 0;
}

.settings-page-actions {
    display: flex;
    gap: 8px;
}

.settings-page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    align-items: start;
}

.settings-page-col {
    min-width: 0;
}

@media (max-width: 700px) {
    .settings-page-grid {
        grid-template-columns: 1fr;
    }
}

.settings-body {
    margin: 0.75rem 0 1rem;
    max-height: 65vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 1.25rem;
}

.settings-release-note {
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.settings-release-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.settings-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.settings-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.settings-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.settings-label .modal-input {
    margin-top: 0.3rem;
}

.subjects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.subject-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.subject-card:hover {
    border-color: var(--church-gold);
    background: rgba(200, 155, 60, 0.08);
}

.subject-card.subject-active {
    border-color: rgba(200, 155, 60, 0.4);
}

.subject-card-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.subject-card-info {
    flex: 1;
    min-width: 0;
}

.subject-card-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.subject-card-desc {
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 0.1rem;
}

.subject-card-status {
    font-size: 0.65rem;
    color: var(--church-gold);
    margin-top: 0.15rem;
    font-weight: 500;
}

.subject-back-btn {
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    background: rgba(200, 155, 60, 0.12);
    border: 1px solid rgba(200, 155, 60, 0.3);
    color: var(--church-gold);
    border-radius: 6px;
    cursor: pointer;
}

.subject-back-btn:hover {
    background: rgba(200, 155, 60, 0.2);
}

.subject-lesson-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.subject-lesson-icon {
    font-size: 1.4rem;
}

.subject-lesson-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subject-lesson-card {
    padding: 0.6rem 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.4rem;
    transition: border-color 0.15s, background 0.15s;
}

.subject-lesson-card:hover {
    border-color: var(--church-gold);
    background: rgba(200, 155, 60, 0.08);
}

.subject-lesson-name {
    font-weight: 600;
    color: var(--church-gold);
    font-size: 0.82rem;
}

.subject-lesson-desc {
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 0.15rem;
}

.grade-indicator {
    display: inline-block;
    background: rgba(200, 155, 60, 0.2);
    border: 1px solid var(--church-gold);
    color: var(--church-gold);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.ns-entry-actions {
    display: flex;
    gap: 0.3rem;
}

.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    border-radius: 3px;
}

.ns-row:hover {
    background: rgba(78, 201, 176, 0.08);
}

.ns-row-active {
    background: rgba(78, 201, 176, 0.08) !important;
    border-left: 3px solid rgba(200, 155, 60, 0.4);
}

.ns-detail-row td {
    padding: 0 !important;
    border-bottom: 1px solid rgba(200, 155, 60, 0.25) !important;
}

.ns-detail-panel {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0.75rem;
    margin: 0;
}

.ns-detail-title {
    font-size: 0.75rem;
    color: rgba(200, 155, 60, 0.7);
    font-weight: 600;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(212, 168, 67, 0.15);
    margin-bottom: 0.4rem;
    font-family: 'Courier New', monospace;
}

.ns-mem-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.ns-mem-table th {
    background: rgba(30, 30, 30, 0.5);
    padding: 0.25rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border);
}

.ns-mem-table td {
    padding: 0.2rem 0.5rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.2);
}

.crd-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    padding: 0.3rem;
    background: #0d1b2a;
    border-radius: 6px;
    position: sticky;
    top: 0;
    z-index: 12;
}

.crd-tab {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    line-height: 1.2;
    background: #1b2d45;
    color: #e0e0e0;
    border: 2px solid #3a86ff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    box-sizing: border-box;
}

.crd-tab:hover {
    background: #3a86ff;
    border-color: #3a86ff;
    color: white;
}

.crd-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.4);
}

.crd-tab-action {
    background: #1a3a1a;
    border-color: #4caf50;
    color: #4caf50;
}
.crd-tab-action:hover {
    background: #4caf50;
    border-color: #4caf50;
    color: white;
}
.crd-tab-fpga {
    background: #1a2a3a;
    border-color: #3a86ff;
    color: #3a86ff;
}
.crd-tab-fpga:hover {
    background: #3a86ff;
    border-color: #3a86ff;
    color: white;
}

/* Thread view: make crDetailContent the scroll container so the
   title, tabs, and thread header are all frozen above the zone tables */
.crd-content-thread {
    overflow-y: auto;
    max-height: calc(100vh - 105px);
}
/* Tabs row already sticky via .crd-tabs base rule */
/* Thread layout header pins below the tabs (~46px) */
.crd-content-thread .thread-layout-sticky {
    top: 46px;
    z-index: 10;
}
/* Strip the section box styling for the thread section —
   the thread layout manages its own visual hierarchy */
.cr-detail-section-thread {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* Zone navigation buttons (Thread view) */
.crd-zone-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid #1e3a5f;
}
.crd-tab-zone {
    padding: 0.3rem 0.55rem;
    font-size: 0.68rem;
    font-family: 'Courier New', monospace;
    background: #0d1f30;
    color: #7dd3fc;
    border: 1px solid #1e4a6e;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.crd-tab-zone:hover {
    background: #1e4a6e;
    color: #e0f2fe;
    border-color: #38bdf8;
}

#zone-data-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #07111c;
    border: 1px solid #2a5a8a;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    min-width: 270px;
    max-width: 400px;
    max-height: 54vh;
    overflow-y: auto;
    font-size: 0.74rem;
    color: #c8d8e8;
    line-height: 1.5;
    box-shadow: 0 6px 28px rgba(0,0,0,0.75);
    pointer-events: auto;
}
#zone-data-popup .zdp-dismiss {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: #6b8faf;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
}
#zone-data-popup .zdp-dismiss:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.08);
}
#zone-data-popup .zdp-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #1e3a5f;
}
#zone-data-popup table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 0.3rem;
}
#zone-data-popup td {
    padding: 0.1rem 0.35rem 0.1rem 0;
    vertical-align: top;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
}
#zone-data-popup td:first-child {
    color: #6b8faf;
    white-space: nowrap;
    padding-right: 0.5rem;
}
#zone-data-popup .zdp-hex { color: rgba(206,145,120,0.9); }
#zone-data-popup .zdp-val { color: #e2e8f0; }
#zone-data-popup .zdp-note { color: #7dd3fc; }
#zone-data-popup .zdp-dim { color: #374151; }
#zone-data-popup .zdp-frame-top { color: #38bdf8; font-weight: 600; }
#zone-data-popup .zdp-frame-more { color: #7dd3fc; }
#zone-data-popup .zdp-sentinel { color: #f97316; font-weight: 600; }
#zone-data-popup .zdp-lbl { color: #93c5fd; font-style: italic; }
#zone-data-popup .zdp-empty { color: #374151; font-style: italic; }

#cr-hover-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #07111c;
    border: 1px solid #2a5a8a;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    min-width: 270px;
    max-width: 420px;
    max-height: 54vh;
    overflow-y: auto;
    font-size: 0.74rem;
    color: #c8d8e8;
    line-height: 1.5;
    box-shadow: 0 6px 28px rgba(0,0,0,0.75);
    pointer-events: auto;
}
#cr-hover-popup .zdp-dismiss {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: #6b8faf;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
}
#cr-hover-popup .zdp-dismiss:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.08);
}
#cr-hover-popup .zdp-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #1e3a5f;
}
#cr-hover-popup table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 0.3rem;
}
#cr-hover-popup td {
    padding: 0.1rem 0.35rem 0.1rem 0;
    vertical-align: top;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
}
#cr-hover-popup td:first-child {
    color: #6b8faf;
    white-space: nowrap;
    padding-right: 0.5rem;
}
#cr-hover-popup .zdp-hex { color: rgba(206,145,120,0.9); }
#cr-hover-popup .zdp-val { color: #e2e8f0; }
#cr-hover-popup .zdp-note { color: #7dd3fc; }
#cr-hover-popup .zdp-dim { color: #374151; }
#cr-hover-popup .zdp-lbl { color: #93c5fd; font-style: italic; }
#cr-hover-popup .zdp-empty { color: #374151; font-style: italic; }

.cr-hover-target {
    cursor: help;
    border-bottom: 1px dotted rgba(244,185,66,0.4);
    transition: color 0.15s;
}
.cr-hover-target:hover {
    color: #f4b942;
    border-bottom-color: #f4b942;
}

.dr-hover-target {
    cursor: help;
    border-bottom: 1px dotted rgba(168,85,247,0.4);
    transition: color 0.15s;
}
.dr-hover-target:hover {
    color: #c084fc;
    border-bottom-color: #a855f7;
}

.dr-hover-row {
    cursor: help;
    transition: background 0.12s;
}
.dr-hover-row:hover {
    background: rgba(168,85,247,0.08);
}

.patch-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    min-width: 280px;
    max-width: 400px;
    background: #0d1b2a;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.7);
    padding: 0;
    overflow: hidden;
    transition: opacity 0.4s ease;
}
.patch-toast-ok  { border: 2px solid #22c55e; }
.patch-toast-fail { border: 2px solid #ef4444; }

.patch-toast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
}
.patch-toast-ok   .patch-toast-header { background: rgba(34,197,94,0.15); }
.patch-toast-fail .patch-toast-header { background: rgba(239,68,68,0.15); }

.patch-toast-icon {
    font-size: 1.1rem;
    font-weight: 700;
}
.patch-toast-ok   .patch-toast-icon { color: #22c55e; }
.patch-toast-fail .patch-toast-icon { color: #ef4444; }

.patch-toast-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
}

.patch-toast-close {
    background: none;
    border: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.patch-toast-close:hover { color: #fff; }

.patch-toast-summary {
    padding: 0.4rem 0.8rem 0.5rem;
    font-size: 0.78rem;
    color: #b0c4d8;
}

.patch-toast-log {
    margin: 0;
    padding: 0.5rem 0.8rem 0.6rem;
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: #90a8c0;
    background: #091420;
    border-top: 1px solid #1e3a5f;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.patch-toast-fade { opacity: 0; }

.fpga-toast {
    position: fixed;
    top: 3.5rem;
    right: 1.5rem;
    z-index: 2100;
    min-width: 300px;
    max-width: 440px;
    background: #0d1b2a;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.7);
    overflow: hidden;
    animation: fpga-toast-in 0.25s ease-out;
    transition: opacity 0.35s ease;
}
@keyframes fpga-toast-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.fpga-toast-info    { border: 2px solid #3b82f6; }
.fpga-toast-ok      { border: 2px solid #22c55e; }
.fpga-toast-warn    { border: 2px solid #f59e0b; }
.fpga-toast-err     { border: 2px solid #ef4444; }

.fpga-toast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
}
.fpga-toast-info .fpga-toast-header { background: rgba(59,130,246,0.15); }
.fpga-toast-ok   .fpga-toast-header { background: rgba(34,197,94,0.15); }
.fpga-toast-warn .fpga-toast-header { background: rgba(245,158,11,0.15); }
.fpga-toast-err  .fpga-toast-header { background: rgba(239,68,68,0.15); }

.fpga-toast-icon {
    font-size: 1.1rem;
    font-weight: 700;
}
.fpga-toast-info .fpga-toast-icon { color: #3b82f6; }
.fpga-toast-ok   .fpga-toast-icon { color: #22c55e; }
.fpga-toast-warn .fpga-toast-icon { color: #f59e0b; }
.fpga-toast-err  .fpga-toast-icon { color: #ef4444; }

.fpga-toast-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
}
.fpga-toast-close {
    background: none;
    border: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.fpga-toast-close:hover { color: #fff; }

.fpga-toast-body {
    padding: 0.4rem 0.8rem 0.6rem;
    font-size: 0.78rem;
    color: #b0c4d8;
    line-height: 1.45;
    white-space: pre-wrap;
}
.fpga-toast-fade { opacity: 0; }

.cr-inject-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid #1e3a5f;
    flex-wrap: wrap;
}

.cr-inject-log {
    margin-top: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: #05111f;
    border: 1px solid #1e3a5f;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #a8d8a8;
    font-family: var(--font-mono);
    max-height: 8rem;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.ref-tab-row {
    display: flex;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem 0;
    border-bottom: 1px solid rgba(218,165,32,0.2);
    background: var(--bg-secondary);
}

.ref-tab {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    color: var(--text-secondary);
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, background 0.15s;
}
.ref-tab:hover { color: var(--text-primary); background: rgba(218,165,32,0.05); }
.ref-tab.active {
    color: var(--church-gold);
    background: var(--bg-primary);
    border-color: rgba(218,165,32,0.3);
}

.ref-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    height: calc(100vh - 110px);
    overflow: hidden;
}

.ref-list-panel {
    overflow-y: auto;
    padding-right: 0.25rem;
}

.ref-list-panel .panel {
    height: 100%;
}

.ref-detail-panel {
    overflow-y: auto;
}

.ref-detail-panel .panel {
    height: 100%;
}

.instr-domain-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--church-gold);
    padding: 0.6rem 0.5rem 0.3rem;
    border-bottom: 1px solid var(--border);
    margin-top: 0.25rem;
}

.instr-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.25rem 0;
}

.instr-card {
    display: grid;
    grid-template-columns: 28px 100px 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
    font-size: 0.78rem;
}

.instr-card:hover {
    background: rgba(233, 69, 96, 0.1);
    border-color: var(--border);
}

.instr-card.active {
    background: rgba(233, 69, 96, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.15);
}

.instr-card.instr-shared {
    border-left: 2px solid var(--church-green);
    opacity: 0.75;
}

.instr-card.abs-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.instr-card.abs-card .instr-mnemonic {
    white-space: normal;
    line-height: 1.3;
}

.instr-card.abs-card .instr-brief {
    white-space: normal;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.instr-opcode {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    padding: 1px 4px;
}

.instr-mnemonic {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--church-gold);
    font-size: 0.8rem;
}

.instr-brief {
    color: var(--text-secondary);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.instr-detail-content {
    padding: 0.5rem 0;
}

.instr-placeholder {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 3rem 1rem;
}

.instr-detail-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.instr-detail-section:last-child {
    border-bottom: none;
}

.instr-detail-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 0.4rem;
}

.instr-detail-badge.church {
    background: rgba(251, 191, 36, 0.2);
    color: var(--church-gold);
    border: 1px solid var(--church-gold);
}

.instr-detail-badge.turing {
    background: rgba(96, 165, 250, 0.2);
    color: var(--church-blue);
    border: 1px solid var(--church-blue);
}

.instr-detail-desc {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.instr-detail-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 0.3rem;
}

.instr-detail-code {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--church-gold);
    background: rgba(0,0,0,0.3);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.instr-detail-value {
    font-size: 0.82rem;
    color: var(--text-primary);
}

.instr-detail-text {
    font-family: 'Courier New', monospace;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    background: rgba(0,0,0,0.25);
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    overflow-x: auto;
    margin: 0;
}

.instr-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.instr-fields-table th {
    text-align: left;
    padding: 0.3rem 0.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.instr-fields-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.instr-field-name {
    font-family: 'Courier New', monospace;
    color: var(--church-gold);
    font-weight: 600;
    white-space: nowrap;
}

.instr-detail-example {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--church-green);
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: pre-wrap;
    line-height: 1.6;
    margin: 0;
}

.abs-catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.abs-library-btn {
    background: #C89B3C;
    color: #141414;
    border: none;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.abs-library-btn:hover {
    background: #d4a94a;
}

.abs-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.abs-list-panel {
    overflow-y: auto;
    padding-right: 0.25rem;
}

.abs-list-panel .panel {
    height: 100%;
}

.abs-detail-panel {
    overflow-y: auto;
}

.abs-detail-panel .panel {
    height: 100%;
    overflow-y: auto;
}

.abs-layer-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--church-gold);
    padding: 0.6rem 0.5rem 0.3rem;
    border-bottom: 1px solid var(--border);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.abs-layer-header .layer-count {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.abs-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
    font-size: 0.78rem;
}

.abs-item:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--border);
}

.abs-item.active {
    background: rgba(251, 191, 36, 0.2);
    border-color: var(--church-gold);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.15);
}

.abs-item-name {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--church-gold);
    font-size: 0.8rem;
}

.abs-item-type {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    padding: 1px 6px;
    border-radius: 3px;
}

.abs-profile-badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1.4;
    text-transform: uppercase;
}
.profile-badge-iot {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
}
.profile-badge-full {
    background: rgba(251, 146, 60, 0.18);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.abs-item-desc {
    grid-column: 1 / -1;
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.abs-placeholder {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 3rem 1rem;
    line-height: 1.6;
}

.abs-detail-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.abs-detail-section:last-child {
    border-bottom: none;
}

.abs-detail-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 0.3rem;
}

.abs-detail-desc {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.abs-detail-code {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--church-gold);
    background: rgba(0,0,0,0.3);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.abs-method-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.abs-method {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    background: rgba(15,52,96,0.3);
    border-radius: 4px;
    border-left: 2px solid var(--church-blue);
    color: var(--text-primary);
}

.abs-polymorphic-section {
    background: rgba(218, 165, 32, 0.06);
    border: 1px solid rgba(218, 165, 32, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
}

.abs-polymorphic-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.abs-poly-method {
    display: inline-block;
    background: rgba(218, 165, 32, 0.15);
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(218, 165, 32, 0.3);
}

.abs-poly-note {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.abs-methods-section {
    background: rgba(15, 52, 96, 0.12);
    border: 1px solid rgba(100, 160, 255, 0.15);
    border-radius: 6px;
    padding: 0.75rem;
}

.abs-methods-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.abs-methods-header .abs-detail-label {
    margin-bottom: 0;
}

.abs-methods-controls {
    display: flex;
    gap: 0.3rem;
}

.abs-method-ctrl-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    background: rgba(30, 60, 120, 0.4);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.abs-method-ctrl-btn:hover:not(:disabled) {
    background: rgba(30, 100, 200, 0.5);
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.abs-method-ctrl-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.abs-method-form-container {
    margin-top: 0.5rem;
}

.abs-method-form {
    background: rgba(5, 15, 35, 0.6);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
    animation: absPanelFade 0.12s ease;
}

.abs-method-form-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--church-gold);
    margin-bottom: 0.55rem;
}

.abs-method-form-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    margin-top: 0.35rem;
}

.abs-method-form-input,
.abs-method-form-textarea,
.abs-method-form-select {
    width: 100%;
    box-sizing: border-box;
    background: rgba(8, 20, 50, 0.7);
    border: 1px solid rgba(100, 160, 255, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
}

.abs-method-form-input:focus,
.abs-method-form-textarea:focus,
.abs-method-form-select:focus {
    border-color: rgba(100, 160, 255, 0.5);
}

.abs-method-form-code {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
}

.abs-method-form-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.55rem;
}

.abs-method-form-cancel {
    background: rgba(40, 40, 60, 0.5);
    color: var(--text-secondary);
}

.abs-method-del-confirm {
    background: rgba(160, 30, 30, 0.5);
    color: #ff9999;
    border-color: rgba(200, 60, 60, 0.4);
}

.abs-method-del-confirm:hover {
    background: rgba(200, 40, 40, 0.6);
}

.abs-method-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.abs-method-tab-spacer {
    flex: 1;
    min-width: 0.4rem;
}

.abs-method-tabs-empty {
    margin-top: 0.3rem;
}

.abs-method-tab {
    display: inline-block;
    background: rgba(30, 60, 120, 0.3);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    border: 1px solid rgba(100, 160, 255, 0.2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}

.abs-method-tab:hover {
    background: rgba(30, 80, 180, 0.4);
    color: var(--text-primary);
    border-color: rgba(100, 160, 255, 0.4);
}

.abs-method-tab-active {
    background: rgba(15, 52, 150, 0.55);
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.abs-method-panels {
    border-top: 1px solid rgba(100, 160, 255, 0.15);
    padding-top: 0.55rem;
}

.abs-method-panel-item {
    animation: absPanelFade 0.12s ease;
}

@keyframes absPanelFade {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.abs-method-panel-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.abs-method-panel-name {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--church-gold);
    flex: 1;
}

.abs-method-edit-btn {
    opacity: 0.45;
    font-size: 0.85rem;
    transition: opacity 0.15s;
}

.abs-method-edit-btn:hover {
    opacity: 1;
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.abs-method-panel-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 0.45rem;
}

.abs-reg-conv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    margin: 0.4rem 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(100, 160, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}
.abs-reg-conv-table td {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid rgba(100, 160, 255, 0.08);
}
.abs-reg-conv-table td:first-child {
    color: var(--text-secondary);
    font-weight: 600;
    width: 110px;
    white-space: nowrap;
}
.abs-reg-conv-table td:last-child {
    color: #b8d4f8;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
}
.abs-reg-conv-table tr:last-child td {
    border-bottom: none;
}
.abs-reg-conv-table code {
    background: rgba(100, 160, 255, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.68rem;
}

.abs-method-panel-code {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: #b8d4f8;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(100, 160, 255, 0.15);
    border-radius: 4px;
    padding: 0.5rem 0.7rem;
    margin: 0;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.5;
}

.abs-method-empty {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
}

.abs-method-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.abs-method-card {
    background: rgba(15, 52, 96, 0.2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--church-blue);
    border-radius: 4px;
    padding: 0.5rem 0.6rem;
}

.abs-method-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.abs-method-card-name {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--church-gold);
}

.abs-method-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.abs-method-card-code {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    line-height: 1.5;
    color: #c8e6c9;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.4rem 0.5rem;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 0;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}

.abs-perm-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin: 0 0.15rem;
}

.abs-perm-badge.perm-on {
    background: rgba(74, 222, 128, 0.2);
    color: var(--church-green);
    border: 1px solid var(--church-green);
}

.abs-perm-badge.perm-off {
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.lumps-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    height: calc(100vh - 70px);
    overflow: visible;
}

.lumps-list-panel {
    padding-right: 0.25rem;
    overflow: visible;
}

.lumps-list-panel .panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

#lumpsListContent {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.lumps-detail-panel {
    overflow-y: auto;
}

.lumps-detail-panel .panel {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#lumpsDetailContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.lumps-catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lumps-actions-dropdown {
    right: 0;
    left: auto;
    flex-direction: column;
    min-width: 130px;
    grid-template-columns: none;
}

.lumps-placeholder {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 3rem 1rem;
    line-height: 1.6;
}

.lumps-loading {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 2rem 1rem;
}

.lump-item {
    padding: 0.55rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.lump-item:hover {
    background: rgba(30, 60, 120, 0.3);
    border-color: rgba(100, 160, 255, 0.15);
}

.lump-item.active {
    background: rgba(30, 60, 120, 0.5);
    border-color: var(--church-gold);
}

.lump-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.2rem;
}

.lump-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lump-mtbf-badge {
    font-size: 0.55rem;
    padding: 1px 6px;
}

.lump-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.lump-token {
    font-family: 'Courier New', monospace;
    color: #8ab4f8;
}

.lump-detail-sections {
    padding: 0.5rem 0;
}

.lump-detail-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.lump-detail-section:last-child {
    border-bottom: none;
}

.lump-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--church-gold);
    margin-bottom: 0.4rem;
}

.lump-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(100, 160, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}

.lump-detail-table th {
    padding: 0.3rem 0.5rem;
    text-align: left;
    font-size: 0.68rem;
    color: var(--church-gold);
    font-weight: 600;
    border-bottom: 1px solid rgba(100, 160, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
}

.lump-detail-table td {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid rgba(100, 160, 255, 0.08);
}

.lump-detail-table td:first-child {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.lump-detail-table tr:last-child td {
    border-bottom: none;
}

.lump-detail-table code {
    background: rgba(100, 160, 255, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.68rem;
    font-family: 'Courier New', monospace;
}

.lump-detail-actions {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ── LUMP binary hex-dump / disassembly table ──────────────────────────── */
.lump-binary-badge {
    font-size: 0.62rem;
    font-weight: 400;
    color: #6b7280;
    margin-left: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
}

.lump-hex-loading {
    color: #6b7280;
    font-size: 0.73rem;
    font-style: italic;
    padding: 0.4rem 0;
}

.lump-hex-table-wide {
    min-width: max-content;
}
.lump-hex-table-wide th,
.lump-hex-table-wide td {
    white-space: nowrap;
}
.lump-hex-table td.lump-hex-ascii {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
    color: #b8d4ff;
    border-left: 1px solid rgba(100, 160, 255, 0.15);
    padding-left: 0.6rem;
}
.lump-hex-table td.lump-hex-empty {
    background: transparent;
}
.lump-hex-hdr-row td {
    background: rgba(200, 168, 75, 0.08);
    color: var(--church-gold, #c8a84b);
}
.lump-hex-clist-row td {
    background: rgba(100, 200, 255, 0.06);
    color: #7effea;
}
.lump-hex-pad-row td {
    background: transparent;
    color: #4b5563;
}
.lump-hex-table td.lump-hex-addr {
    color: #6b7280;
    font-family: 'Courier New', monospace;
    border-right: 1px solid rgba(100, 160, 255, 0.12);
    padding-right: 0.6rem;
}

.lump-hex-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.71rem;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(100, 160, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}

.lump-hex-table th {
    padding: 0.25rem 0.45rem;
    text-align: left;
    font-size: 0.63rem;
    color: var(--church-gold);
    font-weight: 600;
    border-bottom: 1px solid rgba(100, 160, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.lump-hex-table td {
    padding: 0.18rem 0.45rem;
    border-bottom: 1px solid rgba(100, 160, 255, 0.06);
    white-space: nowrap;
    vertical-align: middle;
}

.lump-hex-table tr:last-child td { border-bottom: none; }

.lump-hex-word  { color: #6b7280; min-width: 3rem; }
.lump-hex-addr  { color: #52525b; min-width: 4rem; }
.lump-hex-val   { color: rgba(206, 145, 120, 0.95); letter-spacing: 0.5px; min-width: 7rem; }
.lump-hex-disasm { color: #a0c4ff; }

.lump-hex-region-row td {
    background: rgba(0, 0, 0, 0.35);
    color: #4b5563;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0.18rem 0.45rem;
    border-bottom: 1px solid rgba(100, 160, 255, 0.1);
    font-family: inherit;
}

.lump-hex-method-row td {
    background: rgba(100, 160, 255, 0.04);
    color: var(--church-gold);
    font-size: 0.64rem;
    font-style: italic;
    padding: 0.18rem 0.45rem;
    border-bottom: 1px solid rgba(100, 160, 255, 0.08);
}

.lump-delete-btn {
    background: rgba(160, 30, 30, 0.5);
    color: #ff9999;
    border: 1px solid rgba(200, 60, 60, 0.4);
    font-size: 0.72rem;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.lump-delete-btn:hover {
    background: rgba(200, 40, 40, 0.6);
}


.ns-type-badge {
    display: inline-block;
    background: #2d7d46;
    color: #e0ffe0;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

/* ── LUMP content-type badges ──────────────────────────── */
.lump-ct-badge {
    display: inline-block;
    font-size: 0.52rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.4px;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
    line-height: 1.4;
}
.lump-ct-ns     { background: #2d7d46; color: #e0ffe0; }
.lump-ct-code   { background: #1e3a6e; color: #7eb8ff; }
.lump-ct-data   { background: #4a2d1e; color: #ffb87e; }
.lump-ct-text   { background: #2d3a1e; color: #b8ff7e; }
.lump-ct-md     { background: #1e2d4a; color: #7eb8ff; }
.lump-ct-img    { background: #3a1e4a; color: #e07eff; }
.lump-ct-thread { background: #1e3a3a; color: #7effea; }
.lump-ct-outform{ background: #4a3a1e; color: #ffe07e; }
.lump-ct-doc    { background: #2a2a4a; color: #b0b8ff; }

/* ── LUMP detail tab bar ───────────────────────────────── */
.lump-tabs-bar {
    display: flex;
    gap: 2px;
    padding: 0 0 0 0;
    border-bottom: 1px solid rgba(100, 160, 255, 0.18);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}
.lump-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.8rem 0.3rem;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
}
.lump-tab:hover { color: var(--text-primary); }
.lump-tab.lump-tab-active {
    color: var(--church-gold, #c8a84b);
    border-bottom-color: var(--church-gold, #c8a84b);
    background: rgba(200, 168, 75, 0.07);
}

/* ── LUMP tab panels ───────────────────────────────────── */
.lump-tab-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: auto;
    min-height: 0;
}
.lump-tab-panel-active {
    display: flex;
}

/* ── LUMP code content viewer ──────────────────────────── */
.lump-content-code {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    overflow-x: auto;
}
.lump-code-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    line-height: 1.6;
}
.lump-code-row:hover { background: rgba(100, 160, 255, 0.06); }
.lump-code-addr {
    color: #6b7280;
    min-width: 5.2rem;
    flex-shrink: 0;
}
.lump-code-hex {
    color: #7eb8ff;
    min-width: 6rem;
    flex-shrink: 0;
}
.lump-code-instr {
    color: var(--text-primary);
    white-space: nowrap;
}
.lump-code-method-label {
    color: var(--church-gold, #c8a84b);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.4rem 0.2rem 0.15rem;
    letter-spacing: 0.4px;
    border-top: 1px solid rgba(200, 168, 75, 0.2);
    margin-top: 0.3rem;
}
.lump-meth-auto {
    font-weight: 400;
    opacity: 0.55;
    font-size: 0.62rem;
    vertical-align: middle;
    margin-left: 0.25rem;
}
.lump-sym-ann {
    color: #7dd3a8;
    font-size: 0.68rem;
    margin-left: 0.5rem;
    opacity: 0.85;
    font-style: italic;
}
.lump-code-comment {
    color: #6fa87a;
    font-size: 0.68rem;
    margin-left: auto;
    padding-left: 1rem;
    opacity: 0.75;
    font-style: italic;
    white-space: nowrap;
    flex-shrink: 0;
}
.lump-code-docstring {
    color: #8a9aaa;
    font-size: 0.67rem;
    font-style: italic;
    padding: 0.2rem 0.4rem 0.35rem 0.75rem;
    border-left: 2px solid rgba(100, 160, 255, 0.18);
    margin: 0.1rem 0 0.3rem 0;
    line-height: 1.5;
}
.lump-code-docstring .lump-doc-desc {
    color: #9bb0c4;
    display: block;
    margin-bottom: 0.15rem;
}
.lump-code-docstring .lump-doc-io {
    color: #6a8899;
    display: block;
    font-size: 0.63rem;
}
/* ── C-List viewer ──────────────────────────────────────── */
.lump-clist-section {
    margin-top: 0.8rem;
    border-top: 1px solid rgba(100, 160, 255, 0.12);
    padding-top: 0.5rem;
}
.lump-clist-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #7eb8ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}
.lump-clist-table {
    font-family: 'Courier New', monospace;
    font-size: 0.71rem;
}
.lump-clist-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.08rem 0.2rem;
    line-height: 1.6;
}
.lump-clist-row:hover { background: rgba(100,160,255,0.05); }
.lump-clist-idx  { color: #6b7280; min-width: 2.4rem; flex-shrink: 0; }
.lump-clist-tok  { color: #7eb8ff; min-width: 7.2rem; flex-shrink: 0; }
.lump-clist-name { color: var(--text-primary); }
.lump-clist-null { color: #444; font-style: italic; }

/* ── LUMP text / markdown content ──────────────────────── */
.lump-content-text {
    font-family: 'Courier New', monospace;
    font-size: 0.73rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.18);
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    border: 1px solid rgba(100, 160, 255, 0.1);
    max-height: 100%;
    overflow-y: auto;
    margin: 0;
    flex: 1;
}
.lump-content-markdown {
    font-size: 0.78rem;
    line-height: 1.65;
    color: var(--text-primary);
    padding: 0.3rem 0.2rem;
    overflow-y: auto;
}
.lump-content-markdown h1, .lump-content-markdown h2, .lump-content-markdown h3 {
    color: var(--church-gold, #c8a84b);
    margin: 0.6rem 0 0.3rem;
}
.lump-content-markdown code {
    background: rgba(100, 160, 255, 0.1);
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.9em;
}
.lump-content-markdown pre { overflow-x: auto; }

/* ── LUMP image content ────────────────────────────────── */
.lump-content-image {
    display: flex;
    flex-direction: column;
    padding: 0.3rem 0;
    overflow-y: auto;
}

/* ── LUMP thread content ───────────────────────────────── */
.lump-content-thread {
    font-size: 0.73rem;
    overflow-y: auto;
}

/* ── LUMP inline editor ────────────────────────────────── */
.lump-edit-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}
.lump-edit-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
}
.lump-edit-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
}
.lump-edit-preview {
    width: 100%;
}
.lump-edit-area {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}
.lump-draft-restore-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    background: #2a2208;
    border: 1px solid #fbbf24;
    border-radius: 4px;
    color: #fbbf24;
    font-size: 0.82rem;
}
.lump-draft-restore-banner span { flex: 1; }
.lump-draft-restore-btn { background: #fbbf24; color: #1a1a2e; }
.lump-draft-restore-btn:hover { background: #f59e0b; }
.lump-draft-discard-btn { background: transparent; border: 1px solid #fbbf24; color: #fbbf24; }
.lump-edit-split {
    display: grid;
    grid-template-columns: 1fr 6px 1fr;
    width: 100%;
    min-height: 220px;
}
.lump-edit-split-divider {
    width: 6px;
    cursor: col-resize;
    background: var(--border, #3c3c3c);
    border-radius: 3px;
    transition: background 0.15s;
    position: relative;
    user-select: none;
}
.lump-edit-split-divider:hover,
.lump-edit-split-divider.dragging {
    background: var(--accent, #569cd6);
}
.lump-edit-split-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.lump-edit-split-right {
    min-width: 0;
    border: 1px solid var(--border, #3c3c3c);
    border-radius: 4px;
    padding: 0.5rem;
    background: var(--bg-secondary, #252526);
    overflow-y: auto;
    max-height: 420px;
}
.lump-edit-live-preview {
    width: 100%;
    word-break: break-word;
}
.lump-edit-textarea {
    width: 100%;
    min-height: 180px;
    background: var(--bg-tertiary, #1e1e1e);
    color: var(--text-primary, #d4d4d4);
    border: 1px solid var(--border, #3c3c3c);
    border-radius: 4px;
    padding: 0.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}
.lump-edit-split-left .lump-edit-textarea {
    flex: 1;
    min-height: 220px;
    max-height: 420px;
    resize: none;
}
@media (max-width: 600px) {
    .lump-edit-split {
        grid-template-columns: 1fr !important;
    }
    .lump-edit-split-divider {
        display: none;
    }
    .lump-edit-split-right {
        max-height: 240px;
    }
}
.lump-edit-textarea:focus {
    outline: none;
    border-color: var(--accent, #569cd6);
}
.lump-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.lump-edit-save-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
    background: var(--accent, #569cd6);
    color: #fff;
    border: none;
}
.lump-edit-save-btn:hover:not(:disabled) {
    opacity: 0.85;
}
.lump-edit-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.lump-edit-cancel-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
}
.lump-edit-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: 0.3rem;
}

/* ── LUMP import modal ─────────────────────────────────── */
.lump-import-dialog {
    max-width: 420px;
    width: 95vw;
}
.lump-import-row {
    margin-bottom: 0.65rem;
}
.lump-import-row label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.lump-import-row input[type=text],
.lump-import-row input[type=number],
.lump-import-row select,
.lump-import-row textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    font-family: inherit;
    resize: vertical;
}
.lump-import-row select {
    background: #1a1a2e;
    color: #e0e0f0;
}
.lump-import-row select option {
    background: #1a1a2e;
    color: #e0e0f0;
}
.lump-import-row textarea { min-height: 80px; }
.lump-import-img-pair { display: flex; gap: 0.5rem; }
.lump-import-img-pair input { flex: 1; }
.lump-import-err {
    color: #ff7070;
    font-size: 0.7rem;
    min-height: 1rem;
    margin-top: 0.4rem;
}

.ns-dep-graph-toolbar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.ns-dep-graph-btn {
    font-size: 0.72rem;
    font-family: monospace;
    padding: 0.18rem 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(100, 160, 255, 0.22);
    border-radius: 4px;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}

.ns-dep-graph-btn:hover {
    background: rgba(100, 160, 255, 0.14);
    color: var(--text-primary, #e5e7eb);
}

.ns-dep-graph-null-btn {
    margin-left: 0.4rem;
    color: #7a7a9a;
    font-size: 0.68rem;
}

.ns-dep-graph-wrap {
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(100, 160, 255, 0.10);
    padding: 4px 2px;
    max-height: 420px;
    position: relative;
}

.ns-dep-graph-svg {
    display: block;
    width: 100%;
    max-width: 660px;
    height: auto;
    cursor: grab;
}

.ns-dep-graph-svg:active {
    cursor: grabbing;
}

.ns-dep-graph-svg text {
    user-select: none;
}

.nsdg-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #111820;
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
    min-width: 160px;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 4px 18px rgba(0,0,0,0.55);
    font-family: monospace;
    font-size: 0.72rem;
    line-height: 1.45;
}

.nsdg-tip-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: #e0e8f8;
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(100,160,255,0.15);
}

.nsdg-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 3px;
}

.nsdg-tip-lbl {
    color: #6a8aaa;
    flex-shrink: 0;
}

.nsdg-tip-val {
    color: #c8dce8;
    text-align: right;
    word-break: break-all;
}

.nsdg-tip-mono {
    font-family: monospace;
    font-size: 0.68rem;
}

.nsdg-tip-nav {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(100,160,255,0.12);
    color: #4a9a7a;
    font-size: 0.68rem;
    text-align: right;
}

.ns-builder-form {
    padding: 0.5rem 0;
}

.ns-builder-form .ns-form-group {
    margin-bottom: 0.75rem;
}

.ns-builder-form label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ns-builder-form input[type="text"],
.ns-builder-form input[type="number"],
.ns-builder-form select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.78rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    box-sizing: border-box;
}

.ns-builder-form input:focus,
.ns-builder-form select:focus {
    outline: none;
    border-color: var(--church-gold);
}

.ns-slot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(100,160,255,0.12);
    border-radius: 4px;
    margin-top: 0.4rem;
}

.ns-slot-table th {
    padding: 0.3rem 0.5rem;
    text-align: left;
    font-size: 0.65rem;
    color: var(--church-gold);
    font-weight: 600;
    border-bottom: 1px solid rgba(100,160,255,0.15);
    background: rgba(0,0,0,0.15);
}

.ns-slot-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid rgba(100,160,255,0.08);
    vertical-align: top;
}

.ns-slot-table select,
.ns-slot-table input {
    padding: 3px 5px;
    font-size: 0.72rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
}

.ns-slot-table .ns-slot-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 3px;
}

.ns-slot-table .ns-slot-fields label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
}

.ns-slot-remove-btn {
    background: rgba(160,30,30,0.4);
    color: #ff9999;
    border: 1px solid rgba(200,60,60,0.3);
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.ns-slot-remove-btn:hover {
    background: rgba(200,40,40,0.5);
}

.ns-slot-add-btn {
    background: rgba(30,80,160,0.3);
    color: #8ab4f8;
    border: 1px solid rgba(100,160,255,0.2);
    font-size: 0.7rem;
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.ns-slot-add-btn:hover {
    background: rgba(40,100,200,0.4);
}

.ns-build-btn {
    background: #2d7d46;
    color: #e0ffe0;
    border: 1px solid #3a9955;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 24px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

.ns-build-btn:hover {
    background: #38955a;
}

.ns-build-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lump-type-selector-dialog {
    max-width: 640px;
    width: 100%;
}

.lump-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.lump-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8rem 0.9rem;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.lump-type-card:hover {
    border-color: var(--church-gold);
    background: rgba(200,155,60,0.07);
}

.lump-type-card-ns {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
}

.lump-type-card-ns .lump-type-desc {
    flex: 1;
}

.lump-type-icon {
    font-size: 1.3rem;
    line-height: 1;
    color: var(--church-gold);
}

.lump-type-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.lump-type-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.lump-type-cancel-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.25rem;
}

@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
    }

    header h1 {
        font-size: 1rem;
    }

    .controls {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .view-buttons {
        gap: 0.2rem;
    }

    .btn-view {
        padding: 0.25rem 0.45rem;
        font-size: 0.65rem;
    }

    .sim-exec-btns {
        width: 100%;
        justify-content: flex-start;
    }

    .sim-controls {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .sim-controls .btn {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }

    .view {
        top: 80px;
        padding: 0.35rem;
    }

    .editor-layout {
        flex-direction: column;
        height: auto;
    }

    .editor-divider {
        display: none;
    }

    .repl-layout {
        flex-direction: column;
        height: auto;
    }

    .repl-panel {
        flex: none;
    }

    .repl-divider {
        display: none;
    }

    .repl-sidebar {
        flex: none;
    }

    .tutorial-body {
        grid-template-columns: 1fr;
    }

    .pipeline-stages {
        flex-wrap: wrap;
    }

    .comparison-row {
        grid-template-columns: 30px 1fr 60px 60px;
    }

    .ref-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .ref-list-panel {
        max-height: 40vh;
    }

    .abs-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .abs-list-panel {
        max-height: 40vh;
    }

    .lumps-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .lumps-list-panel {
        max-height: 40vh;
    }

    .modal-dialog {
        min-width: unset;
        max-width: 95vw;
        margin: 0 0.5rem;
    }

    .dash-tabs {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .dash-tab {
        padding: 0.35rem 0.8rem;
        font-size: 0.72rem;
    }

    .flags-bar {
        flex-wrap: wrap;
    }

    .instr-card {
        grid-template-columns: 24px 80px 1fr;
        font-size: 0.72rem;
    }

    .tutorial-phase-indicators {
        flex-wrap: wrap;
    }

}

.docs-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.docs-sidebar {
    overflow-y: auto;
    padding-right: 0.25rem;
}

.docs-sidebar .panel {
    height: 100%;
}

.docs-content-panel {
    overflow-y: auto;
}

.docs-content-panel .panel {
    height: 100%;
}

.docs-content-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-back-btn {
    display: none;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.docs-file-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.25rem 0;
}

.docs-chapter-group {
    margin-bottom: 0.5rem;
}

.docs-chapter-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--church-gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.6rem 0.2rem;
    border-top: 1px solid rgba(200, 155, 60, 0.15);
    margin-top: 0.25rem;
}

.docs-chapter-group:first-child .docs-chapter-title {
    border-top: none;
    margin-top: 0;
}

.docs-chapter-num {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-right: 0.4rem;
    min-width: 1.8rem;
    display: inline-block;
}

.docs-file-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0.3rem 0.6rem 0.3rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
    transition: background 0.15s;
}

.docs-file-item:hover {
    background: rgba(200, 155, 60, 0.1);
    color: var(--text-color);
}

.docs-file-item.active {
    background: rgba(200, 155, 60, 0.2);
    color: var(--church-gold);
}

.docs-file-item .file-size {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.docs-file-item .file-icon {
    margin-right: 6px;
    opacity: 0.6;
}

.docs-placeholder {
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 2rem;
    text-align: center;
}

.docs-content-body {
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
}

.docs-content-body h1 {
    font-size: 1.4rem;
    color: var(--church-gold);
    margin: 1.5rem 0 0.75rem 0;
    border-bottom: 1px solid rgba(200, 155, 60, 0.3);
    padding-bottom: 0.4rem;
}

.docs-content-body h2 {
    font-size: 1.15rem;
    color: var(--church-gold);
    margin: 1.25rem 0 0.5rem 0;
}

.docs-content-body h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin: 1rem 0 0.4rem 0;
}

.docs-content-body p {
    margin: 0.5rem 0;
}

.docs-content-body code {
    background: rgba(200, 155, 60, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--church-gold);
}

.docs-content-body pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(200, 155, 60, 0.2);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    font-size: 0.78rem;
    line-height: 1.5;
}

.docs-content-body pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
}

.docs-content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.78rem;
}

.docs-content-body th {
    background: rgba(200, 155, 60, 0.15);
    color: var(--church-gold);
    padding: 0.4rem 0.6rem;
    text-align: left;
    border: 1px solid rgba(200, 155, 60, 0.2);
}

.docs-content-body td {
    padding: 0.35rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.docs-content-body ul, .docs-content-body ol {
    margin: 0.4rem 0;
    padding-left: 1.5rem;
}

.docs-content-body li {
    margin: 0.2rem 0;
}

.docs-content-body blockquote {
    border-left: 3px solid var(--church-gold);
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    color: var(--text-dim);
    background: rgba(200, 155, 60, 0.05);
}

.docs-content-body strong {
    color: var(--text-color);
}

.docs-content-body hr {
    border: none;
    border-top: 1px solid rgba(200, 155, 60, 0.2);
    margin: 1.25rem 0;
}

.docs-figure-frame {
    width: 100%;
    border: none;
    min-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 6px;
}

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .docs-sidebar {
        max-height: 40vh;
        overflow-y: auto;
    }

    .docs-sidebar.docs-sidebar-collapsed {
        display: none !important;
    }

    .docs-content-panel {
        overflow-y: visible;
        max-width: 100vw;
    }

    .docs-content-panel .panel {
        height: auto;
        max-width: 100%;
        overflow-x: hidden;
    }

    .docs-content-body {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .docs-content-body pre {
        max-width: calc(100vw - 3rem);
        overflow-x: auto;
        font-size: 0.7rem;
        white-space: pre-wrap;
        word-break: break-all;
    }

    .docs-content-body code {
        word-break: break-all;
    }

    .docs-content-body table {
        display: block;
        max-width: calc(100vw - 3rem);
        overflow-x: auto;
        font-size: 0.7rem;
    }

    .docs-content-body td,
    .docs-content-body th {
        padding: 0.25rem 0.35rem;
        font-size: 0.68rem;
    }

    .docs-back-btn {
        display: inline-block !important;
    }
}

.tutorial-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.tutorial-selector [data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.tutorial-selector .btn-tut-select {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.tutorial-selector .btn-tut-select:hover {
    background: rgba(200, 155, 60, 0.1);
    color: var(--text-primary);
}

.tutorial-selector .btn-tut-select.active {
    background: var(--church-gold);
    color: var(--bg-dark);
    font-weight: 600;
    border-color: var(--church-gold);
}

.sr-wrapper {
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sr-header {
    margin-bottom: 1rem;
}

.sr-header h2 {
    font-size: 1.1rem;
    color: var(--church-gold);
    margin-bottom: 0.25rem;
}

.sr-tagline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.sr-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.sr-progress-bar {
    display: flex;
    gap: 2px;
    margin-top: 0.5rem;
}

.sr-prog-section {
    flex: 1;
    padding: 0.25rem 0.4rem;
    text-align: center;
    font-size: 0.65rem;
    border-radius: 3px;
    transition: all 0.3s;
}

.sr-prog-pending {
    background: var(--bg-input);
    color: var(--text-dim);
}

.sr-prog-active {
    background: var(--church-gold);
    color: var(--bg-dark);
    font-weight: 600;
}

.sr-prog-done {
    background: rgba(200, 155, 60, 0.3);
    color: var(--church-gold);
}

.sr-body {
    flex: 1;
    overflow-y: auto;
}

.sr-step-container {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    line-height: 1.6;
}

.sr-step-title {
    font-size: 1.2rem;
    color: var(--church-gold);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sr-step-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.sr-step-content {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.sr-step-content p {
    margin-bottom: 0.75rem;
}

.sr-step-content ul {
    margin: 0.5rem 0 0.75rem 1.5rem;
}

.sr-step-content li {
    margin-bottom: 0.25rem;
}

.sr-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0.75rem 0;
}

.sr-four-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.sr-col-title {
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.sr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.sr-table th {
    background: rgba(200, 155, 60, 0.15);
    color: var(--church-gold);
    padding: 0.3rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.sr-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sr-table-wide {
    margin: 0.75rem 0;
}

.sr-encoding {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--church-gold);
    margin: 0.75rem 0;
    overflow-x: auto;
    white-space: pre;
}

pre {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.68rem;
    padding: 2px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    font-family: sans-serif;
}

pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.code-copy-btn.copied {
    color: #7ee787;
    border-color: rgba(126, 231, 135, 0.3);
}

.sr-code {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: var(--text-primary);
    margin: 0.75rem 0;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.4;
}

.sr-code-js {
    border-left: 3px solid var(--church-gold);
}

.sr-code-hs {
    border-left: 3px solid #9b59b6;
}

.sr-asm {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: #7ee787;
    margin: 0.75rem 0;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.5;
}

.sr-key-concept {
    background: rgba(200, 155, 60, 0.08);
    border: 1px solid rgba(200, 155, 60, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.sr-concept-title {
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.sr-warning {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin: 0.75rem 0;
    font-size: 0.8rem;
    color: #e74c3c;
}

.sr-objectives {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.sr-obj-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 0.82rem;
}

.sr-obj-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--church-gold);
    color: var(--bg-dark);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sr-hardware {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border-radius: 6px;
}

.sr-lump-diagram {
    display: flex;
    flex-direction: column;
    margin: 0.75rem 0;
    border: 2px solid var(--church-gold);
    border-radius: 6px;
    overflow: hidden;
}

.sr-lump-region {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.sr-lump-code {
    background: rgba(46, 160, 67, 0.15);
    color: #7ee787;
    border-bottom: 1px dashed var(--border);
}

.sr-lump-free {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    border-bottom: 1px dashed var(--border);
    font-style: italic;
}

.sr-lump-clist {
    background: rgba(200, 155, 60, 0.15);
    color: var(--church-gold);
}

.sr-compiler-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin: 0.75rem 0;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: 8px;
}

.sr-comp-inputs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sr-comp-input {
    padding: 0.4rem 1rem;
    background: rgba(200, 155, 60, 0.15);
    border: 1px solid rgba(200, 155, 60, 0.3);
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--church-gold);
    position: relative;
    cursor: help;
}

.sr-comp-input[data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    white-space: pre-line;
    text-align: left;
    max-width: 340px;
    font-family: monospace;
    font-size: 0.72rem;
    line-height: 1.5;
}

.sr-comp-arrow {
    font-size: 1.2rem;
    color: var(--text-dim);
}

.sr-comp-layout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.sr-comp-layout .sr-compiler-diagram {
    margin: 0;
    flex-shrink: 0;
}

.sr-comp-side {
    flex: 1;
    min-width: 0;
}

.sr-comp-side-panel {
    background: rgba(26, 45, 80, 0.6);
    border: 1px solid rgba(100, 150, 220, 0.3);
    border-radius: 8px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.sr-comp-side-panel.open {
    padding: 0.6rem 0.75rem;
    max-height: 800px;
    overflow-y: auto;
    opacity: 1;
}

.sr-comp-side-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.4rem;
}

.sr-comp-side-panel p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin: 0 0 0.4rem;
    line-height: 1.45;
}

.sr-comp-side-panel p:last-child {
    margin-bottom: 0;
}

.sr-comp-side-panel code {
    color: var(--church-gold);
    font-size: 0.7rem;
}

.sr-comp-core {
    padding: 0.6rem 1.5rem;
    background: var(--church-gold);
    color: var(--bg-dark);
    border-radius: 6px;
    font-weight: 600;
    position: relative;
    cursor: pointer;
}

.sr-comp-output {
    padding: 0.4rem 1rem;
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid rgba(46, 160, 67, 0.3);
    border-radius: 4px;
    font-size: 0.78rem;
    color: #7ee787;
    position: relative;
    cursor: pointer;
}

.sr-totals {
    background: var(--bg-input);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.sr-total-item {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.sr-total-note {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    font-style: italic;
}

.sr-security-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.sr-sec-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 0.82rem;
    align-items: flex-start;
}

.sr-sec-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(200, 155, 60, 0.2);
    color: var(--church-gold);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.sr-pros-list, .sr-cons-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sr-pro-item, .sr-con-item {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border-radius: 6px;
    border-left: 3px solid var(--church-gold);
}

.sr-con-item {
    border-left-color: #e74c3c;
}

.sr-pro-title, .sr-con-title {
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.sr-con-title {
    color: #e74c3c;
}

.sr-pro-item p, .sr-con-item p {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.sr-objection {
    color: var(--text-dim);
    font-style: italic;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(200, 155, 60, 0.3);
}

.sr-references {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.sr-ref-title {
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.5rem;
}

.sr-references ol {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-left: 1.5rem;
    line-height: 1.6;
}

.gc-console-dialog {
    background: #0d1b2a;
    border: 2px solid #9b59b6;
    border-radius: 10px;
    padding: 1.5rem;
    min-width: 520px;
    max-width: 700px;
    width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(155, 89, 182, 0.3);
}

.gc-console-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #9b59b6;
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.gc-console-output {
    background: #080f1a;
    color: #c8d6e5;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #1e3a5f;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 50vh;
    white-space: pre-wrap;
    word-break: break-word;
}

.gc-console-status {
    font-size: 0.8rem;
    color: #a0a0a0;
    margin: 0.75rem 0;
    padding: 0.4rem 0.6rem;
    background: #111d2e;
    border-radius: 4px;
    border-left: 3px solid #9b59b6;
}

.gc-console-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.gc-console-buttons .btn {
    padding: 0.4rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.sr-references a {
    color: #5dade2;
    text-decoration: none;
}

.sr-references a:hover {
    color: var(--church-gold);
    text-decoration: underline;
}

.sr-tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sr-tut-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.sr-tut-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--church-gold);
    color: var(--bg-dark);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sr-tut-step div {
    flex: 1;
}

@media (max-width: 768px) {
    .sr-two-col,
    .sr-four-col {
        grid-template-columns: 1fr;
    }
    .sr-progress-bar {
        flex-wrap: wrap;
    }
    .sr-prog-section {
        font-size: 0.55rem;
        padding: 0.2rem 0.3rem;
    }
    .tutorial-selector {
        flex-direction: column;
    }
}

.hp35-tile-grid {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    align-items: flex-start;
}

.hp35-tile-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.hp35-tile {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
}

.hp35-tile-calc {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    justify-content: center;
}

@media (max-width: 700px) {
    .hp35-tile-grid {
        flex-direction: column;
    }
}

.hp35-tile-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--church-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.hp35-body {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #444;
    border-radius: 16px;
    padding: 20px 16px 24px;
    width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

.hp35-brand {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 8px 12px;
}

.hp35-hp-logo {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #888;
    font-weight: 300;
    text-transform: uppercase;
}

.hp35-model {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ccc;
    font-style: italic;
}

.hp35-screen {
    background: #0a0a0a;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 12px 16px 10px;
    margin-bottom: 16px;
    position: relative;
    min-height: 48px;
}

.hp35-arc-indicator {
    position: absolute;
    top: 2px;
    left: 8px;
    font-size: 0.55rem;
    color: #ff3333;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.hp35-screen-value {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    color: #ff3333;
    text-align: right;
    text-shadow: 0 0 8px rgba(255,50,50,0.6);
    letter-spacing: 2px;
    min-height: 28px;
    overflow: hidden;
    white-space: nowrap;
}

.hp35-keys {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hp35-key-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.hp35-key {
    width: 54px;
    height: 36px;
    border: none;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hp35-key:active {
    transform: translateY(1px);
    filter: brightness(0.85);
}

.hp35-key-digit {
    background: linear-gradient(180deg, #555, #3a3a3a);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.hp35-key-digit:hover {
    background: linear-gradient(180deg, #666, #4a4a4a);
}

.hp35-key-op {
    background: linear-gradient(180deg, #cc6600, #994d00);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.hp35-key-op:hover {
    background: linear-gradient(180deg, #dd7711, #aa5500);
}

.hp35-key-fn {
    background: linear-gradient(180deg, #2a4a6a, #1a3050);
    color: #ccdde8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-size: 0.68rem;
}

.hp35-key-fn:hover {
    background: linear-gradient(180deg, #3a5a7a, #2a4060);
}

.hp35-key-enter {
    width: 116px;
    background: linear-gradient(180deg, #2a4a6a, #1a3050);
    color: #ccdde8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-size: 0.72rem;
    letter-spacing: 1px;
}

.hp35-key-enter:hover {
    background: linear-gradient(180deg, #3a5a7a, #2a4060);
}

.hp35-stack-display {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hp35-stack-reg {
    background: #0a0e1a;
    border: 1px solid #2a2a3a;
    border-radius: 4px;
    padding: 5px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #ff4444;
}

.hp35-reg-label {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 8px;
}

.hp35-reg-value {
    color: #ff4444;
}


.hp35-stack-guide-body p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.hp35-stack-guide-body strong {
    color: var(--text-primary);
}

.hp35-stack-diagram {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 8px 0;
}

.hp35-stack-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: #1a1f2e;
    border-radius: 4px;
    border-left: 3px solid var(--church-gold);
}

.hp35-sreg {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--church-gold);
    min-width: 18px;
}

.hp35-sdesc {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.hp35-stack-tips {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.hp35-tip-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 4px;
}

.hp35-stack-tips p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.hp35-example {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--text-primary);
    background: #1a1f2e;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 4px 0 8px;
}

.hp35-ekey {
    background: var(--church-gold);
    color: #1a1400;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
}

.hp35-tile-trace {
    max-height: none;
    overflow-y: visible;
}

.hp35-trace-area {
    padding: 2px 0;
}

.hp35-trace-entry {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(45,55,72,0.4);
}

.hp35-trace-latest {
    background: rgba(233,69,96,0.08);
}

.hp35-trace-lambda {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: #88ccff;
    word-break: break-all;
    line-height: 1.3;
}

.hp35-trace-desc {
    font-size: 0.66rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

#abacusContainer, #slideruleContainer {
    flex: 1;
    overflow-y: auto;
}

.abacus-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    padding: 8px 0;
    align-items: start;
}

.abacus-tile {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
}

.abacus-tile-calc {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    justify-content: center;
}

.abacus-tile-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.abacus-tile-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--church-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.abacus-tile-trace {
    max-height: 300px;
    overflow-y: auto;
}

.abacus-frame {
    background: linear-gradient(145deg, #2a1a0a, #3a2510);
    border: 3px solid #8B7355;
    border-radius: 12px;
    padding: 16px 12px;
    width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

.abacus-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 4px 10px;
}

.abacus-title-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--church-gold);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.abacus-title-ns {
    font-size: 0.65rem;
    color: #8B7355;
    font-family: 'Courier New', monospace;
}

.abacus-readout {
    background: #0a0a0a;
    border: 2px solid #444;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    text-align: right;
}

.abacus-readout-value {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    color: var(--church-gold);
    text-shadow: 0 0 8px rgba(218,165,32,0.4);
    letter-spacing: 2px;
}

.abacus-rods-area {
    display: flex;
    gap: 2px;
    justify-content: center;
    padding: 4px 0;
}

.abacus-rod {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 24px;
    position: relative;
}

.abacus-rod::after {
    content: '';
    position: absolute;
    top: 18px;
    bottom: 0;
    width: 2px;
    background: #8B7355;
    z-index: 0;
}

.abacus-rod-label {
    font-size: 0.5rem;
    color: #8B7355;
    margin-bottom: 2px;
    font-family: 'Courier New', monospace;
    z-index: 1;
}

.abacus-heaven-zone {
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    z-index: 1;
}

.abacus-beam-bar {
    height: 4px;
    width: 100%;
    background: #8B7355;
    border-radius: 2px;
    z-index: 1;
}

.abacus-earth-zone {
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 2px;
    padding-top: 4px;
    z-index: 1;
}

.abacus-bead {
    width: 20px;
    height: 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 2;
    position: relative;
}

.abacus-heaven-bead {
    background: linear-gradient(180deg, #555, #333);
    border: 1px solid #666;
    margin-bottom: 24px;
}

.abacus-heaven-bead.active {
    background: linear-gradient(180deg, var(--church-gold), #b8860b);
    border-color: var(--church-gold);
    margin-bottom: 0;
    box-shadow: 0 0 8px rgba(218,165,32,0.5);
}

.abacus-earth-bead {
    background: linear-gradient(180deg, #555, #333);
    border: 1px solid #666;
}

.abacus-earth-bead.active {
    background: linear-gradient(180deg, var(--church-gold), #b8860b);
    border-color: var(--church-gold);
    box-shadow: 0 0 6px rgba(218,165,32,0.4);
}

.abacus-bead:hover {
    filter: brightness(1.3);
}

.abacus-controls {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.abacus-btn {
    padding: 6px 20px;
    background: linear-gradient(180deg, #8B7355, #6B5335);
    color: #fff;
    border: 1px solid #a08060;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.abacus-btn:hover {
    background: linear-gradient(180deg, #a08060, #8B7355);
}


.abacus-place-info {
    font-size: 0.68rem;
    color: #8B7355;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 10px;
    text-align: center;
}


.abacus-trace-area {
    overflow-y: auto;
    padding: 2px 0;
    flex: 1;
}

.abacus-trace-entry {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(45,55,72,0.4);
}

.abacus-trace-latest {
    background: rgba(139,115,85,0.1);
}

.abacus-trace-lambda {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: #cc9933;
    word-break: break-all;
    line-height: 1.3;
}

.abacus-trace-desc {
    font-size: 0.66rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.sliderule-tile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 8px 0;
    align-items: start;
}

.sliderule-tile {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
}

.sliderule-tile-calc {
    background: transparent;
    border: none;
    padding: 0;
}

.sliderule-tile-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.sliderule-tile-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--church-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.sliderule-tile-trace {
    max-height: 300px;
    overflow-y: auto;
}

.sliderule-body {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #555;
    border-radius: 12px;
    padding: 16px 12px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.sliderule-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 4px 10px;
}

.sliderule-title-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--church-gold);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sliderule-title-ns {
    font-size: 0.65rem;
    color: #888;
    font-family: 'Courier New', monospace;
}

.sliderule-readout {
    background: #0a0a0a;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    text-align: center;
}

.sliderule-readout-value {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #33cc66;
    letter-spacing: 1px;
}

.sliderule-svg {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.sliderule-lock-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 20, 10, 0.92);
    border: 1px solid #cc9933;
    color: #cc9933;
    font-size: 0.72rem;
    font-family: monospace;
    padding: 6px 14px;
    border-radius: 6px;
    display: none;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.sliderule-lock-msg.visible {
    display: block;
    animation: slideruleLockFade 2.2s ease forwards;
}

@keyframes slideruleLockFade {
    0% { opacity: 0; }
    8% { opacity: 1; }
    75% { opacity: 1; }
    100% { opacity: 0; }
}

.sliderule-instructions {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 4px 0;
}

.sliderule-presets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.sliderule-explanation {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(26, 45, 26, 0.5);
    border: 1px solid #3a5a3a;
    border-radius: 6px;
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.sliderule-expl-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: #cc9933;
    margin-bottom: 6px;
}
.sliderule-expl-body {
    margin-bottom: 8px;
    color: #c8c8c8;
}
.sliderule-expl-scales {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sliderule-expl-scale {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    color: #88aacc;
    padding: 2px 0;
}
.sliderule-expl-layout {
    margin-top: 8px;
    font-size: 0.68rem;
    color: #99aa88;
    font-style: italic;
    border-top: 1px solid #3a5a3a;
    padding-top: 6px;
}
.sliderule-layout-ref {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(40, 30, 15, 0.5);
    border: 1px solid #5a4a2a;
    border-radius: 4px;
    flex-wrap: wrap;
}
.sliderule-layout-label {
    color: #888;
    font-size: 0.62rem;
    text-transform: uppercase;
}
.sliderule-layout-scales {
    font-weight: 700;
    font-size: 0.72rem;
}
.sliderule-layout-sep {
    color: #555;
    margin: 0 2px;
}

.sliderule-scale-selector {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.sliderule-scale-btn {
    padding: 5px 10px;
    background: linear-gradient(180deg, #2a2a2a, #1a1a1a);
    color: #999;
    border: 1px solid #444;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.sliderule-scale-btn .sliderule-scale-desc {
    font-size: 0.52rem;
    font-weight: 400;
    opacity: 0.7;
}

.sliderule-scale-btn:hover {
    color: #ccc;
    border-color: #888;
}

.sliderule-scale-btn.active {
    background: linear-gradient(180deg, #3a2a10, #2a1a05);
    color: var(--church-gold);
    border-color: var(--church-gold);
    box-shadow: 0 0 6px rgba(218,165,32,0.3);
}

.sliderule-preset-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.sliderule-preset-btn {
    padding: 4px 10px;
    background: linear-gradient(180deg, #333, #222);
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 0.68rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.sliderule-preset-btn:hover {
    background: linear-gradient(180deg, #444, #333);
    color: var(--church-gold);
    border-color: var(--church-gold);
}

.sliderule-info-panel {
    width: 100%;
}

.sliderule-info-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.5;
}

.sliderule-info-text em {
    color: var(--church-gold);
    font-style: italic;
}

.sliderule-trace-inline {
    overflow: hidden;
    max-height: 200px;
    display: flex;
    flex-direction: column;
}

.sliderule-trace-header {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--church-gold);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sliderule-trace-area {
    overflow-y: auto;
    padding: 2px 0;
    flex: 1;
}

.sliderule-trace-entry {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(45,55,72,0.4);
}

.sliderule-trace-latest {
    background: rgba(51,204,102,0.06);
}

.sliderule-trace-lambda {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: #33cc66;
    word-break: break-all;
    line-height: 1.3;
}

.sliderule-trace-desc {
    font-size: 0.66rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.sliderule-fp-body p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.sliderule-fp-body strong {
    color: var(--text-primary);
}

.sliderule-fp-diagram {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 10px 0;
}

.sliderule-fp-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #1a1f2e;
    border-radius: 4px;
    font-size: 0.72rem;
}

.sliderule-fp-label {
    min-width: 70px;
    color: var(--church-gold);
    font-weight: 700;
}

.sliderule-fp-parts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sliderule-fp-sign {
    color: #ff6699;
    font-weight: 600;
}

.sliderule-fp-mant {
    color: #33cc66;
    font-weight: 600;
}

.sliderule-fp-exp {
    color: #4fc3f7;
    font-weight: 600;
}

.sliderule-fp-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.sliderule-fp-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--church-gold);
    margin-bottom: 4px;
}

@keyframes intro-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 18px;
    z-index: 9999;
    transition: transform 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.pull-refresh-arrow {
    font-size: 1.2rem;
    color: var(--church-gold);
    transition: transform 0.1s ease;
    display: inline-block;
}

.pull-refresh-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.pull-refresh-indicator.ready .pull-refresh-text {
    color: var(--church-gold);
}

@keyframes pullSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-share-icon {
    font-size: 0.9rem;
    padding: 0.25rem 0.45rem;
    line-height: 1;
}

.share-link-dialog {
    max-width: 480px;
}

.share-link-desc {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: 0 0 0.75rem;
}

.share-link-url-box {
    display: flex;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.share-link-input {
    flex: 1;
    background: var(--bg-dark);
    color: var(--church-gold);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.45rem 0.6rem;
    font-family: monospace;
    font-size: 0.78rem;
    outline: none;
    min-width: 0;
}

.share-link-input:focus {
    border-color: var(--church-gold);
}

.share-link-copy {
    white-space: nowrap;
    padding: 0.45rem 1rem;
}

.share-link-status {
    font-size: 0.75rem;
    min-height: 1.2em;
    margin-bottom: 0.5rem;
}

.share-link-status.success {
    color: #33cc66;
}

.share-link-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.sr-instr-tip {
    position: relative;
    cursor: help;
    color: var(--church-gold);
    font-weight: bold;
    border-bottom: 1px dotted rgba(200, 155, 60, 0.4);
}

.sr-instr-tip[data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 6px);
    left: 0;
    transform: none;
    text-align: left;
    max-width: 320px;
    white-space: normal;
    font-weight: normal;
    line-height: 1.4;
}

/* ── TSB Audit Mode ─────────────────────────────────────────────── */
.pipeline-audit .audit-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
}

.audit-gate {
    border-radius: 6px;
    padding: 10px 14px;
    border-left: 4px solid #555;
    background: rgba(30, 30, 40, 0.7);
    transition: background 0.2s;
}

.audit-gate.gate-pass {
    border-left-color: #33cc66;
    background: rgba(20, 60, 35, 0.6);
}

.audit-gate.gate-fail {
    border-left-color: #cc3344;
    background: rgba(60, 20, 25, 0.6);
}

.audit-gate.gate-active {
    box-shadow: 0 0 0 2px rgba(200, 155, 60, 0.6);
}

.audit-gate.gate-done {
    opacity: 0.85;
}

.gate-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.gate-type-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.gate-mload {
    background: rgba(40, 110, 170, 0.4);
    color: #7ec8f0;
    border: 1px solid rgba(120, 180, 230, 0.35);
}

.gate-msave {
    background: rgba(140, 80, 20, 0.4);
    color: #f0bb6a;
    border: 1px solid rgba(220, 160, 60, 0.35);
}

.gate-navana {
    background: rgba(100, 40, 140, 0.4);
    color: #c8a0f0;
    border: 1px solid rgba(160, 100, 220, 0.35);
}

.gate-label {
    color: #e8e0d0;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gate-perm-req {
    color: #aaa;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.gate-perm-req b {
    color: #f0d080;
}

.gate-result {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.result-pass {
    color: #33cc66;
    background: rgba(30, 80, 45, 0.5);
}

.result-fail {
    color: #cc3344;
    background: rgba(80, 25, 30, 0.5);
}

.gate-checks {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.gate-check {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 3px;
    font-weight: 600;
}

.check-pass {
    background: rgba(30, 80, 45, 0.5);
    color: #55ee88;
    border: 1px solid rgba(50, 140, 70, 0.4);
}

.check-fail {
    background: rgba(80, 20, 25, 0.5);
    color: #ff6677;
    border: 1px solid rgba(160, 50, 60, 0.4);
}

.check-range.check-pass {
    background: rgba(20, 55, 70, 0.55);
    color: #5dd6f5;
    border: 1px solid rgba(40, 120, 160, 0.4);
}

.check-range.check-fail {
    background: rgba(80, 45, 10, 0.6);
    color: #ffaa33;
    border: 1px solid rgba(180, 100, 20, 0.5);
    font-weight: 700;
}

.check-skipped {
    background: rgba(40, 40, 50, 0.4);
    color: #888;
    border: 1px dashed rgba(120, 120, 140, 0.35);
    font-style: italic;
}

.fault-scope-section {
    margin-bottom: 0.85rem;
    border: 1px solid rgba(255, 170, 50, 0.4);
    border-left: 4px solid #ffaa33;
    border-radius: 5px;
    padding: 8px 12px;
    background: rgba(80, 45, 10, 0.3);
}

.fault-scope-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffaa33;
    margin-bottom: 4px;
}

.fault-scope-detail {
    font-size: 0.82rem;
    color: #e0c080;
}

.fault-scope-detail code {
    background: rgba(255, 170, 50, 0.15);
    border-radius: 3px;
    padding: 1px 4px;
    color: #ffcc66;
    font-family: var(--font-mono, monospace);
}

.fault-trace-section {
    margin-bottom: 0.85rem;
    border: 1px solid rgba(100,180,220,0.18);
    border-radius: 5px;
    overflow: hidden;
    font-size: 0.8rem;
}
.fault-trace-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #88bbdd;
    background: rgba(0,0,0,0.22);
    padding: 4px 10px;
    border-bottom: 1px solid rgba(100,180,220,0.12);
}
.fault-trace-scroll {
    overflow-x: auto;
    max-height: 160px;
    overflow-y: auto;
}
.fault-trace-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
}
.fault-trace-table thead th {
    background: rgba(0,0,0,0.18);
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(100,180,220,0.12);
    white-space: nowrap;
}
.fault-trace-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.10);
}
.fault-trace-table tbody tr:hover {
    background: rgba(80,160,220,0.10);
}
.fault-trace-table tbody td {
    padding: 3px 8px;
    white-space: nowrap;
}
.itrace-step { color: var(--text-secondary); }
.itrace-addr { color: #88ddaa; }
.itrace-raw  { color: #aaa; font-size: 0.72rem; }
.itrace-instr { color: #ddeeff; }
tr.itrace-fault {
    background: rgba(220, 60, 60, 0.18) !important;
    border-left: 3px solid #e05555;
}
tr.itrace-fault td { color: #ff9999; }

.gate-flag {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 3px;
    color: #aaa;
    background: rgba(40, 40, 50, 0.5);
    border: 1px solid rgba(100, 100, 120, 0.3);
}

/* Regular instruction steps inside audit mode */
.audit-instr-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-radius: 5px;
    background: rgba(25, 25, 35, 0.5);
    border-left: 4px solid rgba(100, 100, 120, 0.4);
    font-size: 0.8rem;
}

.audit-instr-step.instr-done {
    opacity: 0.75;
}

.instr-stage-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    font-weight: bold;
    color: #c8c0b0;
    background: rgba(50, 50, 65, 0.6);
    padding: 2px 7px;
    border-radius: 3px;
    flex-shrink: 0;
    min-width: 52px;
    text-align: center;
}

.instr-desc {
    color: #b0a898;
    flex: 1;
    font-size: 0.78rem;
}

.instr-status-ok  { color: #33cc66; font-weight: bold; }
.instr-status-fail { color: #cc3344; font-weight: bold; }

.pipeline-fault {
    color: #cc3344;
    font-weight: bold;
}

/* TSB Audit guide (empty state) */
.audit-guide ol.audit-guide-steps {
    text-align: left;
    margin: 10px 0 10px 0;
    padding-left: 1.4em;
    color: #c8c0b0;
    font-size: 0.82rem;
    line-height: 1.8;
}
.audit-guide ol.audit-guide-steps li b {
    color: #f0d080;
}

/* Gate Log empty state */
.gate-log-empty {
    padding: 16px;
    color: #9a9080;
    font-size: 0.84rem;
    text-align: center;
}
.gate-log-empty p {
    margin: 0 0 8px 0;
}

/* NIA table on Pipeline page — vertical layout */
.nia-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 10px 0;
    font-size: 0.82rem;
    background: rgba(0,0,0,0.18);
    border: 1px solid rgba(180,160,100,0.15);
    border-radius: 5px;
    overflow: hidden;
}
.nia-table td {
    padding: 4px 10px;
    vertical-align: middle;
    white-space: nowrap;
}
.nia-row-last td { color: #7a7060; border-bottom: 1px solid rgba(180,160,100,0.10); }
.nia-row-curr td { background: rgba(220,180,40,0.08); border-bottom: 1px solid rgba(180,160,100,0.10); }
.nia-row-next td { color: #7a7060; }

/* label column */
.nia-lbl {
    width: 54px;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    border-right: 1px solid rgba(180,160,100,0.13);
}
.nia-row-last .nia-lbl { color: #8a7a60; }
.nia-row-curr .nia-lbl { color: #f0d060; }
.nia-row-next .nia-lbl { color: #8a7a60; }

/* address column */
.nia-addr { width: 66px; }
.nia-row-last .nia-addr code { color: #908060; font-family: var(--font-mono, monospace); font-size: 0.82rem; }
.nia-row-curr .nia-addr code { color: #ffe060; font-family: var(--font-mono, monospace); font-size: 0.84rem; font-weight: 700; }
.nia-row-next .nia-addr code { color: #908060; font-family: var(--font-mono, monospace); font-size: 0.82rem; }

/* disassembly column */
.nia-disasm { width: 52%; }
.nia-row-last .nia-disasm code { color: #7a7060; font-family: var(--font-mono, monospace); font-size: 0.80rem; }
.nia-row-curr .nia-disasm code { color: #d0c890; font-family: var(--font-mono, monospace); font-size: 0.82rem; }
.nia-row-next .nia-disasm code { color: #7a7060; font-family: var(--font-mono, monospace); font-size: 0.80rem; }

/* program / offset column */
.nia-loc { text-align: right; }
.nia-loc-text {
    display: inline-block;
    font-size: 0.76rem;
    font-family: var(--font-mono, monospace);
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(180,160,80,0.10);
}
.nia-row-last .nia-loc-text { color: #7a7060; }
.nia-row-curr .nia-loc-text { color: #c0a840; background: rgba(180,160,80,0.17); }
.nia-row-next .nia-loc-text { color: #7a7060; }

/* ── Fault Popup Modal ───────────────────────────────────────── */
.fault-dialog {
    min-width: 380px;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(220, 60, 60, 0.45);
    box-shadow: 0 0 32px rgba(200, 40, 40, 0.18), 0 4px 24px rgba(0,0,0,0.6);
}

.fault-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.fault-type-badge {
    display: inline-block;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid;
    text-transform: uppercase;
    white-space: nowrap;
}

.fault-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e05050;
    flex: 1;
}

.fault-modal-message {
    font-size: 0.86rem;
    color: var(--text-primary);
    background: rgba(200,40,40,0.08);
    border-left: 3px solid rgba(220,60,60,0.5);
    border-radius: 0 4px 4px 0;
    padding: 8px 12px;
    margin-bottom: 1rem;
    font-family: var(--font-mono, monospace);
    line-height: 1.5;
    word-break: break-word;
}

.fault-detail-grid {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    border: 1px solid rgba(180,160,100,0.12);
    border-radius: 5px;
    overflow: hidden;
    font-size: 0.82rem;
}

.fault-detail-row {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid rgba(180,160,100,0.08);
}

.fault-detail-row:last-child {
    border-bottom: none;
}

.fault-detail-label {
    flex: 0 0 86px;
    padding: 5px 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(0,0,0,0.18);
    border-right: 1px solid rgba(180,160,100,0.10);
}

.fault-detail-value {
    flex: 1;
    padding: 5px 10px;
    color: var(--text-primary);
    font-family: var(--font-mono, monospace);
    background: rgba(0,0,0,0.06);
    word-break: break-word;
    min-width: 0;
}

.fault-detail-value code {
    font-family: var(--font-mono, monospace);
    color: #d0c890;
    font-size: 0.83rem;
}

.fault-history-row .fault-detail-value {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    font-family: inherit;
}

.fault-hist-item {
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    background: rgba(220,60,60,0.12);
    color: #c07070;
    border-radius: 3px;
    padding: 1px 6px;
}

.fault-hist-item.fault-hist-current {
    background: rgba(220,60,60,0.25);
    color: #e08080;
    font-weight: 600;
}

.fault-code-val {
    font-family: var(--font-mono, monospace);
    color: #f0b050;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ── Register snapshot sections inside fault modal ──────────── */
.fault-regs-section {
    margin-bottom: 0.85rem;
    border: 1px solid rgba(100,140,200,0.18);
    border-radius: 5px;
    overflow: hidden;
    font-size: 0.8rem;
}

.fault-regs-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.22);
    padding: 4px 10px;
    border-bottom: 1px solid rgba(100,140,200,0.12);
}

.fault-regs-scroll {
    overflow-x: auto;
    max-height: 160px;
    overflow-y: auto;
}

.fault-regs-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
}

.fault-regs-table thead th {
    background: rgba(0,0,0,0.18);
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(100,140,200,0.12);
    white-space: nowrap;
}

.fault-regs-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.10);
}

.fault-regs-table tbody tr:hover {
    background: rgba(80,120,200,0.10);
}

.fault-regs-table td {
    padding: 3px 8px;
    white-space: nowrap;
    border-bottom: 1px solid rgba(100,140,200,0.06);
}

.freg-name  { color: #90b8f0; font-weight: 600; }
.freg-type  { color: #a0c888; }
.freg-slot  { color: #c0a860; }
.freg-perms { color: #d08858; font-weight: 600; letter-spacing: 0.02em; }
.freg-base  { color: #a0a8c0; }

.fault-dr-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(100,140,200,0.08);
}

.freg-dr {
    font-family: var(--font-mono, monospace);
    font-size: 0.76rem;
    background: rgba(100,160,220,0.10);
    border: 1px solid rgba(100,160,220,0.18);
    border-radius: 3px;
    padding: 1px 7px;
    color: #90b8d0;
    white-space: nowrap;
}

.fault-flags-row {
    font-family: var(--font-mono, monospace);
    font-size: 0.76rem;
    color: var(--text-secondary);
    padding: 5px 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.freg-flag {
    font-family: var(--font-mono, monospace);
    font-size: 0.76rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.freg-flag.flag-set {
    color: #f0c060;
    opacity: 1;
    font-weight: 700;
}

.btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #991b1b;
}
.btn-danger:hover { background: #991b1b; }
.btn-muted {
    background: #374151;
    color: #9ca3af;
    border-color: #4b5563;
}
.btn-muted:hover { background: #4b5563; color: #d1d5db; }

.lump-map { margin-top: 0.5rem; }
.lump-map-bar {
    display: flex;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #374151;
    margin-bottom: 0.35rem;
}
.lump-seg {
    height: 100%;
    min-width: 2px;
    transition: opacity 0.15s;
    cursor: default;
}
.lump-seg:hover { opacity: 0.8; }
.lump-seg-hdr   { background: #6b7280; }
.lump-seg-code  { background: #22d3ee; }
.lump-seg-free  { background: #1e293b; border-left: 1px dashed #334155; border-right: 1px dashed #334155; }
.lump-seg-clist { background: #a78bfa; }

.lump-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.lump-leg {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.lump-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.lump-swatch-hdr   { background: #6b7280; }
.lump-swatch-code  { background: #22d3ee; }
.lump-swatch-free  { background: #1e293b; border: 1px dashed #334155; }
.lump-swatch-clist { background: #a78bfa; }

#builderView {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.builder-layout {
    display: flex;
    height: 100%;
    gap: 0;
}

.builder-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: #0d1b2a;
    border-bottom: 1px solid var(--border);
}

.builder-title {
    color: var(--church-gold);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.builder-toolbar-actions {
    display: flex;
    gap: 0.4rem;
}

.hardware-build-panel {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.hardware-build-header {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 160px;
}

.hardware-build-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--church-gold);
    letter-spacing: 0.3px;
}

.hardware-build-subtitle {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.hardware-build-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.hardware-build-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.hardware-build-info {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: var(--mono);
    opacity: 0.85;
    flex: 1;
    min-width: 200px;
}

.builder-view-tab-row {
    display: flex;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem 0;
    border-bottom: 1px solid rgba(218,165,32,0.2);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.builder-view-tab {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    color: var(--text-secondary);
    padding: 0.3rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, background 0.15s;
}
.builder-view-tab:hover { color: var(--text-primary); background: rgba(218,165,32,0.05); }
.builder-view-tab.active {
    color: var(--church-gold);
    background: var(--bg-primary);
    border-color: rgba(218,165,32,0.3);
}

.build-details-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem;
    gap: 0.75rem;
}

.build-details-status-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
}

.build-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.3s;
}
.build-status-dot.idle    { background: var(--text-secondary); }
.build-status-dot.running { background: #f0a020; animation: pulse-dot 0.8s ease-in-out infinite; }
.build-status-dot.ok      { background: var(--church-green); }
.build-status-dot.error   { background: var(--accent); }

@keyframes pulse-dot {
    0%,100% { opacity: 1; } 50% { opacity: 0.3; }
}

.build-status-label {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.build-status-board {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--church-gold);
    opacity: 0.85;
}

.build-details-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: 1fr;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.build-details-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow: hidden;
    min-height: 0;
}

.build-details-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
}

.build-log-area {
    flex-grow: 1;
    height: 0;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.6rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #c8c8c8;
    overflow-y: scroll;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    scroll-behavior: auto;
}

.build-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.build-file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.76rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
}

.build-file-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.build-file-empty {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.4rem 0;
}

.build-next-steps {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.build-step-row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 0.25rem 0;
}

.build-step-num {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--church-gold);
    background: rgba(218,165,32,0.12);
    border-radius: 3px;
    padding: 1px 5px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 1px;
}

.builder-export-btn {
    background: #2a6fdb !important;
    color: #fff !important;
    border: none !important;
}

.builder-clear-btn {
    background: var(--bg-panel) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
}

.builder-canvas {
    flex: 1;
    background: #0a0a1a;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.builder-svg {
    display: block;
}

.builder-side-panel {
    width: 320px;
    min-width: 280px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.builder-panel-empty {
    color: var(--text-secondary);
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
}

.builder-panel-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.builder-label-input {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
}

.builder-label-input:focus {
    outline: none;
    border-color: var(--church-gold);
}

.builder-add-btn {
    background: #4a7a2e !important;
    color: #fff !important;
    border: none !important;
    white-space: nowrap;
}

.builder-back-btn {
    background: var(--bg-input) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
    white-space: nowrap;
}

.builder-ns-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.builder-ns-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.builder-ns-card:hover {
    border-color: #3a86ff;
}

.builder-ns-card.selected {
    border-color: var(--church-gold);
    background: rgba(251, 191, 36, 0.06);
}

.builder-ns-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.builder-ns-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--church-blue);
    flex: 1;
}

.builder-ns-count {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.builder-remove-btn {
    background: none;
    border: none;
    color: #f87171;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}

.builder-remove-btn:hover {
    color: #ef4444;
}

.builder-panel-hint {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-align: center;
    padding: 1rem;
}

.builder-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 1.2rem 0.8rem;
    text-align: center;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.builder-drop-zone.drag-over {
    border-color: var(--church-gold);
    background: rgba(251, 191, 36, 0.06);
}

.builder-drop-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.builder-drop-text {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
}

.builder-drop-sub {
    color: #555;
    font-size: 0.72rem;
}

.builder-file-label {
    color: var(--church-blue);
    cursor: pointer;
    text-decoration: underline;
}

.builder-error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid #7f1d1d;
    border-radius: 4px;
    color: #f87171;
    font-size: 0.78rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.builder-abs-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}

.builder-dep-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.builder-abs-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.5rem;
    position: relative;
    z-index: 1;
}

.builder-abs-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.builder-abs-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--church-gold);
    flex: 1;
}

.builder-abs-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.builder-abs-grants {
    font-size: 0.72rem;
    color: var(--church-green);
    margin-top: 0.2rem;
}

.builder-abs-methods {
    font-size: 0.72rem;
    color: var(--church-blue);
    margin-top: 0.15rem;
}

.builder-abs-deps {
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.builder-deps-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.builder-dep {
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 3px;
}

.builder-dep.resolved {
    background: rgba(74, 222, 128, 0.12);
    color: var(--church-green);
}

.builder-dep.unresolved {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

.builder-ns-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 5px;
    padding: 0.6rem;
    text-align: center;
    margin-bottom: 0.3rem;
    transition: border-color 0.2s, background 0.2s;
}

.builder-ns-drop-zone.drag-over {
    border-color: var(--church-gold);
    background: rgba(251, 191, 36, 0.06);
}

.builder-drop-hint {
    font-size: 0.72rem;
    color: #555;
}

.builder-cross-deps-section {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
}

.builder-cross-deps-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--church-gold);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.builder-cross-dep {
    font-size: 0.72rem;
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 3px;
}

.builder-cross-dep.resolved {
    background: rgba(74, 222, 128, 0.1);
    color: var(--church-green);
}

.builder-cross-dep.unresolved {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.builder-dep-arrows {
    z-index: 0;
}

.builder-palette-card {
    display: inline-block;
    background: #1a1a2e;
    border: 1.5px dashed #3a86ff;
    border-radius: 5px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-family: monospace;
    color: #3a86ff;
    cursor: grab;
    user-select: none;
    transition: border-color 0.2s, background 0.2s;
    margin-right: 4px;
}

.builder-palette-card:hover {
    border-color: var(--church-gold);
    color: var(--church-gold);
    background: #1a1500;
}

.builder-palette-card:active {
    cursor: grabbing;
}

.builder-cross-ns-lines {
    z-index: 0;
}

.builder-abs-deps-details {
    margin-top: 3px;
}

.builder-abs-deps-details > summary {
    cursor: pointer;
    font-size: 0.72rem;
    color: #aaa;
    user-select: none;
}

.builder-abs-deps-details > summary:hover {
    color: var(--church-gold);
}

.builder-abs-deps-details[open] > summary {
    margin-bottom: 3px;
}

.builder-help-btn {
    background: var(--bg-input) !important;
    color: var(--church-gold) !important;
    border: 1px solid var(--church-gold) !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    min-width: 26px;
    padding: 2px 6px !important;
    border-radius: 50% !important;
    line-height: 1;
}

.builder-help-btn:hover {
    background: rgba(251, 191, 36, 0.15) !important;
}

.builder-hint-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: rgba(58, 134, 255, 0.08);
    border: 1px solid rgba(58, 134, 255, 0.25);
    border-radius: 5px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0.35rem 0;
}

.builder-hint-banner span {
    flex: 1;
}

.builder-hint-banner code {
    background: #1a1a2e;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: var(--church-gold);
    font-size: 0.74rem;
}

.builder-hint-schema {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.2);
}

.builder-hint-dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.builder-hint-dismiss:hover {
    color: var(--text-primary);
}

.builder-map-btns {
    display: flex;
    gap: 2px;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    padding: 2px 3px;
}

.builder-map-btn {
    background: none !important;
    border: none !important;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 4px !important;
    cursor: pointer;
    border-radius: 4px !important;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s;
    min-width: 0;
}

.builder-map-btn:hover {
    opacity: 0.9;
    background: rgba(255,255,255,0.08) !important;
}

.builder-map-btn.active {
    opacity: 1;
    background: rgba(251,191,36,0.15) !important;
    box-shadow: 0 0 0 1px rgba(251,191,36,0.3);
}

.builder-location-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: rgba(74,222,128,0.05);
    border: 1px solid rgba(74,222,128,0.15);
    border-radius: 5px;
    margin: 0.35rem 0;
}

.builder-location-icon {
    font-size: 0.9rem;
    line-height: 1;
    flex-shrink: 0;
}

.builder-location-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.builder-location-input::placeholder {
    color: #555;
}

.builder-locate-btn {
    background: rgba(74,222,128,0.12) !important;
    border: 1px solid rgba(74,222,128,0.25) !important;
    color: #4ade80 !important;
    font-size: 0.72rem !important;
    padding: 2px 8px !important;
    flex-shrink: 0;
}

.builder-locate-btn:hover {
    background: rgba(74,222,128,0.22) !important;
}

.builder-data-attrs {
    margin: 0.35rem 0;
    border: 1px solid rgba(251,191,36,0.15);
    border-radius: 5px;
    background: rgba(251,191,36,0.03);
    padding: 0.4rem 0.5rem;
}

.builder-data-attrs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.builder-data-attrs-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--church-gold);
    opacity: 0.8;
}

.builder-add-attr-btn {
    background: rgba(251,191,36,0.1) !important;
    border: 1px solid rgba(251,191,36,0.25) !important;
    color: var(--church-gold) !important;
    font-size: 0.68rem !important;
    padding: 1px 7px !important;
}

.builder-add-attr-btn:hover {
    background: rgba(251,191,36,0.2) !important;
}

.builder-attr-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.builder-attr-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.builder-attr-key,
.builder-attr-val {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.73rem;
    font-family: monospace;
    padding: 2px 6px;
    outline: none;
    min-width: 0;
}

.builder-attr-key {
    flex: 0.8;
    color: var(--church-gold);
}

.builder-attr-key:focus,
.builder-attr-val:focus {
    border-color: rgba(251,191,36,0.4);
}

.builder-attr-eq {
    font-size: 0.75rem;
    color: #555;
    flex-shrink: 0;
}

.builder-attr-empty {
    font-size: 0.72rem;
    color: #555;
    font-style: italic;
    padding: 2px 0;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Implementation Status ─────────────────────────────────────── */
:root {
    --impl-pseudo:    #6b7280;
    --impl-js:        #ef4444;
    --impl-cloomc:    #c084fc;
    --impl-installed: #22c55e;
    --impl-tested:    #38bdf8;
    --impl-released:  #f1f5f9;
}

.impl-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.impl-dot-pseudo    { background: var(--impl-pseudo); }
.impl-dot-js        { background: var(--impl-js);        box-shadow: 0 0 4px var(--impl-js); }
.impl-dot-cloomc    { background: var(--impl-cloomc);    box-shadow: 0 0 4px var(--impl-cloomc); }
.impl-dot-installed { background: var(--impl-installed); box-shadow: 0 0 4px var(--impl-installed); }
.impl-dot-tested    { background: var(--impl-tested);    box-shadow: 0 0 5px var(--impl-tested); }
.impl-dot-released  { background: var(--impl-released);  box-shadow: 0 0 5px var(--impl-released); }

/* abs-item: add third column for the status dot */
.abs-item {
    grid-template-columns: 1fr auto auto;
}
.abs-item-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    justify-self: center;
    align-self: center;
}

/* Legend strip */
.impl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    border-radius: 5px;
    margin-bottom: 7px;
    font-size: 0.6rem;
    line-height: 1;
}
.impl-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.impl-legend-swatch {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Status select in method panel */
.impl-status-select {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    border: 1px solid;
    background: transparent;
    cursor: pointer;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    outline: none;
    transition: opacity 0.15s;
    margin-left: auto;
}
.impl-status-select:hover { opacity: 0.75; }
.impl-status-select option {
    background: #1a1a2e;
    color: #eaeaea;
    text-transform: none;
    font-weight: normal;
    font-size: 0.75rem;
}
.impl-status-pseudo    { color: var(--impl-pseudo);    border-color: var(--impl-pseudo); }
.impl-status-js        { color: var(--impl-js);        border-color: var(--impl-js); }
.impl-status-cloomc    { color: var(--impl-cloomc);    border-color: var(--impl-cloomc); }
.impl-status-installed { color: var(--impl-installed); border-color: var(--impl-installed); }
.impl-status-tested    { color: var(--impl-tested);    border-color: var(--impl-tested); }
.impl-status-released  { color: var(--impl-released);  border-color: var(--impl-released); }

/* Badge inside method tab chip */
.abs-method-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 1px 5px 1px 4px;
    border-radius: 8px;
    border: 1px solid currentColor;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.4;
    transition: opacity 0.15s;
}
.abs-method-status-badge:hover { opacity: 0.8; }
.abs-method-status-badge-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.abs-method-status-badge-pseudo    { color: var(--impl-pseudo); }
.abs-method-status-badge-js        { color: var(--impl-js); }
.abs-method-status-badge-cloomc    { color: var(--impl-cloomc); }
.abs-method-status-badge-installed { color: var(--impl-installed); }
.abs-method-status-badge-tested    { color: var(--impl-tested); }
.abs-method-status-badge-released  { color: var(--impl-released); }

/* Floating status dropdown (appended to body) */
.abs-status-dropdown {
    position: fixed;
    z-index: 9999;
    background: #1b2d45;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.55);
    min-width: 160px;
    padding: 4px 0;
    font-size: 0.72rem;
}
.abs-status-dropdown-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    color: var(--text-secondary);
}
.abs-status-dropdown-option:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.abs-status-dropdown-option.current { background: rgba(255,255,255,0.04); }
.abs-status-dropdown-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Boot Sequence Code section */
.abs-boot-code-section .abs-detail-label {
    color: var(--impl-installed);
    border-bottom-color: var(--impl-installed);
}
.abs-boot-code-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-style: italic;
}
.abs-boot-code-desc code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-style: normal;
    color: var(--church-gold);
    font-size: 0.68rem;
}
.abs-boot-code-pre {
    border-left: 3px solid var(--impl-installed) !important;
}

/* ── Tools View ─────────────────────────────────────────────────────────── */
.tools-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
    box-sizing: border-box;
    align-content: start;
}
@media (max-width: 760px) {
    .tools-layout { grid-template-columns: 1fr; }
}
.tools-panel {
    background: var(--panel-bg, #10101e);
    border: 1px solid var(--border, #1e2040);
    border-radius: 10px;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.tools-panel-header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    border-bottom: 1px solid var(--border, #1e2040);
    padding-bottom: 0.9rem;
}
.tools-panel-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}
.tools-panel-title {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    color: var(--church-gold, #daa520);
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.tools-panel-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
}
/* Stat grid */
.tools-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.tools-stat-card {
    background: var(--sim-bg, #08080f);
    border: 1px solid var(--border, #1e2040);
    border-radius: 7px;
    padding: 0.6rem 0.4rem;
    text-align: center;
}
.tools-stat-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--church-gold, #daa520);
    line-height: 1.2;
}
.tools-stat-label {
    font-size: 0.62rem;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}
/* Phase list */
.tools-phases { display: flex; flex-direction: column; gap: 0.4rem; }
.tools-phase {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    padding: 0.35rem 0.5rem;
    border-radius: 5px;
    background: var(--sim-bg, #08080f);
}
.tools-phase-num {
    width: 1.4em; height: 1.4em;
    border-radius: 50%;
    background: var(--church-gold, #daa520);
    color: #000;
    font-weight: 700;
    font-size: 0.72rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.tools-phase-name {
    color: #e2e8f0;
    font-weight: 600;
    min-width: 5.5em;
}
.tools-phase-desc { color: var(--text-secondary, #888); }
/* Action row */
.tools-action-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.2rem;
}
.tools-last-run {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    font-style: italic;
}
/* Buttons */
.tools-btn {
    border: none;
    border-radius: 7px;
    padding: 0.55rem 1.1rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.tools-btn:active { transform: scale(0.97); }
.tools-btn-primary {
    background: var(--church-gold, #daa520);
    color: #000;
}
.tools-btn-primary:hover { opacity: 0.88; }
.tools-btn-secondary {
    background: #1e2040;
    color: #e2e8f0;
    border: 1px solid #38bdf8;
}
.tools-btn-secondary:hover { background: #28305a; }
/* GitHub cards */
.tools-gh-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}
.tools-gh-card {
    background: var(--sim-bg, #08080f);
    border: 1px solid var(--border, #1e2040);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tools-gh-card-icon {
    font-size: 1.5rem;
    color: #38bdf8;
}
.tools-gh-card-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: #e2e8f0;
}
.tools-gh-card-desc {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    line-height: 1.5;
    flex: 1;
}
.tools-gh-note {
    font-size: 0.7rem;
    color: var(--text-secondary, #888);
    border-top: 1px solid var(--border, #1e2040);
    padding-top: 0.7rem;
    line-height: 1.5;
}
.tools-link-btn {
    background: none;
    border: none;
    color: #38bdf8;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
}

/* ── Tools GC Phase Cards ───────────────────────────────────────────────── */
.tools-panel-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.tgc-run-btn {
    margin-left: auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
    flex-shrink: 0;
}
.tgc-run-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.tgc-phase-cards {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.tgc-card {
    border: 1px solid var(--border, #1e2040);
    border-radius: 7px;
    overflow: hidden;
    transition: border-color 0.3s, background 0.3s;
    background: var(--sim-bg, #08080f);
}
.tgc-card[data-state="idle"] {
    border-color: #1e2040;
    opacity: 0.65;
}
.tgc-card[data-state="running"] {
    border-color: var(--church-gold, #daa520);
    opacity: 1;
    animation: tgcPulse 0.6s ease-in-out infinite alternate;
}
.tgc-card[data-state="done"] {
    border-color: #22c55e;
    opacity: 1;
    animation: none;
}
.tgc-card[data-state="error"] {
    border-color: #ef4444;
    opacity: 1;
}
@keyframes tgcPulse {
    from { box-shadow: 0 0 0 0 rgba(218,165,32,0.0); }
    to   { box-shadow: 0 0 8px 2px rgba(218,165,32,0.35); }
}
.tgc-card-hdr {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
}
.tgc-card-num {
    width: 1.5em; height: 1.5em;
    border-radius: 50%;
    background: #1e2040;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s, color 0.3s;
}
.tgc-card[data-state="running"] .tgc-card-num {
    background: var(--church-gold, #daa520);
    color: #000;
}
.tgc-card[data-state="done"] .tgc-card-num {
    background: #22c55e;
    color: #000;
}
.tgc-card[data-state="error"] .tgc-card-num {
    background: #ef4444;
    color: #fff;
}
.tgc-card-title-col {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}
.tgc-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
}
.tgc-card-static-desc {
    font-size: 0.68rem;
    color: var(--text-secondary, #888);
}
.tgc-card-badge {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 2em;
    text-align: right;
    flex-shrink: 0;
    color: #22c55e;
    transition: color 0.3s;
}
.tgc-card[data-state="running"] .tgc-card-badge { color: var(--church-gold, #daa520); }
.tgc-card[data-state="error"]   .tgc-card-badge { color: #ef4444; font-size: 0.62rem; }
.tgc-card-report {
    padding: 0 0.7rem 0.5rem 2.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.tgc-card-report:empty { display: none; }
.tgc-line {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.67rem;
    color: #a0aec0;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── GC View (standalone page) ──────────────────────────────────────────── */
.gc-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.2rem 1.4rem 1rem;
    gap: 1rem;
    box-sizing: border-box;
    overflow: hidden;
}
.gc-topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border, #1e2040);
    padding-bottom: 0.9rem;
}
.gc-topbar-left { flex: 1; min-width: 0; }
.gc-title {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    color: var(--church-gold, #daa520);
    font-weight: 600;
}
.gc-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    margin-top: 0.2rem;
}
.gc-topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.gc-stat-grid {
    grid-template-columns: repeat(4, auto) !important;
    gap: 0.5rem !important;
}
/* Horizontal phase cards — override the previous flex-column */
#gc .tgc-phase-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}
#gc .tgc-card {
    display: flex;
    flex-direction: column;
}
#gc .tgc-card-report {
    flex: 1;
    overflow-y: auto;
    padding-left: 0.7rem;
    padding-bottom: 0.6rem;
}
.gc-last-run {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    font-style: italic;
    flex-shrink: 0;
    text-align: right;
}

/* ── GitHub View (standalone page) ─────────────────────────────────────── */
.github-layout {
    padding: 1.5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.gh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gh-header-left { flex: 1; }
.gh-refresh-btn {
    background: transparent;
    border: 1px solid var(--border, #1e2040);
    color: var(--text-secondary, #888);
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gh-refresh-btn:hover { border-color: var(--church-gold, #daa520); color: var(--church-gold, #daa520); }
.gh-refresh-btn.spinning { animation: gh-spin 0.8s linear infinite; }
@keyframes gh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.gh-repos-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.gh-repo-card {
    background: var(--panel-bg, #10101e);
    border: 1px solid var(--border, #1e2040);
    border-radius: 10px;
    padding: 1.2rem 1.4rem;
    transition: border-color 0.2s;
}
.gh-repo-card:hover { border-color: var(--church-gold, #daa520); }
.gh-repo-name {
    font-size: 1rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 0.3rem;
}
.gh-repo-name a {
    color: #38bdf8;
    text-decoration: none;
}
.gh-repo-name a:hover { text-decoration: underline; }
.gh-repo-desc {
    font-size: 0.78rem;
    color: var(--text-secondary, #888);
    line-height: 1.5;
    margin-bottom: 0.7rem;
}
.gh-repo-stats {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.gh-stat {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.gh-stat-val { color: #e2e8f0; font-weight: 600; }
.gh-stat-icon { font-size: 0.85rem; }

.gh-section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.gh-section-panel {
    background: var(--panel-bg, #10101e);
    border: 1px solid var(--border, #1e2040);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    min-height: 200px;
    max-height: 380px;
    overflow-y: auto;
}
.gh-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--church-gold, #daa520);
    margin-bottom: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gh-loading-placeholder {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    font-style: italic;
    padding: 1rem 0;
}

.gh-commit-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    align-items: flex-start;
}
.gh-commit-item:last-child { border-bottom: none; }
.gh-commit-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--border, #1e2040);
}
.gh-commit-info { flex: 1; min-width: 0; }
.gh-commit-msg {
    font-size: 0.78rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gh-commit-msg a { color: #e2e8f0; text-decoration: none; }
.gh-commit-msg a:hover { color: #38bdf8; }
.gh-commit-meta {
    font-size: 0.68rem;
    color: var(--text-secondary, #888);
    margin-top: 0.15rem;
}
.gh-commit-sha {
    font-family: 'Fira Mono', monospace;
    color: #38bdf8;
    font-size: 0.68rem;
}

.gh-contributors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.gh-contributor {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, #1e2040);
    border-radius: 20px;
    padding: 0.3rem 0.7rem 0.3rem 0.3rem;
    transition: border-color 0.2s;
    text-decoration: none;
}
.gh-contributor:hover { border-color: #38bdf8; }
.gh-contributor-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border, #1e2040);
}
.gh-contributor-name {
    font-size: 0.72rem;
    color: #e2e8f0;
    font-weight: 500;
}
.gh-contributor-count {
    font-size: 0.65rem;
    color: var(--text-secondary, #888);
}

.gh-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.gh-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #38bdf8;
    text-decoration: none;
    background: rgba(56,189,248,0.06);
    border: 1px solid rgba(56,189,248,0.15);
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    transition: all 0.2s;
}
.gh-quick-link:hover {
    background: rgba(56,189,248,0.12);
    border-color: #38bdf8;
}

.gh-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}
.gh-full-card {
    background: var(--panel-bg, #10101e);
    border: 1px solid var(--border, #1e2040);
    border-radius: 10px;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.2s;
}
.gh-full-card:hover { border-color: #38bdf8; }
.gh-full-icon {
    font-size: 1.6rem;
    color: #38bdf8;
    line-height: 1;
}
.gh-full-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
}
.gh-full-desc {
    font-size: 0.78rem;
    color: var(--text-secondary, #888);
    line-height: 1.5;
    flex: 1;
}
.gh-full-btn {
    align-self: flex-start;
    margin-top: 0.3rem;
}
.gh-footer-message {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    line-height: 1.7;
    padding: 1rem 2rem 0.5rem;
    font-style: italic;
}
.gh-get-started-link {
    color: var(--church-gold, #daa520);
    font-weight: 700;
    font-style: normal;
    text-decoration: none;
    font-size: 0.95rem;
}
.gh-get-started-link:hover { text-decoration: underline; }
.editor-patch-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    background: rgba(200,155,60,0.1);
    border: 1px solid rgba(200,155,60,0.3);
    border-radius: 6px;
    margin-bottom: 0.3rem;
}
.editor-patch-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--church-gold, #daa520);
    margin-right: 0.3rem;
    white-space: nowrap;
}
.editor-patch-btn {
    font-size: 0.72rem !important;
    padding: 0.2rem 0.6rem !important;
    border: 1px solid var(--border, #1e2040) !important;
    background: var(--panel-bg, #10101e) !important;
    color: #e2e8f0 !important;
    border-radius: 4px !important;
    cursor: pointer;
    white-space: nowrap;
}
.editor-patch-btn:hover { border-color: var(--church-gold, #daa520) !important; color: var(--church-gold, #daa520) !important; }
.editor-patch-btn-fpga { color: #4ade80 !important; }
.editor-patch-btn-fpga:hover { color: #22c55e !important; border-color: #22c55e !important; }
.editor-patch-btn-close {
    font-size: 0.72rem !important;
    padding: 0.15rem 0.45rem !important;
    background: transparent !important;
    border: 1px solid var(--border, #1e2040) !important;
    color: var(--text-secondary, #888) !important;
    border-radius: 4px !important;
    cursor: pointer;
}
.editor-patch-btn-close:hover { border-color: #e74c3c !important; color: #e74c3c !important; }
.mtbf-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}
.mtbf-red     { background: #3a1111; color: #f87171; border: 1px solid #7f1d1d; }
.mtbf-amber   { background: #3a2a0a; color: #fbbf24; border: 1px solid #78350f; }
.mtbf-green   { background: #0a3a1a; color: #4ade80; border: 1px solid #14532d; }
.mtbf-unknown { background: #1c1c2a; color: #9ca3af; border: 1px solid #374151; }
@media (max-width: 768px) {
    .gh-repos-row, .gh-section-grid, .gh-actions-row { grid-template-columns: 1fr; }
}

#trace.view.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.trace-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-secondary, #1a1a2e);
    border-bottom: 1px solid var(--border, #333);
    flex-shrink: 0;
}
.trace-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--text-primary, #e0e0e0);
}
.trace-row-count {
    font-size: 0.82rem;
    color: var(--text-secondary, #888);
}
.trace-clear-btn {
    margin-left: auto;
    background: #c0392b;
    color: #fff;
    border: none;
    font-size: 0.78rem;
    padding: 0.2rem 0.7rem;
    border-radius: 3px;
    cursor: pointer;
}
.trace-clear-btn:hover { background: #e74c3c; }
.trace-table-wrap {
    flex: 1;
    overflow: auto;
    position: relative;
}
.trace-table {
    border-collapse: collapse;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.72rem;
    width: max-content;
    min-width: 100%;
}
.trace-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}
.trace-table th {
    background: var(--bg-secondary, #1a1a2e);
    color: var(--text-secondary, #aaa);
    padding: 0.25rem 0.4rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--border, #444);
    font-weight: 600;
    font-size: 0.7rem;
}
.trace-table td {
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-primary, #d0d0d0);
}
.trace-table tbody tr:hover {
    background: rgba(255,255,255,0.04);
}
.trace-row-skipped td {
    opacity: 0.35;
}
.trace-td-changed {
    color: #f1c40f !important;
    font-weight: bold;
}
.trace-th-desc { min-width: 180px; }
.trace-th-step { min-width: 36px; }
.trace-th-pc { min-width: 40px; }
.trace-th-op { min-width: 50px; }
.trace-th-cond { min-width: 30px; }
.trace-th-dst { min-width: 30px; }
.trace-th-src { min-width: 30px; }

#version-tag {
    position: fixed;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: #555;
    font-family: 'Courier New', monospace;
    pointer-events: none;
    z-index: 1;
}

.devices-layout {
    padding: 1.2rem;
    max-width: 900px;
    margin: 0 auto;
}
.dev-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.dev-header-left { flex: 1; }
.dev-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.dev-empty {
    color: #888;
    font-style: italic;
    padding: 2rem 1rem;
    text-align: center;
}
.dev-entry {
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.dev-entry:has(.dev-row-open) { border-color: var(--church-gold, #daa520); }
.dev-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    background: var(--panel-bg, #1a1a2a);
    user-select: none;
    transition: background 0.15s;
}
.dev-row:hover { background: #222238; }
.dev-row-open { background: #1e1e30; }
.dev-row-name {
    font-weight: 600;
    color: var(--church-gold, #daa520);
    font-size: 0.92rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dev-status-chip {
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}
.chip-online { background: #1a3a1a; color: #4caf50; }
.chip-offline { background: #2a2a2a; color: #888; }
.dev-chevron {
    font-size: 0.65rem;
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.dev-row-open .dev-chevron { transform: rotate(90deg); }
.dev-detail {
    display: none;
    padding: 0.7rem 1rem;
    background: #111120;
    border-top: 1px solid #2e2e2e;
}
.dev-detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.5rem;
    margin-bottom: 0.65rem;
}
.dev-detail-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.8rem;
}
.dev-detail-label {
    color: #666;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.dev-detail-val {
    color: #ccc;
    font-family: monospace;
    font-size: 0.82rem;
}
.dev-detail-footer {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}
.dev-detail-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}
.dev-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dev-status-dot.online { background: #4caf50; box-shadow: 0 0 5px #4caf5080; }
.dev-status-dot.offline { background: #555; }
.dev-badge {
    display: inline-block;
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.dev-badge-full { background: #2d4a22; color: #8bc34a; }
.dev-badge-iot { background: #1a3a4a; color: #4fc3f7; }
.dev-badge-official { background: #2e4a1e; color: #66bb6a; border: 1px solid #4a7a2e; }
.dev-badge-custom { background: #4a3a1a; color: #ffb74d; border: 1px solid #7a5a2e; }
.dev-fault-badge { background: #5a1a1a; color: #ef5350; border: 1px solid #8a2222; border-radius: 4px; padding: 0 0.3rem; font-size: 0.7rem; font-weight: 600; margin-left: 0.3rem; }
.dev-label-input {
    background: transparent;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    padding: 2px 6px;
    font-size: 0.82rem;
    width: 150px;
}
.dev-label-input:focus { border-color: var(--church-gold, #daa520); outline: none; }
.dev-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}
.dev-action-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.dev-action-btn:hover { background: #333; border-color: var(--church-gold, #daa520); color: #fff; }
.dev-action-btn.dev-action-disabled { opacity: 0.4; cursor: not-allowed; }
.dev-deploy-all-btn {
    background: #2d4a22;
    border: 1px solid #4caf50;
    color: #8bc34a;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.dev-deploy-all-btn:hover { background: #3a5a2e; color: #fff; }
.dev-deploy-status {
    font-size: 0.78rem;
    margin-top: 4px;
    font-weight: 600;
}
.dev-deploy-deploying { color: #ffb74d; }
.dev-deploy-success { color: #4caf50; }
.dev-deploy-failed { color: #ef5350; }
.deploy-program-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
    transition: background 0.15s;
}
.deploy-program-option:hover { background: #2a2a2a; }
.deploy-program-option input[type="radio"] { accent-color: var(--church-gold, #daa520); }
.deploy-program-list { border: 1px solid #333; border-radius: 4px; padding: 0.3rem; }
.dev-fault-log-btn {
    background: #3a1a1a;
    border: 1px solid #8a2222;
    color: #ef5350;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.dev-fault-log-btn:hover { background: #4a2222; color: #fff; }
.fault-log-container { font-size: 0.85rem; max-height: 60vh; overflow-y: auto; }
.fault-log-title { font-weight: 700; color: var(--church-gold, #daa520); margin-bottom: 0.5rem; font-size: 0.9rem; }
.fault-log-empty { color: #888; font-style: italic; padding: 0.5rem 0; }
.fault-mtbf-table, .fault-events-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.fault-mtbf-table th, .fault-events-table th {
    text-align: left;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #444;
    color: #aaa;
    font-weight: 600;
}
.fault-mtbf-table td, .fault-events-table td {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid #2a2a2a;
}
.fault-addr { font-family: monospace; color: #7dd3fc; }
.fault-loc { font-family: monospace; color: #e8b84a; }
.fault-count { text-align: center; }
.fault-mtbf { font-weight: 600; }
.fault-ts { color: #888; font-size: 0.78rem; }
.fault-dev { color: #aaa; }
.mtbf-cell-green { color: #4ade80; }
.mtbf-cell-amber { color: #fbbf24; }
.mtbf-cell-red { color: #ef5350; }
