:root {
    /* Fonts */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;

    /* Base Dark Mode Colors (Matte + Neon Red) */
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    
    --accent-red: #ff2a2a; /* Neon Red */
    --accent-red-hover: #ff4d4d;
    --accent-red-translucent: rgba(255, 42, 42, 0.15);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --blob-gradient: linear-gradient(135deg, #ff2a2a, #ff1a66, #ff8c00);
    --btn-primary-text: #ffffff;
}

[data-theme="light"] {
    /* Spider-Verse Comic Pop-Art Theme */
    --bg-color: #f7f6f2; /* Off-white comic paper */
    --surface-color: #ffffff;
    --text-primary: #121212;
    --text-secondary: #000000;
    
    --accent-red: #ea1d24; /* Comic Red */
    --accent-red-hover: #ff3c43;
    --accent-red-translucent: rgba(234, 29, 36, 0.3);
    
    --border-color: #000000;
    --blob-gradient: repeating-linear-gradient(45deg, #00f0ff, #00f0ff 20px, #ff007f 20px, #ff007f 40px, #ffde00 40px, #ffde00 60px);
    --btn-primary-text: #ffffff;
}

/* Spider-Verse Comic Overrides */
[data-theme="light"] .badge {
    border: 2px solid #000;
    box-shadow: 4px 4px 0px #00f0ff;
    border-radius: 0;
    background: #ffde00; 
}
[data-theme="light"] .badge-text { color: #000; }
[data-theme="light"] .pulse-dot { background-color: #ff007f; }
[data-theme="light"] .pulse-dot::after { background-color: #ff007f; }

[data-theme="light"] h1 {
    text-transform: uppercase;
    text-shadow: 3px 3px 0 #00f0ff, -3px -3px 0 #ea1d24;
}

[data-theme="light"] .highlight {
    background: none;
    -webkit-text-fill-color: #121212;
    position: relative;
    z-index: 1;
}
[data-theme="light"] .highlight::before {
    content: '';
    position: absolute;
    bottom: 15px;
    left: -5px;
    width: 105%;
    height: 18px;
    background: #ffde00;
    z-index: -1;
    transform: rotate(-2deg);
}

[data-theme="light"] .btn {
    border-radius: 0;
    border: 2px solid #000;
    box-shadow: 4px 4px 0px var(--accent-red);
}
[data-theme="light"] .btn-primary:hover {
    transform: translate(-3px, -3px);
    box-shadow: 7px 7px 0px var(--accent-red);
}
[data-theme="light"] .btn-secondary {
    box-shadow: 4px 4px 0px #00f0ff;
}
[data-theme="light"] .btn-secondary:hover {
    transform: translate(-3px, -3px);
    box-shadow: 7px 7px 0px #00f0ff;
    background-color: #fff;
}

[data-theme="light"] .particle {
    border: 2px solid #000;
    /* Spider-Verse snappiness (animating "on twos") */
    animation-timing-function: steps(15, end) !important;
}

[data-theme="light"] #blob {
    animation-timing-function: steps(30, end);
    filter: contrast(180%) brightness(130%) blur(5px);
}

[data-theme="light"] .slide-up, 
[data-theme="light"] .fade-in-up {
    /* Apply stepped snappy animation to the floating text */
    animation-timing-function: steps(10, end);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Mouse Tracking Gradient Blob Effect */
#blob {
    background: var(--blob-gradient);
    height: 34vmax;
    aspect-ratio: 1;
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    border-radius: 50%;
    animation: rotate 20s infinite;
    opacity: 0.6;
    z-index: 1;
    transition: background 0.4s ease;
}

#blur {
    height: 100%;
    width: 100%;
    position: absolute;
    z-index: 2;
    backdrop-filter: blur(12vmax);
    -webkit-backdrop-filter: blur(12vmax);
    background-color: rgba(18, 18, 18, 0.5);
}

[data-theme="light"] #blur {
    background-color: rgba(248, 249, 250, 0.5);
}

@keyframes rotate {
    from { rotate: 0deg; }
    50% { scale: 1 1.5; }
    to { rotate: 360deg; }
}

/* Particles */
.particles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--accent-red);
    border-radius: 50%;
    left: var(--x);
    top: var(--y);
    opacity: 0.5;
    animation: drift 15s ease-in-out infinite alternate;
    animation-delay: var(--d);
    filter: blur(2px);
    cursor: crosshair;
    transition: opacity 0.3s ease, filter 0.3s ease;
    pointer-events: auto;
}

.particle:hover {
    filter: blur(0px);
    opacity: 0.9;
    transform: scale(1.1);
}

.particle.popped {
    animation: popEffect 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: none;
}

@keyframes popEffect {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(3); opacity: 0; }
    100% { transform: scale(0); opacity: 0; }
}

.particle.spawning {
    animation: spawnBubble 1s ease-out forwards, drift 15s ease-in-out infinite alternate;
}

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

.boss-bubble {
    width: 30px !important;
    height: 30px !important;
    background: #FFD700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: none !important;
    transition: left 0.7s cubic-bezier(0.25, 1, 0.5, 1), top 0.7s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s ease !important;
    z-index: 5;
    opacity: 0.9 !important;
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(20px, -20px, 0) scale(1.2); }
    100% { transform: translate3d(40px, -40px, 0) scale(1.5); }
}

/* Theme Switch */
.theme-switch-wrapper {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display:none;
}

.slider {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

.slider .sun-icon, .slider .moon-icon {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.slider:before {
    background-color: var(--text-primary);
    bottom: 4px;
    content: "";
    height: 24px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 24px;
    z-index: 2;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Main Container */
.container {
    position: relative;
    z-index: 3;
    max-width: 800px;
    padding: 2rem;
    text-align: center;
    perspective: 1200px;
}

.content {
    transform-style: preserve-3d;
    transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Theme Switch Transition Glitch */
.theme-transitioning {
    animation: comicGlitch 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes comicGlitch {
    0% { filter: contrast(100%); transform: scale(1); }
    33% { filter: contrast(130%) brightness(115%); transform: scale(1.02) rotate(1deg); }
    66% { filter: sepia(30%) hue-rotate(15deg); transform: scale(0.98) rotate(-1deg); }
    100% { filter: contrast(100%); transform: scale(1); }
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-red);
    border-radius: 50%;
    position: relative;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 50%;
    background-color: var(--accent-red);
    animation: pulseing 1.5s ease-out infinite;
}

@keyframes pulseing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.badge-text {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-primary);
}

/* Typography */
h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hover-scale {
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.4s ease;
}

.hover-scale:hover {
    transform: scale(1.05) rotate(-1deg);
}

.highlight {
    background: linear-gradient(to right, var(--text-primary), var(--accent-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: colorCycle 5s linear infinite;
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.6;
}

/* Buttons */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background-color: var(--accent-red);
    color: var(--btn-primary-text);
    border: 1px solid transparent;
    box-shadow: 0 4px 15px var(--accent-red-translucent);
}

.btn-primary:hover {
    background-color: var(--accent-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-red-translucent);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    background-color: var(--bg-color);
    transform: translateY(-2px);
}

.btn i {
    width: 20px;
    height: 20px;
}

/* Initial Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards 0.2s;
}

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s, float 6s ease-in-out infinite 1.4s;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.6s, float 6s ease-in-out infinite 1.6s;
}

.stagger-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards 0.8s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    to { opacity: 1; transform: translate3d(0,0,0); }
}

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

@keyframes colorCycle {
    0% { background-position: 0% center; filter: hue-rotate(0deg); }
    50% { background-position: 100% center; }
    100% { background-position: 0% center; filter: hue-rotate(360deg); }
}

/* Media Queries */
@media (max-width: 600px) {
    .theme-switch-wrapper {
        top: 1rem;
        right: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}
