@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

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

body {
    font-family: 'Space Mono', monospace;
    background: #1a1a1a;
    color: #00ff00;
    overflow: hidden;
    user-select: none;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.gameboy-shell {
    width: 600px;
    background: #8b956d;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.3),
        0 20px 40px rgba(0,0,0,0.5);
    position: relative;
}

.gameboy-shell::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #6b7353, #9ba473);
    border-radius: 25px;
    z-index: -1;
}

.screen-section {
    margin-bottom: 30px;
}

.screen {
    background: #9bbc0f;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
    position: relative;
}

.screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 25%,
        rgba(0,0,0,0.1) 25%,
        rgba(0,0,0,0.1) 50%,
        transparent 50%
    );
    background-size: 4px 4px;
    border-radius: 10px;
    pointer-events: none;
}

.screen-content {
    background: #8bac0f;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: #306230;
    margin-bottom: 2px;
}

.tagline {
    font-size: 10px;
    color: #306230;
    margin-bottom: 5px;
}

#waveform {
    width: 100%;
    height: 80px;
    background: #306230;
    border-radius: 3px;
    margin: 5px 0;
}

.status {
    font-size: 12px;
    color: #306230;
    font-weight: 700;
    margin-top: auto;
    padding-top: 5px;
    animation: blink 1s infinite;
}

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

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn {
    background: #306230;
    color: #9bbc0f;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 
        0 4px 0 #1a3a1a,
        inset 0 2px 0 rgba(255,255,255,0.2);
    position: relative;
    top: 0;
}

.btn:hover {
    background: #4a7c4a;
}

.btn:active {
    top: 2px;
    box-shadow: 
        0 2px 0 #1a3a1a,
        inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn:disabled {
    background: #5a5a5a;
    color: #8a8a8a;
    cursor: not-allowed;
    box-shadow: 
        0 4px 0 #3a3a3a,
        inset 0 2px 0 rgba(255,255,255,0.1);
}

.btn-eject {
    background: #8b0000;
    color: #ff6666;
    box-shadow: 
        0 4px 0 #5a0000,
        inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn-eject:hover {
    background: #a01010;
}

.btn-eject:active {
    box-shadow: 
        0 2px 0 #5a0000,
        inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn.recording {
    background: #ff4136;
    color: #ffffff;
    animation: pulse-red 1.5s infinite ease-in-out;
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 
            0 4px 0 #85144b,
            0 0 5px rgba(255, 65, 54, 0.5);
    }
    50% {
        box-shadow: 
            0 4px 0 #85144b,
            0 0 20px rgba(255, 65, 54, 1);
    }
}

.btn-small {
    padding: 8px 16px;
    font-size: 10px;
}

.glitch-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 10px;
    color: #306230;
    font-weight: 700;
}

.control-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #306230;
    border-radius: 2px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #9bbc0f;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #9bbc0f;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.control-group span {
    font-size: 10px;
    color: #306230;
    text-align: center;
    font-weight: 700;
}

.channel-display {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.channel {
    background: #306230;
    color: #9bbc0f;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    transition: all 0.2s;
}

.channel.active {
    background: #9bbc0f;
    color: #306230;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.utility-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.ram-display-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-top: 5px;
}

.ram-display-container.hidden {
    display: none;
}

.ram-label {
    font-size: 8px;
    color: #306230;
    margin-bottom: 2px;
}

#ram-display {
    background: #306230;
    color: #9bbc0f;
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    line-height: 8px;
    padding: 4px;
    border-radius: 3px;
    white-space: pre;
    text-align: left;
    overflow: hidden;
}

.glitch-active {
    animation: glitch 0.1s infinite;
}

@keyframes glitch {
    0% { transform: translate(0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, 2px); }
    40% { transform: translate(1px, -2px); }
    50% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, 1px); }
    70% { transform: translate(-1px, -2px); }
    80% { transform: translate(1px, 2px); }
    90% { transform: translate(-2px, -1px); }
    100% { transform: translate(0); }
}

.corrupted {
    filter: hue-rotate(90deg) saturate(200%);
}

.screen-noise {
    background: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.03) 2px,
            rgba(0,0,0,0.03) 4px
        );
}