/* ── Reset & Base ─────────────────────────────────────────────────────── */

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

:root,
:root[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #171923;
    --surface-2: #1e2130;
    --border: #2d3148;
    --text: #e2e8f0;
    --text-muted: #718096;
    --accent: #63b3ed;
    --accent-hover: #90cdf4;
    --green: #48bb78;
    --red: #fc8181;
    --yellow: #f6e05e;
    --yellow-dark: #b7a42e;
    --yellow-bright: #fef08a;
    --orange: #ed8936;
    --purple: #b794f4;
    /* Memory trace R/W — QIRA-style yellow pair by default; overridable via Memory tab pickers */
    --mem-access-read: var(--yellow-dark);
    --mem-access-read-bg: rgba(183, 164, 46, 0.25);
    --mem-access-read-badge-bg: rgba(183, 164, 46, 0.2);
    --mem-access-write: var(--yellow-bright);
    --mem-access-write-bg: rgba(254, 240, 138, 0.35);
    --mem-access-write-badge-bg: rgba(254, 240, 138, 0.2);
    --mem-access-rw: var(--yellow-bright);
    --mem-access-rw-bg: rgba(237, 137, 54, 0.3);
    --mono: "SF Mono", "Fira Code", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 8px;
}

/* Light (white) theme */
:root[data-theme="light"] {
    --bg: #f7fafc;
    --surface: #ffffff;
    --surface-2: #edf2f7;
    --border: #e2e8f0;
    --text: #1a202c;
    --text-muted: #718096;
    --accent: #3182ce;
    --accent-hover: #2c5282;
    --green: #276749;
    --red: #c53030;
    --yellow: #b7791f;
    --yellow-dark: #975a16;
    --yellow-bright: #d69e2e;
    --orange: #c05621;
    --purple: #553c9a;
    --mem-access-read: var(--yellow-dark);
    --mem-access-read-bg: rgba(151, 90, 22, 0.2);
    --mem-access-read-badge-bg: rgba(151, 90, 22, 0.16);
    --mem-access-write: var(--yellow-bright);
    --mem-access-write-bg: rgba(214, 158, 46, 0.28);
    --mem-access-write-badge-bg: rgba(214, 158, 46, 0.18);
    --mem-access-rw: var(--yellow-bright);
    --mem-access-rw-bg: rgba(192, 86, 33, 0.22);
}

/* Unicorn theme — soft pastels, magical ✨ */
:root[data-theme="unicorn"] {
    --bg: #fff5f8;
    --surface: #ffe8f0;
    --surface-2: #fce4ec;
    --border: #f8bbd9;
    --text: #4a1942;
    --text-muted: #880e4f;
    --accent: #c2185b;
    --accent-hover: #ad1457;
    --green: #66bb6a;
    --red: #ec407a;
    --yellow: #ffb74d;
    --yellow-dark: #ff8f00;
    --yellow-bright: #ffcc80;
    --orange: #ff7043;
    --purple: #ba68c8;
    --mem-access-read: var(--yellow-dark);
    --mem-access-read-bg: rgba(255, 143, 0, 0.22);
    --mem-access-read-badge-bg: rgba(255, 143, 0, 0.18);
    --mem-access-write: var(--yellow-bright);
    --mem-access-write-bg: rgba(255, 204, 128, 0.32);
    --mem-access-write-badge-bg: rgba(255, 204, 128, 0.22);
    --mem-access-rw: var(--yellow-bright);
    --mem-access-rw-bg: rgba(255, 112, 67, 0.26);
}

/* Rainbow theme — vivid and cheerful 🌈 */
:root[data-theme="rainbow"] {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface-2: #1f3460;
    --border: #533483;
    --text: #e8e0f0;
    --text-muted: #a78bfa;
    --accent: #22d3ee;
    --accent-hover: #67e8f9;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fde047;
    --yellow-dark: #eab308;
    --yellow-bright: #fef08a;
    --orange: #fb923c;
    --purple: #c084fc;
    --mem-access-read: var(--yellow-dark);
    --mem-access-read-bg: rgba(234, 179, 8, 0.28);
    --mem-access-read-badge-bg: rgba(234, 179, 8, 0.22);
    --mem-access-write: var(--yellow-bright);
    --mem-access-write-bg: rgba(254, 240, 138, 0.35);
    --mem-access-write-badge-bg: rgba(254, 240, 138, 0.2);
    --mem-access-rw: var(--yellow-bright);
    --mem-access-rw-bg: rgba(251, 146, 60, 0.3);
}

/* Rainbow theme: subtle gradient on body for extra flair */
:root[data-theme="rainbow"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #1e1b4b 70%, #1a1a2e 100%);
}

/* Nyan Cat theme — space + rainbow 🌌🐱🌈 */
:root[data-theme="nyan"] {
    --bg: #0f0c1a;
    --surface: #1a1530;
    --surface-2: #251e40;
    --border: #4a3f6b;
    --text: #e8e4f0;
    --text-muted: #a78bfa;
    --accent: #f472b6;
    --accent-hover: #fb7185;
    --green: #34d399;
    --red: #f87171;
    --yellow: #fde047;
    --yellow-dark: #facc15;
    --yellow-bright: #fef08a;
    --orange: #fb923c;
    --purple: #c084fc;
    --mem-access-read: var(--yellow-dark);
    --mem-access-read-bg: rgba(250, 204, 21, 0.28);
    --mem-access-read-badge-bg: rgba(250, 204, 21, 0.22);
    --mem-access-write: var(--yellow-bright);
    --mem-access-write-bg: rgba(254, 240, 138, 0.35);
    --mem-access-write-badge-bg: rgba(254, 240, 138, 0.2);
    --mem-access-rw: var(--yellow-bright);
    --mem-access-rw-bg: rgba(251, 146, 60, 0.3);
}

:root[data-theme="nyan"] body {
    background: linear-gradient(180deg, #0f0c1a 0%, #1a1530 50%, #0f0c1a 100%);
}

/* Nyan cat run overlay — fixed, full viewport, above content */
.nyan-cat-container {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.nyan-cat-container.nyan-cat-visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s;
}

.nyan-cat-run {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: -280px;
    will-change: left;
}

.nyan-cat-container.nyan-cat-visible .nyan-cat-run {
    animation: nyan-cat-run 4.5s linear forwards;
}

.nyan-cat-gif {
    display: block;
    width: 256px;
    height: auto;
    max-height: 128px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(244, 114, 182, 0.4));
}

@keyframes nyan-cat-run {
    0% { left: -280px; }
    100% { left: 100%; }
}

html {
    font-size: 14px;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main: flex column so debugger area is constrained and timeline stays visible at bottom */
main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Header ──────────────────────────────────────────────────────────── */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: box-shadow 0.2s ease;
}
.header-logo:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.header-logo-img {
    display: block;
    height: 1.75rem;
    width: auto;
    object-fit: contain;
}
.header-title-wrap {
    min-width: 0;
}
.header-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
    line-height: 1.2;
    margin: 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin: 0.05rem 0 0 0;
    line-height: 1.2;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ── Controls ────────────────────────────────────────────────────────── */

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.upload-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-name {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.75rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.file-info-badge {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.65rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
}
.file-info-popup {
    position: fixed;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text);
    max-width: 520px;
    word-break: break-all;
}
.file-info-popup .fi-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.15rem 0;
}
.file-info-popup .fi-label {
    color: var(--text-muted);
    min-width: 6ch;
    flex-shrink: 0;
}
.file-info-popup .fi-value {
    color: var(--text);
    user-select: all;
}
.program-args-input {
    min-width: 140px;
    max-width: 220px;
    padding: 0.2rem 0.4rem;
    font-size: 0.72rem;
    font-family: var(--mono);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
}
.program-args-input::placeholder { color: var(--text-muted); }

.vt-hash-input {
    min-width: 10rem;
    max-width: 22rem;
    flex: 0 1 16rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.72rem;
    font-family: var(--mono);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
}
.vt-hash-input::placeholder { color: var(--text-muted); }

.prefs-modal .prefs-note {
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
    line-height: 1.45;
}
.prefs-label {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}
.prefs-input {
    width: 100%;
    max-width: 420px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    font-family: var(--mono);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
}
.prefs-input::placeholder { color: var(--text-muted); }
.prefs-key-status {
    font-size: 0.75rem;
    margin: 0.45rem 0 0;
    min-height: 1.2em;
}
.prefs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.sysroot-name {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.sysroot-name .sysroot-clear {
    padding: 0 0.25rem;
    min-width: 1.25rem;
    line-height: 1.2;
}

.quick-sysroot-select {
    font-family: var(--sans);
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    min-width: 7rem;
}
.quick-sysroot-select:hover { border-color: var(--accent); }
.quick-sysroot-select:focus { outline: none; border-color: var(--accent); }

.shellcode-panel,
.shellcode-file-prompt {
    flex-basis: 100%;
    width: 100%;
    padding: 0.5rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.shellcode-panel .shellcode-row { margin-bottom: 0.5rem; }
.shellcode-panel .shellcode-row:last-child { margin-bottom: 0; }
.shellcode-panel label { font-size: 0.75rem; color: var(--text-muted); }
.shellcode-textarea {
    display: block;
    width: 100%;
    min-height: 4rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}
.shellcode-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.shellcode-arch { font-size: 0.75rem; padding: 0.25rem 0.5rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.shellcode-demo-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.shellcode-demo-select { font-size: 0.8rem; padding: 0.3rem 0.5rem; min-width: 12rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.shellcode-hint, .shellcode-file-msg { font-size: 0.7rem; color: var(--text-muted); }
.shellcode-file-prompt { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.action-buttons {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
    align-items: center;
    flex-wrap: wrap;
}

.step-n-group {
    display: inline-flex;
    align-items: stretch;
    gap: 0.35rem;
}
.step-n-group .btn {
    border-radius: var(--radius);
}
.step-n-select {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.35rem;
    padding-right: 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35rem center;
    background-size: 8px 5px;
    min-width: 3rem;
}
.step-n-select:hover {
    background-color: var(--surface-3);
}
.step-n-select:focus {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.btn {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.7rem; }
.btn-xs { padding: 0.15rem 0.4rem; font-size: 0.65rem; border-radius: 4px; }

.btn-demo { background: #ffb6c1; color: #5c2a2a; border-color: #e8959e; }
.btn-demo:hover:not(:disabled) { background: #ffc0cb; color: #4a2222; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text-muted); }
.btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text); }

.btn-accent { background: var(--green); color: var(--bg); border-color: var(--green); }
.btn-accent:hover:not(:disabled) { filter: brightness(1.1); }

.btn-accent-run { background: var(--purple); color: var(--bg); border-color: var(--purple); }
.btn-accent-run:hover:not(:disabled) { filter: brightness(1.15); }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: var(--bg); }

/* ── Debugger Layout (3 columns, resizable) ───────────────────────────── */

.debugger-layout {
    --col-disasm: 320px;
    --col-right: 340px;
    display: flex;
    flex-direction: row;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.disasm-panel {
    width: var(--col-disasm);
    min-width: 200px;
    max-width: 60vw;
    flex: 0 0 auto;
}

.center-panel {
    flex: 1 1 0;
    min-width: 0;
}

.right-panel {
    width: var(--col-right);
    min-width: 260px;
    max-width: 50vw;
    flex: 0 0 auto;
}

.layout-resizer {
    width: 6px;
    flex-shrink: 0;
    cursor: col-resize;
    background: var(--border);
    transition: background 0.1s;
}
.layout-resizer:hover,
.layout-resizer.resizing {
    background: var(--accent);
}
.layout-resizer::after {
    content: '';
    display: block;
    width: 2px;
    height: 100%;
    margin: 0 auto;
    background: inherit;
}

@media (max-width: 1100px) {
    .debugger-layout {
        flex-wrap: wrap;
    }
    .disasm-panel { flex: 1 1 45%; min-width: 260px; }
    .center-panel { flex: 1 1 45%; min-width: 260px; }
    .right-panel { flex: 1 1 100%; width: 100%; }
    .layout-resizer { display: none; }
}

@media (max-width: 700px) {
    .disasm-panel, .center-panel { flex: 1 1 100%; width: 100%; min-width: 0; }
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.layout-resizer + .panel { border-left: none; }
.panel.right-panel { border-right: none; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.disasm-fn-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--accent);
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Badges ──────────────────────────────────────────────────────────── */

.badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.badge.running    { color: var(--green); border-color: var(--green); }
.badge.paused     { color: var(--orange); border-color: var(--orange); }
.badge.breakpoint { color: var(--red); border-color: var(--red); }
.badge.exited     { color: var(--accent); border-color: var(--accent); }
.badge.error      { color: var(--red); border-color: var(--red); }

.mode-badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */

.center-tabs,
.right-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.tab-btn {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Wrapper that holds scroll; keeps timeline visible when tab content is large */
.tab-scroll-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: block;
}
.tab-scroll-wrap > .terminal {
    flex: none;
    min-height: 0;
    margin: 0;
    display: block;
}

/* ── Disassembly Panel ───────────────────────────────────────────────── */

.disasm-search-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.disasm-search-input {
    font-family: var(--mono);
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    flex: 1;
    min-width: 8ch;
}
.disasm-search-input:focus { outline: 1px solid var(--accent); }
.disasm-search-mode {
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.disasm-search-status {
    font-size: 0.65rem;
    font-family: var(--mono);
    color: var(--accent);
    min-width: 3ch;
}
.disasm-search-status.muted { color: var(--text-muted); }
.disasm-line.disasm-search-hit { background: rgba(237, 217, 99, 0.15); }
.disasm-line.disasm-search-current { background: rgba(99, 179, 237, 0.2); outline: 1px solid var(--accent); }

.disasm-listing {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    background: var(--bg);
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.7;
    min-height: 0;
}

.disasm-listing .muted {
    padding: 2rem;
    color: var(--text-muted);
    font-family: var(--sans);
}

.center-text { text-align: center; }

.disasm-fn-header {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    padding: 0.35rem 0.5rem 0.1rem 0.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.disasm-fn-header:first-child { border-top: none; }

.disasm-src-line {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--green);
    padding: 0.05rem 0.5rem 0.05rem 2.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
    user-select: none;
}

.disasm-annotation {
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.05rem 0.5rem 0.05rem 2.2rem;
    user-select: none;
    cursor: default;
}
.disasm-label {
    color: var(--accent);
    font-weight: 600;
}
.disasm-comment {
    color: var(--text-muted);
    font-style: italic;
}
.disasm-string-ref {
    color: var(--green);
    font-style: italic;
}

.disasm-line {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.5rem;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.disasm-line:hover {
    background: var(--surface-2);
}

.disasm-line.disasm-current {
    background: rgba(99, 179, 237, 0.12);
    border-left-color: var(--accent);
}

.disasm-line.disasm-bp {
    background: rgba(252, 129, 129, 0.08);
}

.disasm-line.disasm-current.disasm-bp {
    background: rgba(252, 129, 129, 0.15);
    border-left-color: var(--red);
}

.disasm-line.disasm-syscall {
    border-left: 3px solid #06b6d4;
}
.disasm-line.disasm-current.disasm-syscall {
    border-left-color: #06b6d4;
}

.disasm-bp-col {
    width: 16px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

.bp-marker {
    color: var(--red);
    font-size: 0.7rem;
}

.bp-marker-empty {
    color: var(--red);
    font-size: 0.65rem;
    opacity: 0.45;
    transition: opacity 0.1s;
}

.disasm-line:hover .bp-marker-empty {
    opacity: 1;
}

.disasm-addr {
    color: var(--text-muted);
    min-width: 10ch;
    flex-shrink: 0;
}

.disasm-region {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    margin-left: 0.35rem;
    border-radius: 3px;
    background: var(--surface-2);
    color: var(--text-muted);
    flex-shrink: 0;
    max-width: 8ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disasm-region[title*="main"] { color: var(--green); }
.disasm-region[title*="interpreter"],
.disasm-region[title*="ld-linux"] { color: var(--yellow); }
.disasm-region[title*=".so"] { color: var(--purple); }
.disasm-region[title*="mapped"] { color: var(--text-muted); }

.disasm-instr {
    color: var(--text);
    flex: 1;
}

.disasm-instr .disasm-mnemonic { color: var(--accent); font-weight: 600; }
.disasm-instr .disasm-reg     { color: var(--yellow); }
.disasm-instr .disasm-imm     { color: var(--green); }
.disasm-instr .disasm-mem     { color: var(--purple); }

.disasm-arrow {
    color: var(--accent);
    font-weight: 700;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.disasm-jump-arrow {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
}
.disasm-jump-arrow.disasm-jump-inview {
    color: var(--green);
    cursor: pointer;
}
.disasm-jump-arrow.disasm-jump-inview:hover {
    text-decoration: underline;
    color: var(--accent);
}

/* ── Terminal ────────────────────────────────────────────────────────── */

.terminal {
    flex: 1;
    min-height: 0; /* allow shrink so tab scrolls; timeline stays visible */
    padding: 0.75rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.6;
    background: var(--bg);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
}

.terminal .muted { color: var(--text-muted); }
.terminal .error { color: var(--red); }
.terminal .info  { color: var(--accent); }

.stdin-prompt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.stdin-prompt label { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.stdin-prompt .stdin-input {
    flex: 1;
    min-width: 12ch;
    font-family: var(--mono);
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
}

.strace-search-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.strace-search-input {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    flex: 1;
    min-width: 10ch;
}
.strace-search-input:focus { outline: 1px solid var(--accent); }
.strace-search-mode {
    font-size: 0.7rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.strace-search-status {
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--accent);
    min-width: 3ch;
}
.strace-search-status.muted { color: var(--text-muted); }
/* Syscall Trace list: line numbers + structured rows */
.strace-list {
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text);
    padding: 0.5rem 0;
    background: var(--bg);
}

.strace-list .strace-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.2rem 0.75rem;
    border-left: 2px solid transparent;
    min-height: 1.5em;
}

.strace-list .strace-row:hover {
    background: var(--surface-2);
}

.strace-list .strace-row.strace-search-hit {
    background: rgba(237, 217, 99, 0.12);
}

.strace-list .strace-row.strace-search-current {
    background: rgba(99, 179, 237, 0.18);
    border-left-color: var(--accent);
}

.strace-list .strace-num {
    flex-shrink: 0;
    width: 3.5rem;
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.strace-list .strace-ic {
    flex-shrink: 0;
    min-width: 5ch;
    text-align: right;
    color: var(--purple, #a78bfa);
    font-variant-numeric: tabular-nums;
    margin-right: 0.5em;
    font-size: 0.9em;
    opacity: 0.75;
}

.strace-list .strace-name {
    flex-shrink: 0;
    color: var(--accent);
    font-weight: 600;
}

.strace-list .strace-args {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.strace-list .strace-result {
    flex-shrink: 0;
    color: var(--green);
    margin-left: 0.25rem;
}

.strace-list .strace-plain {
    flex: 1;
    min-width: 0;
}

.strace-list .strace-row + .strace-row {
    border-top: 1px solid rgba(45, 49, 72, 0.5);
}

/* ── Functions tab ────────────────────────────────────────────────────────── */

.fn-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.fn-search-input {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
}
.fn-search-input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.fn-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.fn-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}
.fn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.fn-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-1);
    font-weight: 600;
    text-align: left;
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
}
.fn-table tbody tr { border-bottom: 1px solid var(--surface-2); }
.fn-table tbody tr:hover { background: var(--surface-2); }
.fn-table td { padding: 0.2rem 0.4rem; }

.fn-bp-col { width: 1.2rem; text-align: center; }
.fn-bp-dot {
    cursor: pointer;
    color: var(--surface-3);
    font-size: 0.7rem;
    transition: color 0.15s;
}
.fn-bp-dot:hover { color: var(--red); }
.fn-bp-dot.active { color: var(--red); }
.fn-row.fn-bp-active { background: rgba(235, 87, 87, 0.07); }

.fn-name {
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text);
    font-family: var(--mono);
}
.fn-name:hover { color: var(--accent); text-decoration: underline; }

.fn-addr {
    cursor: pointer;
    color: var(--accent);
    white-space: nowrap;
}
.fn-addr:hover { text-decoration: underline; }

.fn-size { color: var(--text-muted); white-space: nowrap; }
.fn-file {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fn-bind { color: var(--text-muted); font-size: 0.65rem; text-transform: uppercase; }

.fn-truncated { padding: 0.5rem; font-size: 0.7rem; text-align: center; }

/* ── ELF structure tab ────────────────────────────────────────────────────── */

.elf-controls {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.elf-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}
.elf-structure {
    flex: 1;
    min-height: 0;
    padding: 0.75rem 1rem;
    font-size: 0.72rem;
    line-height: 1.5;
    overflow: auto;
}
.elf-section {
    margin-bottom: 1rem;
}
.elf-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.35rem;
}
.elf-dwarf-summary {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0.35rem 0;
}
.elf-header-pre {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text);
    white-space: pre;
}
.elf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
    font-family: var(--mono);
}
.elf-table th,
.elf-table td {
    padding: 0.2rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.elf-table th {
    color: var(--text-muted);
    font-weight: 600;
}
.elf-table td.mono {
    color: var(--green);
}
.elf-table tbody tr:hover {
    background: var(--surface-2);
}
.elf-table .xref-addr {
    cursor: pointer;
    color: var(--accent);
}
.elf-table .xref-addr:hover {
    text-decoration: underline;
}

/* ── Memory viewer ───────────────────────────────────────────────────── */

.memory-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mem-access-colors-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}
.mem-access-colors-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.mem-access-color-input {
    width: 1.75rem;
    height: 1.35rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    cursor: pointer;
    vertical-align: middle;
}
.mem-access-colors-reset {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    margin-left: 0.1rem;
    line-height: 1.2;
}

.mem-addr-input {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    width: 12ch;
}
.mem-addr-input:focus { outline: 1px solid var(--accent); }

.memory-search-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mem-palette-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.mem-palette-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.mem-palette-select {
    font-size: 0.7rem;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}
.mem-palette-select:focus { outline: 1px solid var(--accent); }

.mem-edit-hint {
    font-size: 0.65rem;
    white-space: nowrap;
}
.mem-search-input {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    flex: 1;
    min-width: 12ch;
}
.mem-search-input:focus { outline: 1px solid var(--accent); }
.mem-search-mode {
    font-size: 0.7rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.mem-search-spinner {
    display: none;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: search-spin 0.7s linear infinite;
    flex-shrink: 0;
}
.mem-search-spinner.searching {
    display: inline-block;
}
@keyframes search-spin {
    to { transform: rotate(360deg); }
}

.mem-search-status {
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--accent);
    min-width: 4ch;
}
.mem-search-status.muted { color: var(--text-muted); }
/* Stronger rules live under .memory-dump (see below) so value palette does not hide hits. */

.mem-info {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* Scrolls inside #memory-dump-wrap; dump can grow vertically with MEM_LINES. */
.memory-dump-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.memory-dump-wrap .memory-dump {
    margin: 0;
    padding: 0.5rem 0.75rem 1rem;
    min-height: 50vh;
}
.memory-dump {
    font-size: 0.78rem;
    line-height: 1.5;
    min-width: 100ch;
}

/* Fixed-width columns so hex bytes and ASCII stay vertically aligned */
.memory-dump .mem-addr-col {
    display: inline-block;
    width: 12ch;
    min-width: 12ch;
    text-align: right;
    box-sizing: border-box;
}
.memory-dump .mem-byte-hex {
    display: inline-block;
    width: 3ch;
    min-width: 3ch;
    text-align: right;
    box-sizing: border-box;
}
.memory-dump .mem-byte:not(.mem-byte-hex) {
    display: inline-block;
    width: 1ch;
    min-width: 1ch;
    text-align: center;
    box-sizing: border-box;
}

/* ── Registers ───────────────────────────────────────────────────────── */

/* ── Call stack panel ────────────────────────────────────────────── */
.callstack-list {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.6;
    background: var(--bg);
    overflow-y: auto;
    min-height: 0;
}
.callstack-frame {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.2rem 0.35rem;
    border-radius: var(--radius);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.callstack-frame:hover { background: var(--surface-2); }
.callstack-frame.active { background: var(--surface-2); border-left: 2px solid var(--accent); }
.callstack-depth { color: var(--text-muted); font-size: 0.65rem; min-width: 1.5rem; text-align: right; flex-shrink: 0; }
.callstack-name { color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14ch; }
.callstack-addr { color: var(--text-muted); font-size: 0.72rem; flex-shrink: 0; }
.callstack-callsite { color: var(--text-muted); font-size: 0.65rem; opacity: 0.7; margin-left: auto; flex-shrink: 0; }
.callstack-empty { color: var(--text-muted); padding: 0.5rem 0; font-style: italic; font-family: var(--sans); font-size: 0.75rem; }
.callstack-count { color: var(--text-muted); font-size: 0.65rem; padding-bottom: 0.3rem; font-family: var(--sans); }

.registers {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.8;
    background: var(--bg);
    overflow-y: scroll;
    min-height: 0;
}

.registers .muted {
    color: var(--text-muted);
    font-family: var(--sans);
}

.reg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    gap: 0 0.5rem;
}
.reg-row:hover { background: var(--surface-2); }

.reg-name {
    color: var(--accent);
    font-weight: 600;
    min-width: 3.2rem;
}

.reg-value { color: var(--text); }
.reg-value.changed { color: var(--yellow); }

/* Previous value (shown when register changes) */
.reg-prev {
    font-size: 0.78em;
    color: var(--text-muted);
    opacity: 0.55;
    text-decoration: line-through;
    white-space: nowrap;
}

/* Sub-register decomposition row — visible on hover */
.reg-subs {
    flex-basis: 100%;
    display: none;
    flex-wrap: wrap;
    gap: 0.15rem 0.6rem;
    padding-left: 3.2rem;
    margin-top: -0.05rem;
    margin-bottom: 0.2rem;
}
.reg-row.has-subs:hover .reg-subs { display: flex; }
.sub-reg {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 0.78em;
}
.sub-name {
    color: var(--text-muted);
    font-weight: 600;
}
.sub-val {
    color: var(--text-muted);
    opacity: 0.8;
}
.reg-value.clickable { cursor: pointer; }
.reg-value.clickable:hover { text-decoration: underline; color: var(--accent); }
.reg-value.reg-bp-active { color: var(--red); text-decoration: underline; }

.reg-edit-input {
    width: 100%;
    min-width: 12ch;
    font: inherit;
    font-family: var(--mono);
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--accent);
    border-radius: 2px;
    padding: 0.1rem 0.25rem;
    box-sizing: border-box;
}

/* Register seeking (Tenet-style): seek trace to instruction that set this register */
.reg-seek-hint {
    font-size: 0.65rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}
.reg-seek-hint kbd {
    font-family: var(--mono);
    font-size: 0.7em;
    padding: 0.05rem 0.2rem;
    border-radius: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.reg-row-seek { align-items: center; gap: 0.25rem; }
.reg-row-seek .reg-value { flex: 1; min-width: 0; }
.reg-seek-arrows {
    display: flex;
    flex-shrink: 0;
    gap: 0.1rem;
}
.reg-seek-prev, .reg-seek-next {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.85rem;
    padding: 0.1rem 0.15rem;
    border-radius: 2px;
    user-select: none;
}
.reg-seek-prev:hover:not(.disabled), .reg-seek-next:hover:not(.disabled) {
    background: var(--surface-2);
    color: var(--text);
}
.reg-seek-prev.disabled, .reg-seek-next.disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.5;
}

.flags-row {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.flag-tag {
    padding: 0.08rem 0.3rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
}
.flag-tag.set { background: var(--accent); color: var(--bg); }
.flag-tag.clear { background: var(--surface-2); color: var(--text-muted); }
.flag-tag.clickable { cursor: pointer; }
.flag-tag.clickable:hover { opacity: 0.9; filter: brightness(1.1); }

/* ── Breakpoints Panel ───────────────────────────────────────────────── */

.bp-section {
    margin-bottom: 0.5rem;
}
.bp-section-title {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.bp-syscall-row {
    margin-bottom: 0.25rem;
}
.bp-any-syscall-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.bp-any-syscall-cb {
    cursor: pointer;
}
.bp-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.bp-addr-input {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    width: 14ch;
}
.bp-addr-input:focus { outline: 1px solid var(--accent); }

.bp-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    font-family: var(--mono);
    font-size: 0.75rem;
    min-height: 0;
}
.bp-list .muted { color: var(--text-muted); font-family: var(--sans); }

.bp-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}
.bp-entry:last-child { border-bottom: none; }
.bp-icon { font-size: 0.6rem; }
.bp-type { font-size: 0.65rem; color: var(--text-muted); margin-right: 0.35rem; min-width: 2.5rem; }
.bp-addr { color: var(--text); flex: 1; }

/* ── Info Bar ────────────────────────────────────────────────────────── */

.info-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.4rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow: hidden;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.info-item .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.info-item .value {
    font-size: 0.75rem;
    color: var(--text);
}

.mono { font-family: var(--mono); }

/* ── Log/Debug Controls ──────────────────────────────────────────────── */

.log-level-select {
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.7rem;
    font-family: var(--mono);
    cursor: pointer;
}
.log-level-select:focus { outline: 2px solid var(--accent); }

.strace-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.strace-toggle input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

.timeless-toggle {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.2rem 0.55rem;
    transition: all 0.2s;
}
.timeless-toggle:has(input:checked) {
    border-color: var(--purple);
    background: rgba(183, 148, 244, 0.1);
}
.timeless-label {
    font-weight: 700;
    letter-spacing: 0.02em;
}
.timeless-toggle:has(input:checked) .timeless-label {
    color: var(--purple);
}

/* ── Footer ──────────────────────────────────────────────────────────── */

footer {
    padding: 0.4rem 1.5rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

footer kbd {
    font-family: var(--mono);
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface-2);
    color: var(--text-muted);
}

footer .footer-contact {
    margin-top: 0.35rem;
}

footer .footer-contact a {
    color: var(--text-muted);
    text-decoration: none;
}

footer .footer-contact a:hover {
    text-decoration: underline;
}

footer .footer-beta {
    margin-top: 0.25rem;
    font-style: italic;
}

/* ── Timeline Bar (Tenet-style Timeless Debugger) ────────────────────── */

.timeline-bar {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.3rem 1rem;
    flex-shrink: 0;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.trace-position {
    font-size: 0.7rem;
    color: var(--accent);
    margin: 0 0.5rem;
    min-width: 20ch;
}

.zoom-info {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin: 0 0.3rem;
}

.timeline-canvas-wrap {
    width: 100%;
    height: 120px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    cursor: crosshair;
    position: relative;
    user-select: none;
}

.timeline-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Drag-to-select overlay */
.timeline-selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(99, 179, 237, 0.2);
    border-left: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
    pointer-events: none;
    display: none;
    z-index: 2;
}

/* Cursor vertical line */
.timeline-cursor {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    pointer-events: none;
    display: none;
    z-index: 3;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

/* Lane labels overlay */
.timeline-lane-labels {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    font-size: 0.55rem;
    font-family: var(--mono);
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-slider {
    width: 100%;
    margin-top: 0.3rem;
    accent-color: var(--accent);
    cursor: pointer;
    height: 6px;
}

/* ── Memory Map ─────────────────────────────────────────────────────── */

.memory-map-list {
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0.75rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.6;
    background: var(--bg);
    overflow-y: auto;
}

.memory-map-list .muted {
    color: var(--text-muted);
    font-family: var(--sans);
}

/* Grid: same column widths for header and all rows */
.memmap-grid {
    display: grid;
    grid-template-columns: 22ch 14ch 5ch 5ch 1fr;
    column-gap: 1.25rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.memmap-header {
    display: contents;
}
.memmap-header > * {
    padding: 0.2rem 0;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}
.memmap-entry {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 0.15rem 0;
    border-radius: 3px;
    cursor: pointer;
}
.memmap-entry:hover {
    background: var(--surface-2);
}

.memmap-col-addr   { text-align: right; font-variant-numeric: tabular-nums; }
.memmap-col-size   { text-align: right; font-variant-numeric: tabular-nums; }
.memmap-col-perms  { text-align: left; }
.memmap-col-entropy { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.memmap-col-heatmap { min-width: 0; }

.memmap-addr { color: var(--text-muted); }
.memmap-size { color: var(--text); }
.memmap-perms { font-weight: 600; }
.memmap-perms-r { color: var(--green); }
.memmap-perms-w { color: var(--yellow); }
.memmap-perms-x { color: var(--red); }
.memmap-perms-none { color: var(--text-muted); }

/* ── Memory Map: entropy heatmap ─────────────────────────────────── */

.memmap-entropy { font-variant-numeric: tabular-nums; }

.memmap-heatmap {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}
.memmap-heat-cell {
    display: inline-block;
    flex: 1;
    height: 12px;
    min-width: 2px;
    border-radius: 1px;
}
.memmap-entry:first-child .memmap-heat-cell { border-radius: 2px 2px 0 0; }
.memmap-entry:last-child .memmap-heat-cell { border-radius: 0 0 2px 2px; }

.memmap-legend {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.3rem 0.35rem;
    font-size: 0.6rem;
    color: var(--text-muted);
}
.memmap-legend-label {
    white-space: nowrap;
}
.memmap-legend-bar {
    display: flex;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
.memmap-legend-bar span {
    flex: 1;
    min-width: 1px;
}

/* ── Hex dump: per-line entropy bar ──────────────────────────────── */

.mem-entropy-bar {
    display: inline-block;
    width: 8px;
    height: 1em;
    vertical-align: middle;
    border-radius: 2px;
    margin-left: 2px;
}
.mem-entropy-unmapped {
    background: var(--surface-1);
    opacity: 0.3;
}
.mem-entropy-legend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 0.4rem;
}
.mem-entropy-legend-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}
.mem-entropy-legend-bar {
    display: inline-flex;
    width: 48px;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

/* Same value = same color; 16 slots by low nibble. Default palette: 00=red for visibility, then distinct hues. */
.mem-byte-v0  { color: #ef4444; background: rgba(239, 68, 68, 0.25);   border-radius: 2px; } /* 00 = red */
.mem-byte-v1  { color: #f87171; background: rgba(248, 113, 113, 0.22);  border-radius: 2px; }
.mem-byte-v2  { color: #fb923c; background: rgba(251, 146, 60, 0.22);  border-radius: 2px; }
.mem-byte-v3  { color: #facc15; background: rgba(250, 204, 21, 0.22);   border-radius: 2px; }
.mem-byte-v4  { color: #a3e635; background: rgba(163, 230, 53, 0.18);   border-radius: 2px; }
.mem-byte-v5  { color: #22c55e; background: rgba(34, 197, 94, 0.2);   border-radius: 2px; }
.mem-byte-v6  { color: #2dd4bf; background: rgba(45, 212, 191, 0.2);  border-radius: 2px; }
.mem-byte-v7  { color: #22d3ee; background: rgba(34, 211, 238, 0.2);   border-radius: 2px; }
.mem-byte-v8  { color: #38bdf8; background: rgba(56, 189, 248, 0.22);   border-radius: 2px; }
.mem-byte-v9  { color: #60a5fa; background: rgba(96, 165, 250, 0.22);   border-radius: 2px; }
.mem-byte-v10 { color: #818cf8; background: rgba(129, 140, 248, 0.22);  border-radius: 2px; }
.mem-byte-v11 { color: #a78bfa; background: rgba(167, 139, 250, 0.22);  border-radius: 2px; }
.mem-byte-v12 { color: #c084fc; background: rgba(192, 132, 252, 0.22);  border-radius: 2px; }
.mem-byte-v13 { color: #e879f9; background: rgba(232, 121, 249, 0.22);  border-radius: 2px; }
.mem-byte-v14 { color: #f472b6; background: rgba(244, 114, 182, 0.22);  border-radius: 2px; }
.mem-byte-v15 { color: #fb7185; background: rgba(251, 113, 133, 0.22);  border-radius: 2px; }

/* Alternative palettes (applied via body[data-mem-palette="..."]) */
[data-mem-palette="grayscale"] .mem-byte-v0  { color: #f1f5f9; background: rgba(241, 245, 249, 0.3);  }
[data-mem-palette="grayscale"] .mem-byte-v1  { color: #e2e8f0; background: rgba(226, 232, 240, 0.25); }
[data-mem-palette="grayscale"] .mem-byte-v2  { color: #cbd5e1; background: rgba(203, 213, 225, 0.22); }
[data-mem-palette="grayscale"] .mem-byte-v3  { color: #94a3b8; background: rgba(148, 163, 184, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v4  { color: #64748b; background: rgba(100, 116, 139, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v5  { color: #475569; background: rgba(71, 85, 105, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v6  { color: #334155; background: rgba(51, 65, 85, 0.25);  }
[data-mem-palette="grayscale"] .mem-byte-v7  { color: #1e293b; background: rgba(30, 41, 59, 0.3);   }
[data-mem-palette="grayscale"] .mem-byte-v8  { color: #94a3b8; background: rgba(148, 163, 184, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v9  { color: #64748b; background: rgba(100, 116, 139, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v10 { color: #475569; background: rgba(71, 85, 105, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v11 { color: #334155; background: rgba(51, 65, 85, 0.25);  }
[data-mem-palette="grayscale"] .mem-byte-v12 { color: #cbd5e1; background: rgba(203, 213, 225, 0.22); }
[data-mem-palette="grayscale"] .mem-byte-v13 { color: #94a3b8; background: rgba(148, 163, 184, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v14 { color: #64748b; background: rgba(100, 116, 139, 0.2);  }
[data-mem-palette="grayscale"] .mem-byte-v15 { color: #475569; background: rgba(71, 85, 105, 0.2);  }

[data-mem-palette="pastel"] .mem-byte-v0  { color: #fca5a5; background: rgba(252, 165, 165, 0.25);  }
[data-mem-palette="pastel"] .mem-byte-v1  { color: #f9a8d4; background: rgba(249, 168, 212, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v2  { color: #fcd34d; background: rgba(252, 211, 77, 0.2);   }
[data-mem-palette="pastel"] .mem-byte-v3  { color: #bef264; background: rgba(190, 242, 100, 0.18);  }
[data-mem-palette="pastel"] .mem-byte-v4  { color: #6ee7b7; background: rgba(110, 231, 183, 0.18);  }
[data-mem-palette="pastel"] .mem-byte-v5  { color: #67e8f9; background: rgba(103, 232, 249, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v6  { color: #93c5fd; background: rgba(147, 197, 253, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v7  { color: #a5b4fc; background: rgba(165, 180, 252, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v8  { color: #c4b5fd; background: rgba(196, 181, 253, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v9  { color: #d8b4fe; background: rgba(216, 180, 254, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v10 { color: #e9d5ff; background: rgba(233, 213, 255, 0.18); }
[data-mem-palette="pastel"] .mem-byte-v11 { color: #f5d0fe; background: rgba(245, 208, 254, 0.18); }
[data-mem-palette="pastel"] .mem-byte-v12 { color: #fbcfe8; background: rgba(251, 207, 232, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v13 { color: #fed7aa; background: rgba(254, 215, 170, 0.2);  }
[data-mem-palette="pastel"] .mem-byte-v14 { color: #bbf7d0; background: rgba(187, 247, 208, 0.18);  }
[data-mem-palette="pastel"] .mem-byte-v15 { color: #a5f3fc; background: rgba(165, 243, 252, 0.2);  }

[data-mem-palette="vivid"] .mem-byte-v0  { color: #dc2626; background: rgba(220, 38, 38, 0.3);   }
[data-mem-palette="vivid"] .mem-byte-v1  { color: #ea580c; background: rgba(234, 88, 12, 0.28);  }
[data-mem-palette="vivid"] .mem-byte-v2  { color: #ca8a04; background: rgba(202, 138, 4, 0.28);   }
[data-mem-palette="vivid"] .mem-byte-v3  { color: #65a30d; background: rgba(101, 163, 13, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v4  { color: #059669; background: rgba(5, 150, 105, 0.25);   }
[data-mem-palette="vivid"] .mem-byte-v5  { color: #0d9488; background: rgba(13, 148, 136, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v6  { color: #0891b2; background: rgba(8, 145, 178, 0.25);   }
[data-mem-palette="vivid"] .mem-byte-v7  { color: #2563eb; background: rgba(37, 99, 235, 0.25);   }
[data-mem-palette="vivid"] .mem-byte-v8  { color: #4f46e5; background: rgba(79, 70, 229, 0.25);   }
[data-mem-palette="vivid"] .mem-byte-v9  { color: #7c3aed; background: rgba(124, 58, 237, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v10 { color: #a21caf; background: rgba(162, 28, 175, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v11 { color: #be185d; background: rgba(190, 24, 93, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v12 { color: #e11d48; background: rgba(225, 29, 72, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v13 { color: #f43f5e; background: rgba(244, 63, 94, 0.25);  }
[data-mem-palette="vivid"] .mem-byte-v14 { color: #f97316; background: rgba(249, 115, 22, 0.28);  }
[data-mem-palette="vivid"] .mem-byte-v15 { color: #eab308; background: rgba(234, 179, 8, 0.28);   }

/* Memory access highlighting in hex dump — read vs write (defaults: cyan vs orange; customizable) */
.mem-byte-read {
    color: var(--mem-access-read);
    background: var(--mem-access-read-bg);
    border-radius: 2px;
}
.mem-byte-write {
    color: var(--mem-access-write);
    font-weight: 700;
    background: var(--mem-access-write-bg);
    border-radius: 2px;
}
.mem-byte-rw {
    color: var(--mem-access-rw);
    font-weight: 700;
    text-decoration: underline;
    background: var(--mem-access-rw-bg);
    border-radius: 2px;
}

.mem-byte.clickable { cursor: pointer; }
.mem-byte.clickable:hover:not(.mem-search-hit):not(.mem-search-current) { background: var(--surface-2); border-radius: 2px; }
.mem-byte-daddr {
    outline: 2px solid var(--accent);
    border-radius: 2px;
    background: rgba(99, 179, 237, 0.25);
}
.mem-byte-daddr.mem-byte-read { background: rgba(99, 179, 237, 0.2); }
.mem-byte-daddr.mem-byte-write,
.mem-byte-daddr.mem-byte-rw { background: rgba(99, 179, 237, 0.3); }

/* Search hits: must override mem-byte-v* palettes and trace R/W tints.
   Use high-contrast solid backgrounds so hex values stay readable.
   ASCII column gets the same treatment — the 1ch-wide chars need extra emphasis. */
.memory-dump .mem-byte.mem-search-hit,
.memory-dump .mem-byte-hex.mem-search-hit {
    background: #fbbf24 !important;
    color: #000 !important;
    font-weight: 700;
    border-radius: 2px;
    outline: 1px solid #b45309;
}
.memory-dump .mem-byte.mem-search-current,
.memory-dump .mem-byte-hex.mem-search-current {
    background: #38bdf8 !important;
    color: #000 !important;
    font-weight: 700;
    border-radius: 2px;
    outline: 2px solid #0284c7;
}
/* ASCII column: just background + underline, no padding/margin to preserve alignment */
.memory-dump .mem-byte:not(.mem-byte-hex).mem-search-hit {
    outline: none;
    text-decoration: underline 2px #b45309;
    text-underline-offset: 2px;
}
.memory-dump .mem-byte:not(.mem-byte-hex).mem-search-current {
    outline: none;
    text-decoration: underline 2px #0284c7;
    text-underline-offset: 2px;
}
.memory-dump .mem-byte.mem-search-hit:hover,
.memory-dump .mem-byte.mem-search-current:hover {
    filter: brightness(1.1);
}

/* Hex editor inline edit */
.mem-byte-edit {
    font-family: var(--font-mono);
    font-size: inherit;
    width: 1.6em;
    padding: 0;
    margin: 0;
    border: 1px solid var(--accent);
    background: var(--surface-2);
    color: var(--accent);
    text-align: center;
    outline: none;
    border-radius: 2px;
}
.mem-byte.editing { background: var(--surface-2); outline: 1px solid var(--accent); border-radius: 2px; }

/* Toolbar separator */
.toolbar-sep { width: 1px; height: 1.2rem; background: var(--border); margin: 0 0.15rem; flex-shrink: 0; }

/* Snapshot buttons */
.btn-snapshot { border: 1px solid var(--accent); color: var(--accent); }
.btn-snapshot:hover { background: var(--accent); color: var(--bg); }

.mem-addr-col {
    color: var(--text-muted);
    cursor: pointer;
}
.mem-addr-col:hover { color: var(--accent); text-decoration: underline; }

.mem-legend {
    font-size: 0.65rem;
    font-family: var(--mono);
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.mem-legend-read {
    color: var(--mem-access-read);
    font-weight: 700;
}
.mem-legend-write {
    color: var(--mem-access-write);
    font-weight: 700;
}

.btn-watch { border-color: var(--yellow); color: var(--yellow); }
.btn-watch:hover:not(:disabled) { background: var(--yellow); color: var(--bg); }

/* Trace browsing mode indicator */
.badge.trace { color: var(--purple); border-color: var(--purple); }

/* ── Memory Accesses Panel ──────────────────────────────────────────── */

.accesses-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.accesses-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.accesses-info {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--mono);
    margin-left: auto;
}

.accesses-split {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.accesses-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.4rem 0.75rem;
    background: var(--bg);
    font-family: var(--mono);
    font-size: 0.72rem;
}
.accesses-list .muted { color: var(--text-muted); font-family: var(--sans); font-size: 0.75rem; }

.accesses-mem-preview {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    max-height: 45%;
    display: flex;
    flex-direction: column;
}

.accesses-mem-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.accesses-mem-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.accesses-mem-addr {
    font-size: 0.65rem;
    color: var(--accent);
}

.accesses-mem-dump {
    font-size: 0.68rem;
    line-height: 1.5;
    padding: 0.3rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
    max-height: 180px;
}

.acc-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    border-left: 3px solid transparent;
}
.acc-entry:hover { background: var(--surface-2); }
.acc-entry.acc-read { border-left-color: var(--mem-access-read); }
.acc-entry.acc-write { border-left-color: var(--mem-access-write); }

.acc-type {
    font-weight: 700;
    font-size: 0.65rem;
    padding: 0.05rem 0.25rem;
    border-radius: 3px;
    min-width: 1.5ch;
    text-align: center;
}
.acc-read .acc-type { background: var(--mem-access-read-badge-bg); color: var(--mem-access-read); }
.acc-write .acc-type { background: var(--mem-access-write-badge-bg); color: var(--mem-access-write); }

.acc-addr {
    color: var(--accent);
    cursor: pointer;
    min-width: 10ch;
}
.acc-addr:hover { text-decoration: underline; }

.acc-size { color: var(--text-muted); font-size: 0.65rem; min-width: 3ch; }
.acc-val { color: var(--text); }

/* ── Watch Panel ─────────────────────────────────────────────────────── */

.watch-size-input {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    width: 4ch;
}
.watch-size-input:focus { outline: 1px solid var(--accent); }

.watch-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.3rem;
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 0.75rem;
}
.watch-entry:hover { background: var(--surface-2); }
.watch-entry.watch-active { background: rgba(246, 224, 94, 0.08); }

.watch-color {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.watch-addr {
    color: var(--accent);
    cursor: pointer;
    min-width: 10ch;
}
.watch-addr:hover { text-decoration: underline; }
.watch-size { color: var(--text-muted); font-size: 0.65rem; }
.watch-hits { color: var(--yellow); font-size: 0.65rem; margin-left: auto; }

/* ── Bookmarks / Comments panels ─────────────────────────────────────────── */
.annot-list { overflow: auto; max-height: 280px; font-size: 0.75rem; }
.annot-list-empty { padding: 0.5rem; font-size: 0.72rem; }
.annot-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    font-family: var(--mono);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.annot-entry:hover { background: var(--surface-2); }
.annot-entry-addr {
    color: var(--accent);
    flex-shrink: 0;
    min-width: 10ch;
}
.annot-entry-addr:hover { text-decoration: underline; }
.annot-entry-label { color: var(--text); word-break: break-word; }
.annot-entry-comment { color: var(--text-muted); font-style: italic; word-break: break-word; flex: 1; min-width: 0; }

/* ── Region value history (History tab) ───────────────────────────────────── */
.history-header-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.history-header { font-size: 0.7rem; flex: 1; min-width: 0; }
.region-history-wrap { overflow: auto; max-height: 280px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.history-table th, .history-table td { padding: 0.2rem 0.35rem; text-align: left; border-bottom: 1px solid var(--border); }
.history-table th { color: var(--text-muted); font-weight: 500; }
.history-row { cursor: pointer; }
.history-row:hover { background: var(--surface-2); }
.history-row.history-row-current { background: rgba(246, 224, 94, 0.15); }

/* ── VFS tab ───────────────────────────────────────────────────────────── */
.vfs-header { font-size: 0.75rem; margin-bottom: 0.5rem; }
.vfs-add-section { margin-bottom: 0.5rem; }
.vfs-path-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.vfs-path-row .vfs-path-input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.vfs-path-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
}
.vfs-path-input::placeholder { color: var(--text-muted); }
.vfs-drop-zone {
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.vfs-drop-zone:hover { background: var(--surface-2); border-color: var(--accent); color: var(--text); }
.vfs-drop-zone.vfs-drop-active { background: rgba(100, 149, 237, 0.1); border-color: var(--accent); }
.vfs-file-input { display: none; }
.vfs-list-and-detail { display: flex; gap: 0.75rem; min-height: 0; flex: 1; }
.vfs-list-wrap {
    overflow: auto;
    flex: 1 1 42%;
    min-width: 0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-1);
}
.vfs-detail {
    flex: 1 1 58%;
    min-width: 0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-1);
    padding: 0.5rem;
}
.vfs-detail-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; flex-shrink: 0; }
.vfs-detail-path { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.vfs-detail-content { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.vfs-detail-textarea {
    flex: 1;
    min-height: 160px;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    resize: vertical;
}
.vfs-detail-binary { font-size: 0.8rem; padding: 0.5rem; }
.vfs-list-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--surface-2);
    font-size: 0.9rem;
    flex-shrink: 0;
}
.vfs-filter-label { color: var(--text-muted); }
.vfs-filter-select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--surface-3);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.vfs-filter-select:focus { outline: none; border-color: var(--accent); }

.vfs-list-header {
    display: flex;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}
.vfs-col-path { flex: 1; min-width: 0; }
.vfs-col-size { flex-shrink: 0; width: 5rem; }
.vfs-list { font-size: 0.8rem; padding: 0 0.25rem 0.25rem; flex: 1; min-height: 0; overflow: auto; }
.vfs-entry {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}
.vfs-entry:hover { background: var(--surface-2); }
.vfs-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); color: var(--accent); }
.vfs-size { flex-shrink: 0; width: 5rem; color: var(--text-muted); }
.vfs-tag { font-size: 0.65rem; font-family: var(--sans); margin-left: 0.35rem; padding: 0.15rem 0.4rem; border-radius: 3px; white-space: nowrap; }
.vfs-tag-sysroot { background: var(--accent); color: var(--bg); }
.vfs-tag-modified { background: var(--yellow); color: var(--bg); }

/* ── daddr display in info bar ──────────────────────────────────────── */

.daddr-value { color: var(--text-muted); }
.daddr-value.active { color: var(--yellow); font-weight: 600; cursor: pointer; }
.daddr-value.active:hover { text-decoration: underline; }

/* ── Trace keyboard shortcuts hint ──────────────────────────────────── */

.trace-shortcuts {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-left: auto;
}
.trace-shortcuts kbd {
    font-family: var(--mono);
    font-size: 0.55rem;
    padding: 0.05rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface-2);
    color: var(--text-muted);
}

/* ── Summary & Help buttons ─────────────────────────────────────────── */

.header-actions .btn-summary,
.header-actions .btn-prefs,
.header-actions .btn-help {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
}
.header-actions .btn-summary {
    color: var(--text-muted);
}
.header-actions .btn-summary:hover { background: var(--border); color: var(--text); }
.header-actions .btn-prefs {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
}
.header-actions .btn-prefs:hover { background: var(--border); color: var(--text); }
.header-actions .btn-help {
    color: var(--accent);
}
.header-actions .btn-help:hover { background: var(--accent); color: var(--bg); }

.header-actions .theme-select,
.header-actions .lang-select {
    font-size: 0.72rem;
    padding: 0.28rem 0.5rem;
    height: 28px;
    min-height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23718096'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 8px 5px;
    padding-right: 1.25rem;
}
.header-actions .theme-select:hover,
.header-actions .lang-select:hover { border-color: var(--accent); }
.header-actions .theme-select:focus,
.header-actions .lang-select:focus { outline: none; border-color: var(--accent); }
.header-actions .theme-select { min-width: 4.5rem; }
.header-actions .lang-select { min-width: 5rem; }

/* ── PE at-a-glance summary ───────────────────────────────────────────── */

.pe-at-a-glance {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pe-summary-block .pe-summary-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.pe-summary-body { font-size: 0.75rem; }
.pe-summary-section {
    margin-bottom: 0.6rem;
}
.pe-summary-section:last-child { margin-bottom: 0; }
.pe-summary-section strong {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}
.pe-summary-pre {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.7rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
}
.pe-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}
.pe-summary-table th,
.pe-summary-table td {
    padding: 0.15rem 0.35rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.pe-summary-table th { color: var(--text-muted); font-weight: 600; }
.pe-summary-list {
    margin: 0;
    padding-left: 1rem;
    list-style: disc;
}
.pe-summary-list li { margin: 0.1rem 0; }
.file-info-popup .pe-summary-block {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.file-info-popup .pe-summary-block .pe-summary-title { font-size: 0.75rem; }
.file-info-popup .pe-summary-body { font-size: 0.72rem; }
.file-info-popup .pe-summary-table { font-size: 0.65rem; }
.file-info-popup .pe-summary-pre { font-size: 0.65rem; }

.pe-sig-present { color: var(--green); font-weight: 600; }

/* PE Resources viewer: icons, bitmaps, version text */
.pe-resource-section {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.pe-resource-section-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text);
}
.pe-resource-section .pe-resource-no-images {
    margin: 0;
    font-size: 0.85rem;
}
.pe-resource-entry {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-subtle);
}
.pe-resource-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}
.pe-resource-img-wrap {
    margin-top: 0.35rem;
}
.pe-resource-img {
    max-width: 128px;
    max-height: 128px;
    object-fit: contain;
    vertical-align: middle;
}
.pe-resource-text {
    margin: 0.35rem 0 0;
    padding: 0.5rem;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 12rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
}
.pe-sig-absent { color: var(--red); }
.pe-risk-block { margin-top: 0.25rem; }
.pe-risk-desc { font-size: 0.75rem; font-weight: normal; }
.pe-risk-score { font-weight: 700; padding: 0.1rem 0.35rem; border-radius: 4px; margin-right: 0.25rem; }
.pe-risk-none { color: var(--green); background: rgba(72, 187, 120, 0.2); }
.pe-risk-low { color: var(--yellow-dark); background: rgba(246, 224, 94, 0.2); }
.pe-risk-medium { color: var(--orange); background: rgba(237, 137, 54, 0.2); }
.pe-risk-high { color: var(--red); background: rgba(252, 129, 129, 0.2); }
.pe-risk-tags { margin-top: 0.2rem; }
.pe-risk-tags li { font-size: 0.7rem; }

/* ── Help Modal ─────────────────────────────────────────────────────── */

.help-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.help-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(680px, 90vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
}
.help-modal-header h2 { font-size: 1rem; }
.summary-modal-header .summary-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.summary-modal-logo {
    display: block;
    height: 3rem;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
.summary-modal-header h2 { margin: 0; }
.help-modal-close { font-size: 1.2rem; line-height: 1; }
.help-modal-body {
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.5;
}
.help-section { margin-bottom: 1.2rem; }
.help-section h3 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.2rem;
}
.help-section p { color: var(--text); margin-bottom: 0.3rem; }
.summary-partner-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.summary-partner-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.15s ease;
}
.summary-partner-link:hover {
    opacity: 1;
    transform: scale(1.05);
}
.summary-partner-img {
    display: block;
    height: 2.75rem;
    width: auto;
    object-fit: contain;
}
.help-lead { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.help-steps {
    list-style: decimal;
    padding-left: 1.2rem;
    margin: 0.4rem 0;
}
.help-steps li { margin-bottom: 0.35rem; color: var(--text); }
.help-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }
.help-section code { font-size: 0.75em; padding: 0.05rem 0.2rem; background: var(--surface-2); border-radius: 2px; }
.help-colors { display: flex; flex-direction: column; gap: 0.3rem; }
.help-color-row { display: flex; align-items: center; gap: 0.6rem; }
.help-swatch {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}
.help-swatch-mem-read { background: var(--mem-access-read); }
.help-swatch-mem-write { background: var(--mem-access-write); }
.help-table {
    width: 100%;
    border-collapse: collapse;
}
.help-table td {
    padding: 0.2rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.help-table td:first-child {
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--accent);
    width: 30%;
}
.help-table kbd {
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.05rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface-2);
}
.help-tips {
    list-style: none;
    padding: 0;
}
.help-tips li {
    padding: 0.2rem 0;
    padding-left: 1rem;
    position: relative;
}
.help-tips li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ── Drag-and-Drop Highlight ─────────────────────────────────────────── */

body.dragover::after {
    content: "Drop ELF or PE (EXE/DLL) here";
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(15, 17, 23, 0.9);
    border: 3px dashed var(--accent);
    z-index: 1000;
    pointer-events: none;
}

/* ── Cross-references (XREFs) panel ──────────────────────────────── */

.xrefs-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    flex-wrap: wrap;
}
.xrefs-summary {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
}
.xref-stat {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--surface-1);
    font-variant-numeric: tabular-nums;
}
.xref-stat.xref-call { color: #7dd3fc; }
.xref-stat.xref-jmp  { color: #a5f3a6; }
.xref-stat.xref-data { color: #fbbf24; }

.xrefs-detail {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    max-height: 45%;
    overflow-y: auto;
    font-size: 0.7rem;
}
.xref-detail-header {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.3rem;
}
.xref-detail-addr { color: var(--accent); font-weight: 600; }
.xref-detail-name { color: var(--text); font-weight: 500; }

.xref-section-title {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0.3rem 0 0.15rem;
    letter-spacing: 0.04em;
}

.xref-ref-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.68rem;
}
.xref-ref-entry:hover { background: var(--surface-2); }
.xref-ref-addr { color: var(--text-muted); min-width: 10ch; }
.xref-ref-name { color: var(--text); }
.xref-ref-count { color: var(--text-muted); font-size: 0.6rem; }

.xref-kind-badge {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.xref-kind-call { background: rgba(125, 211, 252, 0.15); color: #7dd3fc; }
.xref-kind-jmp  { background: rgba(165, 243, 166, 0.15); color: #a5f3a6; }
.xref-kind-data { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

.xrefs-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
}
.xrefs-top-header {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}
.xref-top-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
}
.xref-top-entry:hover { background: var(--surface-2); }
.xref-top-addr { color: var(--text-muted); min-width: 10ch; }
.xref-top-name { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xref-top-count { color: var(--text-muted); font-size: 0.6rem; min-width: 4ch; text-align: right; }

/* ── Inline XREF annotations in disassembly ──────────────────────── */

.disasm-xref-line {
    font-size: 0.62rem;
    color: var(--text-muted);
    padding: 0 0 0 2.2rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.75;
    line-height: 1.4;
}
.disasm-xref-line:hover { opacity: 1; background: var(--surface-1); }

.xref-inline-label {
    color: #7dd3fc;
    font-weight: 600;
}
.xref-inline-ref {
    cursor: pointer;
    color: var(--text-muted);
}
.xref-inline-ref:hover { color: var(--accent); text-decoration: underline; }
.xref-inline-more {
    color: var(--text-muted);
    font-style: italic;
    cursor: pointer;
}
.xref-inline-more:hover { color: var(--accent); }

/* ── Annotations context menu (bookmarks / comments) ───────── */
.annotation-context-menu {
    display: none;
    position: fixed;
    z-index: 10000;
    min-width: 12rem;
    padding: 0.25rem 0;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.annotation-context-menu[aria-hidden="false"] {
    display: block;
}
.annotation-menu-item {
    display: block;
    width: 100%;
    padding: 0.35rem 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
}
.annotation-menu-item:hover {
    background: var(--surface-2);
    color: var(--accent);
}
.annotation-menu-item[hidden] {
    display: none;
}

/* ── YARA Tab ─────────────────────────────────────────────── */
.yara-scan-target-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}
.yara-scan-target-label span {
    white-space: nowrap;
}
.yara-scan-target-select {
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    max-width: 11rem;
}

.yara-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.yara-rule-search {
    background: var(--surface-1);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.72rem;
    min-width: 8rem;
    max-width: 12rem;
}
.yara-rule-search::placeholder {
    color: var(--text-muted);
}
.yara-example-select {
    background: var(--surface-1);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
    font-size: 0.72rem;
    cursor: pointer;
}
.yara-pe-on-load {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.yara-pe-on-load input { cursor: pointer; }
.yara-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}
.yara-progress-wrap {
    display: none;
    width: 100%;
    flex-basis: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.yara-progress-wrap[aria-hidden="false"] {
    display: flex;
}
.yara-progress-bar {
    flex: 1;
    min-width: 80px;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.yara-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--yara-progress-pct, 0%);
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.12s ease-out;
}
.yara-progress-text {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.yara-split {
    display: flex;
    flex-direction: column;
    height: calc(100% - 2.2rem);
    overflow: hidden;
}
.yara-editor-wrap {
    flex: 0 0 45%;
    min-height: 80px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.yara-highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    background: var(--bg);
    color: var(--text);
    border: none;
    tab-size: 4;
}
.yara-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    color: transparent;
    caret-color: var(--text);
    border: none;
    padding: 0.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 4;
}
.yara-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}
/* YARA syntax highlighting */
.yara-kw { color: #c084fc; font-weight: 600; }
.yara-comment { color: var(--text-muted); font-style: italic; }
.yara-str { color: #86efac; }
.yara-hex { color: #fcd34d; }
.yara-id { color: #22d3ee; }
.yara-num { color: #f472b6; }
.yara-meta { color: #a78bfa; }
.yara-results-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.yara-results-header {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.yara-match-count {
    font-weight: normal;
    color: var(--accent);
}
.yara-summary {
    font-weight: normal;
    color: var(--text-muted);
    margin-left: auto;
}
.yara-scan-context {
    flex-shrink: 0;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 179, 237, 0.06);
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--text);
}
.yara-scan-context-box {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.yara-scan-context-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
}
.yara-scan-context-badge {
    display: inline-block;
    padding: 0.08rem 0.35rem;
    border-radius: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.yara-scan-context-hint {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-style: italic;
}
.yara-scan-context-stats {
    font-family: var(--mono);
    color: var(--text-muted);
    font-size: 0.65rem;
}
.yara-scan-context-detail {
    color: var(--text-muted);
    font-size: 0.65rem;
}
.yara-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
}
.yara-skipped-log {
    font-size: 0.72rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 4px;
    border-left: 3px solid var(--red);
}
.yara-skipped-log-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.3rem;
}
.yara-skipped-log-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.15rem 0;
    font-family: var(--mono);
}
.yara-skipped-log-rule {
    color: var(--accent);
    flex-shrink: 0;
}
.yara-skipped-log-error {
    color: var(--text-muted);
    word-break: break-word;
}
.yara-match-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.yara-match-row.yara-match-file {
    border-left: 2px solid var(--green, #4ade80);
}

.yara-match-row:hover {
    background: var(--surface-1);
}
.yara-match-rule {
    color: #22d3ee;
    font-weight: 600;
    min-width: 6rem;
}
.yara-match-pattern {
    color: #fbbf24;
    min-width: 4rem;
}
.yara-match-addr {
    color: var(--accent);
    min-width: 8rem;
}
.yara-match-len {
    color: var(--text-muted);
    min-width: 3rem;
}
.yara-match-preview {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-file-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

/* ── Assembly tab (educational ASM mode) ─────────────────────────────────── */
.asm-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.asm-example-select {
    background: var(--surface-1);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
    font-size: 0.72rem;
    cursor: pointer;
}
.asm-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}
.asm-split {
    display: flex;
    flex-direction: column;
    height: calc(100% - 2.2rem);
    overflow: hidden;
}
.asm-editor-wrap {
    flex: 0 0 45%;
    min-height: 80px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.asm-highlight-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: 0; padding: 0.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    background: var(--bg);
    color: var(--text);
    tab-size: 4;
}
.asm-editor {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: transparent;
    color: transparent;
    caret-color: var(--text);
    border: none;
    padding: 0.5rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 4;
}
.asm-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}
.asm-kw { color: #c084fc; font-weight: 600; }
.asm-reg { color: #22d3ee; }
.asm-comment { color: var(--text-muted); font-style: italic; }
.asm-output-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.asm-output-header,
.asm-hex-header {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-0);
}
.asm-listing,
.asm-hex-output {
    flex: 1;
    min-height: 2rem;
    overflow: auto;
    padding: 0.3rem 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.asm-listing .asm-addr { color: var(--accent); }
.asm-listing .asm-bytes { color: #86efac; }
.asm-listing .asm-source { color: var(--text-muted); }
.asm-listing .asm-error { color: var(--red); }

/* ── Mobile & touch compatibility ─────────────────────────────────────── */

@media (max-width: 768px) {
    /* Safe area for notched devices */
    body {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    header,
    .controls,
    .info-bar,
    .timeline-bar,
    footer {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    html { font-size: 15px; }

    /* Header: reflow so theme/lang/help don’t overlap title */
    header {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    .header-brand {
        flex: 1 1 auto;
        min-width: 0;
    }
    .header-brand .subtitle {
        font-size: 0.65rem;
    }
    .header-logo-img {
        height: 1.5rem;
    }
    .header-actions {
        margin-left: auto;
    }
    .header-actions .theme-select,
    .header-actions .lang-select,
    .header-actions .btn-summary,
    .header-actions .btn-prefs,
    .header-actions .btn-help {
        min-width: 44px;
        min-height: 44px;
        height: 44px;
    }
    .header-actions .theme-select,
    .header-actions .lang-select {
        padding: 0.35rem 0.6rem;
        padding-right: 1.5rem;
    }

    /* Controls: stack and larger touch targets */
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    .upload-area {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .file-name {
        max-width: 140px;
    }
    .program-args-input {
        min-width: 0;
        max-width: 100%;
        flex: 1 1 120px;
        font-size: 16px; /* prevent iOS zoom on focus */
    }
    .action-buttons {
        margin-left: 0;
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    /* Touch-friendly minimum 44px tap targets */
    .btn:not(.btn-xs) {
        min-height: 44px;
        padding: 0.5rem 0.85rem;
    }
    .btn-sm {
        min-height: 44px;
        padding: 0.4rem 0.65rem;
    }
    .theme-select,
    .lang-select,
    .quick-sysroot-select {
        min-height: 44px;
        padding: 0.4rem 0.6rem;
    }
    .strace-toggle,
    .timeless-toggle {
        min-height: 44px;
        padding: 0.35rem 0.6rem;
        display: inline-flex;
        align-items: center;
    }
    .log-level-select {
        min-height: 44px;
        padding: 0.4rem 0.5rem;
    }
    .step-n-select {
        min-height: 44px;
    }

    /* Tabs: horizontal scroll instead of wrap */
    .center-tabs,
    .right-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    .tab-btn {
        flex-shrink: 0;
        min-height: 44px;
        padding: 0.5rem 0.65rem;
        font-size: 0.65rem;
    }

    .disasm-search-bar {
        flex-wrap: wrap;
    }
    .disasm-search-input {
        min-width: 0;
        font-size: 16px; /* prevent iOS zoom */
    }

    /* Info bar */
    .info-bar {
        gap: 0.75rem;
        padding: 0.35rem 0.75rem;
    }
    .info-item .value {
        font-size: 0.7rem;
        word-break: break-all;
    }
    .info-item .label {
        font-size: 0.6rem;
    }

    /* Timeline bar */
    .timeline-bar {
        padding: 0.35rem 0.75rem;
    }
    .timeline-controls {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .timeline-controls .btn-xs {
        min-height: 36px;
        min-width: 36px;
    }
    .trace-shortcuts {
        font-size: 0.6rem;
        display: block;
        width: 100%;
        margin-top: 0.2rem;
    }

    /* Help modal: near full-screen on small viewports */
    .help-modal {
        width: 95vw;
        max-width: none;
        max-height: 90vh;
        border-radius: var(--radius);
    }
    .help-modal-body {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    .help-modal-header .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Footer */
    footer {
        padding: 0.5rem 0.75rem;
        font-size: 0.65rem;
    }
    footer kbd {
        font-size: 0.55rem;
        padding: 0.08rem 0.25rem;
    }
}

@media (max-width: 480px) {
    .header-brand h1 {
        font-size: 1.1rem;
    }
    .upload-area .file-name {
        max-width: 100px;
    }
    .help-modal {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .file-info-popup {
        max-width: 95vw;
        left: 50% !important;
        transform: translateX(-50%);
    }
}
