@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

/* --- Global Variables --- */
:root {
    --primary-neon: #00ffff;
    --secondary-neon: #ff00ff;
    --background-dark: #0d0221;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(255, 255, 255, 0.15);
    --primary-glow: 0 0 10px #0ff, 0 0 20px #0ff;
    --secondary-glow: 0 0 10px #f0f, 0 0 20px #f0f;
}

/* --- Base Styles --- */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-dark);
    color: white;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    background: radial-gradient(circle at 50% 50%, #1a0b2e 0%, #050505 100%);
}

h1, h2, h3 {
    font-family: 'Press Start 2P', cursive;
    color: var(--secondary-neon);
    text-shadow: var(--secondary-glow);
}

.title-glow {
    text-shadow: 0 0 10px #d946ef, 0 0 20px #a855f7;
}

.hidden {
    display: none !important;
}

/* --- Boss Mode --- */
#boss-mode-overlay * {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#boss-mode-overlay i {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands';
}

/* --- Glassmorphism --- */
.glass-panel {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: white;
}

/* --- Menu --- */
#menu {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    pointer-events: none; /* Allow clicks to pass through to canvas */
}

/* Re-enable pointer events for interactive children */
#menu header, #hub-stats, #menu-grid {
    pointer-events: auto;
}

#menu h1 {
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
}

/* --- Game Cards --- */
.game-card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    cursor: pointer;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    min-height: 200px;
    text-align: center;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5),
                0 0 15px rgba(255, 0, 255, 0.2);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    margin: 10px 0;
    text-shadow: none;
    color: white;
}

.game-card i {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* --- Game Containers --- */
.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.9);
    z-index: 20;
    overflow: hidden;
}

/* --- Canvas Defaults --- */
canvas {
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: block;
}

/* --- Navigation --- */
.back-btn {
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    font-size: 0.8rem;
    z-index: 100;
}

/* --- Overlay --- */
#global-overlay {
    backdrop-filter: blur(5px);
}

.overlay-panel {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Specific Game Overrides --- */

/* Matterhorn & Aetheria Fullscreen Canvas */
#matterhorn-game canvas, #aetheria-game-container canvas, #prism-realms-game canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* Matterhorn UI */
#mh-ui-root {
    font-family: 'Inter', sans-serif;
}

/* Aetheria UI */
#aetheria-selection-screen {
    background: rgba(15, 23, 42, 0.95);
}

/* Eclipse Logic Puzzle Grid */
#eclipselogic-grid-container {
    background-color: #334155;
    padding: 2px;
    border-radius: 4px;
}
.grid-cell {
    background-color: #1e293b;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
}
.grid-cell:hover {
    background-color: #334155;
}

/* --- Prism Realms Styles --- */
#prism-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.9); z-index: 100; cursor: pointer; text-align: center;
}
#prism-hud {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; padding: 30px; box-sizing: border-box; display: none;
    flex-direction: column; justify-content: space-between; z-index: 10;
}
.prism-stats-top { display: flex; justify-content: space-between; width: 100%; }
.prism-stat-group { border-left: 3px solid var(--primary-neon); padding-left: 15px; background: rgba(0, 255, 255, 0.05); backdrop-filter: blur(5px); }
.prism-label { font-size: 10px; text-transform: uppercase; letter-spacing: 3px; opacity: 0.7; }
.prism-value { font-size: 28px; font-weight: bold; text-shadow: 0 0 10px var(--primary-neon); }
#prism-console {
    width: 350px; height: 180px; font-size: 11px; overflow: hidden;
    display: flex; flex-direction: column-reverse; opacity: 0.9;
    mask-image: linear-gradient(to top, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, black 70%, transparent 100%);
}
.prism-log-entry { margin-bottom: 4px; border-left: 2px solid #333; padding-left: 8px; animation: glitch-flash 0.3s ease-out; }
@keyframes glitch-flash { 0% { color: #fff; transform: translateX(5px); } 100% { color: var(--primary-neon); transform: translateX(0); } }
#prism-crosshair {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; pointer-events: none; opacity: 0.8;
}
#prism-crosshair::before { content: ''; position: absolute; top: 50%; left: 0; width: 100%; height: 1px; background: var(--primary-neon); }
#prism-crosshair::after { content: ''; position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: var(--primary-neon); }
.prism-key { border: 1px solid var(--primary-neon); padding: 2px 6px; margin: 0 4px; font-size: 12px; }
#prism-vignette {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; box-shadow: inset 0 0 150px rgba(0,0,0,1); z-index: 5;
}

/* --- CRT Effect --- */
.crt-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    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%;
    animation: flicker 0.15s infinite;
    mix-blend-mode: overlay;
    opacity: 0.8;
}

@keyframes flicker {
    0% { opacity: 0.8; }
    50% { opacity: 0.75; }
    100% { opacity: 0.8; }
}

/* --- Avatar Customization --- */
.avatar-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    margin-bottom: 2rem;
    transition: all 0.3s;
}

/* --- Tech Tree --- */
.tech-node {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}
.tech-node.unlocked {
    background: #0f172a;
    border-color: var(--primary-neon);
    box-shadow: 0 0 15px var(--primary-neon);
}
.tech-node.purchased {
    background: var(--primary-neon);
    color: #000;
    box-shadow: 0 0 25px var(--primary-neon);
}
.tech-node.locked {
    opacity: 0.5;
    cursor: not-allowed;
}
.tech-connection {
    position: absolute;
    height: 4px;
    background: #475569;
    z-index: -1;
    transform-origin: 0 50%;
}
.tech-connection.active {
    background: var(--primary-neon);
    box-shadow: 0 0 10px var(--primary-neon);
}

/* --- UI Themes --- */
.theme-blue {
    --primary-neon: #00ffff;
    --secondary-neon: #d946ef;
    --primary-glow: 0 0 10px #0ff, 0 0 20px #0ff;
    --secondary-glow: 0 0 10px #d946ef, 0 0 20px #d946ef;
}

.theme-pink {
    --primary-neon: #ff00ff;
    --secondary-neon: #00ffff;
    --primary-glow: 0 0 10px #f0f, 0 0 20px #f0f;
    --secondary-glow: 0 0 10px #0ff, 0 0 20px #0ff;
}

.theme-gold {
    --primary-neon: #ffd700;
    --secondary-neon: #ffffff;
    --primary-glow: 0 0 10px #ffd700, 0 0 20px #ffd700;
    --secondary-glow: 0 0 10px #fff, 0 0 20px #fff;
}

.theme-green {
    --primary-neon: #00ff41;
    --secondary-neon: #008f11;
    --primary-glow: 0 0 10px #00ff41, 0 0 20px #00ff41;
    --secondary-glow: 0 0 10px #008f11, 0 0 20px #008f11;
}

.theme-red {
    --primary-neon: #ff0000;
    --secondary-neon: #ff4500;
    --primary-glow: 0 0 10px #f00, 0 0 20px #f00;
    --secondary-glow: 0 0 10px #ff4500, 0 0 20px #ff4500;
}

/* --- Cursor Trail (Bolt Optimized) --- */
.trail-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background: cyan;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    box-shadow: 0 0 5px cyan;
    opacity: 0;
    will-change: transform, opacity;
}
