/* recycle.games - Retro Pixel Art Game Library */

:root {
    --console-black: #1A1A2E;
    --cartridge-navy: #16213E;
    --power-yellow: #FFD93D;
    --pixel-green: #6BCB77;
    --fire-red: #FF6B6B;
    --mana-blue: #4D96FF;
    --screen-white: #F0F0F0;
    --shadow-dark: #0D0D1A;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--console-black);
    color: var(--screen-white);
    overflow-x: hidden;
    image-rendering: pixelated;
}

.section {
    min-height: 100vh;
    position: relative;
}

.section__heading {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1rem, 3vw, 1.8rem);
    color: var(--power-yellow);
    text-align: center;
    padding: 2rem;
    letter-spacing: 0.05em;
}

/* ========== COLOR BAR BOOT ========== */

.color-bar-boot {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(to right,
        #F0F0F0 12.5%,
        #FFD93D 12.5%, #FFD93D 25%,
        #6BCB77 25%, #6BCB77 37.5%,
        #4D96FF 37.5%, #4D96FF 50%,
        #FF6B6B 50%, #FF6B6B 62.5%,
        #1A1A2E 62.5%, #1A1A2E 75%,
        #16213E 75%, #16213E 87.5%,
        #0D0D1A 87.5%
    );
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.color-bar-boot.hidden {
    opacity: 0;
}

/* ========== SECTION 1: TITLE SCREEN ========== */

.section--title {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--console-black);
    position: relative;
    overflow: hidden;
}

.falling-cartridges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.falling-cart {
    position: absolute;
    width: 40px;
    height: 60px;
    border: 2px solid var(--shadow-dark);
    animation: fallDown linear infinite;
}

.falling-cart__top {
    width: 100%;
    height: 60%;
}

.falling-cart__bottom {
    width: 100%;
    height: 40%;
    background: var(--screen-white);
}

@keyframes fallDown {
    from { transform: translateY(-80px); }
    to { transform: translateY(110vh); }
}

.title__content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.title__name {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--power-yellow);
    text-shadow: 4px 4px 0 var(--shadow-dark), 2px 2px 0 var(--fire-red);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

.title__press-start {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--screen-white);
    animation: hardBlink 1s steps(2) infinite;
}

@keyframes hardBlink {
    0%, 49.99% { opacity: 1; }
    50%, 99.99% { opacity: 0; }
}

/* ========== SECTION 2: GAME LIBRARY ========== */

.section--library {
    background-color: var(--console-black);
    padding: 2rem;
    min-height: 200vh;
}

.library__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.cartridge-card {
    background: var(--cartridge-navy);
    border: 2px solid var(--shadow-dark);
    box-shadow: 4px 4px 0 var(--shadow-dark);
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    image-rendering: pixelated;
}

.cartridge-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--shadow-dark);
}

.cartridge-card__label {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cartridge-card__info {
    flex: 0.8;
    background: var(--screen-white);
    padding: 0.5rem;
    color: var(--shadow-dark);
}

.cartridge-card__title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    color: var(--shadow-dark);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.cartridge-card__meta {
    font-family: 'VT323', monospace;
    font-size: 0.85rem;
    color: var(--cartridge-navy);
    display: block;
    margin-bottom: 0.35rem;
}

/* Health Bar */
.health-bar {
    width: 100%;
    height: 8px;
    background: var(--console-black);
    border: 1px solid var(--shadow-dark);
    display: flex;
}

.health-bar__fill {
    height: 100%;
    background: var(--pixel-green);
    display: block;
    transition: width 0.8s ease;
}

/* Pixel Icons */
.pixel-icon {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}

/* ========== SECTION 3: INSERT CARTRIDGE ========== */

.section--insert {
    background-color: var(--console-black);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.insert__split {
    display: flex;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.insert__art {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 4px solid var(--shadow-dark);
    padding: 2rem;
}

.pixel-console {
    position: relative;
    width: 200px;
    height: 160px;
}

.console-body {
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 60%;
    background: #444;
    border: 3px solid var(--shadow-dark);
    border-radius: 2px;
}

.console-slot {
    position: absolute;
    bottom: 65%;
    left: 30%;
    width: 40%;
    height: 8px;
    background: var(--shadow-dark);
}

.console-cartridge {
    position: absolute;
    bottom: 55%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: var(--cartridge-navy);
    border: 2px solid var(--shadow-dark);
    animation: insertCartridge 3s ease infinite;
}

.console-cartridge__label {
    width: 60%;
    height: 40%;
    margin: 10% auto;
    background: var(--fire-red);
    border: 1px solid var(--shadow-dark);
}

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

.insert__story {
    flex: 1;
    padding: 3rem;
}

.insert__game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--power-yellow);
    margin-bottom: 2rem;
}

.insert__detail {
    margin-bottom: 1.5rem;
}

.insert__label {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--mana-blue);
    display: block;
    margin-bottom: 0.25rem;
}

.insert__value {
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--screen-white);
}

.insert__value--active {
    color: var(--pixel-green);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
}

/* ========== SECTION 4: HIGH SCORE BOARD ========== */

.section--scoreboard {
    background-color: var(--console-black);
    min-height: 100vh;
    padding: 4rem 2rem;
}

.scoreboard__subtitle {
    font-family: 'VT323', monospace;
    font-size: 1.3rem;
    color: var(--mana-blue);
    text-align: center;
    margin-bottom: 2rem;
}

.scoreboard__table {
    max-width: 700px;
    margin: 0 auto;
}

.score-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--shadow-dark);
    margin-bottom: 4px;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.score-row.visible {
    transform: translateX(0);
    opacity: 1;
}

.score-row--header {
    background: var(--shadow-dark);
    transform: translateX(0);
    opacity: 1;
}

.score-row:nth-child(even) {
    background: var(--console-black);
}

.score-row:nth-child(odd) {
    background: var(--cartridge-navy);
}

.score-rank {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    color: var(--power-yellow);
    width: 60px;
    flex-shrink: 0;
}

.score-badge-col {
    width: 40px;
    flex-shrink: 0;
    font-family: 'VT323', monospace;
    color: var(--screen-white);
}

.score-badge {
    width: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.badge {
    width: 24px;
    height: 24px;
    border: 2px solid var(--shadow-dark);
    display: block;
}

.badge--gold { background: var(--power-yellow); }
.badge--silver { background: #C0C0C0; }
.badge--bronze { background: #CD7F32; }
.badge--blue { background: var(--mana-blue); }
.badge--green { background: var(--pixel-green); }

.score-name {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--screen-white);
    flex: 1;
}

.score-pts {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--pixel-green);
    text-align: right;
    width: 100px;
    flex-shrink: 0;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .insert__split {
        flex-direction: column;
    }

    .insert__art {
        border-right: none;
        border-bottom: 4px solid var(--shadow-dark);
        min-height: 200px;
    }

    .library__grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .score-row {
        padding: 0.5rem 0.75rem;
    }
}
