/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Preloader */
#preloader {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0a0a0a;
    z-index: 1000;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.loading-text {
    margin-top: 20px;
    font-size: 14px;
    opacity: 0.6;
}

/* Experience Container */
#experience {
    background: #000;
}

/* Video Layer - Background, always visible */
#video-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #000;
    overflow: hidden;
}

#video-player,
#video-player-b {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Chromeless - no native controls */
}

#video-player-b {
    opacity: 0;
}

/* Video crossfade transition */
.video-crossfade {
    transition: opacity 0.5s ease;
}

/* Rive Layer - Transparent overlay on top of video */
#rive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through by default */
    overflow: hidden;
}

#rive-layer.interactive {
    pointer-events: auto; /* Enable when Rive has interactive elements */
}

#rive-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* CRITICAL: Video shows through */
}

/* Rive layer transitions */
#rive-layer.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

#rive-layer.fade-in {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Legacy: Keep for backward compatibility */
#media-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#video-player.active {
    display: block;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Progress Bar */
#progress-bar {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.progress-dots {
    display: flex;
    gap: 10px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.progress-dot.active {
    background: #fff;
    transform: scale(1.2);
}

.progress-dot.completed {
    background: rgba(255, 255, 255, 0.5);
}

/* Continue Prompt */
#continue-prompt {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Skip Button */
#skip-button {
    position: absolute;
    bottom: 40px;
    right: 40px;
    padding: 10px 24px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

#skip-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

#skip-button:active {
    transform: scale(0.98);
}

/* Transitions */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Responsive */
@media (max-width: 768px) {
    #skip-button {
        bottom: 20px;
        right: 20px;
        padding: 8px 16px;
        font-size: 12px;
    }

    #continue-prompt {
        bottom: 80px;
        font-size: 12px;
    }

    #progress-bar {
        bottom: 20px;
    }

    .progress-dot {
        width: 6px;
        height: 6px;
    }
}

/* Touch Device Improvements */
@media (hover: none) {
    #skip-button:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ==================== Debug Bar ==================== */
#debug-bar {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 11px;
    color: #fff;
    z-index: 9999;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

#debug-bar.hidden {
    display: none !important;
}

.debug-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.debug-row:last-child {
    margin-bottom: 0;
}

.debug-label {
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.debug-value {
    color: #0ff;
    font-weight: 500;
}

.debug-separator {
    color: rgba(255, 255, 255, 0.2);
}

/* State colors */
#debug-state[data-state="idle"] { color: #888; }
#debug-state[data-state="loading"] { color: #ff0; }
#debug-state[data-state="cutscene"] { color: #0f0; }
#debug-state[data-state="transitioning"] { color: #f80; }
#debug-state[data-state="rive"] { color: #0ff; }
#debug-state[data-state="complete"] { color: #f0f; }

/* Video status */
#debug-video-status[data-playing="true"] {
    color: #0f0;
}

#debug-video-status[data-playing="false"] {
    color: #f80;
}

/* Video progress bar */
#debug-video-progress {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-left: 8px;
    position: relative;
    overflow: visible;
}

#debug-video-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ff, #0f0);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

#debug-video-pause-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #f00;
    border-radius: 1px;
    display: none;
}

#debug-video-pause-marker.visible {
    display: block;
}
