@font-face {
    font-family: 'PressStart';
    src: local('Press Start 2P');
}

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

body {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background: #5c94fc;
    image-rendering: pixelated;
    border: 4px solid #fff;
    box-shadow: 0 0 20px rgba(128, 0, 255, 0.5);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #000033 0%, #330066 50%, #000033 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    z-index: 10;
}

#title-screen h1 {
    font-size: 36px;
    color: #b366ff;
    text-shadow: 
        4px 4px 0 #4d0099,
        -2px -2px 0 #ff66ff;
    margin-bottom: 30px;
    letter-spacing: 2px;
    animation: titlePulse 2s ease-in-out infinite;
}

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

.pixel-duck {
    width: 64px;
    height: 64px;
    background: #9933ff;
    margin: 20px;
    position: relative;
    image-rendering: pixelated;
    animation: duckBounce 0.5s ease-in-out infinite;
}

.pixel-duck::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 16px;
    background: #ff9900;
    top: 20px;
    right: -12px;
}

.pixel-duck::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #000;
    top: 12px;
    left: 12px;
    box-shadow: 20px 0 0 #000;
}

@keyframes duckBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

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

.controls-info {
    margin-top: 40px;
    font-size: 12px;
    color: #aaa;
    line-height: 2;
}

#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
}

#game-ui.hidden {
    display: none;
}

#ui-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    color: #fff;
    font-size: 16px;
    text-shadow: 2px 2px 0 #000;
}

#controls-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 4px;
}

#level-complete,
#game-over,
#victory {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    z-index: 20;
}

#level-complete.hidden,
#game-over.hidden,
#victory.hidden {
    display: none;
}

#level-complete h2 {
    font-size: 32px;
    color: #66ff66;
    margin-bottom: 20px;
}

#game-over h2 {
    font-size: 32px;
    color: #ff4444;
    margin-bottom: 20px;
}

#victory h2 {
    font-size: 36px;
    color: #ffcc00;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #ff9900;
}

.hidden {
    display: none !important;
}

#cheat-panel {
    position: absolute;
    top: 56px;
    right: 12px;
    width: 320px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #b366ff;
    box-shadow: 0 0 18px rgba(128, 0, 255, 0.6);
    color: #fff;
    z-index: 30;
    pointer-events: auto;
}

#cheat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

#cheat-panel-title {
    font-size: 14px;
    letter-spacing: 1px;
    color: #ffcc00;
    text-shadow: 1px 1px 0 #000;
}

#cheat-close {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 28px;
    height: 26px;
    cursor: pointer;
}

#cheat-panel-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cheat-row {
    display: grid;
    grid-template-columns: 70px 1fr 64px;
    gap: 8px;
    align-items: center;
}

.cheat-row label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.cheat-row input,
.cheat-row select {
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 0 8px;
    outline: none;
}

.cheat-row button {
    height: 28px;
    background: rgba(179, 102, 255, 0.22);
    border: 1px solid rgba(179, 102, 255, 0.8);
    color: #fff;
    cursor: pointer;
}
