@import 'variables.css';

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrolling during transitions */
    background-color: var(--background-color);
    color: var(--text-color);
}

body.scrollable-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- Custom Scrollbar --- */
/* Works on Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) transparent;
}

/* Works on Chrome, Edge, and Safari */
*::-webkit-scrollbar {
    width: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 20px;
    border: 2px solid transparent; /* Creates padding around scroll thumb */
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color);
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* --- Vignette Overlay --- */
#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle, transparent 50%, black 150%);
    opacity: 0;
    transition: opacity 1s ease;
}

.vignette-active {
    opacity: 1 !important;
    background-color: rgba(0,0,0,0.8) !important; /* Darken screen */
}

/* --- Splash Screen --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, var(--surface-color) 0%, var(--background-color) 100%);
    z-index: 1000;
    transition: opacity 0.8s cubic-bezier(0.7, 0, 0.3, 1);
    overflow: hidden;
}

/* Scanline Effect */
#splash-screen::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    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));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Background decorative elements for depth */
#splash-screen::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(66, 165, 245, 0.05) 0%, transparent 60%);
    animation: rotateBackground 30s linear infinite;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    width: 90%;
    max-width: 800px;
    padding: 50px;
    background: rgba(30, 30, 40, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.5),
        0 1px 1px rgba(255, 255, 255, 0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 10;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.splash-content:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 
        0 40px 90px rgba(0, 0, 0, 0.6),
        0 1px 1px rgba(255, 255, 255, 0.2) inset;
    border-color: rgba(255, 255, 255, 0.1);
}

.splash-text {
    font-size: 2.5rem;
    margin-bottom: 40px;
    font-weight: 800;
    color: white;
    text-shadow: 0 0 20px rgba(66, 165, 245, 0.5);
    letter-spacing: 2px;
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.highlight-name {
    background: linear-gradient(135deg, var(--primary-color), var(--highlight-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none; /* Remove shadow to make gradient clear */
    position: relative;
    display: inline-block;
}

@media (max-width: 768px) {
    .splash-text {
        font-size: 1.5rem;
        white-space: normal; /* Allow wrapping on very small screens if needed, or keep nowrap and scale down */
    }
}

/* Glitch Effect Animation */
@keyframes glitch-anim {
    0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 1px); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
    40% { clip-path: inset(40% 0 50% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -2px); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(-1px, 1px); }
    100% { clip-path: inset(30% 0 50% 0); transform: translate(1px, -1px); }
}

.splash-text::before,
.splash-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
}

.splash-text::before {
    left: 2px;
    text-shadow: -1px 0 var(--primary-color);
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
    display: none; 
}

.splash-text::after {
    left: -2px;
    text-shadow: -1px 0 var(--secondary-color);
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
    display: none;
}

.splash-text.glitch-active::before,
.splash-text.glitch-active::after {
    display: block;
}

.progress-container {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--highlight-color), var(--accent-color));
    background-size: 200% 100%;
    border-radius: 20px;
    transition: width 0.1s linear;
    box-shadow: 0 0 20px var(--primary-color);
    position: relative;
    animation: gradientMove 2s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Shine effect on progress bar */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        45deg, 
        rgba(255,255,255,0) 25%, 
        rgba(255,255,255,0.5) 50%, 
        rgba(255,255,255,0) 75%
    );
    background-size: 200% 200%;
    animation: shine 2s infinite linear;
}

.splash-footer {
    position: absolute;
    bottom: 20px;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-light);
    opacity: 0.8;
}

#start-btn {
    padding: 18px 50px;
    font-size: 1.3rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-color), var(--highlight-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 
        0 10px 20px rgba(108, 92, 231, 0.3),
        0 0 0 4px rgba(108, 92, 231, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#start-btn:hover,
#start-btn.hover-active {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 
        0 15px 30px rgba(108, 92, 231, 0.4),
        0 0 0 6px rgba(108, 92, 231, 0.1);
}

#start-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* --- HUB Page --- */
#hub-page {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 1s ease;
    overflow-y: auto; /* Enable scrolling for content */
    overflow-x: hidden;
}

.hub-visible {
    opacity: 1 !important;
}

.hub-main {
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px;
    margin-top: 30px;
}

.hub-card {
    background: rgba(30, 30, 40, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.2),
        0 1px 1px rgba(255,255,255,0.05) inset;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;

    /* Animation */
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: var(--delay, 0s);
}

.hub-card:hover,
.hub-card.hover-active {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.5),
        0 0 0 1px var(--primary-color),
        0 0 25px rgba(255, 171, 64, 0.2);
    border-color: var(--primary-color);
    background: rgba(40, 40, 55, 0.8);
}

.hub-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.4s ease;
}

.hub-card:hover::before,
.hub-card.hover-active::before {
    transform: scaleX(1);
}

.card-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.hub-card:hover .card-icon-wrapper,
.hub-card.hover-active .card-icon-wrapper {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transform: rotate(10deg) scale(1.1);
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(255, 171, 64, 0.3);
}

.card-icon {
    width: 40px;
    height: 40px;
    fill: var(--primary-color);
    transition: fill 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.hub-card:hover .card-icon,
.hub-card.hover-active .card-icon {
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: 0.5px;
}

.card-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-weight: 400;
}

/* Specific Card Styles */
.card-finale .card-icon-wrapper {
    background-color: rgba(46, 204, 113, 0.15);
}

.card-finale:hover .card-icon-wrapper,
.card-finale.hover-active .card-icon-wrapper {
    background-color: var(--accent-color);
}

.card-finale .card-icon {
    fill: var(--accent-color);
}

.card-finale:hover .card-icon,
.card-finale.hover-active .card-icon {
    fill: white;
}

header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: var(--surface-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 100;
    position: sticky;
    top: 0;
    width: 100%;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: var(--background-color);
}

.icon-svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}

.finale-icon {
    fill: white;
    width: 20px;
    height: 20px;
}

/* --- Sidebar --- */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed);
}

.sidebar-open #sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

#sidebar {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden by default */
    width: var(--sidebar-width);
    height: 100%;
    height: 100dvh; /* Better for mobile */
    background-color: var(--surface-color);
    z-index: 201;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto; /* Enable scrolling for sidebar content */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.sidebar-open #sidebar {
    right: 0; /* Slide in */
}

.sidebar-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
    flex-shrink: 0;
}

.profile-section {
    text-align: center;
    margin-bottom: 40px;
    flex-shrink: 0;
}

.profile-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-pic {
    width: 80px;
    height: 80px;
    background-color: var(--secondary-color);
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.profile-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%; /* Slightly larger to frame the circle */
    height: 120%;
    z-index: 2;
    pointer-events: none;
    object-fit: contain;
    border-radius: 50%;
}

.class-badge {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(26, 188, 156, 0.4);
    /* Removed rotation for straight label */
    transition: transform 0.2s;
}

.class-badge:hover {
    transform: scale(1.1);
}

.sidebar-stats {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--background-color);
    border-radius: 15px;
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateX(5px);
    background-color: var(--surface-hover);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
}

.finale-btn {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
}

/* --- Modal --- */
.modal {
    position: fixed;
    z-index: 300;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--accent-color);
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.modal-content p {
    line-height: 1.6;
    color: var(--text-color);
}

/* --- Animations --- */
@keyframes popStat {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: var(--accent-color); text-shadow: 0 0 10px var(--accent-color); }
    100% { transform: scale(1); color: var(--primary-color); }
}

.stat-pop {
    animation: popStat 0.4s ease-out forwards;
}

@keyframes pulse {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.8; transform: scale(1); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes rotateBackground {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shine {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
}

/* --- Content Pages Common --- */
.content-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px;
    animation: popIn 0.5s ease-out;
}

/* --- Puns Page --- */
.puns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.pun-card {
    background-color: transparent;
    border-radius: 20px;
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.pun-content {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 20px;
}

.pun-card.revealed .pun-content {
    transform: rotateY(180deg);
}

.pun-front, .pun-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.pun-front {
    background-color: var(--surface-color);
    border: 2px solid var(--primary-color);
}

.pun-back {
    background-color: var(--primary-color);
    color: white;
    transform: rotateY(180deg);
}

.tap-hint {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 10px;
    font-weight: normal;
}

/* --- Message Page --- */
.message-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height));
    padding: 20px;
}

.message-card {
    background: rgba(30, 30, 40, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 30px;
    max-width: 800px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: cardPopIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardPopIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.message-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.message-body {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-wrap; /* Preserves newlines */
}

#typing-text {
    min-height: 100px;
}

#typing-text::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Info Page --- */
.info-card {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 40px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
}

.section-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    text-align: center;
}

.credit-item {
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: 15px;
    transition: transform 0.3s;
}

.credit-item:hover {
    transform: translateY(-5px);
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

/* --- Finale Page --- */
.finale-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.gift-box-wrapper {
    text-align: center;
    cursor: pointer;
}

.gift-box {
    width: 150px;
    height: 150px;
    background-color: var(--accent-color);
    position: relative;
    margin: 0 auto 20px;
    transition: transform 0.3s;
}

.gift-box:hover {
    transform: scale(1.05) rotate(2deg);
}

.gift-box .box {
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.gift-box .lid {
    position: absolute;
    top: -20px;
    left: -10px;
    width: 170px;
    height: 40px;
    background-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 1s ease-in-out, top 1s ease-in-out, opacity 0.5s ease-in-out;
    z-index: 2;
}

.gift-box.open .lid {
    transform: rotate(-45deg) translateY(-100px) translateX(-50px);
    opacity: 0;
}

.ribbon-vertical {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 100%;
    background-color: white;
}

.ribbon-horizontal {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 30px;
    background-color: white;
}

.finale-content {
    text-align: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

.finale-content.visible {
    opacity: 1;
    transform: scale(1);
}

.video-placeholder {
    width: 100%;
    height: 200px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    border: 2px dashed var(--text-light);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.signature {
    font-family: 'Brush Script MT', cursive;
    font-size: 2rem;
    color: var(--accent-color);
    margin-top: 30px;
}

/* --- Reason Overlay --- */
#reason-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* Above everything */
    background-color: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    overflow: hidden;
}

#reason-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#fireworks-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.reason-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px;
    border-radius: 30px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    transform-style: preserve-3d;
    z-index: 10;
    
    /* Animation Initial State */
    transform: translateY(100px) rotateX(10deg);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#reason-overlay.active .reason-card {
    transform: translateY(0) rotateX(0);
    opacity: 1;
    transition-delay: 0.3s; /* Wait for bg darken */
}

.reason-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.reason-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.reason-footer {
    position: absolute;
    bottom: 30px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 10;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
    opacity: 0;
    transition: opacity 1s ease;
}

#reason-overlay.active .reason-footer {
    opacity: 1;
    transition-delay: 1s;
}

#back-btn-reason {
    position: absolute;
    top: 30px;
    left: -100px; /* Start off-screen */
    z-index: 20;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#reason-overlay.active #back-btn-reason {
    left: 30px;
    transition-delay: 0.6s;
}

#back-btn-reason:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

#back-btn-reason svg {
    fill: white;
    width: 24px;
    height: 24px;
}

/* --- Global Animations --- */
.animate-in {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effects */
.icon-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-btn:hover {
    transform: scale(1.15) rotate(5deg);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* --- About Page Styles --- */

/* Creator Card */
.creator-card {
    background: rgba(30, 30, 40, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 30px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.creator-card:hover {
    transform: translateY(-5px);
}

.creator-bg {
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    position: relative;
}

.creator-content {
    padding: 0 30px 30px;
    text-align: center;
    position: relative;
}

.creator-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid var(--surface-color);
    margin: -60px auto 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.creator-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.creator-badge {
    display: inline-block;
    padding: 5px 15px;
    background: rgba(108, 92, 231, 0.2);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 10px;
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.creator-info h2 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.creator-info p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.creator-bio {
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 15px;
}

.creator-socials {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-link {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* Tech Cards */
.tech-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tech-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.tech-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.tech-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.tech-card p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}

.tech-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Fun Facts */
.fact-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px 30px;
    border-radius: 20px;
    min-width: 150px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.fact-item:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.08);
}

.fact-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 5px;
    font-variant-numeric: tabular-nums;
}

.fact-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Message Storm Overlay --- */
#message-storm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Dark theme */
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: none;
    overflow: hidden;
}

#message-storm-overlay.active {
    display: block;
    opacity: 1;
}

.storm-message {
    position: absolute;
    background: rgba(30, 30, 40, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.5),
        0 0 0 1px rgba(255,255,255,0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1); /* Rotation handled inline */
    }
}

.section-header {
    text-align: center;
    font-size: 1.8rem;
    margin: 60px 0 30px;
    color: var(--text-color);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-header::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* Mystery Button Section */
#mystery-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.8); /* Dim background behind button */
    opacity: 0;
    animation: fadeIn 2s forwards;
}

#mystery-btn {
    background: linear-gradient(145deg, var(--color-blue-dark), #000000);
    color: #fff;
    border: 2px solid var(--color-blue-highlight);
    padding: 20px 50px;
    font-size: 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(66, 165, 245, 0.5);
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#mystery-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(66, 165, 245, 0.8);
    background: linear-gradient(145deg, var(--color-blue-highlight), #000000);
}

/* Scrolling Credits Overlay */
#credits-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 3000;
    display: flex;
    justify-content: center;
    overflow: hidden; /* Hide scrollbars */
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.credits-content {
    position: absolute;
    bottom: -100%; /* Start below screen */
    width: 80%;
    max-width: 600px;
    text-align: center;
    color: #fff;
    animation: scrollCredits 60s linear forwards; /* Adjust duration based on content length */
}

.credit-item {
    margin-bottom: 50px;
    font-size: 1.2rem;
    opacity: 0.9;
}

.credit-item h3 {
    color: #9d4edd;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.credit-item p {
    line-height: 1.6;
}

.final-thank-you {
    margin-top: 100px;
    margin-bottom: 300px; /* Extra space at end */
    font-size: 3rem;
    color: #e0aaff;
    font-weight: bold;
}

@keyframes scrollCredits {
    0% {
        transform: translateY(0);
        bottom: -100%;
    }
    100% {
        bottom: 100%;
        transform: translateY(-100%); /* Move completely off screen */
    }
}


/* --- Refined Finale Styles --- */

/* Fix Gift Box Centering & Animation */
.gift-box-wrapper {
    animation: none !important; /* Ensure no slide-in interference */
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.5s;
}

/* Slower Lid Animation */
.gift-box .lid {
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1), top 2s ease-in-out, opacity 1s ease-in-out;
}

/* Message Wall (Ending) */
#credits-overlay {
    /* Reuse existing overlay but allow scrolling for the wall */
    overflow-y: auto; 
    align-items: flex-start; /* Start from top */
    padding: 40px 20px;
    box-sizing: border-box;
}

.credits-content {
    /* Reset animation from previous version */
    animation: none;
    position: relative;
    bottom: auto;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 0 auto;
    padding-bottom: 100px; /* Space for return button */
}

.wall-message {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 20px;
    color: #fff;
    font-size: 1.1rem;
    opacity: 0;
    transform: scale(0.5);
    animation: popUpMessage 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.wall-message:nth-child(even) {
    background: rgba(157, 78, 221, 0.2);
    border-color: rgba(157, 78, 221, 0.3);
}

@keyframes popUpMessage {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Return Button in Finale */
#finale-return-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #000;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: bold;
    text-decoration: none;
    opacity: 0;
    transition: opacity 1s;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    z-index: 4000;
    cursor: pointer;
}

#finale-return-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 0 30px rgba(255,255,255,0.8);
}


/* --- Fixes & Enhancements --- */

/* 1. Fix Flickering/Movement on Load */
.finale-container {
    animation: fadeIn 1.5s ease-out !important; /* Override popIn to stop 'moving' effect */
    transform: none !important; /* Ensure no scaling/translation */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 2. Fix Overlay/Click Issues */
.gift-box-wrapper {
    position: relative;
    z-index: 10; /* Ensure it's above background elements */
    pointer-events: auto;
}

#message-storm-overlay {
    pointer-events: none !important; /* Ensure clicks pass through even if active */
}

/* 3. Enhanced Visuals for Message Wall */
.wall-message {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-family: 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
    transition: transform 0.3s ease;
}

.wall-message:hover {
    transform: scale(1.05) !important; /* Override animation scale */
    background: rgba(255, 255, 255, 0.15);
    z-index: 100;
    border-color: var(--accent-color);
}

/* 4. Mystery Button Glow Up */
#mystery-btn {
    background: linear-gradient(135deg, #240046, #10002b);
    border: 1px solid rgba(157, 78, 221, 0.5);
    box-shadow: 
        0 0 20px rgba(157, 78, 221, 0.3),
        inset 0 0 20px rgba(157, 78, 221, 0.1);
    position: relative;
    overflow: hidden;
}

#mystery-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: rotateBackground 10s linear infinite;
    pointer-events: none;
}


/* --- Splash Screen Fixes --- */

/* 1. Prevent Layout Shift */
.splash-content {
    min-height: 350px; /* Fixed height to prevent shrinking */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 2. Fix Button Positioning & Animation */
#start-btn {
    position: absolute;
    bottom: 50px;
    left: 50%;
    margin: 0;
    /* Override previous animation to include centering */
    animation: popInCentered 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    transform: translateX(-50%); /* Ensure final state is centered */
}

@keyframes popInCentered {
    0% { 
        transform: translateX(-50%) scale(0); 
        opacity: 0; 
    }
    100% { 
        transform: translateX(-50%) scale(1); 
        opacity: 1; 
    }
}

/* 3. Ensure Progress Bar doesn't shift layout when present */
.progress-container {
    position: absolute;
    bottom: 60px;
    width: 80%;
    left: 10%;
}

.splash-text {
    margin-bottom: 80px; /* Make room for absolute elements */
}


/* --- Finale Reset Styles --- */

/* Ensure layers are properly styled */
#layer-gift {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60vh;
    width: 100%;
}

/* Storm Messages */
.storm-message {
    position: absolute;
    background: rgba(30, 30, 40, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Wall Messages */
.wall-message {
    display: inline-block;
    margin: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: 20px;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: popIn 0.5s ease forwards;
}

/* Wall Content Container */
#wall-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 100px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Return Button */
#finale-return-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #000;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s;
    z-index: 100;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

#finale-return-btn:hover {
    transform: translateX(-50%) scale(1.05);
}

