@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500;600;700&display=swap');

:root {
    --page-bg: #87CEEB;                 /* Warm beige now fills the whole page */
    --card-bg: #edece8;
    --accent-bg: #ffd6a4;
    --border-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.25);

    --text-main: #2B2D42;
    --text-muted: #5C677D;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', sans-serif;
}

body {
    background-color: var(--page-bg);     /* Clean, full-page beige background */
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 30px 20px;
    gap: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Header Bar at Top */
.arcade-header {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 14px 20px;
    border-radius: 16px;
    border: 3px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-color);
    gap: 10px; /* Adds safe spacing if items get close */
}

.arcade-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap; /* Prevents the title text itself from awkwardly wrapping words */
}

.header-spacer {
    width: 75px; /* Balances the back link to keep title centered on desktop */
}

/* --- MOBILE RESPONSIVE HEADER FIX --- */
@media (max-width: 600px) {
    .arcade-header {
        flex-direction: column; /* Stacks the header items vertically on narrow screens */
        gap: 12px;
        padding: 16px;
    }

    .header-spacer {
        display: none; /* Hides the desktop spacer so the title stays perfectly centered when stacked */
    }

    .back-link {
        width: 100%;
        justify-content: center; /* Centers the back link button nicely across the top */
    }
}

.back-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background-color: var(--accent-bg);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.15s;
}

.back-link:hover {
    transform: translateY(-2px);
    background-color: #ffe7bb;
}

.header-spacer {
    width: 75px; /* Balances the back link to keep title centered */
}

/* Main Content Area */
.arcade-main {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.arcade-subtitle {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Cartridge Grid */
.cartridge-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    padding: 10px 0;
}

/* Retro Cartridge Styling */
.cartridge {
    --shell-color: #FFD166;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--shell-color);
    border: 3px solid var(--border-color);
    border-radius: 14px 34px 12px 12px; /* Classic Game Boy notch */
    padding: 12px 14px 10px;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: 0 6px 0 var(--border-color), 0 12px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
}

/* Lift up effect on hover */
.cartridge:hover {
    transform: translateY(-10px);
    box-shadow: 0 14px 0 var(--border-color), 0 22px 28px rgba(0, 0, 0, 0.25);
}

.cartridge:active {
    transform: translateY(-3px);
    box-shadow: 0 6px 0 var(--border-color), 0 10px 15px rgba(0, 0, 0, 0.18);
}

/* Top Cartridge Header & Grip Ridges */
.cartridge-top-notch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.grip-lines {
    width: 28px;
    height: 12px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25),
        rgba(0, 0, 0, 0.25) 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 2px;
}

.cartridge-badge {
    background: rgba(255, 255, 255, 0.75);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Recessed Sticker Label Area */
.cartridge-label {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Game Screenshot Container */
.screenshot-frame {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #2B2D42;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Game Title Below Screenshot */
.game-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    padding: 2px 0;
}

/* Bottom Insertion Arrows */
.cartridge-arrows {
    text-align: center;
    font-size: 0.65rem;
    color: rgba(0, 0, 0, 0.45);
    margin-top: 8px;
    letter-spacing: 4px;
}


/* --- CALM GAME LANDSCAPE BACKGROUND --- */
.game-landscape {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #B1E1FF 0%, #E0F4FF 75%);
    z-index: -1;                   /* Sits safely behind all text and cartridges */
}

/* Grassy Ground using a repeating tile image */
.grassy-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px; /* Adjust height to match your tile's height */
    background-image: url('./Assets/grass_tile.png');
    background-repeat: repeat-x;
    background-size: auto 50px;
}

/* --- DRIFTING CLOUDS --- */
.cloud {
    position: absolute;
    background: #FFFFFF;
    border-radius: 50px;
    opacity: 0.85;
    animation: drift linear infinite;
}

/* Cloud shapes using pseudo-elements for fluffy puffs */
.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: #FFFFFF;
    border-radius: 50%;
}

.cloud-1 {
    width: 140px; height: 45px;
    top: 8vh;
    animation-duration: 45s;
    animation-delay: 0s;
}
.cloud-1::before { width: 60px; height: 60px; top: -30px; left: 20px; }
.cloud-1::after  { width: 50px; height: 50px; top: -20px; left: 70px; }

.cloud-2 {
    width: 180px; height: 55px;
    top: 22vh;
    animation-duration: 65s;
    animation-delay: -15s;
    opacity: 0.6; /* Slightly further back/lighter */
}
.cloud-2::before { width: 75px; height: 75px; top: -38px; left: 25px; }
.cloud-2::after  { width: 60px; height: 60px; top: -25px; left: 90px; }

.cloud-3 {
    width: 110px; height: 38px;
    top: 15vh;
    animation-duration: 35s;
    animation-delay: -7s;
}
.cloud-3::before { width: 45px; height: 45px; top: -22px; left: 15px; }
.cloud-3::after  { width: 40px; height: 40px; top: -18px; left: 55px; }

.cloud-4 {
    width: 150px; height: 50px;
    top: 35vh; /* Lower in the sky */
    animation-duration: 55s;
    animation-delay: -5s;
}
.cloud-4::before { width: 65px; height: 65px; top: -32px; left: 20px; }
.cloud-4::after  { width: 55px; height: 55px; top: -22px; left: 75px; }

.cloud-5 {
    width: 130px; height: 42px;
    top: 50vh; /* Even lower, closer to the middle/grass */
    animation-duration: 40s;
    animation-delay: -20s;
    opacity: 0.5; /* Fades out slightly for depth */
}
.cloud-5::before { width: 55px; height: 55px; top: -28px; left: 18px; }
.cloud-5::after  { width: 45px; height: 45px; top: -20px; left: 65px; }

@keyframes drift {
    from { transform: translateX(-200px); }
    to   { transform: translateX(calc(100vw + 200px)); }
}

/* Wind-blown Flower Images */
.ground-flower {
    position: absolute;
    bottom: 35px; /* Rests right on top of the ground */
    width: 65px;  /* Adjust width to fit your flower image size */
    height: 75px; /* Adjust height to fit your flower image size */
    object-fit: contain;
    transform-origin: bottom center;
    animation: sway 3s ease-in-out infinite alternate;
}

/* Stagger the wind sway timing so they look natural */
.ground-flower:nth-child(2) { animation-delay: 0.5s; animation-duration: 2.7s; }
.ground-flower:nth-child(3) { animation-delay: 1.2s; animation-duration: 3.4s; }
.ground-flower:nth-child(4) { animation-delay: 0.3s; animation-duration: 2.9s; }
.ground-flower:nth-child(5) { animation-delay: 1.5s; animation-duration: 3.1s; }
.ground-flower:nth-child(6) { animation-delay: 0.8s; animation-duration: 2.6s; }


@keyframes sway {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(18deg) skewX(10deg); } /* Gentle breeze leaning right */
}