: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;
}

.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);
}

.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;
}

#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; }

.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-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.85rem;
    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.85rem;
    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; }
.code-editor-wrap:focus-within { outline: 1px solid var(--accent); }

.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;
    border-color: var(--church-green);
    font-weight: 600;
}

.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);
}

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

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

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

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

.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: auto;
    white-space: pre;
    line-height: 1.4;
    max-height: calc(100vh - 160px);
}

.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;
}

.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;
}

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

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; }
.ns-label-col { font-style: italic; }
.ns-flag { text-align: center; color: var(--church-gold); font-weight: 600; }

.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: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 320px;
    max-width: 420px;
}

.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-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;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    padding: 0.3rem;
    background: #0d1b2a;
    border-radius: 6px;
}

.crd-tab {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    background: #1b2d45;
    color: #e0e0e0;
    border: 2px solid #3a86ff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.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);
}

.ref-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    height: calc(100vh - 70px);
    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-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%;
}

.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-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-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);
}

@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-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;
    }

    .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: 400px;
    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-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);
}

.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: 560px;
    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;
}

.btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #991b1b;
}
.btn-danger:hover { background: #991b1b; }

.builder-layout {
    display: flex;
    height: calc(100vh - 60px);
    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;
}

.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;
}
