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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 2s ease;
}

body.phase-trust {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.phase-doubt {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body.phase-chaos {
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 50%, #764ba2 100%);
    background-size: 200% 200%;
    animation: chaosBackground 3s ease infinite;
}

body.phase-existential {
    background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
}

body.phase-acceptance {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

@keyframes chaosBackground {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#app {
    width: 90%;
    max-width: 600px;
    padding: 40px;
    text-align: center;
}

#loading-container {
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Library ticker - rapidly changing text */
#library-ticker {
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    min-height: 16px;
    text-align: center;
}

#library-text {
    opacity: 0.7;
    animation: flicker 0.1s infinite;
}

@keyframes libraryFlicker {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }
}

/* Loading Bar Styles */
.loading-bar-wrapper {
    width: 100%;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.loading-bar-bg {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loading-bar-text {
    margin-top: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Chaos Phase Bar Animations */
.bar-glitch {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

.bar-rotate {
    animation: rotate 3s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

.bar-backwards .loading-bar-fill {
    background: linear-gradient(90deg, #ff6b6b 0%, #4ecdc4 100%);
    animation: backwards 2s ease-in-out infinite;
}

@keyframes backwards {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-20px);
    }
}

.bar-pacman .loading-bar-fill {
    background: #ffff00;
    position: relative;
}

.bar-pacman .loading-bar-fill::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #ffff00;
    border-radius: 50%;
    clip-path: polygon(100% 0, 100% 30%, 50% 50%, 100% 70%, 100% 100%, 0 100%, 0 0);
    animation: chomp 0.5s infinite;
}

@keyframes chomp {

    0%,
    100% {
        clip-path: polygon(100% 0, 100% 30%, 50% 50%, 100% 70%, 100% 100%, 0 100%, 0 0);
    }

    50% {
        clip-path: polygon(100% 0, 100% 45%, 50% 50%, 100% 55%, 100% 100%, 0 100%, 0 0);
    }
}

/* Message Styles */
#message-container {
    margin: 40px 0;
    animation: fadeIn 0.5s ease;
}

#main-message {
    font-size: 24px;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}

#sub-message {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

/* Glitch Effect */
.glitch {
    animation: textGlitch 0.3s infinite;
}

@keyframes textGlitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

/* Interactive Elements */
#interactive-container {
    margin: 40px 0;
    animation: fadeIn 1s ease;
}

.interactive-button {
    padding: 12px 30px;
    margin: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 25px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.interactive-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.interactive-input {
    padding: 12px 20px;
    margin: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 25px;
    color: white;
    font-size: 16px;
    width: 80%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.interactive-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.draggable-bar {
    cursor: grab;
}

.draggable-bar:active {
    cursor: grabbing;
}

/* Stats Overlay */
#stats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.stats-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    color: white;
}

.stats-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.stats-line {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 16px;
}

.stats-separator {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 20px 0;
}

.stats-footer {
    margin-top: 30px;
    text-align: center;
    font-style: italic;
}

.stats-buttons {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Screen Flicker */
.flicker {
    animation: flicker 0.1s infinite;
}

@keyframes flicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* User Select Disable */
body {
    user-select: none;
    -webkit-user-select: none;
}

/* Cursor Style for Chaos */
body.phase-chaos {
    cursor: wait !important;
}

body.phase-existential {
    cursor: help !important;
}

/* Pulse animation for skip button */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Testimonials Section - Floating Bubbles */
#testimonials-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.testimonial {
    position: absolute;
    bottom: -200px;
    left: 20px;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: floatUp 8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        bottom: -200px;
        opacity: 0;
        transform: scale(0.8);
    }

    15% {
        opacity: 1;
        transform: scale(1);
    }

    70% {
        opacity: 1;
        transform: scale(1);
    }

    90% {
        opacity: 0.5;
        transform: scale(1.1);
    }

    100% {
        bottom: 75vh;
        opacity: 0;
        transform: scale(0);
    }
}

.testimonial-name {
    color: white;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.testimonial-review {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 6px;
}

.testimonial-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-style: italic;
}

/* ===== Social Pressure Elements ===== */

#viewer-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 200;
    animation: fadeIn 0.5s ease;
}

.viewer-dot {
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    animation: pulse 1.5s ease infinite;
}

.viewer-count {
    font-weight: 700;
    color: white;
}

.viewer-flash {
    animation: viewerFlash 0.5s ease;
}

@keyframes viewerFlash {

    0%,
    100% {
        background: rgba(0, 0, 0, 0.3);
    }

    50% {
        background: rgba(255, 100, 100, 0.4);
    }
}

#leaderboard-tease {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.4);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    color: white;
    backdrop-filter: blur(10px);
    z-index: 200;
    animation: fadeIn 0.5s ease;
}

.leaderboard-update {
    animation: leaderboardPop 0.5s ease !important;
}

@keyframes leaderboardPop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

#fake-notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    pointer-events: none;
}

.completion-notification {
    background: rgba(0, 200, 100, 0.2);
    border: 1px solid rgba(0, 200, 100, 0.4);
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: white;
    backdrop-filter: blur(10px);
    animation: slideInRight 0.5s ease, fadeOut 0.5s ease 5.5s forwards;
    max-width: 300px;
}

.completion-icon {
    font-size: 18px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.urgent-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 50, 50, 0.2);
    border: 2px solid rgba(255, 50, 50, 0.6);
    padding: 20px 30px;
    border-radius: 15px;
    font-size: 16px;
    color: white;
    backdrop-filter: blur(15px);
    z-index: 500;
    animation: fadeIn 0.3s ease, fadeOut 0.5s ease 4.5s forwards;
}

/* ===== Meta-Awareness Messages ===== */

.meta-awareness {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    backdrop-filter: blur(10px);
    z-index: 400;
    animation: fadeIn 0.5s ease;
    max-width: 90%;
    text-align: center;
}

.meta-fade-out {
    animation: fadeOut 1s ease forwards;
}

/* ===== Color Desaturation for Existential Phase ===== */

body.phase-existential {
    filter: saturate(0.3);
    transition: filter 5s ease;
}

body.phase-existential #app {
    filter: saturate(3.33);
    /* Compensate to keep text readable */
}

/* Slowly drain color over time */
body.phase-existential.desaturating {
    animation: drainColor 120s ease forwards;
}

@keyframes drainColor {
    0% {
        filter: saturate(0.3);
    }

    100% {
        filter: saturate(0) brightness(0.8);
    }
}

/* ===== Enhanced Chaos Phase ===== */

body.phase-chaos {
    animation: chaosBackground 3s ease infinite, subtleShake 0.5s ease infinite;
}

@keyframes subtleShake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(1px, 0);
    }

    50% {
        transform: translate(-1px, 1px);
    }

    75% {
        transform: translate(0, -1px);
    }
}