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

body {
    background-color: #0a0a0a;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    font-family: 'IBM Plex Mono', monospace;
    color: #aaa;
    min-height: 100vh;
    overflow-x: hidden;
}

.crt-bezel {
    background: linear-gradient(145deg, #3a3a3a 0%, #1a1a1a 30%, #2a2a2a 70%, #1a1a1a 100%);
    border-radius: 20px;
    padding: 24px;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.1),
        inset 0 -2px 4px rgba(0,0,0,0.5),
        0 8px 32px rgba(0,0,0,0.8),
        0 0 60px rgba(0,0,0,0.5);
    border: 2px solid #444;
    position: relative;
}

.crt-bezel::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    height: 30%;
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 100%);
    border-radius: 16px 16px 0 0;
    pointer-events: none;
}

.crt-screen {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #001100;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.6),
        inset 0 0 10px rgba(0,0,0,0.4);
}

.crt-screen.green { background: #001100; }
.crt-screen.amber { background: #110800; }
.crt-screen.white { background: #080808; }

.crt-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.15) 1px,
        rgba(0, 0, 0, 0.15) 2px
    );
    pointer-events: none;
    z-index: 2;
}

.crt-screen::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.35) 80%);
    pointer-events: none;
    z-index: 3;
}

.screen-text {
    position: relative;
    z-index: 1;
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.25;
    padding: 16px;
    white-space: pre;
    letter-spacing: 0.5px;
    min-height: 360px;
}

.screen-text.green {
    color: #33FF33;
    text-shadow: 0 0 8px rgba(51, 255, 51, 0.6), 0 0 20px rgba(51, 255, 51, 0.3);
}

.screen-text.amber {
    color: #FFB000;
    text-shadow: 0 0 8px rgba(255, 176, 0, 0.6), 0 0 20px rgba(255, 176, 0, 0.3);
}

.screen-text.white {
    color: #CCCCCC;
    text-shadow: 0 0 8px rgba(204, 204, 204, 0.5), 0 0 20px rgba(204, 204, 204, 0.2);
}

.btn-retro {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    border: 2px solid #555;
    border-radius: 4px;
    background: linear-gradient(180deg, #3a3a3a 0%, #222 100%);
    color: #ccc;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.1s ease;
    user-select: none;
}

.btn-retro:hover {
    background: linear-gradient(180deg, #4a4a4a 0%, #333 100%);
    border-color: #666;
    color: #fff;
}

.btn-retro:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.btn-retro.active {
    background: linear-gradient(180deg, #1a3a1a 0%, #0a2a0a 100%);
    border-color: #33FF33;
    color: #33FF33;
    box-shadow: 0 0 8px rgba(51, 255, 51, 0.3);
}

.btn-retro.danger {
    border-color: #a33;
    color: #f66;
}

.btn-retro.danger:hover {
    border-color: #f44;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
}

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

.led-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #333;
}

.led-on {
    background: #33FF33;
    box-shadow: 0 0 6px #33FF33, 0 0 12px rgba(51, 255, 51, 0.5);
}

.led-off {
    background: #1a1a1a;
}

.led-amber {
    background: #FFB000;
    box-shadow: 0 0 6px #FFB000;
}

.led-red {
    background: #FF3333;
    box-shadow: 0 0 6px #FF3333;
}

.drop-zone {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: #33FF33;
    background: rgba(51, 255, 51, 0.05);
}

.debug-panel {
    font-family: 'VT323', monospace;
    font-size: 16px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
}

.register-val {
    color: #33FF33;
    font-weight: bold;
}

.flag-on { color: #33FF33; }
.flag-off { color: #333; }

.rom-table {
    width: 100%;
    border-collapse: collapse;
}

.rom-table th, .rom-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #222;
    font-size: 13px;
}

.rom-table th {
    color: #666;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
}

input[type="range"] {
    -webkit-appearance: none;
    background: #222;
    height: 6px;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #33FF33;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(51, 255, 51, 0.5);
}

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

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

.scroll-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.scroll-thin::-webkit-scrollbar-track {
    background: #111;
}
.scroll-thin::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}