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

:root {
    --phosphor: #00ff41;
    --phosphor-dim: #00aa2a;
    --phosphor-glow: rgba(0,255,65,0.4);
    --bg-dark: #0d0d0d;
    --panel-bg: #1a1a1a;
    --panel-border: #2a2a2a;
    --bezel: #222;
    --bezel-inner: #111;
    --text-dim: #666;
    --text-mid: #999;
    --amber: #ffbf00;
    --led-off: #333;
}

html, body {
    height: 100%;
    background: #0a0a0a;
    color: #ccc;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    overflow-x: hidden;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px;
    gap: 6px;
}

/* CONTROLS PANEL */
#controls-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #222 0%, #1a1a1a 40%, #181818 100%);
    border: 1px solid #333;
    border-radius: 6px;
    align-items: flex-end;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.5);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.knob-label {
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
    font-family: 'Share Tech Mono', monospace;
    text-align: center;
}

/* HARDWARE BUTTON */
.hw-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hw-button .btn-face {
    display: block;
    padding: 6px 14px;
    background: linear-gradient(180deg, #444 0%, #2a2a2a 50%, #222 100%);
    border: 1px solid #555;
    border-radius: 4px;
    color: #ddd;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.1s;
}

.hw-button:active .btn-face {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5), inset 0 1px 3px rgba(0,0,0,0.3);
    background: linear-gradient(180deg, #333 0%, #222 50%, #1a1a1a 100%);
}

/* TRANSPORT BUTTONS */
.transport-buttons {
    display: flex;
    gap: 4px;
}

.transport-btn {
    position: relative;
}

.transport-btn .btn-face {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 38px;
    text-align: center;
}

.led {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin: 4px auto 0;
    background: var(--led-off);
    box-shadow: none;
    transition: all 0.2s;
}

.led.on.led-green { background: #00ff41; box-shadow: 0 0 6px #00ff41; }
.led.on.led-amber { background: #ffbf00; box-shadow: 0 0 6px #ffbf00; }
.led.on.led-red { background: #ff3333; box-shadow: 0 0 6px #ff3333; }

/* KNOBS */
.knob-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.knob {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #555, #222 60%, #111 100%);
    border: 2px solid #444;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6), inset 0 -1px 2px rgba(0,0,0,0.4);
    transition: transform 0.15s;
}

.knob:hover {
    border-color: #666;
}

.knob-indicator {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 10px;
    background: var(--amber);
    border-radius: 2px;
    box-shadow: 0 0 4px var(--amber);
}

.knob-value {
    font-size: 11px;
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 16px;
}

/* TOGGLE BUTTONS */
.toggle-group {
    display: flex;
    gap: 2px;
    background: #111;
    border-radius: 3px;
    padding: 2px;
    border: 1px solid #333;
}

.toggle-btn {
    padding: 4px 8px;
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s;
}

.toggle-btn.active {
    background: var(--phosphor-dim);
    color: #000;
    box-shadow: 0 0 6px var(--phosphor-glow);
}

.toggle-btn:hover:not(.active) {
    color: #bbb;
}

/* COLOR SWATCHES */
.color-swatches {
    display: flex;
    gap: 6px;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.15s;
}

.color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 8px currentColor;
    transform: scale(1.15);
}

.color-swatch:hover:not(.active) {
    border-color: #888;
}

/* SCOPE AREA */
#scope-area {
    flex: 1;
    display: flex;
    gap: 8px;
    min-height: 300px;
}

#scope-bezel {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 50%, #151515 100%);
    border: 2px solid #3a3a3a;
    border-radius: 12px;
    padding: 12px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.6);
}

.screw {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #666, #333 70%);
    border: 1px solid #444;
    z-index: 5;
}

.screw::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) rotate(35deg);
    width: 6px;
    height: 1px;
    background: #222;
}

.screw.top-left { top: 6px; left: 6px; }
.screw.top-right { top: 6px; right: 6px; }
.screw.bottom-left { bottom: 6px; left: 6px; }
.screw.bottom-right { bottom: 6px; right: 6px; }

#scope-screen {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #050805;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.8), inset 0 0 4px rgba(0,255,65,0.05);
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#scanlines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.06) 2px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* DROP OVERLAY */
#drop-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    z-index: 10;
    border: 3px solid var(--phosphor);
    border-radius: 6px;
    animation: dropPulse 1s ease-in-out infinite;
}

#drop-overlay.visible {
    display: flex;
}

@keyframes dropPulse {
    0%, 100% { border-color: var(--phosphor); box-shadow: inset 0 0 30px var(--phosphor-glow); }
    50% { border-color: var(--phosphor-dim); box-shadow: inset 0 0 10px rgba(0,255,65,0.1); }
}

#drop-text {
    font-family: 'VT323', monospace;
    font-size: 28px;
    color: var(--phosphor);
    text-shadow: 0 0 10px var(--phosphor-glow);
    letter-spacing: 3px;
}

/* TRIGGER */
#trigger-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    width: 44px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

#trigger-slider {
    -webkit-appearance: none;
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 24px;
    flex: 1;
    background: transparent;
    cursor: pointer;
}

#trigger-slider::-webkit-slider-runnable-track {
    width: 4px;
    background: #333;
    border-radius: 2px;
}

#trigger-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 10px;
    background: linear-gradient(180deg, #888, #444);
    border: 1px solid #666;
    border-radius: 2px;
    cursor: grab;
    margin-left: -6px;
}

#trigger-slider::-moz-range-track {
    width: 4px;
    background: #333;
    border-radius: 2px;
}

#trigger-slider::-moz-range-thumb {
    width: 16px;
    height: 10px;
    background: linear-gradient(180deg, #888, #444);
    border: 1px solid #666;
    border-radius: 2px;
    cursor: grab;
}

#trigger-val {
    font-size: 10px;
}

/* INFO BAR */
#info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 10px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.5);
}

.info-cell {
    display: flex;
    gap: 6px;
    align-items: baseline;
    padding: 2px 8px;
    border-right: 1px solid #222;
}

.info-cell:last-child {
    border-right: none;
}

.info-label {
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.info-value {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: var(--phosphor);
    text-shadow: 0 0 4px var(--phosphor-glow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* SEEKBAR */
#seekbar-container {
    padding: 4px 12px;
}

#seekbar-track {
    position: relative;
    height: 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 3px;
    cursor: pointer;
    overflow: visible;
}

#seekbar-fill {
    height: 100%;
    width: 0%;
    background: var(--phosphor-dim);
    border-radius: 3px;
    box-shadow: 0 0 6px var(--phosphor-glow);
    transition: width 0.1s linear;
}

#seekbar-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--phosphor);
    box-shadow: 0 0 8px var(--phosphor-glow);
    cursor: grab;
    transition: left 0.1s linear;
}

/* FOOTER */
#app-footer {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

#app-footer a {
    color: var(--text-mid);
    text-decoration: none;
    transition: color 0.2s;
}

#app-footer a:hover {
    color: var(--phosphor);
    text-shadow: 0 0 6px var(--phosphor-glow);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #app-container {
        padding: 4px;
        gap: 4px;
    }

    #controls-panel {
        padding: 6px 8px;
        gap: 6px;
        justify-content: center;
    }

    .control-group {
        min-width: auto;
    }

    .knob {
        width: 36px;
        height: 36px;
    }

    .knob-indicator {
        height: 8px;
        top: 3px;
    }

    #scope-area {
        min-height: 250px;
    }

    .info-cell {
        padding: 2px 4px;
    }

    .info-value {
        max-width: 100px;
        font-size: 14px;
    }

    #drop-text {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .toggle-btn {
        font-size: 8px;
        padding: 3px 5px;
    }
    
    .hw-button .btn-face {
        padding: 4px 8px;
        font-size: 10px;
    }

    #scope-bezel {
        padding: 8px;
    }
}