:root {
    --bg-color: #05050a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --neon-blue: #00f0ff;
    --neon-purple: #b026ff;
    --neon-red: #ff2a2a;
    --glass-bg: rgba(20, 20, 35, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
}

.hidden {
    display: none !important;
    opacity: 0;
}

.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.scene.active {
    opacity: 1;
    pointer-events: all;
}

.scene-header {
    position: absolute;
    top: 10%;
    text-align: center;
    z-index: 10;
}

.scene-header h2 {
    font-size: 2rem;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.scene-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.next-scene-btn {
    position: absolute;
    bottom: 5%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 20;
}

.next-scene-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
}

/* --- SCENE 1: BOOT SEQUENCE --- */
.terminal {
    width: 100%;
    height: 100%;
    position: relative;
    font-family: 'Fira Code', monospace;
}

.matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    z-index: 1;
}

.terminal-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--neon-blue);
    text-shadow: 0 0 5px var(--neon-blue);
    font-size: 1.1rem;
    line-height: 1.8;
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

.fingerprint-btn {
    margin-top: 2rem;
    width: 80px;
    height: 80px;
    align-self: center;
    color: var(--neon-purple);
    cursor: pointer;
    filter: drop-shadow(0 0 10px var(--neon-purple));
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.fingerprint-btn:active {
    transform: scale(0.9);
}

@keyframes pulse {
    0% { filter: drop-shadow(0 0 10px var(--neon-purple)); }
    50% { filter: drop-shadow(0 0 25px var(--neon-purple)); }
    100% { filter: drop-shadow(0 0 10px var(--neon-purple)); }
}

/* --- SCENE 2: CONSTELLATION --- */
#stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #05050a 100%);
}

.star-node {
    position: absolute;
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px 5px var(--neon-blue);
    cursor: pointer;
    z-index: 5;
    transition: transform 0.3s;
    animation: twinkle 3s infinite alternate;
}

.star-node:active {
    transform: scale(1.5);
}

@keyframes twinkle {
    0% { opacity: 0.6; box-shadow: 0 0 10px 2px var(--neon-blue); }
    100% { opacity: 1; box-shadow: 0 0 25px 8px var(--neon-blue); }
}

.glass-modal {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    width: 85%;
    max-width: 400px;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s;
}

.glass-modal.hidden .modal-content {
    transform: translateY(50px);
}

.close-btn {
    position: absolute;
    top: 10px; right: 15px;
    background: none; border: none;
    color: #fff; font-size: 1.5rem;
    cursor: pointer;
}

#memory-title {
    color: var(--neon-blue);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#memory-text {
    line-height: 1.6;
    color: var(--text-primary);
}

/* --- SCENE 3: LETTERS --- */
.desk {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    padding: 0 2rem;
    margin-top: 5rem;
}

.envelope-wrapper {
    perspective: 1000px;
    cursor: pointer;
    height: 120px;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #1e1e2f, #151520);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.envelope::before {
    content: "TAP TO OPEN";
    position: absolute;
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 2px;
    z-index: 10;
}

.flap {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 50%;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--glass-border);
    transform-origin: top;
    transition: transform 0.6s 0.2s;
    z-index: 3;
}

.letter {
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    background: #fdfbf7;
    color: #1a1a2e;
    padding: 1.5rem;
    border-radius: 5px;
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s 0.4s;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

.envelope-wrapper.open .envelope {
    transform: translateY(-20px);
}

.envelope-wrapper.open .envelope::before {
    display: none;
}

.envelope-wrapper.open .flap {
    transform: rotateX(180deg);
}

.envelope-wrapper.open .letter {
    opacity: 1;
    transform: translateY(-40px);
    z-index: 20;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/* --- SCENE 4: CODE EDITOR --- */
.code-editor {
    width: 90%;
    max-width: 500px;
    background: #0f111a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
}

.editor-header {
    background: #1a1c29;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.filename {
    margin-left: 10px;
    color: #8f93a2;
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
}

#code-block {
    display: block;
    padding: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #a6accd;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 50vh;
}

.keyword { color: #c792ea; }
.function { color: #82aaff; }
.string { color: #c3e88d; }
.comment { color: #697098; font-style: italic; }
.variable { color: #f07178; }

/* --- SCENE 5: FINALE --- */
.finale-container {
    text-align: center;
    z-index: 10;
    width: 100%;
    padding: 0 2rem;
}

.heartbeat {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    background: radial-gradient(circle at center, rgba(176, 38, 255, 0.1) 0%, transparent 70%);
    animation: throb 2s infinite;
    z-index: 0;
}

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

.glitch {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    position: relative;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px var(--neon-red);
}

#finale-question {
    font-size: 1.2rem;
    margin-bottom: 4rem;
    line-height: 1.5;
}

.button-container {
    position: relative;
    height: 200px;
    width: 100%;
}

.glass-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    color: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    position: absolute;
}

.glass-btn.primary {
    background: rgba(0, 240, 255, 0.2);
    border: 1px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
    left: 10%;
    top: 0;
    z-index: 5;
}

.glass-btn.danger {
    background: rgba(255, 42, 42, 0.2);
    border: 1px solid var(--neon-red);
    box-shadow: 0 0 15px rgba(255, 42, 42, 0.5);
    right: 10%;
    top: 0;
    z-index: 5;
}

#confetti {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
}
