/* Import Mario Kart-style font */
@font-face {
    font-family: 'mario kart';
    src: url('./src/font-Mario-Kart.woff2') format('woff2');
}

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

body {
    font-family: 'mario kart', 'Press Start 2P', monospace;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: auto;
    color: #00ff00;
    padding: 10px;
}

@media (min-width: 769px) {
    body {
        overflow: hidden;
        padding: 0;
    }
}

/* CRT Monitor Container */
.crt-monitor {
    position: relative;
    width: 95vw;
    max-width: 1200px;
    height: 95vh;
    max-height: 800px;
    background: #0a0a0a;
    border: 25px solid #2a2a2a;
    border-radius: 20px;
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.9),
        0 0 100px rgba(0, 255, 0, 0.2),
        0 0 50px rgba(0, 255, 0, 0.1);
    overflow: hidden;
    animation: powerOn 0.5s ease-out;
}

@media (max-width: 768px) {
    .crt-monitor {
        width: 100%;
        height: auto;
        min-height: 100vh;
        max-height: none;
    }
}

/* CRT Screen Curvature Effect */
.crt-monitor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 10;
}

/* CRT Overlay Effects */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 9;
    animation: flicker 0.15s infinite;
}

/* Scanlines */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 8;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

@keyframes flicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.97; }
}

@keyframes powerOn {
    0% {
        box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.9);
    }
    100% {
        box-shadow:
            inset 0 0 50px rgba(0, 0, 0, 0.9),
            0 0 100px rgba(0, 255, 0, 0.2),
            0 0 50px rgba(0, 255, 0, 0.1);
    }
}

/* Screen States */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    background: linear-gradient(180deg, #1a4d8f 0%, #0a2545 100%);
}

.screen.active {
    display: flex;
}

@media (max-width: 768px) {
    .screen {
        position: relative;
        min-height: 100vh;
        padding: 20px 10px;
        overflow-y: auto;
        justify-content: flex-start;
        padding-top: 40px;
    }
}

/* ============= BOOT SCREEN ============= */
#boot-screen {
    background: url('bg.jpg') center/cover;
    background-color: #000;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
}

.boot-logo {
    width: 300px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px #FF00FF)
            drop-shadow(0 0 40px #00FFFF);
    animation: bootLogoGlow 2s ease-in-out infinite;
}

@keyframes bootLogoGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px #FF00FF) drop-shadow(0 0 40px #00FFFF);
    }
    50% {
        filter: drop-shadow(0 0 30px #FF00FF) drop-shadow(0 0 60px #00FFFF);
    }
}

.boot-lakitu {
    width: 100px;
    height: auto;
    margin-bottom: 20px;
    animation: lakituFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
}

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

.boot-text p {
    font-size: 20px;
    margin: 30px 0;
    line-height: 1.8;
    letter-spacing: 2px;
}

#boot-status {
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
}

#boot-progress {
    width: 400px;
    height: 30px;
    border: 3px solid #00ff00;
    margin-top: 40px;
    position: relative;
    overflow: hidden;
}

#boot-progress::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: #00ff00;
    animation: bootProgress 3s ease-out forwards;
}

@keyframes bootProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

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

@keyframes blink {
    50% { opacity: 0; }
}

/* ============= MAIN MENU ============= */
#main-menu {
    background: url('bg.jpg') center/cover, linear-gradient(180deg, #87CEEB 0%, #4682B4 50%, #1a4d8f 100%);
    position: relative;
    overflow: hidden;
}

/* Floating coins */
.floating-coin {
    position: absolute;
    width: 60px;
    height: 60px;
    animation: coinSpin 2s steps(6) infinite, floatAround 8s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

.coin-1 {
    top: 10%;
    left: 5%;
    animation-delay: 0s, 0s;
}

.coin-2 {
    top: 20%;
    right: 8%;
    animation-delay: 0.3s, 2s;
}

.coin-3 {
    bottom: 15%;
    left: 10%;
    animation-delay: 0.6s, 4s;
}

.coin-4 {
    bottom: 25%;
    right: 5%;
    animation-delay: 0.9s, 6s;
}

@keyframes coinSpin {
    0% { background-position: 0 0; }
    100% { background-position: -360px 0; }
}

@keyframes floatAround {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -20px) rotate(90deg); }
    50% { transform: translate(0, -40px) rotate(180deg); }
    75% { transform: translate(-20px, -20px) rotate(270deg); }
}

/* Question boxes */
.question-box {
    position: absolute;
    width: 80px;
    height: 80px;
    animation: boxBounce 1s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.box-1 {
    top: 50%;
    left: 2%;
    animation-delay: 0s;
}

.box-2 {
    top: 60%;
    right: 3%;
    animation-delay: 0.5s;
}

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

/* Background Meow cats */
.bg-meow {
    position: absolute;
    width: 120px;
    height: auto;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    filter: blur(2px);
    animation: meowFloat 6s ease-in-out infinite;
}

.meow-bg-1 {
    top: 5%;
    left: 3%;
    animation-delay: 0s;
}

.meow-bg-2 {
    top: 10%;
    right: 5%;
    animation-delay: 1.5s;
    transform: scaleX(-1);
}

.meow-bg-3 {
    bottom: 10%;
    left: 8%;
    animation-delay: 3s;
}

.meow-bg-4 {
    bottom: 8%;
    right: 6%;
    animation-delay: 4.5s;
    transform: scaleX(-1);
}

@keyframes meowFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

.menu-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 5;
    position: relative;
    padding: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.logo-side-meow {
    width: 120px;
    height: auto;
    opacity: 1;
    filter: drop-shadow(0 0 15px rgba(255, 0, 255, 0.6));
}

.left-meow {
    animation: meowBounceLeft 0.8s ease-in-out infinite alternate;
}

.right-meow {
    animation: meowBounceRight 0.8s ease-in-out infinite alternate;
    transform: scaleX(-1);
}

@keyframes meowBounceLeft {
    from { transform: translateY(0) rotate(-5deg); }
    to { transform: translateY(-15px) rotate(-8deg); }
}

@keyframes meowBounceRight {
    from { transform: scaleX(-1) translateY(0) rotate(-5deg); }
    to { transform: scaleX(-1) translateY(-15px) rotate(-8deg); }
}

.game-logo {
    width: 60%;
    max-width: 400px;
    height: auto;
    filter: drop-shadow(0 0 20px #FF00FF)
            drop-shadow(0 0 40px #00FFFF)
            drop-shadow(5px 5px 0 rgba(0, 0, 0, 0.5));
    animation: logoFloat 2s ease-in-out infinite;
}

/* CA Display Box */
.ca-display {
    background: #000;
    border: 6px solid #FFD700;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 20px;
    box-shadow:
        0 6px 0 #8B4513,
        0 8px 20px rgba(0, 0, 0, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
    max-width: 600px;
    cursor: pointer;
    transition: all 0.2s;
}

.ca-display:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #8B4513,
        0 10px 25px rgba(0, 0, 0, 0.7),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(255, 215, 0, 0.6);
}

.ca-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #FFFFFF;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    word-break: break-all;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.03); }
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 20px 0;
    z-index: 5;
    position: relative;
}

.menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px 20px;
    background: linear-gradient(180deg, #FF6B6B 0%, #C92A2A 100%);
    border: 6px solid #FFF;
    border-radius: 15px;
    box-shadow:
        0 8px 0 #8B0000,
        0 10px 20px rgba(0, 0, 0, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
    cursor: pointer;
    text-decoration: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s;
    position: relative;
    text-transform: uppercase;
}

.menu-button:hover {
    transform: translateY(-5px);
    box-shadow:
        0 12px 0 #8B0000,
        0 15px 25px rgba(0, 0, 0, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        0 0 30px rgba(255, 107, 107, 0.8);
}

.menu-button:active {
    transform: translateY(4px);
    box-shadow:
        0 4px 0 #8B0000,
        0 5px 10px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.button-icon {
    font-size: 48px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

.button-icon-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    image-rendering: pixelated;
}

.star-icon {
    width: 60px;
    height: 60px;
}

.button-text {
    font-size: 16px;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.buy-button {
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    animation: buyPulse 2s ease-in-out infinite;
}

@keyframes buyPulse {
    0%, 100% {
        box-shadow:
            0 8px 0 #CC8400,
            0 10px 20px rgba(0, 0, 0, 0.5),
            inset 0 2px 0 rgba(255, 255, 255, 0.3),
            0 0 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow:
            0 8px 0 #CC8400,
            0 10px 20px rgba(0, 0, 0, 0.5),
            inset 0 2px 0 rgba(255, 255, 255, 0.3),
            0 0 40px rgba(255, 215, 0, 0.9);
    }
}

.copy-ca-button {
    background: linear-gradient(180deg, #3498DB 0%, #2874A6 100%);
}

.memes-button {
    background: linear-gradient(180deg, #9B59B6 0%, #6C3483 100%);
}

.menu-meow-img {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 0 20px #FF00FF);
    animation: meowBounce 0.6s ease-in-out infinite alternate;
}

@keyframes meowBounce {
    from { transform: translateY(0) rotate(-3deg); }
    to { transform: translateY(-20px) rotate(3deg); }
}

/* ============= MEMES GALLERY (Mario Kart Style) ============= */
#memes-screen {
    background: linear-gradient(180deg, #2C3E50 0%, #1a252f 100%);
    padding: 0;
}

#memes-screen.active {
    display: flex;
    flex-direction: column;
}

.memes-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(180deg, #2C3E50 0%, #1a252f 100%);
    z-index: 100;
    flex-shrink: 0;
}

.kart-title {
    font-size: 48px;
    color: #FFD700;
    text-shadow:
        4px 4px 0 #FF0000,
        0 0 30px #FFD700;
    letter-spacing: 3px;
    animation: titleShake 0.5s ease-in-out infinite;
}

@keyframes titleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

.back-button {
    padding: 15px 30px;
    font-size: 20px;
    font-family: 'mario kart', monospace;
    background: linear-gradient(180deg, #E74C3C 0%, #C0392B 100%);
    color: white;
    border: 5px solid white;
    border-radius: 10px;
    cursor: pointer;
    box-shadow:
        0 6px 0 #8B0000,
        0 8px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.back-button:hover {
    transform: translateY(-3px);
    box-shadow:
        0 9px 0 #8B0000,
        0 12px 20px rgba(0, 0, 0, 0.6);
}

.back-button:active {
    transform: translateY(3px);
    box-shadow:
        0 3px 0 #8B0000,
        0 4px 8px rgba(0, 0, 0, 0.4);
}

.memes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.meme-slot {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.3s;
}

.meme-slot:hover {
    transform: scale(1.1) translateY(-10px);
    z-index: 10;
}

.meme-frame {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #34495E 0%, #2C3E50 100%);
    border: 8px solid #FFD700;
    border-radius: 20px;
    padding: 15px;
    box-shadow:
        0 10px 0 #CC8400,
        0 12px 25px rgba(0, 0, 0, 0.6),
        inset 0 4px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    position: relative;
}

.meme-selector {
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.8));
}

.meme-slot:hover .meme-selector {
    opacity: 1;
    animation: selectorPulse 0.8s ease-in-out infinite;
}

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

.meme-slot:hover .meme-frame {
    border-color: #FF00FF;
    box-shadow:
        0 10px 0 #CC8400,
        0 12px 25px rgba(0, 0, 0, 0.6),
        inset 0 4px 0 rgba(255, 255, 255, 0.2),
        0 0 40px rgba(255, 0, 255, 0.8);
}

.meme-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    object-fit: cover;
}

.meme-label {
    font-size: 16px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    letter-spacing: 1px;
}

/* Responsive Design */

/* Large screens */
@media (min-width: 1400px) {
    .crt-monitor {
        max-width: 1400px;
        max-height: 900px;
    }

    .menu-grid {
        max-width: 1000px;
        gap: 25px;
    }

    .memes-grid {
        max-width: 1200px;
    }
}

/* Tablets and medium screens */
@media (max-width: 1024px) {
    .memes-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .logo-side-meow {
        width: 100px;
    }

    .game-logo {
        max-width: 350px;
    }

    .menu-grid {
        max-width: 700px;
    }

    .bg-meow {
        width: 100px;
    }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
    .kart-title {
        font-size: 28px;
        margin-top: 20px;
    }

    .memes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 10px;
        margin-bottom: 30px;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .logo-container {
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .logo-side-meow {
        width: 80px;
    }

    .game-logo {
        width: 80%;
        max-width: 300px;
    }

    .button-text {
        font-size: 12px;
    }

    .button-icon-img {
        width: 40px;
        height: 40px;
    }

    .menu-button {
        padding: 20px 10px;
        gap: 10px;
    }

    .ca-display {
        max-width: 90%;
        padding: 8px 12px;
    }

    .ca-text {
        font-size: 11px;
    }

    .bg-meow {
        width: 80px;
        opacity: 0.1;
    }

    .boot-logo {
        width: 250px;
        margin-top: 40px;
    }

    .memes-header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 25px;
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, #2C3E50 0%, #1a252f 100%);
        z-index: 100;
        padding: 20px 10px 10px;
        margin: -20px -10px 25px;
    }

    .menu-meow-img {
        margin-bottom: 30px;
    }

    #memes-screen {
        padding: 20px 10px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .crt-monitor {
        border-width: 10px;
        border-radius: 10px;
    }

    .boot-text p {
        font-size: 12px;
        margin: 15px 0;
    }

    #boot-progress {
        width: 200px;
        height: 15px;
    }

    .boot-logo {
        width: 180px;
    }

    .menu-button {
        padding: 15px 8px;
        gap: 8px;
    }

    .button-icon-img {
        width: 35px;
        height: 35px;
    }

    .button-text {
        font-size: 10px;
    }

    .kart-title {
        font-size: 24px;
    }

    .back-button {
        font-size: 12px;
        padding: 10px 15px;
    }

    .memes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .meme-label {
        font-size: 12px;
    }

    .logo-side-meow {
        width: 60px;
    }

    .game-logo {
        max-width: 200px;
    }

    .ca-text {
        font-size: 9px;
    }

    .menu-meow-img {
        width: 120px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .button-text {
        font-size: 9px;
    }

    .button-icon-img {
        width: 30px;
        height: 30px;
    }

    .menu-button {
        padding: 12px 6px;
    }

    .kart-title {
        font-size: 20px;
    }

    .meme-label {
        font-size: 10px;
    }

    .ca-text {
        font-size: 8px;
        letter-spacing: 0;
    }
}
