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

.mario3-page {
    padding: 24px 0 32px;
    background: radial-gradient(ellipse at 50% -10%, #7fb0ff 0%, #5c94fc 55%, #3a6fd8 100%);
    font-family: 'Press Start 2P', 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.mario3-page h1 {
    color: #ffd700;
    text-shadow:
        3px 3px 0 #000,
        0 0 10px rgba(255, 215, 0, 0.6);
    font-size: 24px;
    letter-spacing: 2px;
    margin-bottom: 18px;
    animation: titlePulse 2.4s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow: 3px 3px 0 #000, 0 0 10px rgba(255, 215, 0, 0.6);
    }
    50% {
        text-shadow: 3px 3px 0 #000, 0 0 18px rgba(255, 215, 0, 0.95);
    }
}

.game-container {
    position: relative;
    background: #1a1a1a;
    border: 4px solid #fff;
    border-radius: 4px;
    padding: 10px;
    box-shadow:
        0 0 0 4px #000,
        8px 8px 0 rgba(0, 0, 0, 0.5);
}

/* arcade-cabinet corner bolts */
.game-container::before,
.game-container::after {
    content: '';
    position: absolute;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ddd, #777 70%, #333);
}

.game-container::before {
    left: 6px;
}

.game-container::after {
    right: 6px;
}

.ui {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    color: #ffe66d;
    min-width: 720px;
}

.ui p {
    background: #000;
    border: 2px solid #ffe66d;
    border-radius: 3px;
    padding: 6px 10px;
    margin: 0;
    flex: 1;
    text-align: center;
}

.ui p:nth-child(1)::before {
    content: '\25CF ';
    color: #ffd700;
}

.ui p:nth-child(2)::before {
    content: '\25B6 ';
    color: #6bd6ff;
}

.ui p:nth-child(3)::before {
    content: '\2665 ';
    color: #ff5b5b;
}

#game-area {
    position: relative;
    width: 720px;
    height: 360px;
    background:
        radial-gradient(16px 10px at 90px 55px, #fff 60%, transparent 62%),
        radial-gradient(12px 8px at 112px 50px, #fff 60%, transparent 62%),
        radial-gradient(14px 9px at 280px 85px, #fff 55%, transparent 58%),
        radial-gradient(10px 7px at 300px 80px, #fff 55%, transparent 58%),
        radial-gradient(16px 10px at 520px 45px, #fff 60%, transparent 62%),
        radial-gradient(11px 7px at 542px 40px, #fff 60%, transparent 62%),
        radial-gradient(240px 130px at 130px 350px, #3aa93a 55%, transparent 58%),
        radial-gradient(200px 110px at 560px 345px, #3aa93a 50%, transparent 54%),
        linear-gradient(to bottom, #5c94fc 0%, #5c94fc 85%, #00a800 85%, #00a800 100%);
    border: 2px solid #000;
    overflow: hidden;
    image-rendering: pixelated;
}

/* CRT scanlines, on top of every sprite */
#game-area::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.14) 0px,
        rgba(0, 0, 0, 0.14) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 600;
}

/* soft screen vignette */
#game-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.35) 100%);
    pointer-events: none;
    z-index: 601;
}

#mario {
    position: absolute;
    width: 22px;
    height: 26px;
    z-index: 100;
    background:
        linear-gradient(to bottom,
            #e52521 0%, #e52521 30%,
            #ffcc99 30%, #ffcc99 55%,
            #1e4fb0 55%, #1e4fb0 100%);
    border: 1px solid #000;
    box-sizing: border-box;
}

/* cap brim */
#mario::before {
    content: '';
    position: absolute;
    top: 4px;
    left: -3px;
    width: 13px;
    height: 3px;
    background: #b5211d;
    border: 1px solid #000;
}

/* eyes + mustache */
#mario::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 6px;
    width: 2px;
    height: 2px;
    background: #1a1005;
    box-shadow:
        9px 0 0 #1a1005,
        -1px 4px 0 1px #1a1005;
}

.platform {
    position: absolute;
    background-color: #c84c0c;
    background-image:
        linear-gradient(#00000055 1px, transparent 1px),
        linear-gradient(90deg, #00000055 1px, transparent 1px);
    background-size: 20px 10px;
    border-top: 4px solid #1f8f1f;
    box-shadow:
        inset -3px -3px 0 rgba(0, 0, 0, 0.35),
        inset 3px 3px 0 rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.platform::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background:
        repeating-linear-gradient(90deg, #35c235 0 4px, #2ba32b 4px 8px);
}

.enemy {
    position: absolute;
    width: 22px;
    height: 22px;
    background: linear-gradient(to bottom, #a0522d 0%, #a0522d 72%, #5a2d0c 72%, #5a2d0c 100%);
    border-radius: 6px 6px 2px 2px;
    border: 1px solid #000;
    box-sizing: border-box;
}

.enemy::before,
.enemy::after {
    content: '';
    position: absolute;
    top: 6px;
    width: 4px;
    height: 4px;
    background: #fff;
    border: 1px solid #000;
    box-shadow: 0 -3px 0 -1px #2b1400;
}

.enemy::before {
    left: 3px;
}

.enemy::after {
    right: 3px;
}

.coin {
    position: absolute;
    width: 16px;
    height: 16px;
    background:
        radial-gradient(circle at 35% 30%, #fff8c8 0%, #ffd700 35%, #d69b00 100%);
    border: 2px solid #8a6400;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
    animation: coinSpin 0.9s linear infinite;
}

@keyframes coinSpin {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(0.2);
    }
}

.pipe {
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(90deg, #007a00 0%, #00a800 20%, #1fcc1f 45%, #00a800 70%, #006400 100%);
    border: 2px solid #000;
    box-sizing: border-box;
}

.pipe::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    right: -4px;
    height: 10px;
    background: linear-gradient(90deg, #007a00 0%, #3cd63c 25%, #6bff6b 50%, #3cd63c 75%, #007a00 100%);
    border: 2px solid #000;
    box-sizing: border-box;
}

.flagpole {
    position: absolute;
    top: 40px;
    bottom: 40px;
    width: 4px;
    background: linear-gradient(90deg, #eee, #999);
}

.flag {
    position: absolute;
    top: 0;
    left: 4px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid #00c800;
    filter: drop-shadow(1px 1px 0 #000);
    animation: flagWave 1s ease-in-out infinite;
}

@keyframes flagWave {
    0%, 100% {
        transform: skewY(0deg);
    }
    50% {
        transform: skewY(6deg);
    }
}

.controls {
    margin-top: 14px;
    text-align: center;
    font-size: 10px;
    color: #fff;
    line-height: 1.9;
    text-shadow: 1px 1px 0 #000;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 4px solid #fff;
    outline: 2px solid #000;
    outline-offset: 4px;
    background: #000;
    color: #fff;
    padding: 26px 30px;
    text-align: center;
    box-shadow:
        0 0 0 4px #000,
        0 0 24px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
}

#game-over h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #ffd700;
    text-shadow: 2px 2px 0 #000;
}

#game-over p {
    font-size: 12px;
    margin-bottom: 14px;
}

#restart-button {
    background: #e52521;
    color: #fff;
    border: 2px solid #fff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 11px;
    padding: 10px 14px;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    transition: background 0.1s ease;
}

#restart-button:hover {
    background: #ff3b36;
}

#restart-button:active {
    box-shadow: none;
    transform: translate(3px, 3px);
}
