/**
 * EVERYTHING STAYS - INTERACTIVE MUSIC TV
 * Mobile-First Full-Screen Experience
 * 
 * 50+ Mobile UI Responsive Features
 * 20+ Immersive "Live" UI/UX Features
 * 
 * Layout: Full-screen background image with 3 interactive zones:
 * 1. TV Screen - Video plays inside TV
 * 2. Guitar Strings - Invisible touch zones over guitar
 * 3. Mirror/Portal - Synced lyrics display
 */

/* ============================================
   RESET & BASE
   ============================================ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Caveat', 'Shadows Into Light', cursive, sans-serif;
    background: #050505;
    color: #fff;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

/* Prevent pull-to-refresh */
body {
    overscroll-behavior-y: contain;
}

/* ============================================
   FEATURE 1-10: CRT TV EFFECTS
   ============================================ */

/* CRT Screen curvature effect */
.crt-curve {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    background: radial-gradient(ellipse at center, transparent 0%, transparent 70%, rgba(0, 0, 0, 0.3) 100%);
}

/* CRT Scanlines - Horizontal lines */
.crt-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 51;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px);
    animation: scanlineMove 0.1s linear infinite;
}

@keyframes scanlineMove {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(2px);
    }
}

/* CRT Flicker effect */
.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 52;
    opacity: 0;
    background: rgba(255, 255, 255, 0.03);
    animation: crtFlicker 0.15s infinite;
}

@keyframes crtFlicker {
    0% {
        opacity: 0.27861;
    }

    5% {
        opacity: 0.34769;
    }

    10% {
        opacity: 0.23604;
    }

    15% {
        opacity: 0.90626;
    }

    20% {
        opacity: 0.18128;
    }

    25% {
        opacity: 0.83891;
    }

    30% {
        opacity: 0.65583;
    }

    35% {
        opacity: 0.67807;
    }

    40% {
        opacity: 0.26559;
    }

    45% {
        opacity: 0.84693;
    }

    50% {
        opacity: 0.96019;
    }

    55% {
        opacity: 0.08594;
    }

    60% {
        opacity: 0.20313;
    }

    65% {
        opacity: 0.71988;
    }

    70% {
        opacity: 0.53455;
    }

    75% {
        opacity: 0.37288;
    }

    80% {
        opacity: 0.71428;
    }

    85% {
        opacity: 0.70419;
    }

    90% {
        opacity: 0.7003;
    }

    95% {
        opacity: 0.36108;
    }

    100% {
        opacity: 0.24387;
    }
}

/* CRT Screen glow */
.crt-glow {
    position: absolute;
    top: -2%;
    left: -2%;
    width: 104%;
    height: 104%;
    pointer-events: none;
    z-index: 49;
    box-shadow:
        inset 0 0 20px rgba(0, 255, 255, 0.1),
        inset 0 0 40px rgba(0, 255, 255, 0.05),
        0 0 10px rgba(0, 255, 255, 0.2),
        0 0 20px rgba(0, 255, 255, 0.1),
        0 0 30px rgba(0, 255, 255, 0.05);
    border-radius: 8px;
}

/* CRT Power-on animation */
.crt-power-on {
    animation: crtPowerOn 1.5s ease-out forwards;
}

@keyframes crtPowerOn {
    0% {
        transform: scaleX(0) scaleY(0.01);
        filter: brightness(30);
    }

    50% {
        transform: scaleX(1) scaleY(0.01);
        filter: brightness(10);
    }

    100% {
        transform: scaleX(1) scaleY(1);
        filter: brightness(1);
    }
}

/* CRT Power-off animation */
.crt-power-off {
    animation: crtPowerOff 0.5s ease-in forwards;
}

@keyframes crtPowerOff {
    0% {
        transform: scaleX(1) scaleY(1);
        filter: brightness(1);
    }

    60% {
        transform: scaleX(1) scaleY(0.01);
        filter: brightness(10);
    }

    100% {
        transform: scaleX(0) scaleY(0.01);
        filter: brightness(0);
    }
}

/* Chromatic aberration on video */
.chromatic-aberration {
    position: relative;
}

.chromatic-aberration::before,
.chromatic-aberration::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.chromatic-aberration::before {
    background: rgba(255, 0, 0, 0.03);
    transform: translateX(-1px);
    mix-blend-mode: screen;
}

.chromatic-aberration::after {
    background: rgba(0, 255, 255, 0.03);
    transform: translateX(1px);
    mix-blend-mode: screen;
}

/* VHS tracking lines */
.vhs-tracking {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 53;
    background: repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.1) 3px,
            rgba(0, 0, 0, 0.1) 4px);
    animation: vhsTracking 8s linear infinite;
    opacity: 0.5;
}

@keyframes vhsTracking {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(100%);
    }
}

/* Screen burn-in effect */
.screen-burn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 48;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(255, 100, 100, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(100, 100, 255, 0.02) 0%, transparent 50%);
}

/* ============================================
   FEATURE 11-20: AMBIENT ATMOSPHERE
   ============================================ */

/* Floating dust particles */
.dust-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Ambient light rays */
.ambient-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background:
        linear-gradient(135deg, rgba(255, 50, 80, 0.03) 0%, transparent 50%),
        linear-gradient(225deg, rgba(50, 100, 255, 0.02) 0%, transparent 50%);
    animation: ambientPulse 10s ease-in-out infinite;
}

@keyframes ambientPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Floating stars/sparkles */
.sparkles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 3s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ambient fog/mist */
.ambient-fog {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    pointer-events: none;
    z-index: 4;
    background: linear-gradient(to top, rgba(100, 50, 150, 0.1) 0%, transparent 100%);
    animation: fogDrift 20s ease-in-out infinite;
}

@keyframes fogDrift {

    0%,
    100% {
        transform: translateX(-5%);
        opacity: 0.3;
    }

    50% {
        transform: translateX(5%);
        opacity: 0.5;
    }
}

/* Cosmic background pulse */
.cosmic-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse at center, rgba(100, 0, 150, 0.1) 0%, transparent 70%);
    animation: cosmicPulse 15s ease-in-out infinite;
}

@keyframes cosmicPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
}

/* Light leak effect */
.light-leak {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(255, 100, 50, 0.05) 0%, transparent 30%),
        radial-gradient(ellipse at 100% 100%, rgba(50, 100, 255, 0.05) 0%, transparent 30%);
    animation: lightLeak 12s ease-in-out infinite;
}

@keyframes lightLeak {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Vignette effect */
.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

/* Film grain overlay */
.film-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 7;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: grainShift 0.5s steps(10) infinite;
}

@keyframes grainShift {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-1%, -1%);
    }

    20% {
        transform: translate(1%, 1%);
    }

    30% {
        transform: translate(-1%, 1%);
    }

    40% {
        transform: translate(1%, -1%);
    }

    50% {
        transform: translate(-1%, 0);
    }

    60% {
        transform: translate(1%, 0);
    }

    70% {
        transform: translate(0, 1%);
    }

    80% {
        transform: translate(0, -1%);
    }

    90% {
        transform: translate(1%, 1%);
    }
}

/* ============================================
   FEATURE 21-30: INTERACTIVE FEEDBACK
   ============================================ */

/* Touch ripple effect */
.touch-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 50, 80, 0.4) 0%, transparent 70%);
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes rippleExpand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* String glow on touch */
.string-glow {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 50, 80, 0.8), transparent);
    box-shadow:
        0 0 10px rgba(255, 50, 80, 0.8),
        0 0 20px rgba(255, 50, 80, 0.5),
        0 0 30px rgba(255, 50, 80, 0.3);
    animation: stringGlow 0.3s ease-out;
    pointer-events: none;
}

@keyframes stringGlow {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Haptic feedback visual indicator */
.haptic-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid rgba(255, 50, 80, 0.5);
    border-radius: 50%;
    animation: hapticPulse 0.3s ease-out;
    pointer-events: none;
    z-index: 200;
}

@keyframes hapticPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Progress bar glow */
.progress-glow {
    filter: drop-shadow(0 0 10px rgba(255, 50, 80, 0.8));
    animation: progressPulse 1s ease-in-out infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(255, 50, 80, 0.8));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 50, 80, 1));
    }
}

/* Button press effect */
.btn-press {
    transition: transform 0.1s ease-out;
}

.btn-press:active {
    transform: scale(0.95);
}

/* Long press indicator */
.long-press-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 50, 80, 0.5);
    border-radius: 50%;
    animation: longPressGrow 1s ease-out forwards;
    pointer-events: none;
}

@keyframes longPressGrow {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Swipe indicator */
.swipe-indicator {
    position: absolute;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: swipeMove 1s ease-in-out infinite;
}

@keyframes swipeMove {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ============================================
   FEATURE 31-40: TV IMMERSION EFFECTS
   ============================================ */

/* TV screen reflection */
.tv-reflection {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 54;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.05) 0%,
            transparent 40%,
            transparent 60%,
            rgba(255, 255, 255, 0.02) 100%);
}

/* TV speaker vibration */
.tv-speaker-vibrate {
    animation: speakerVibrate 0.1s linear infinite;
}

@keyframes speakerVibrate {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-0.5px);
    }

    75% {
        transform: translateX(0.5px);
    }
}

/* TV ambient glow that pulses with video */
.tv-ambient-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(ellipse at center, rgba(255, 50, 80, 0.1) 0%, transparent 50%);
    animation: tvAmbientPulse 2s ease-in-out infinite;
}

@keyframes tvAmbientPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* TV static transition */
.tv-static-transition {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 55;
    opacity: 0;
    animation: staticTransition 0.5s ease-out;
}

@keyframes staticTransition {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* TV channel change effect */
.channel-change {
    animation: channelChange 0.3s ease-out;
}

@keyframes channelChange {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }

    50% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* TV screen distortion */
.screen-distortion {
    animation: screenDistort 5s ease-in-out infinite;
}

@keyframes screenDistort {

    0%,
    100% {
        transform: perspective(500px) rotateX(0deg) rotateY(0deg);
    }

    25% {
        transform: perspective(500px) rotateX(0.5deg) rotateY(0.5deg);
    }

    50% {
        transform: perspective(500px) rotateX(-0.5deg) rotateY(-0.5deg);
    }

    75% {
        transform: perspective(500px) rotateX(0.3deg) rotateY(-0.3deg);
    }
}

/* TV frame shadow */
.tv-frame-shadow {
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 0, 0, 0.5),
        0 5px 30px rgba(0, 0, 0, 0.3);
}

/* ============================================
   FEATURE 41-50: MOBILE OPTIMIZATIONS
   ============================================ */

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .safe-area-bottom {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .safe-area-left {
        padding-left: max(10px, env(safe-area-inset-left));
    }

    .safe-area-right {
        padding-right: max(10px, env(safe-area-inset-right));
    }
}

/* High DPI canvas rendering */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .high-dpi {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #000;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .lyric-line {
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff;
    }
}

/* Touch device detection */
@media (hover: none) and (pointer: coarse) {
    .touch-optimized {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Hover-capable devices */
@media (hover: hover) and (pointer: fine) {
    .hover-effect:hover {
        transform: scale(1.02);
        filter: brightness(1.1);
    }
}

/* Portrait orientation lock message */
@media (orientation: landscape) and (max-height: 500px) {
    .rotate-overlay {
        display: flex !important;
    }
}

/* Prevent text selection on long press */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prevent callout on long press */
.no-callout {
    -webkit-touch-callout: none;
}

/* GPU acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Smooth scrolling */
.smooth-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ============================================
   LOADING SCREEN
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    font-size: 1.5rem;
    color: #ff3250;
    text-shadow: 0 0 20px rgba(255, 50, 80, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.loading-subtext {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.5rem;
}

/* Loading animation - spinning TV */
.loading-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    animation: loadingSpin 2s linear infinite;
}

@keyframes loadingSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.nostalgia-room {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ============================================
   LAYER 0: BACKGROUND IMAGE
   ============================================ */

.void-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1.02) translateY(-5px);
    }
}

/* ============================================
   LAYER 1: VIDEO LAYER (INSIDE TV SCREEN)
   ============================================ */

.video-layer {
    position: absolute;
    /* Position inside TV screen - adjust these percentages based on FINAL.jpg */
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 38%;
    height: 16%;
    z-index: 2;
    overflow: hidden;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    background: #000;
}

.video-layer.visible {
    opacity: 1;
}

.video-layer video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video layer CRT effects */
.video-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background:
        repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.1) 0px,
            rgba(0, 0, 0, 0.1) 1px,
            transparent 1px,
            transparent 2px);
}

/* Video glow effect */
.video-layer::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    pointer-events: none;
    z-index: -1;
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.2),
        0 0 40px rgba(0, 255, 255, 0.1);
    border-radius: 8px;
}

/* ============================================
   LAYER 2: STATIC NOISE (INSIDE TV SCREEN)
   ============================================ */

.static-layer {
    position: absolute;
    /* Same position as video layer */
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 38%;
    height: 16%;
    z-index: 3;
    overflow: hidden;
    border-radius: 4px;
    transition: opacity 0.3s ease-out;
}

.static-layer.hidden {
    opacity: 0;
    pointer-events: none;
}

.static-canvas {
    width: 100%;
    height: 100%;
}

/* Static layer glow */
.static-layer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

/* ============================================
   LAYER 3: GUITAR STRINGS (INVISIBLE TOUCH ZONE)
   ============================================ */

.physics-layer {
    position: absolute;
    /* Position over guitar area in background image */
    bottom: 8%;
    left: 20%;
    right: 20%;
    height: 30%;
    z-index: 4;
    background: transparent;
}

.strings-canvas {
    width: 100%;
    height: 100%;
}

/* Guitar string hint on hover/touch */
.physics-layer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    border: 1px dashed rgba(255, 50, 80, 0.2);
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.physics-layer:hover::before,
.physics-layer:active::before {
    opacity: 1;
}

/* ============================================
   LAYER 4: LYRICS (MIRROR/PORTAL AREA)
   ============================================ */

.lyrics-layer {
    position: absolute;
    /* Position in mirror/portal area - adjust based on FINAL.jpg */
    top: 35%;
    right: 5%;
    width: 35%;
    max-height: 40%;
    z-index: 5;
    overflow: visible;
    pointer-events: none;
}

.lyrics-container {
    text-align: right;
    transform: rotate(-3deg);
}

.lyric-line {
    font-size: clamp(0.9rem, 3vw, 1.4rem);
    color: #fff;
    text-shadow:
        0 0 10px rgba(255, 50, 80, 0.8),
        0 0 20px rgba(255, 50, 80, 0.5),
        0 0 30px rgba(255, 50, 80, 0.3);
    line-height: 1.4;
    margin-bottom: 0.3em;
    opacity: 0;
    transform: translateY(10px);
    animation: lyricFadeIn 0.5s ease-out forwards;
}

.lyric-line.current {
    color: #ff3250;
    text-shadow:
        0 0 15px rgba(255, 50, 80, 1),
        0 0 30px rgba(255, 50, 80, 0.8),
        0 0 45px rgba(255, 50, 80, 0.5);
    animation: currentLyricPulse 1s ease-in-out infinite;
}

@keyframes currentLyricPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

@keyframes lyricFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating animation for lyrics */
.lyrics-container {
    animation: floatLyrics 4s ease-in-out infinite;
}

@keyframes floatLyrics {

    0%,
    100% {
        transform: rotate(-3deg) translateY(0);
    }

    50% {
        transform: rotate(-3deg) translateY(-5px);
    }
}

/* ============================================
   UI OVERLAY (PROGRESS & STATUS)
   ============================================ */

.ui-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.ui-overlay.hidden {
    opacity: 0;
}

.progress-ring {
    width: 100px;
    height: 100px;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.progress-ring.visible {
    opacity: 1;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring circle {
    fill: none;
    stroke-width: 4;
}

.progress-ring .bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.progress-ring .fill {
    stroke: #ff3250;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.1s ease-out;
    filter: drop-shadow(0 0 10px rgba(255, 50, 80, 0.8));
}

.status-text {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 10px rgba(255, 50, 80, 0.5);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* ============================================
   ROTATE OVERLAY (LANDSCAPE WARNING)
   ============================================ */

.rotate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.rotate-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(90deg);
    }
}

.rotate-text {
    font-size: 1.2rem;
    color: #ff3250;
    text-align: center;
    padding: 0 2rem;
}

/* ============================================
   VIDEO END OVERLAY
   ============================================ */

.video-end-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
}

.video-end-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.end-title {
    font-size: 2rem;
    color: #ff3250;
    text-shadow: 0 0 30px rgba(255, 50, 80, 0.8);
    margin-bottom: 1rem;
    animation: endTitleGlow 2s ease-in-out infinite;
}

@keyframes endTitleGlow {

    0%,
    100% {
        text-shadow: 0 0 30px rgba(255, 50, 80, 0.8);
    }

    50% {
        text-shadow: 0 0 50px rgba(255, 50, 80, 1), 0 0 80px rgba(255, 50, 80, 0.5);
    }
}

.end-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
}

.replay-btn {
    padding: 1rem 2rem;
    font-family: inherit;
    font-size: 1.2rem;
    color: #fff;
    background: linear-gradient(135deg, #ff3250, #ff6b7a);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 20px rgba(255, 50, 80, 0.5);
    animation: replayBtnPulse 2s ease-in-out infinite;
}

.replay-btn:hover,
.replay-btn:active {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 50, 80, 0.8);
}

@keyframes replayBtnPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 50, 80, 0.5);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 50, 80, 0.8);
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Small phones */
@media (max-width: 360px) {
    .video-layer {
        top: 17%;
        width: 36%;
        height: 14%;
    }

    .static-layer {
        top: 17%;
        width: 36%;
        height: 14%;
    }

    .lyric-line {
        font-size: 0.8rem;
    }

    .progress-ring {
        width: 80px;
        height: 80px;
    }
}

/* Medium phones */
@media (min-width: 361px) and (max-width: 480px) {
    .video-layer {
        top: 18%;
        width: 38%;
        height: 15%;
    }

    .static-layer {
        top: 18%;
        width: 38%;
        height: 15%;
    }
}

/* Large phones */
@media (min-width: 481px) and (max-width: 600px) {
    .video-layer {
        top: 19%;
        width: 40%;
        height: 17%;
    }

    .static-layer {
        top: 19%;
        width: 40%;
        height: 17%;
    }
}

/* Tablets (portrait) */
@media (min-width: 601px) and (max-width: 900px) {
    .video-layer {
        top: 20%;
        width: 35%;
        height: 18%;
    }

    .static-layer {
        top: 20%;
        width: 35%;
        height: 18%;
    }

    .lyric-line {
        font-size: 1.5rem;
    }
}

/* Landscape orientation handling */
@media (orientation: landscape) and (max-height: 500px) {
    .video-layer {
        top: 15%;
        width: 25%;
        height: 25%;
    }

    .static-layer {
        top: 15%;
        width: 25%;
        height: 25%;
    }

    .physics-layer {
        bottom: 5%;
        left: 35%;
        right: 35%;
        height: 50%;
    }

    .lyrics-layer {
        top: 20%;
        right: 3%;
        width: 25%;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.visible {
    opacity: 1 !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Subtle float for TV area */
@keyframes floatTV {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-3px);
    }
}

.video-layer,
.static-layer {
    animation: floatTV 6s ease-in-out infinite;
}

/* Glow pulse for active elements */
@keyframes glowPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(255, 50, 80, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 50, 80, 0.8));
    }
}

/* ============================================
   ADDITIONAL IMMERSIVE FEATURES
   ============================================ */

/* Parallax effect on tilt (for devices with gyroscope) */
.parallax-layer {
    transition: transform 0.1s ease-out;
}

/* Breathing effect for UI elements */
.breathing {
    animation: breathing 4s ease-in-out infinite;
}

@keyframes breathing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Glitch effect */
.glitch {
    animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }

    20% {
        transform: translate(-2px, 2px);
        filter: hue-rotate(90deg);
    }

    40% {
        transform: translate(2px, -2px);
        filter: hue-rotate(180deg);
    }

    60% {
        transform: translate(-2px, -2px);
        filter: hue-rotate(270deg);
    }

    80% {
        transform: translate(2px, 2px);
        filter: hue-rotate(360deg);
    }

    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

/* Neon flicker */
.neon-flicker {
    animation: neonFlicker 0.15s ease-in-out infinite;
}

@keyframes neonFlicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Heartbeat effect */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.1);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(1);
    }
}

/* Wave effect */
.wave {
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

/* Float up effect */
.float-up {
    animation: floatUp 3s ease-in-out infinite;
}

@keyframes floatUp {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Shimmer effect */
.shimmer {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Pulse ring */
.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid currentColor;
    border-radius: 50%;
    animation: pulseRing 1.5s ease-out infinite;
}

@keyframes pulseRing {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid currentColor;
    white-space: nowrap;
    animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce paint on animations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Contain paint operations */
.contain-paint {
    contain: paint;
}

/* Content visibility for off-screen elements */
.content-visibility-auto {
    content-visibility: auto;
}

/* ============================================
   DEBUG MODE (remove in production)
   ============================================ */

.debug-mode .video-layer {
    border: 2px solid red;
}

.debug-mode .static-layer {
    border: 2px solid blue;
}

.debug-mode .physics-layer {
    border: 2px solid green;
}

.debug-mode .lyrics-layer {
    border: 2px solid yellow;
}