/* ================= DESIGN SYSTEM CONFIGURATION ================= */
:root {
    --bg-dark: #04020a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(139, 92, 246, 0.4);
    
    --color-violet: #8b5cf6;
    --color-pink: #d946ef;
    --color-gold: #d4af37;
    --color-laser: #00ffcc;
    
    --text-light: #f3f0fa;
    --text-muted: #9f86c0;
    
    --font-family: 'Outfit', sans-serif;
    --transition-smooth: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ================= BASIC RESET ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Custom Premium Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #180f33;
    border: 1px solid rgba(0, 255, 204, 0.25);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-laser);
    border-color: var(--color-laser);
}
/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #180f33 var(--bg-dark);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-family);
    overflow: hidden;
    min-height: 100vh;
    position: relative;
}

/* ================= AMBIENT BACKGROUNDS ================= */
.stars {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(20, 10, 45, 0.6) 0%, rgba(4, 2, 10, 1) 90%);
    z-index: -2;
    overflow: hidden;
}

.stars::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.25) 1.5px, transparent 35px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 25px);
    background-size: 450px 450px, 300px 300px;
    opacity: 0.15;
    animation: backgroundShift 120s linear infinite;
}

@keyframes backgroundShift {
    from { background-position: 0 0, 40px 60px; }
    to { background-position: 450px 450px, 340px 410px; }
}

#particles-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, var(--border-glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.25;
    animation: floatParticle 8s infinite ease-in-out;
}

@keyframes floatParticle {
    0% { transform: translateY(105vh) scale(0.6); opacity: 0; }
    50% { opacity: 0.4; }
    100% { transform: translateY(-10vh) scale(1.3); opacity: 0; }
}

/* ================= SCREENS & GENERAL WORKSPACE ================= */
.screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

#welcome-screen {
    overflow-y: auto;
    display: none;
    align-items: flex-start;
    padding: 60px 20px;
}

#welcome-screen.active {
    display: flex;
}

/* ================= 1. MENU PANEL ================= */
.menu-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: scaleUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    width: 100%;
}

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

.menu-title {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 12px;
    background: linear-gradient(135deg, var(--text-light) 30%, var(--color-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 50px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1100px;
    padding: 10px;
}

.menu-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.menu-card:hover {
    border-color: var(--color-violet);
    background: rgba(139, 92, 246, 0.03);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.12);
    transform: translateY(-5px);
}

.guide-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

/* 1. Scroll Hand Guide */
.guide-scroll-hand {
    font-size: 2.5rem;
    color: var(--color-pink);
    text-shadow: 0 0 15px rgba(217, 70, 239, 0.4);
    animation: guideWave 1.8s infinite ease-in-out;
    transform-origin: bottom center;
}

@keyframes guideWave {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(20deg); }
}

/* 2. Zoom Hand Guide & Dots */
.guide-zoom-hand {
    font-size: 2.2rem;
    color: var(--color-pink);
    animation: handPush 2s infinite ease-in-out;
}

@keyframes handPush {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.9); }
}

.guide-zoom-dots {
    position: absolute;
    width: 80px;
    height: 80px;
}

.guide-dot {
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--color-laser);
    box-shadow: 0 0 10px var(--color-laser);
    border-radius: 50%;
    top: 35px;
}

.guide-dot-left {
    left: 32px;
    animation: dotSpreadLeft 2s infinite ease-in-out;
}

.guide-dot-right {
    right: 32px;
    animation: dotSpreadRight 2s infinite ease-in-out;
}

@keyframes dotSpreadLeft {
    0%, 100% { left: 32px; opacity: 0.8; }
    50% { left: 10px; opacity: 0.3; }
}

@keyframes dotSpreadRight {
    0%, 100% { right: 32px; opacity: 0.8; }
    50% { right: 10px; opacity: 0.3; }
}

/* 3. Rotate Hand Guide */
.guide-rotate-hand {
    font-size: 2.5rem;
    color: var(--color-pink);
    text-shadow: 0 0 15px rgba(217, 70, 239, 0.4);
    animation: guideRotateOrbit 2.5s infinite linear;
    transform-origin: center center;
}

@keyframes guideRotateOrbit {
    from { transform: rotate(0deg) translate(-20px) rotate(0deg); }
    to { transform: rotate(360deg) translate(-20px) rotate(-360deg); }
}

/* 4. Magnet Icon Guide */
.guide-magnet-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
    animation: guideMagnetPulse 1.5s infinite ease-in-out;
}

@keyframes guideMagnetPulse {
    0%, 100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 8px var(--color-laser)); }
    50% { transform: scale(0.85); opacity: 0.6; filter: drop-shadow(0 0 2px var(--color-laser)); }
}

/* 5. Gravity Icon Guide */
.guide-gravity-icon {
    font-size: 2.5rem;
    color: var(--color-gold);
    animation: guideGravityDrop 2s infinite ease-in-out;
}

@keyframes guideGravityDrop {
    0%, 100% { transform: translateY(-10px); }
    50% { transform: translateY(10px); }
}

/* 6. Spring Icon Guide */
.guide-spring-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: guideSpringBounce 1.6s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes guideSpringBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.7, 1.3); }
}

/* 7. Wave Icon Guide */
.guide-wave-icon {
    font-size: 2.5rem;
    color: var(--color-pink);
    animation: guideWaveRipple 2s infinite ease-in-out;
}

@keyframes guideWaveRipple {
    0%, 100% { transform: skewX(-15deg); }
    50% { transform: skewX(15deg); }
}

/* 8. Lightning Icon Guide */
.guide-lightning-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: guideLightningFlash 1s infinite alternate;
}

@keyframes guideLightningFlash {
    0%, 100% { opacity: 0.4; filter: drop-shadow(0 0 2px var(--color-laser)); }
    50% { opacity: 1; filter: drop-shadow(0 0 10px var(--color-laser)); }
}

/* 9. Blackhole Icon Guide */
.guide-blackhole-icon {
    font-size: 2.5rem;
    color: var(--color-violet);
    animation: spinClock 4s linear infinite;
}

/* 10. Matrix Icon Guide */
.guide-matrix-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: guideMatrixPulse 1.5s infinite steps(4);
}

@keyframes guideMatrixPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 11. Kaleidoscope Icon Guide */
.guide-kaleidoscope-icon {
    font-size: 2.5rem;
    color: var(--color-pink);
    animation: guideKaleidoRotate 5s linear infinite;
}

@keyframes guideKaleidoRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(0.85); }
    100% { transform: rotate(360deg) scale(1); }
}

/* 12. Fireworks Icon Guide */
.guide-fireworks-icon {
    font-size: 2.5rem;
    color: var(--color-gold);
    animation: guideFireworksBurst 1.8s infinite ease-out;
}

@keyframes guideFireworksBurst {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* 13. Fluid Icon Guide */
.guide-fluid-icon {
    font-size: 2.5rem;
    color: var(--color-violet);
    animation: guideFluidDrift 3s infinite ease-in-out;
}

@keyframes guideFluidDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-8px, 6px) scale(1.1); }
}

/* 14. DNA Icon Guide */
.guide-dna-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: spinClock 6s linear infinite;
}

/* 15. Chaos Icon Guide */
.guide-chaos-icon {
    font-size: 2.5rem;
    color: var(--color-pink);
    animation: guideChaosDance 2s infinite ease-in-out;
}
@keyframes guideChaosDance {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(6px, -6px) rotate(15deg); }
    66% { transform: translate(-6px, 6px) rotate(-15deg); }
}

/* 16. Heatmap Icon Guide */
.guide-heatmap-icon {
    font-size: 2.5rem;
    color: var(--color-gold);
    animation: guideHeatmapPulse 1.2s infinite alternate;
}
@keyframes guideHeatmapPulse {
    0% { transform: scale(0.95); filter: drop-shadow(0 0 2px var(--color-gold)); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 10px var(--color-gold)); }
}

/* 17. Portals Icon Guide */
.guide-portals-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: guidePortalPulse 2s infinite linear;
}
@keyframes guidePortalPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* 18. Rope Icon Guide */
.guide-rope-icon {
    font-size: 2.5rem;
    color: var(--color-pink);
    animation: guideRopeSwing 2.5s infinite ease-in-out;
}
@keyframes guideRopeSwing {
    0%, 100% { transform: rotate(-20deg); }
    50% { transform: rotate(20deg); }
}

/* 19. Orbit Icon Guide */
.guide-orbit-icon {
    font-size: 2.5rem;
    color: var(--color-violet);
    animation: spinClock 8s linear infinite;
}

/* 20. Typography Icon Guide */
.guide-typography-icon {
    font-size: 2.5rem;
    color: var(--color-laser);
    animation: guideTextScale 2s infinite ease-in-out;
}
@keyframes guideTextScale {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(0.78); }
}

.menu-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 10px 20px;
    width: 100%;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.menu-btn:hover {
    border-color: var(--color-laser);
    background: rgba(0, 255, 204, 0.05);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.25);
}

/* ================= 2. LOADING CONTAINER ================= */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 204, 0.1);
    border-top-color: var(--color-laser);
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.2);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================= 3. ACTIVE EXPERIMENT VIEWPORT ================= */
#experiment-screen {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: var(--bg-dark);
}

/* Subtle Back Button */
.back-btn-minimal {
    position: absolute;
    top: 30px; left: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition-smooth);
    opacity: 0.6;
}

.back-btn-minimal:hover {
    opacity: 1;
    color: var(--text-light);
    border-color: var(--color-pink);
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.2);
}

/* Chamber Containers */
.chamber {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 1. Scroll Viewport */
.scroll-viewport {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.scroll-viewport::-webkit-scrollbar {
    width: 0px;
}

.full-card {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

.full-card h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 6px;
    color: var(--color-gold);
    margin-bottom: 25px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.full-card p {
    max-width: 500px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Telemetry HUD */
.scroll-hud {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    gap: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--color-laser);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    z-index: 100;
}
.hud-item span {
    color: var(--text-light);
    font-weight: bold;
}

/* Card Visual Wrapper */
.card-visual-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 35px;
}
.card-main-icon {
    font-size: 3rem;
    color: var(--color-laser);
    filter: drop-shadow(0 0 10px rgba(0, 255, 204, 0.3));
    z-index: 2;
}
.font-cyan {
    color: var(--color-laser) !important;
}
.font-gold {
    color: var(--color-gold) !important;
}

/* Radar Circles */
.radar-circle {
    position: absolute;
    border: 1px solid rgba(0, 255, 204, 0.15);
    border-radius: 50%;
    animation: radarPulse 2s infinite linear;
}
.circle-1 { width: 100%; height: 100%; animation-delay: 0s; }
.circle-2 { width: 140%; height: 140%; animation-delay: 0.6s; }
.circle-3 { width: 180%; height: 180%; animation-delay: 1.2s; }
@keyframes radarPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Spinning Rings */
.spinning-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px dashed;
    border-radius: 50%;
}
.ring-cyan {
    border-color: var(--color-laser);
    animation: rotateRingClock 4s linear infinite;
}
.ring-magenta {
    width: 120%;
    height: 120%;
    border-color: var(--color-pink);
    animation: rotateRingCounter 5s linear infinite;
}
@keyframes rotateRingClock {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes rotateRingCounter {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

/* Fusion Core Glow */
.core-glow-point {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--color-gold);
    border-radius: 50%;
    filter: blur(15px);
    animation: corePulse 1.5s infinite alternate;
}
.flaring-shield {
    position: absolute;
    width: 130%;
    height: 130%;
    border: 2px solid var(--color-gold);
    border-radius: 50%;
    opacity: 0.3;
    animation: spinClock 8s linear infinite;
}
@keyframes corePulse {
    0% { transform: scale(0.85); opacity: 0.5; }
    100% { transform: scale(1.15); opacity: 1; }
}

/* 2. Zoom & Rotate Viewport */
.svg-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.celestial-map, .portal-ring {
    width: 90vmin;
    height: 90vmin;
    max-width: 600px;
    max-height: 600px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 45px rgba(139, 92, 246, 0.15);
    transform-origin: center center;
    transition: transform 0.15s cubic-bezier(0.1, 0.8, 0.2, 1);
}

/* SVG Rotations */
.spin-clockwise {
    transform-origin: 200px 200px;
    animation: spinClock 45s linear infinite;
}

@keyframes spinClock {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin-counter {
    transform-origin: 200px 200px;
    animation: spinCounter 25s linear infinite;
}

@keyframes spinCounter {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Canvas Chamber Styles */
.canvas-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#experiment-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.instruction-overlay {
    position: absolute;
    bottom: 40px;
    z-index: 10;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
    animation: pulseText 2s infinite ease-in-out;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.95; }
}

@media (max-width: 768px) {
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 280px;
    }
    .menu-container {
        padding: 20px;
        overflow-y: auto;
        max-height: 100vh;
    }
    .menu-title {
        font-size: 3rem;
        margin-bottom: 30px;
    }
}
