:root {
    --phosphor: #33ff33;
    --phosphor-dim: #1a8c1a;
    --phosphor-bright: #66ff66;
    --amber: #ffb000;
    --amber-dim: #8c6000;
    --bg-dark: #0a0e14;
    --bg-panel: #0d1117;
    --bg-header: #060a0f;
    --border: #1a3a1a;
    --text-dim: #4a7a4a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-dark);
    font-family: 'Fira Code', monospace;
    color: var(--phosphor);
    overflow-x: hidden;
}

/* CRT Scanline Effect */
#root::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* CRT Curvature */
#root::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes flash-green {
    0% { background: var(--phosphor); color: var(--bg-dark); }
    100% { background: transparent; color: var(--phosphor); }
}

@keyframes flash-amber {
    0% { background: var(--amber); color: var(--bg-dark); }
    100% { background: transparent; color: var(--amber); }
}

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

.flash-register {
    animation: flash-green 0.5s ease-out;
}

.flash-memory {
    animation: flash-amber 0.3s ease-out;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor);
}

/* Button styles */
.btn-retro {
    background: transparent;
    border: 1px solid var(--phosphor-dim);
    color: var(--phosphor);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-retro:hover {
    background: var(--phosphor-dim);
    color: var(--bg-dark);
    box-shadow: 0 0 8px var(--phosphor-dim);
}

.btn-retro:active {
    background: var(--phosphor);
    color: var(--bg-dark);
}

.btn-retro.amber {
    border-color: var(--amber-dim);
    color: var(--amber);
}

.btn-retro.amber:hover {
    background: var(--amber-dim);
    color: var(--bg-dark);
    box-shadow: 0 0 8px var(--amber-dim);
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 2px;
}

.panel-title {
    background: rgba(26, 58, 26, 0.3);
    border-bottom: 1px solid var(--border);
    padding: 4px 8px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--phosphor-dim);
}

input[type="text"], input[type="number"] {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--phosphor);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    padding: 2px 6px;
    outline: none;
}

input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--phosphor-dim);
    box-shadow: 0 0 4px rgba(51, 255, 51, 0.2);
}

.drop-zone {
    border: 2px dashed var(--phosphor-dim);
    transition: all 0.2s;
}

.drop-zone.drag-over {
    border-color: var(--phosphor);
    background: rgba(51, 255, 51, 0.05);
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.1) inset;
}

/* Status indicators */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.ok {
    background: var(--phosphor);
    box-shadow: 0 0 4px var(--phosphor);
}

.status-dot.error {
    background: #ff3333;
    box-shadow: 0 0 4px #ff3333;
}

.status-dot.pending {
    background: var(--amber);
    box-shadow: 0 0 4px var(--amber);
}

/* Instruction Set Reference Panel */
.isa-panel {
    background: var(--bg-dark);
}

.isa-grid {
    display: grid;
    grid-template-columns: 32px repeat(16, 1fr);
    gap: 1px;
    font-size: 0.5rem;
    min-width: 900px;
}

.isa-cell {
    padding: 3px 2px;
    text-align: center;
    border: 1px solid rgba(26, 58, 26, 0.3);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    cursor: default;
}

.isa-cell:not(.isa-header):not(.isa-empty):hover {
    border-color: var(--phosphor);
    box-shadow: 0 0 6px rgba(51, 255, 51, 0.2);
    z-index: 1;
    transform: scale(1.05);
}

.isa-header {
    background: rgba(26, 58, 26, 0.4);
    color: var(--phosphor-dim);
    font-weight: 600;
    font-size: 0.6rem;
    min-height: 24px;
}

.isa-empty {
    background: rgba(10, 14, 20, 0.8);
}

.isa-cell-content {
    line-height: 1.2;
}

.isa-mnemonic {
    font-weight: 600;
    font-size: 0.5rem;
    white-space: nowrap;
}

.isa-operands {
    font-size: 0.42rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

.isa-meta {
    font-size: 0.38rem;
    opacity: 0.5;
    white-space: nowrap;
    color: var(--phosphor-dim);
    margin-top: 1px;
}

.isa-tooltip {
    position: sticky;
    bottom: 0;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid var(--phosphor-dim);
    padding: 6px 12px;
    margin-top: 8px;
    border-radius: 2px;
}

.isa-legend-item {
    font-size: 0.5rem;
    padding: 1px 4px;
    border-radius: 2px;
}

/* Opcode type colors */
.opcode-alu {
    background: rgba(100, 180, 100, 0.1);
    color: #88cc88;
}

.opcode-alu .isa-mnemonic { color: #88cc88; }

.opcode-jmp {
    background: rgba(100, 150, 255, 0.1);
    color: #88aaff;
}

.opcode-jmp .isa-mnemonic { color: #88aaff; }

.opcode-ls {
    background: rgba(200, 150, 50, 0.1);
    color: #ccaa55;
}

.opcode-ls .isa-mnemonic { color: #ccaa55; }

.opcode-str {
    background: rgba(200, 100, 200, 0.1);
    color: #cc88cc;
}

.opcode-str .isa-mnemonic { color: #cc88cc; }

.opcode-grp {
    background: rgba(255, 120, 80, 0.1);
    color: #ff9966;
}

.opcode-grp .isa-mnemonic { color: #ff9966; }

.opcode-pfx {
    background: rgba(80, 200, 200, 0.1);
    color: #66cccc;
}

.opcode-pfx .isa-mnemonic { color: #66cccc; }

.opcode-misc {
    background: rgba(150, 150, 150, 0.08);
    color: #999999;
}

.opcode-misc .isa-mnemonic { color: #aaaaaa; }

.opcode-empty {
    background: rgba(10, 14, 20, 0.5);
}