:root {
    /* Cyberpunk Palette */
    --cp-yellow: #FCEE0A;
    --cp-cyan: #00F0FF;
    --cp-pink: #FF003C;
    --cp-dark: #0a0a10;
    
    /* Console Materials */
    --console-body: #252525;
    --console-joy-l: #00C3E3;
    --console-joy-r: #FF4554;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #000;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    perspective: 1500px;
}

/* --- Background & Shuttling Line --- */
.cyber-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-color: var(--cp-dark);
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.15) 1px, transparent 1px),
        linear-gradient(rgba(255, 0, 60, 0.08) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 0, 60, 0.08) 2px, transparent 2px);
    background-size: 30px 30px, 30px 30px, 150px 150px, 150px 150px;
    box-shadow: inset 0 0 200px rgba(0,0,0,0.9);
    transition: opacity 1s; /* Fade BG in immersive mode */
}
.cyber-background::after {
    content: ''; position: absolute; top: 0; left: -10%; width: 3%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.6), var(--cp-cyan), rgba(0, 240, 255, 0.6), transparent);
    filter: blur(12px); opacity: 0.8;
    animation: shuttleLine 8s linear infinite; 
}
@keyframes shuttleLine {
    0% { left: -15%; opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } 100% { left: 115%; opacity: 0; }
}

/* --- Console Device --- */
.switch-device {
    width: 90vw; height: 85vh; max-width: 1400px;
    display: flex; align-items: center; position: relative;
    transform: rotateX(2deg) rotateY(-1deg);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth Zoom Transition */
    filter: drop-shadow(0 30px 40px rgba(0,0,0,0.9));
}
/* Hover only works if NOT in game mode */
body:not(.game-active) .switch-device:hover { transform: rotateX(0deg) rotateY(0deg) scale(1.01); }

.center-console {
    flex: 1; height: 100%; background: var(--console-body);
    border-radius: 5px; padding: 25px;
    background-image: linear-gradient(to bottom, #2a2a2a, #1f1f1f);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
    position: relative; z-index: 10; border-top: 2px solid #333;
    transition: all 0.8s ease;
}

.screen {
    width: 100%; height: 100%; background-color: #0d0d12;
    border-radius: 3px; overflow-y: auto; overflow-x: hidden; position: relative;
    box-shadow: inset 2px 2px 15px rgba(255,255,255,0.1), inset 0 0 50px rgba(0,0,0,0.5);
    scrollbar-width: thin; scrollbar-color: var(--cp-cyan) #111;
    font-family: 'Rajdhani', sans-serif; color: white;
    scroll-behavior: smooth;
    transition: all 0.8s ease;
}
.screen::-webkit-scrollbar { width: 8px; }
.screen::-webkit-scrollbar-track { background: #111; }
.screen::-webkit-scrollbar-thumb { background-color: var(--cp-cyan); border-radius: 0; }

/* --- JoyCons --- */
.joycon {
    width: 110px; height: 96%; position: relative; z-index: 5;
    background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), transparent 40%);
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bounce effect on exit */
    opacity: 1;
}
.joycon-left {
    background-color: var(--console-joy-l); border-radius: 40px 0 0 40px;
    border-right: 1px solid rgba(0,0,0,0.3);
    box-shadow: inset 10px 0 15px rgba(255,255,255,0.2), inset -5px 0 10px rgba(0,0,0,0.3), -15px 10px 25px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; align-items: center; padding-top: 60px;
}
.joycon-right {
    background-color: var(--console-joy-r); border-radius: 0 40px 40px 0;
    border-left: 1px solid rgba(0,0,0,0.3);
    box-shadow: inset -10px 0 15px rgba(255,255,255,0.2), inset 5px 0 10px rgba(0,0,0,0.3), 15px 10px 25px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 60px;
}

/* Controls styling */
.analog-stick { width: 50px; height: 50px; background: #222; border-radius: 50%; margin: 20px 0; border: 2px solid #111; box-shadow: 0 5px 10px rgba(0,0,0,0.6), inset 0 5px 5px rgba(255,255,255,0.1); position: relative; }
.analog-stick::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; background: radial-gradient(circle at 30% 30%, #444, #111); border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.d-pad-container { width: 60px; height: 60px; position: relative; margin-top: 10px;}
.d-pad-btn { background: #333; position: absolute; border-radius: 3px; box-shadow: 1px 1px 0 #000, inset 1px 1px 2px rgba(255,255,255,0.2); }
.d-up { width: 20px; height: 20px; top: 0; left: 20px; border-radius: 3px 3px 0 0;}
.d-down { width: 20px; height: 20px; bottom: 0; left: 20px; border-radius: 0 0 3px 3px;}
.d-left { width: 20px; height: 20px; top: 20px; left: 0; border-radius: 3px 0 0 3px;}
.d-right { width: 20px; height: 20px; top: 20px; right: 0; border-radius: 0 3px 3px 0;}
.d-center { width: 20px; height: 20px; top: 20px; left: 20px; background: #333; z-index: 2; border-radius: 50%;}
.abxy-cluster { width: 70px; height: 70px; position: relative; margin-bottom: 30px; }
.circle-btn { width: 22px; height: 22px; background: #1a1a1a; border-radius: 50%; color: #777; font-family: 'Inter'; weight: 800; font-size: 9px; display: flex; align-items: center; justify-content: center; position: absolute; box-shadow: 0 3px 5px rgba(0,0,0,0.5), inset 0 2px 2px rgba(255,255,255,0.1), inset 0 -2px 5px rgba(0,0,0,0.8); }
.btn-x { top: 0; left: 50%; transform: translateX(-50%); }
.btn-y { top: 50%; left: 0; transform: translateY(-50%); }
.btn-a { top: 50%; right: 0; transform: translateY(-50%); }
.btn-b { bottom: 0; left: 50%; transform: translateX(-50%); }

/* UI Elements */
.system-bar { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; background: rgba(10, 10, 16, 0.95); border-bottom: 2px solid var(--cp-cyan); position: sticky; top: 0; z-index: 100; color: white; box-shadow: 0 5px 15px rgba(0, 240, 255, 0.1); }
.user-profile { display: flex; align-items: center; gap: 15px; }
.avatar { width: 45px; height: 45px; border-radius: 5px; border: 2px solid var(--cp-cyan); background: #333 url('images/profile-pic.jpg') center/cover; box-shadow: 0 0 10px var(--cp-cyan); }
.user-info h1 { font-size: 1.2rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.user-info span { font-size: 0.7rem; color: var(--cp-yellow); font-family: 'Press Start 2P'; }
.system-clock { font-weight: 700; color: white; display: flex; align-items: center; gap: 15px; }
.battery-icon { color: var(--cp-yellow); }
.hero-section { padding: 60px 40px; text-align: center; background: linear-gradient(180deg, #111 0%, #1a1a24 100%); border-bottom: 1px solid #333; position: relative; overflow: hidden; }
.hero-section::after { content: ''; position: absolute; top:0; left:0; width: 100%; height: 100%; background: repeating-linear-gradient(transparent 0px, transparent 2px, rgba(0,0,0,0.3) 3px); pointer-events: none; }
.hero-title { font-family: 'Press Start 2P', cursive; font-size: 1.8rem; color: var(--cp-yellow); margin-bottom: 20px; text-shadow: 3px 3px 0px var(--cp-pink); line-height: 1.6; }
.hero-desc { max-width: 650px; margin: 0 auto; color: #ccc; font-size: 1.1rem; line-height: 1.6; }
.cta-btn { display: inline-block; padding: 12px 30px; background: var(--cp-cyan); color: #000; text-decoration: none; font-weight: 800; text-transform: uppercase; clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%); transition: 0.2s; border: none; cursor: pointer; }
.cta-btn:hover { background: var(--cp-yellow); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--cp-pink); }

/* Game Cards */
.game-row-title { padding: 0 40px; margin-top: 40px; font-family: 'Rajdhani'; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; font-size: 1.2rem; color: var(--cp-cyan); border-left: 4px solid var(--cp-pink); padding-left: 15px; margin-bottom: 20px; }
.game-scroller { display: flex; gap: 25px; overflow-x: auto; padding: 10px 40px 40px 40px; scroll-snap-type: x mandatory; }
.game-scroller::-webkit-scrollbar { height: 6px; }
.game-card { flex: 0 0 280px; background: #15151e; border: 1px solid #333; scroll-snap-align: start; transition: transform 0.2s, border-color 0.2s; cursor: pointer; position: relative; clip-path: polygon(0 0, 100% 0, 100% 92%, 92% 100%, 0 100%); }
.game-card::after { content: 'START'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); background: var(--cp-pink); color: white; padding: 10px 25px; border-radius: 3px; font-family: 'Press Start 2P'; font-size: 0.8rem; transition: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 0 20px var(--cp-pink); pointer-events: none; z-index: 10; text-shadow: 2px 2px 0px #000; }
.game-card:hover { transform: translateY(-10px); border-color: var(--cp-yellow); box-shadow: 0 0 20px rgba(252, 238, 10, 0.2); }
.game-card:hover::after { transform: translate(-50%, -50%) scale(1); animation: pulse 1s infinite; }
.game-cover { height: 160px; background: #000; display: flex; align-items: center; justify-content: center; border-bottom: 2px solid var(--cp-pink); overflow: hidden; position: relative; }
.game-cover img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s ease; }
.game-card:hover .game-cover img { filter: grayscale(100%) contrast(1.2) brightness(0.4); }
.game-info { padding: 20px; color: white; }
.game-info h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; color: white; }
.game-info p { font-size: 0.9rem; color: #888; margin-bottom: 15px; }
.genre-tag { display: inline-block; background: transparent; border: 1px solid var(--cp-cyan); padding: 2px 8px; font-size: 0.7rem; color: var(--cp-cyan); text-transform: uppercase; }
@keyframes pulse { 0% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.1); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* Settings & Stats */
.settings-list { padding: 0 40px 60px 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 25px; }
.setting-item { background: #12121a; padding: 25px; border: 1px solid #333; display: flex; align-items: flex-start; gap: 20px; transition: 0.3s; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); position: relative; overflow: hidden; }
.setting-item:hover { border-color: var(--cp-cyan); background: #1a1a2e; box-shadow: 0 0 15px rgba(0, 240, 255, 0.15); }
.setting-item::before { content: ''; position: absolute; top:0; left:0; width: 10px; height: 10px; border-top: 2px solid var(--cp-pink); border-left: 2px solid var(--cp-pink); }
.setting-icon { width: 45px; height: 45px; background: var(--cp-pink); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%); }
.setting-text h4 { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; color: white;}
.setting-text span { font-size: 0.85rem; color: var(--cp-cyan); font-weight: 600; display: block; margin-bottom: 10px; letter-spacing: 1px; }
.setting-text p { font-size: 0.95rem; color: #ccc; line-height: 1.5;}
.stats-container { background: #0a0a10; margin: 40px; padding: 35px; border: 1px solid #333; position: relative; box-shadow: 0 0 30px rgba(0,0,0,0.5); }
.stats-container::after { content: ''; position: absolute; top: -2px; right: -2px; width: 20px; height: 20px; border-top: 2px solid var(--cp-yellow); border-right: 2px solid var(--cp-yellow); }
.stats-container::before { content: ''; position: absolute; bottom: -2px; left: -2px; width: 20px; height: 20px; border-bottom: 2px solid var(--cp-yellow); border-left: 2px solid var(--cp-yellow); }
.stat-row { display: flex; align-items: center; margin-bottom: 20px; }
.stat-label { width: 140px; font-family: 'Rajdhani'; font-weight: 700; color: var(--cp-cyan); letter-spacing: 1px; }
.stat-bar-bg { flex: 1; height: 14px; background: #1a1a1a; border: 1px solid #444; skew-x: -15deg; transform: skewX(-20deg); padding: 2px;}
.stat-bar-fill { height: 100%; background: var(--cp-yellow); position: relative; box-shadow: 0 0 15px var(--cp-yellow); background-image: linear-gradient(45deg, rgba(255,255,255,.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.2) 75%, transparent 75%, transparent); background-size: 20px 20px; animation: moveStripes 2s linear infinite; }
@keyframes moveStripes { from { background-position: 0 0; } to { background-position: 40px 0; } }
.controls-footer { display: flex; justify-content: flex-end; padding: 20px 40px; background: #0d0d12; border-top: 2px solid #333; gap: 30px; font-family: 'Rajdhani'; font-weight: 700; font-size: 0.9rem; color: #777; }
.control-hint { display: flex; align-items: center; gap: 10px; transition: 0.2s;}
.control-hint:hover { color: white; }
.btn-icon { width: 24px; height: 24px; background: #333; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; box-shadow: 0 2px 0 #000; }
.hint-a { background: var(--cp-cyan); color: black; box-shadow: 0 2px 0 #008c9e;}
.hint-b { background: var(--cp-pink); color: white; box-shadow: 0 2px 0 #9e0025;}
@media (max-width: 900px) {
    .switch-device { width: 100%; height: 100%; transform: none; border-radius: 0; padding: 0; flex-direction: column; filter: none; }
    .joycon-left, .joycon-right { display: none; }
    .center-console { width: 100%; border-radius: 0; padding: 0; border: none;}
    .screen { border-radius: 0; box-shadow: none;}
    .hero-title { font-size: 1.4rem; }
    .stats-container { margin: 20px; padding: 20px; }
    body { overflow: auto; display: block;}
    .cyber-background { position: fixed; }
}

/* --- NEW GAME MODE & INSTRUCTION STYLES --- */

/* Persistent Instructions */
#instruction-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--cp-cyan);
    padding: 10px 20px;
    color: var(--cp-cyan);
    font-family: 'Press Start 2P';
    font-size: 0.7rem;
    z-index: 2000;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    animation: textBlink 3s infinite;
}

@keyframes textBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* === IMMERSIVE GAME MODE STATE === */

/* 1. Transform the Switch Body to fill screen */
body.game-active .switch-device {
    width: 100vw;
    height: 100vh;
    max-width: none;
    transform: none; /* Remove 3D tilt */
    border-radius: 0;
    filter: none;
}

/* 2. Hide the Console Hardware (Joycons & Bezel) */
body.game-active .joycon-left {
    transform: translateX(-100px); opacity: 0;
}
body.game-active .joycon-right {
    transform: translateX(100px); opacity: 0;
}
body.game-active .center-console {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

/* 3. Screen takes over */
body.game-active .screen {
    border-radius: 0;
    box-shadow: none; /* Remove glossy reflection */
}

/* 4. Active Highlight Styles */
.game-mode-active.game-card {
    transform: translateY(-10px);
    border-color: var(--cp-yellow);
    box-shadow: 0 0 20px rgba(252, 238, 10, 0.8);
}
.game-mode-active.game-card::after {
    transform: translate(-50%, -50%) scale(1);
    animation: pulse 1s infinite;
}
.game-mode-active.game-card .game-cover img {
    filter: grayscale(100%) contrast(1.2) brightness(0.4);
}
.game-mode-active.cta-btn, 
.game-mode-active.setting-item,
.game-mode-active a {
    outline: 3px solid var(--cp-yellow);
    box-shadow: 0 0 15px var(--cp-yellow);
    position: relative;
    z-index: 100;
}
.controls-footer .game-mode-active a {
    background: var(--cp-cyan);
    color: black !important;
    padding: 2px 5px;
}