/* --- DESIGN SYSTEM & VARIABLES --- */
:root {
    --bg-color-dark: #070410;
    --primary-neon: #ff2a6d;
    --primary-glow: rgba(255, 42, 109, 0.6);
    --secondary-neon: #05d9e8;
    --secondary-glow: rgba(5, 217, 232, 0.6);
    --accent-neon: #d1f7ff;
    --accent-glow: rgba(209, 247, 255, 0.6);
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Press Start 2P', cursive;
}

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

body {
    background-color: var(--bg-color-dark);
    color: #fff;
    font-family: var(--font-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* Background elements */
#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Scenes & Transitions */
.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

.scene.active {
    opacity: 1;
    visibility: visible;
}

.content {
    text-align: center;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hidden {
    display: none !important;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

/* Typography & Neon FX */
h1, h2, h3 {
    font-family: var(--font-heading);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-neon);
}

.glitch-title {
    font-size: 3rem;
    color: #fff;
    position: relative;
    letter-spacing: 2px;
}
.glitch-title::before, .glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color-dark);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%);
}
.glitch-title::before {
    left: 3px;
    text-shadow: -2px 0 var(--secondary-neon);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}
.glitch-title::after {
    left: -3px;
    text-shadow: -2px 0 var(--primary-neon);
    clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip-path: polygon(0 15%, 100% 15%, 100% 25%, 0 25%); }
    20% { clip-path: polygon(0 10%, 100% 10%, 100% 20%, 0 20%); }
    40% { clip-path: polygon(0 33%, 100% 33%, 100% 33%, 0 33%); }
    60% { clip-path: polygon(0 50%, 100% 50%, 100% 60%, 0 60%); }
    80% { clip-path: polygon(0 10%, 100% 10%, 100% 15%, 0 15%); }
    100% { clip-path: polygon(0 80%, 100% 80%, 100% 90%, 0 90%); }
}

.neon-text {
    font-size: 1.5rem;
    color: var(--secondary-neon);
    text-shadow: 0 0 10px var(--secondary-glow), 0 0 20px var(--secondary-neon);
}

.huge-neon {
    font-size: 4rem;
    color: var(--primary-neon);
    text-shadow: 0 0 15px var(--primary-glow), 0 0 30px var(--primary-neon), 0 0 45px var(--primary-neon);
    animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
    0% { text-shadow: 0 0 15px var(--primary-glow), 0 0 30px var(--primary-neon); }
    100% { text-shadow: 0 0 25px var(--primary-glow), 0 0 40px var(--primary-neon), 0 0 60px var(--primary-neon); transform: scale(1.02); }
}

/* UI Components: Buttons */
.neon-btn {
    background: transparent;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    padding: 1.5rem 3rem;
    border: 3px solid var(--secondary-neon);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 0 15px var(--secondary-glow), inset 0 0 15px var(--secondary-glow);
    transition: all 0.3s ease;
    overflow: hidden;
    text-transform: uppercase;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.neon-btn:hover {
    background: var(--secondary-neon);
    color: var(--bg-color-dark);
    box-shadow: 0 0 30px var(--secondary-neon), inset 0 0 20px #fff;
    transform: scale(1.05);
}

.neon-btn:hover::before {
    left: 100%;
}

.neon-btn.small {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-color: var(--primary-neon);
    box-shadow: 0 0 10px var(--primary-glow), inset 0 0 10px var(--primary-glow);
}
.neon-btn.small:hover {
    background: var(--primary-neon);
    box-shadow: 0 0 20px var(--primary-neon);
}

/* INTRO EXPLOSION ANIMATION CLASSES */
.start-grow {
    animation: start-pulse 0.2s infinite alternate, grow 2s forwards ease-in;
}

@keyframes start-pulse {
    0% { transform: translate(2px, 2px); }
    100% { transform: translate(-2px, -2px); }
}

@keyframes grow {
    100% { transform: scale(3) translate(0, 0); opacity: 0; }
}

.screen-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.flash {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 9999;
    animation: white-flash 1s forwards;
    pointer-events: none;
}
@keyframes white-flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* CAKE */
.cake-body {
    width: 200px;
    height: 100px;
    background: linear-gradient(180deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    border-radius: 10px 10px 0 0;
    position: relative;
    margin: 0 auto 2rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5), inset 0 5px 10px rgba(255,255,255,0.5);
}
.candle {
    width: 16px;
    height: 50px;
    background: #fff;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: repeating-linear-gradient(45deg, #fff, #fff 10px, #ff2a6d 10px, #ff2a6d 20px);
}
.flame {
    width: 20px;
    height: 30px;
    background: #fdf5a9;
    border-radius: 50% 50% 20% 20%;
    position: absolute;
    bottom: 105%;
    left: -2px;
    box-shadow: 0 0 20px #fdf5a9, 0 0 40px #ffbb00;
    animation: flicker 0.1s infinite alternate;
}
@keyframes flicker {
    0% { transform: scale(1) rotate(2deg); opacity: 0.9; }
    100% { transform: scale(1.1) rotate(-2deg); opacity: 1; }
}

/* CAKE SPARKLERS */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px #fff, 0 0 20px #ffea00, 0 0 40px #ffea00;
    opacity: 0;
    z-index: 10;
}
.sparkle.s1 { top: -20px; left: 60px; animation: pop 0.8s infinite reverse; }
.sparkle.s2 { top: -10px; right: 50px; animation: pop 0.9s infinite 0.2s; }
.sparkle.s3 { top: 30px; left: -20px; animation: pop 0.7s infinite 0.4s reverse; }
.sparkle.s4 { top: 40px; right: -10px; animation: pop 1s infinite 0.5s; }

@keyframes pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* Game 1: Tiramisu Catcher */
#game1-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}
.top-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    z-index: 20;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--secondary-neon);
    text-shadow: 0 0 10px var(--secondary-glow);
}
.game-overlay {
    position: absolute;
    z-index: 30;
    background: rgba(7, 4, 16, 0.9);
    padding: 3rem;
    border: 2px solid var(--primary-neon);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 0 30px var(--primary-glow);
}

.shader-flash {
    animation: red-shader 2s ease-out forwards;
}
@keyframes red-shader {
    0% { filter: hue-rotate(0deg) contrast(1); }
    10% { filter: hue-rotate(300deg) contrast(1.5) sepia(1) saturate(5); }
    100% { filter: hue-rotate(0deg) contrast(1); }
}

/* Game 2: Audio Cable Chaos */
.comic-intro {
    background: rgba(20, 10, 30, 0.8);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--accent-neon);
    max-width: 600px;
    text-align: center;
}
.comic-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 2rem;
}
.character-left {
    width: 100px;
    height: 100px;
    background: #444;
    border-radius: 50%;
    border: 3px solid var(--primary-neon);
}
.bubble {
    background: #fff;
    color: #000;
    padding: 15px;
    border-radius: 16px;
    font-family: var(--font-main);
    font-weight: 700;
    position: relative;
}
.bubble::after {
    content: '';
    position: absolute;
    left: -15px; top: 50%;
    transform: translateY(-50%);
    border-width: 10px 15px 10px 0;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
}

.game2-container {
    width: 80%;
    max-width: 800px;
    background: linear-gradient(135deg, #111, #222);
    border: 4px solid #444;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 20px 20px 60px #000, inset 0 0 50px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ports-container, .cables-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 2rem 0;
}
.port {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.port .hole {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}
.port .hole.connected .svg-hole-ring {
    stroke: var(--secondary-neon) !important;
    filter: drop-shadow(0 0 10px var(--secondary-neon));
}
.port .hole.connected {
    box-shadow: 0 0 20px var(--secondary-glow);
    border-radius: 50%;
}
.port .label { font-family: var(--font-main); font-weight: bold; letter-spacing: 1px; color: #aaa; }

.cable {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    transition: transform 0.2s;
}
.cable:active { cursor: grabbing; transform: scale(1.1); }

.cable .plug {
    display: flex;
    justify-content: center;
    filter: drop-shadow(0 10px 5px rgba(0,0,0,0.5));
}

.cable .wire {
    width: 12px;
    background: #222;
    box-shadow: inset 2px 0 5px rgba(0,0,0,0.5), inset -2px 0 5px rgba(255,255,255,0.1);
    margin-top: -5px;
    border-radius: 0 0 10px 10px;
}

.shake-error {
    animation: horizontal-shake 0.4s;
    border-color: var(--primary-neon) !important;
}

@keyframes horizontal-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

/* Finale Video */
.video-container {
    width: 80%;
    max-width: 800px;
    margin: 2rem 0;
    box-shadow: 0 0 30px var(--secondary-glow);
    border: 4px solid var(--secondary-neon);
    border-radius: 12px;
    overflow: hidden;
}
#final-video {
    width: 100%;
    display: block;
    background: #000;
}
.blur-in {
    animation: unblur 2s ease-out forwards;
}
@keyframes unblur {
    0% { filter: blur(20px); opacity: 0; }
    100% { filter: blur(0); opacity: 1; }
}

/* UI Overlay General */
#ui-layer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border: 1px solid var(--accent-neon);
    border-radius: 8px;
    z-index: 100;
}

/* Responsiveness */
@media (max-width: 768px) {
    .huge-neon { font-size: 2.5rem; }
    .glitch-title { font-size: 2rem; }
    .top-hud { font-size: 0.9rem; padding: 1rem; }
    .ports-container { flex-direction: column; gap: 20px; }
}
