:root {
    --bg: #0a0a0a;
    --bg-panel: #0f0f0f;
    --border: #1a1a1a;
    --green: #33ff33;
    --amber: #ffb000;
    --blue: #00aaff;
    --red: #ff4444;
    --purple: #cc66ff;
    --dim: #333333;
    --text: #cccccc;
    --text-dim: #666666;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    overflow-x: hidden;
}

/* CRT Scanline overlay */
.crt-overlay {
    pointer-events: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 9999;
}

/* Text glow */
.glow-green { text-shadow: 0 0 8px rgba(51, 255, 51, 0.5); }
.glow-amber { text-shadow: 0 0 8px rgba(255, 176, 0, 0.5); }
.glow-blue { text-shadow: 0 0 8px rgba(0, 170, 255, 0.5); }

/* LED indicators */
.led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.15s ease;
}

.led-on {
    background: var(--green);
    box-shadow: 0 0 6px var(--green), 0 0 12px rgba(51, 255, 51, 0.3);
}

.led-off {
    background: #1a1a1a;
    border: 1px solid #333;
}

/* Blinking cursor */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.cursor-blink {
    animation: blink 1s infinite;
}

/* Flash animation for register changes */
@keyframes flash {
    0% { background: rgba(51, 255, 51, 0.3); }
    100% { background: transparent; }
}

.reg-flash {
    animation: flash 0.4s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Press Start 2P for headings */
.font-retro {
    font-family: 'Press Start 2P', cursive;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Panel borders */
.panel {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-panel);
}

/* Button styles */
.btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #151515;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}

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

.btn-primary {
    border-color: var(--green);
    color: var(--green);
}

.btn-primary:hover {
    background: rgba(51, 255, 51, 0.1);
}

.btn-danger {
    border-color: var(--red);
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* Hex editor cell */
.hex-cell {
    width: 24px;
    height: 20px;
    text-align: center;
    font-size: 10px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
}

.hex-cell:focus {
    outline: 1px solid var(--green);
    color: var(--green);
    background: rgba(51, 255, 51, 0.05);
}

.hex-cell-pc {
    color: var(--green) !important;
    font-weight: bold;
}

/* Code block */
.code-block {
    background: #050505;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    font-size: 11px;
    line-height: 1.5;
}

/* Opcode table */
.opcode-cell {
    width: 56px;
    height: 44px;
    border: 1px solid #1a1a1a;
    font-size: 8px;
    text-align: center;
    vertical-align: middle;
    padding: 2px;
    cursor: pointer;
    transition: all 0.1s;
}

.opcode-cell:hover {
    border-color: #555;
    transform: scale(1.05);
    z-index: 10;
    position: relative;
}

.opcode-misc { background: rgba(0, 100, 255, 0.12); }
.opcode-jump { background: rgba(0, 200, 0, 0.12); }
.opcode-load { background: rgba(255, 200, 0, 0.12); }
.opcode-arith { background: rgba(255, 50, 50, 0.12); }
.opcode-shift { background: rgba(200, 100, 255, 0.12); }
.opcode-empty { background: #080808; }

/* Console output */
.console-output {
    background: #020202;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    padding: 8px;
    min-height: 60px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--green);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 11px;
    z-index: 1000;
    max-width: 250px;
    pointer-events: none;
}

/* Collapsible section */
.section-header {
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Disassembly highlight */
.disasm-current {
    background: rgba(51, 255, 51, 0.08);
    border-left: 2px solid var(--green);
}

.disasm-breakpoint {
    background: rgba(255, 68, 68, 0.08);
    border-left: 2px solid var(--red);
}

/* Speed slider */
input[type="range"] {
    -webkit-appearance: none;
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--green);
    border-radius: 50%;
    cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column !important;
    }
    .left-panel, .right-panel {
        width: 100% !important;
        max-height: none !important;
    }
}