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

:root {
    --theme-color: #4ade80; /* Dynamic Variable */
    --theme-color-soft: rgba(74, 222, 128, 0.2);
    --bg-dark: #000000;
    --panel-bg: rgba(20, 20, 20, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --pixel-font: 'Press Start 2P', cursive;
    --transition-speed: 0.6s;
}

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

body {
    background-color: var(--bg-dark);
    color: #fff;
    font-family: var(--pixel-font);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 1s ease;
}

/* DYNAMIC BACKDROP GLOW & IMAGE */
.backdrop-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-dark);
}

.world-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('images/tileset_city.png');
    background-size: 500px;
    opacity: 0.15;
    filter: brightness(0.6) contrast(1.2) grayscale(0.5);
    transition: filter 1s ease;
}

.backdrop-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120vw;
    height: 120vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--theme-color) 0%, transparent 75%);
    opacity: 0.15;
    filter: blur(80px);
    transition: background var(--transition-speed) ease;
}

/* PARTICLE SYSTEM */
.particle-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--theme-color);
    box-shadow: 0 0 10px var(--theme-color);
    opacity: 0.5;
    animation: float-particle 15s linear infinite;
}

@keyframes float-particle {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { transform: translate(100px, -100vh) rotate(360deg); opacity: 0; }
}

/* EMULATOR CHASSIS */
.emulator-wrapper {
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 3px solid var(--theme-color);
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px var(--theme-color-soft);
    overflow: hidden;
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    position: relative;
}

/* SCANLINES */
.emulator-wrapper::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.3;
}

/* STATUS BAR */
.status-bar {
    height: 60px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.5);
    border-bottom: 2px solid var(--theme-color);
    font-size: 10px;
    color: #fff;
    transition: border-color var(--transition-speed) ease;
}

.battery-icon {
    width: 34px;
    height: 18px;
    border: 2px solid #fff;
    position: relative;
    padding: 2px;
}
.battery-icon::after {
    content: '';
    width: 80%;
    height: 100%;
    background: var(--theme-color);
    display: block;
    transition: background var(--transition-speed) ease;
}

/* MAIN CONTENT: CAROUSEL */
.carousel-container {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 0 40px;
}

.nav-btn {
    position: absolute;
    z-index: 20;
    width: 64px;
    height: 64px;
    background: rgba(0,0,0,0.7);
    border: 2px solid var(--theme-color);
    color: var(--theme-color);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
    pointer-events: auto;
}
.nav-btn:hover { 
    background: var(--theme-color); 
    color: #000;
    box-shadow: 0 0 20px var(--theme-color);
}
.nav-btn.left { left: 30px; }
.nav-btn.right { right: 30px; }

.carousel-track {
    display: flex;
    gap: 60px;
    padding: 40px 50% 40px 50%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    width: 100%;
}
.carousel-track::-webkit-scrollbar { display: none; }

.cartridge {
    flex: 0 0 320px;
    height: 420px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 2px solid var(--glass-border);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
}

.cartridge.active {
    background: rgba(255,255,255,0.08);
    border-color: var(--theme-color);
    transform: scale(1.15) translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--theme-color-soft);
}

.cartridge img {
    width: 85%;
    height: auto;
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.7));
}

.cartridge-label {
    margin-top: 25px;
    font-size: 14px;
    text-align: center;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 2px 2px 0px #000;
}

/* METADATA PANEL */
.metadata-panel {
    height: 200px;
    background: rgba(0,0,0,0.6);
    border-top: 2px solid var(--theme-color);
    padding: 30px 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color var(--transition-speed) ease;
}

.meta-title {
    font-size: 24px;
    color: var(--theme-color);
    margin-bottom: 15px;
    transition: color var(--transition-speed) ease;
}

.meta-desc {
    font-size: 11px;
    line-height: 1.8;
    color: #cbd5e1;
    max-width: 600px;
}

.meta-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: right;
    font-size: 11px;
    color: var(--theme-color);
    transition: color var(--transition-speed) ease;
}

/* BUTTONS */
.load-btn {
    padding: 22px 45px;
    background: var(--theme-color);
    color: #000;
    border: none;
    font-family: var(--pixel-font);
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 0 25px var(--theme-color-soft);
    transition: all 0.3s;
}

.load-btn:hover {
    transform: translateY(-5px);
    background: #fff;
    box-shadow: 0 10px 30px var(--theme-color);
}

/* MOBILE */
@media (max-width: 768px) {
    .emulator-wrapper { width: 100vw; height: 100vh; border-radius: 0; }
    .cartridge { flex: 0 0 260px; height: 340px; }
    .metadata-panel { flex-direction: column; height: auto; padding: 40px 20px; gap: 30px; text-align: center; overflow-y: auto; }
    .meta-desc { max-width: 100%; font-size: 10px; }
    .meta-stats { text-align: center; width: 100%; }
    .status-bar { padding: 0 20px; font-size: 8px; }
    .nav-btn { width: 40px; height: 40px; font-size: 16px; }
    .nav-btn.left { left: 10px; }
    .nav-btn.right { right: 10px; }
}
