@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

body {
    font-family: 'Press Start 2P', monospace;
    background: #2c3e50;
    background-image: 
        repeating-linear-gradient(
            0deg,
            #34495e 0px,
            #34495e 8px,
            #2c3e50 8px,
            #2c3e50 16px
        ),
        repeating-linear-gradient(
            90deg,
            #34495e 0px,
            #34495e 8px,
            #2c3e50 8px,
            #2c3e50 16px
        );
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ecf0f1;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent 0px,
            transparent 2px,
            rgba(52, 73, 94, 0.1) 2px,
            rgba(52, 73, 94, 0.1) 4px
        );
    pointer-events: none;
    z-index: 1;
}

.game-container {
    background: #1a252f;
    border: 4px solid #ecf0f1;
    border-style: solid;
    padding: 24px;
    box-shadow: 
        inset 2px 2px 0px #95a5a6,
        inset -2px -2px 0px #7f8c8d,
        4px 4px 0px #34495e;
    text-align: center;
    max-width: 500px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: repeating-linear-gradient(
        45deg,
        #2c3e50 0px,
        #2c3e50 2px,
        #34495e 2px,
        #34495e 4px
    );
    z-index: -1;
}

h1 {
    color: #f39c12;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: normal;
    text-shadow: 
        2px 2px 0px #d35400,
        4px 4px 0px #a0522d;
    letter-spacing: 2px;
    line-height: 1.2;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #34495e;
    border: 2px solid #ecf0f1;
    box-shadow: 
        inset 1px 1px 0px #95a5a6,
        inset -1px -1px 0px #7f8c8d,
        2px 2px 0px #2c3e50;
    position: relative;
}

.score, .high-score {
    font-size: 10px;
    font-weight: normal;
    color: #ecf0f1;
    text-shadow: 1px 1px 0px #2c3e50;
    position: relative;
    z-index: 1;
}

.recording-status {
    color: #ff4444;
    font-weight: bold;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    text-shadow: 2px 2px 0px #000000;
    animation: blink 1s infinite;
    margin-top: 5px;
}

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

#score, #high-score {
    color: #e74c3c;
    text-shadow: 1px 1px 0px #c0392b;
}

#gameCanvas {
    border: 4px solid #ecf0f1;
    border-style: solid;
    background-color: #2c3e50;
    margin: 16px 0;
    box-shadow: 
        inset 2px 2px 0px #95a5a6,
        inset -2px -2px 0px #7f8c8d,
        4px 4px 0px #34495e;
    position: relative;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.game-controls {
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.game-controls button {
    background: #3498db;
    color: #ecf0f1;
    border: 2px solid #ecf0f1;
    padding: 8px 16px;
    margin: 0 4px;
    font-size: 10px;
    font-weight: normal;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    transition: none;
    box-shadow: 
        inset 1px 1px 0px #5dade2,
        inset -1px -1px 0px #2980b9,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #2980b9;
    position: relative;
}

.game-controls button:hover {
    background: #5dade2;
    box-shadow: 
        inset 1px 1px 0px #85c1e9,
        inset -1px -1px 0px #3498db,
        2px 2px 0px #2c3e50;
}

.game-controls button:active {
    background: #2980b9;
    box-shadow: 
        inset 1px 1px 0px #3498db,
        inset -1px -1px 0px #21618c,
        1px 1px 0px #2c3e50;
    transform: translate(1px, 1px);
}

.game-controls button:disabled {
    background: #7f8c8d;
    color: #bdc3c7;
    border-color: #bdc3c7;
    cursor: not-allowed;
    box-shadow: 
        inset 1px 1px 0px #95a5a6,
        inset -1px -1px 0px #5d6d7e,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #5d6d7e;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

.speed-control label {
    font-weight: normal;
    color: #ecf0f1;
    font-size: 10px;
    text-shadow: 1px 1px 0px #2c3e50;
    font-family: 'Press Start 2P', monospace;
}

.speed-control select {
    padding: 6px 8px;
    border: 2px solid #ecf0f1;
    background-color: #9b59b6;
    color: #ecf0f1;
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    transition: none;
    box-shadow: 
        inset 1px 1px 0px #bb8fce,
        inset -1px -1px 0px #7d3c98,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #7d3c98;
}

.speed-control select:hover {
    background: #bb8fce;
    box-shadow: 
        inset 1px 1px 0px #d7bde2,
        inset -1px -1px 0px #9b59b6,
        2px 2px 0px #2c3e50;
}

.speed-control select:focus {
    outline: none;
    background: #7d3c98;
    box-shadow: 
        inset 1px 1px 0px #9b59b6,
        inset -1px -1px 0px #633974,
        2px 2px 0px #2c3e50;
}

.speed-control select option {
    background-color: #9b59b6;
    color: #ecf0f1;
    border: none;
}

.recording-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.recording-control label {
    font-weight: normal;
    color: #ecf0f1;
    font-size: 10px;
    text-shadow: 1px 1px 0px #2c3e50;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.recording-control input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #4ecdc4;
    cursor: pointer;
}

.recording-control .format-control {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

.recording-control .format-control label {
    font-weight: normal;
    color: #ecf0f1;
    font-size: 10px;
    text-shadow: 1px 1px 0px #2c3e50;
    font-family: 'Press Start 2P', monospace;
}

.recording-control .format-control select {
    padding: 6px 8px;
    border: 2px solid #ecf0f1;
    background-color: #9b59b6;
    color: #ecf0f1;
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    transition: none;
    box-shadow: 
        inset 1px 1px 0px #bb8fce,
        inset -1px -1px 0px #7d3c98,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #7d3c98;
}

.recording-control .format-control select:hover {
    background: #bb8fce;
    box-shadow: 
        inset 1px 1px 0px #d7bde2,
        inset -1px -1px 0px #9b59b6,
        2px 2px 0px #2c3e50;
}

.recording-control .format-control select:focus {
    outline: none;
    background: #7d3c98;
    box-shadow: 
        inset 1px 1px 0px #9b59b6,
        inset -1px -1px 0px #633974,
        2px 2px 0px #2c3e50;
}

.recording-control .format-control select option {
    background-color: #9b59b6;
    color: #ecf0f1;
    border: none;
}

.recording-control button {
    padding: 8px 12px;
    border: 2px solid #ecf0f1;
    background-color: #4ecdc4;
    color: #2c3e50;
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    transition: none;
    box-shadow: 
        inset 1px 1px 0px #7dd3c0,
        inset -1px -1px 0px #26a69a,
        2px 2px 0px #2c3e50;
    text-shadow: none;
    font-weight: bold;
}

.recording-control button:hover {
    background: #7dd3c0;
    box-shadow: 
        inset 1px 1px 0px #b2dfdb,
        inset -1px -1px 0px #4ecdc4,
        2px 2px 0px #2c3e50;
}

.recording-control button:active {
    box-shadow: 
        inset 1px 1px 0px #26a69a,
        inset -1px -1px 0px #00695c,
        1px 1px 0px #2c3e50;
    transform: translate(1px, 1px);
}

.recording-control button.recording {
    background: #e74c3c;
    box-shadow: 
        inset 1px 1px 0px #f1948a,
        inset -1px -1px 0px #c0392b,
        2px 2px 0px #2c3e50;
}

.recording-control button.recording:hover {
    background: #f1948a;
    box-shadow: 
        inset 1px 1px 0px #fadbd8,
        inset -1px -1px 0px #e74c3c,
        2px 2px 0px #2c3e50;
}

#pauseBtn {
    background: #f39c12;
    color: #ecf0f1;
    border-color: #ecf0f1;
    box-shadow: 
        inset 1px 1px 0px #f7dc6f,
        inset -1px -1px 0px #d68910,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #d68910;
}

#pauseBtn:hover {
    background: #f7dc6f;
    box-shadow: 
        inset 1px 1px 0px #fcf3cf,
        inset -1px -1px 0px #f39c12,
        2px 2px 0px #2c3e50;
}

#resetBtn {
    background: #e74c3c;
    color: #ecf0f1;
    border-color: #ecf0f1;
    box-shadow: 
        inset 1px 1px 0px #f1948a,
        inset -1px -1px 0px #c0392b,
        2px 2px 0px #2c3e50;
    text-shadow: 1px 1px 0px #c0392b;
}

#resetBtn:hover {
    background: #f1948a;
    box-shadow: 
        inset 1px 1px 0px #fadbd8,
        inset -1px -1px 0px #e74c3c,
        2px 2px 0px #2c3e50;
}

.instructions {
    margin-top: 16px;
    padding: 16px;
    background: #34495e;
    border: 2px solid #ecf0f1;
    border-left: 4px solid #27ae60;
    box-shadow: 
        inset 1px 1px 0px #95a5a6,
        inset -1px -1px 0px #7f8c8d,
        2px 2px 0px #2c3e50;
    position: relative;
}

.instructions h3 {
    color: #27ae60;
    margin-bottom: 8px;
    font-size: 12px;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 1px 1px 0px #1e8449;
    position: relative;
    z-index: 1;
    font-weight: normal;
}

.instructions p {
    margin: 4px 0;
    color: #ecf0f1;
    line-height: 1.4;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 1px 1px 0px #2c3e50;
    position: relative;
    z-index: 1;
    font-size: 8px;
}

@media (max-width: 600px) {
    .game-container {
        margin: 16px;
        padding: 16px;
        border-width: 2px;
    }
    
    h1 {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        border-width: 2px;
    }
    
    .game-controls button {
        padding: 6px 12px;
        margin: 2px 2px;
        font-size: 8px;
        border-width: 2px;
    }
    
    .game-info {
        padding: 8px 12px;
        border-width: 2px;
    }
    
    .instructions {
        padding: 12px;
        border-width: 2px;
        border-left-width: 3px;
    }
    
    .instructions h3 {
        font-size: 10px;
    }
    
    .instructions p {
        font-size: 7px;
    }
    
    .speed-control select {
        padding: 4px 6px;
        border-width: 2px;
        font-size: 8px;
    }
    
    .speed-control label {
        font-size: 8px;
    }
    
    .score, .high-score {
        font-size: 8px;
    }
}