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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(45deg, #ff00cc, #333399, #00ffcc, #ff9900);
    background-size: 400% 400%;
    animation: gradientAnimation 4s infinite;
    color: white;
    text-align: center;
    overflow-x: hidden;
}

@media (hover: hover) and (pointer: fine) {
    body.cursor-enabled { cursor: none; }
}

.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

body.cursor-enabled .custom-cursor { display: block; }

.cursor-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #00ffcc;
    border-radius: 50%;
    transform: translate3d(-50%, -50%, 0);
    left: var(--cx, -50px);
    top: var(--cy, -50px);
    box-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
    transition: background-color 0.2s;
    will-change: left, top;
}

.cursor-ring {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 2px solid #ff00ff;
    border-radius: 50%;
    transform: translate3d(-50%, -50%, 0);
    left: var(--rx, -50px);
    top: var(--ry, -50px);
    box-shadow: 0 0 15px #ff00ff, inset 0 0 8px #ff00ff;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                border-color 0.3s, 
                box-shadow 0.3s;
    will-change: left, top, width, height;
}

.custom-cursor.hovering .cursor-ring {
    width: 68px;
    height: 68px;
    border-color: #00ffcc;
    border-style: dashed;
    box-shadow: 0 0 25px #00ffcc, inset 0 0 12px #00ffcc;
    animation: cursorRingSpin 4s linear infinite;
}

@keyframes cursorRingSpin {
    0% { transform: translate3d(-50%, -50%, 0) rotate(0deg); }
    100% { transform: translate3d(-50%, -50%, 0) rotate(360deg); }
}

.cursor-text {
    position: absolute;
    left: var(--rx, -50px);
    top: var(--ry, -50px);
    transform: translate3d(-50%, -50%, 0);
    font-family: 'Arial', sans-serif;
    font-size: 9px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 0 5px #000, 0 0 10px #00ffcc;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10000;
    text-align: center;
}

.custom-cursor.hovering .cursor-text {
    opacity: 1;
}

@keyframes gradientAnimation {
    0%   { background-position: 0% 50%; }
    25%  { background-position: 100% 50%; }
    50%  { background-position: 100% 100%; }
    75%  { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

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

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float 5s infinite linear;
    will-change: transform, opacity;
}

@keyframes float {
    0%   { transform: translateY(100vh) rotate(0deg) scale(1);   opacity: 0; }
    10%  { opacity: 1; }
    50%  { transform: translateY(50vh) rotate(180deg) scale(1.5); }
    90%  { opacity: 1; }
    100% { transform: translateY(-120px) rotate(360deg) scale(0.5); opacity: 0; }
}

/* ---- Heading: constant wobble + gradient ---- */
h1 {
    background: linear-gradient(90deg, #ff00ff, #ff9900, #00ffcc, #333399, #ff00ff);
    background-size: 600% 600%;
    animation: textGradient 1.5s infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 30px;
    margin: 20px 0;
    font-size: 3.5rem;
    letter-spacing: 3px;
    position: relative;
    display: inline-block;
    will-change: transform;
    cursor: pointer;
}

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

/* ---- Main text: bouncing ---- */
.main-text {
    font-size: 1.5rem;
    margin: 30px 0;
    animation: pulseGlow 1s infinite;
    display: inline-block;
    will-change: transform;
    cursor: pointer;
    transition: color 0.3s;
}

@keyframes pulseGlow {
    0%   { text-shadow: 0 0 20px #ff9900, 0 0 40px #ff00ff; }
    50%  { text-shadow: 0 0 40px #00ffcc, 0 0 70px #ff00ff, 0 0 100px #ff9900; }
    100% { text-shadow: 0 0 20px #ff9900, 0 0 40px #ff00ff; }
}

/* ---- Video wrappers: constant wiggle ---- */
.video-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 40px 20px;
    padding-bottom: 140px;
}

.video-wrapper {
    position: relative;
    width: 300px;
    height: 225px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
    will-change: transform;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: box-shadow 0.3s, z-index 0.3s;
}

.video-wrapper:hover {
    z-index: 10;
    box-shadow: 0 0 80px #ff00ff, 0 0 120px #00ffcc;
}

.video-wrapper::before {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    background: linear-gradient(45deg, #ff00ff, #00ffcc, #ff9900, #333399, #ff00ff);
    background-size: 600% 600%;
    animation: borderGlow 1.5s infinite;
    border-radius: 22px;
    z-index: -1;
}

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

video, iframe, .yt-player-placeholder {
    width: 100% !important;
    height: 100% !important;
    border-radius: 15px;
    position: relative;
    z-index: 1;
    background: #000;
    display: block;
    border: none;
}

/* ---- Video thumbnail overlay ---- */
.video-overlay {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.local-video-overlay {
    background: rgba(0, 0, 0, 0.45);
}

.play-btn-glow {
    width: 60px;
    height: 60px;
    background: rgba(255, 0, 255, 0.85);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 20px #ff00ff, 0 0 40px #00ffcc;
    transition: transform 0.3s, background-color 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn-glow::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 5px;
}

.video-wrapper:hover .play-btn-glow {
    transform: scale(1.2);
    background: rgba(0, 255, 204, 0.95);
    box-shadow: 0 0 35px #00ffcc, 0 0 70px #ff00ff;
}

.video-wrapper.playing .video-overlay {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

/* ---- Beat visualizer: taller, faster ---- */
.beat-visualizer {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 1000;
}

.beat-bar {
    width: 10px;
    height: 80px;
    background: linear-gradient(to top, #ff0000, #ff00ff, #00ffcc, #ff9900);
    border-radius: 5px;
    transform-origin: bottom;
    will-change: transform;
}

/* ---- Footer ---- */
footer {
    background: linear-gradient(90deg, #ff00ff, #ff9900, #00ffcc, #333399, #ff00ff);
    background-size: 600% 600%;
    animation: footerAnimation 1.5s infinite, footerShake 0.3s infinite;
    color: white;
    padding: 25px;
    text-shadow: 0 0 20px #fff, 0 0 40px #ff00ff;
    font-size: 1.8rem;
    font-weight: bold;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    letter-spacing: 3px;
    z-index: 1000;
}

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

@keyframes footerShake {
    0%   { transform: translateX(-3px) skewX(-2deg); }
    33%  { transform: translateX(3px)  skewX(2deg); }
    66%  { transform: translateX(-2px) skewX(-1deg); }
    100% { transform: translateX(-3px) skewX(-2deg); }
}

.creator-name {
    display: inline-block;
    cursor: pointer;
    will-change: transform;
}

/* ---- Party button: also bouncing ---- */
.interactive-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #ff00ff, #ff9900, #00ffcc, #ff00ff);
    background-size: 400% 400%;
    border: none;
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 30px #ff00ff, 0 0 60px #00ffcc;
    z-index: 1000;
    animation: buttonBounce 0.5s infinite, gradientAnimation 2s infinite;
    will-change: transform;
}

@keyframes buttonBounce {
    0%   { transform: scale(1)    rotate(-3deg); }
    25%  { transform: scale(1.1)  rotate(3deg)  translateY(-5px); }
    50%  { transform: scale(0.95) rotate(-2deg); }
    75%  { transform: scale(1.1)  rotate(4deg)  translateY(-8px); }
    100% { transform: scale(1)    rotate(-3deg); }
}

.interactive-button.active {
    background: linear-gradient(45deg, #ff0000, #00ff00, #0000ff, #ff0000);
    box-shadow: 0 0 60px #ff0000, 0 0 100px #00ff00, 0 0 140px #0000ff;
    animation: buttonMegaBounce 0.15s infinite;
}

@keyframes buttonMegaBounce {
    0%   { transform: translate(-4px, -4px) rotate(-8deg) scale(1.2); }
    25%  { transform: translate(4px,   4px) rotate(8deg)  scale(1.3); }
    50%  { transform: translate(-6px,  6px) rotate(-10deg) scale(1.15); }
    75%  { transform: translate(6px,  -6px) rotate(10deg) scale(1.25); }
    100% { transform: translate(-4px, -4px) rotate(-8deg) scale(1.2); }
}

/* ---- Shake + Explosion ---- */
.shake {
    animation: shakeBig 0.4s;
}

@keyframes shakeBig {
    0%   { transform: translate(0, 0) rotate(0); }
    10%  { transform: translate(-15px, -8px) rotate(-5deg); }
    20%  { transform: translate(15px,  8px)  rotate(5deg); }
    30%  { transform: translate(-12px, 5px)  rotate(-4deg); }
    40%  { transform: translate(12px, -5px)  rotate(4deg); }
    50%  { transform: translate(-18px, -3px) rotate(-6deg); }
    60%  { transform: translate(18px,  3px)  rotate(6deg); }
    70%  { transform: translate(-10px, 8px)  rotate(-3deg); }
    80%  { transform: translate(10px, -8px)  rotate(3deg); }
    90%  { transform: translate(-5px,  4px)  rotate(-2deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

body.party-active {
    animation: partyBodyShake 0.1s infinite, gradientAnimation 4s infinite;
}

@keyframes partyBodyShake {
    0%   { transform: translate(-4px, -2px) rotate(-1deg); }
    20%  { transform: translate(4px,   2px) rotate(1deg); }
    40%  { transform: translate(-6px,  4px) rotate(-1.5deg); }
    60%  { transform: translate(6px,  -4px) rotate(1.5deg); }
    80%  { transform: translate(-3px,  2px) rotate(-0.5deg); }
    100% { transform: translate(-4px, -2px) rotate(-1deg); }
}

.explosion {
    position: fixed;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    pointer-events: none;
    animation: explode 0.7s ease-out forwards;
    z-index: 9999;
    will-change: transform, opacity;
}

@keyframes explode {
    0%   { transform: scale(0) rotate(0deg);   opacity: 1; }
    50%  { transform: scale(2) rotate(180deg); opacity: 0.8; }
    100% { transform: scale(4) rotate(360deg); opacity: 0; }
}

.flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    animation: screenFlash 0.3s ease-out forwards;
}

@keyframes screenFlash {
    0%   { opacity: 0.7; }
    100% { opacity: 0; }
}

/* ---- Confetti particle (party mode) ---- */
.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 9997;
    animation: confettiFall var(--dur, 1.5s) ease-in forwards;
    will-change: transform, opacity;
}

@keyframes confettiFall {
    0%   { transform: translateY(var(--start-y)) translateX(0) rotate(0deg) scale(1);   opacity: 1; }
    100% { transform: translateY(110vh) translateX(var(--drift)) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- Glitch screen flash overlay ---- */
body.glitch-flash {
    filter: invert(0.9) hue-rotate(90deg) contrast(1.5) saturate(2);
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
        padding: 20px 10px;
        letter-spacing: 1.5px;
    }
    .main-text {
        font-size: 1.1rem;
        margin: 20px 15px;
    }
    .video-wrapper {
        width: 100%;
        max-width: 320px;
        height: auto;
        aspect-ratio: 4 / 3;
    }
    body {
        animation-duration: 6s;
    }
    .video-wrapper::before {
        animation-duration: 3s;
    }
    
    /* Flow floating elements statically on mobile */
    .admin-controls {
        position: static;
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 20px 0 10px 0;
        gap: 10px;
    }
    .interactive-button {
        position: static;
        display: block;
        margin: 5px auto 15px auto;
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    /* Modal adjustments for small screens */
    .modal-content {
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 20px;
    }
    .modal-content h2 {
        font-size: 1.5rem;
    }
    .tab-container {
        gap: 5px;
        margin-bottom: 15px;
    }
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .submit-btn {
        padding: 10px;
        font-size: 0.95rem;
        border-radius: 12px;
    }
    .input-group input, .input-group select {
        padding: 10px;
        border-radius: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
        padding: 15px 5px;
        margin: 10px 0;
    }
    .main-text {
        font-size: 0.95rem;
        margin: 10px 10px;
    }
    .video-container {
        margin: 20px 10px;
        gap: 15px;
    }
    .video-wrapper {
        max-width: 100%;
    }
}

/* ---- Database Connection & Upload Styles ---- */
.admin-controls {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    will-change: transform;
}

.control-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 255, 204, 0.4);
    border-color: #00ffcc;
}

.upload-btn {
    background: linear-gradient(45deg, #00ffcc, #333399);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 255, 204, 0.3);
}

.upload-btn:hover {
    box-shadow: 0 8px 25px rgba(255, 0, 255, 0.5);
    border-color: transparent;
    background: linear-gradient(45deg, #ff00ff, #00ffcc);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(20, 20, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 255, 0.2);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    width: 95%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    color: white;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: left;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #ff00ff;
}

.modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #ff00ff, #00ffcc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #00ffcc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff00ff, #00ffcc);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 0, 255, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 204, 0.5);
}

.submit-btn:active {
    transform: translateY(0);
}

.sql-instructions {
    margin-top: 25px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 15px;
}

.sql-instructions h3 {
    font-size: 0.9rem;
    color: #ff9900;
    margin-bottom: 5px;
}

.sql-instructions p {
    font-size: 0.8rem;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Tab containers for Upload */
.tab-container {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #00ffcc;
    border-bottom-color: #00ffcc;
}

.upload-form {
    display: none;
}

.upload-form.active {
    display: block;
}

/* Status panel */
.status-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    text-align: center;
}

.status-container.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff00ff;
    border-radius: 50%;
    animation: spinnerRotate 1s linear infinite;
}

@keyframes spinnerRotate {
    to { transform: rotate(360deg); }
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff00ff, #00ffcc);
    border-radius: 3px;
    transition: width 0.2s ease;
}
