/* Moon Mission Page Styles - Glassmorphism Design */

/* Background image with WebP support and parallax effect - Progressive Enhancement */
.moon-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Base fallback for all browsers */
    background-image: url("/img/moon.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Progressive enhancement: WebP support via image-set */
@supports (background-image: image-set(url("test.webp") type("image/webp"))) {
    .moon-bg {
        background-image: 
            image-set(
                url("/img/moon.webp") type("image/webp"),
                url("/img/moon.jpg") type("image/jpeg")
            );
    }
}

/* Smooth parallax animation */
.moon-bg {
    animation: moonParallax 50s ease-in-out infinite alternate;
}

@keyframes moonParallax {
    0% {
        background-position: center 0%;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        background-position: center 6%;
        transform: translate3d(0, -2%, 0) scale(1.02);
    }
}

/* Light overlay for readability (reduced from 0.75 to 0.40) */
.moon-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(5, 8, 22, 0.40) 0%,
        rgba(11, 16, 32, 0.40) 50%,
        rgba(0, 0, 0, 0.40) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Keep animated gradients on top of overlay */
.moon-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.15), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(0, 184, 148, 0.12), transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(9, 132, 227, 0.14), transparent 55%);
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: screen;
}

.moon-mission-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.25;
    position: relative;
    z-index: 1;
}

/* Header - Glassmorphism (like Lotto) */
.moon-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: max(8px, env(safe-area-inset-top, 8px)) 10px 10px;
    flex-shrink: 0;
    margin: 8px 8px 6px;
    background: rgba(15, 20, 40, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    /* Glassmorphism: backdrop-filter with webkit prefix for iOS/Telegram */
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    z-index: 10;
}

.moon-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    max-width: calc(100% - 150px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Text shadow for readability on background */
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 8px rgba(108, 92, 231, 0.3);
}

/* Back Home Button - Glassmorphism (exactly like Lotto) */
.btn-back-home {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    /* Glassmorphism: backdrop-filter with webkit prefix */
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.btn-back-home:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(-2px);
}

.btn-back-home i {
    font-size: 12px;
}

/* Hero Section - Transparent, no black card */
.hero-section {
    position: relative;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 8px 16px 4px;
    flex-shrink: 0;
    /* No background, no border, transparent */
    background: transparent;
    border: none;
    border-radius: 0;
}

.hero-overlay {
    display: none; /* Disabled - no overlay needed */
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0;
    text-align: center;
}

/* Smaller title (20-30% reduction) */
.hero-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.01em;
    text-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.7),
        0 0 16px rgba(108, 92, 231, 0.4);
}

/* Main Content - Scroll starts higher */
.app-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px 16px;
    min-height: 0;
    gap: 12px;
    display: flex;
    flex-direction: column;
}

/* ============================================
   CLEAN COUNTDOWN DISPLAY
   ============================================ */
.countdown-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 16px;
    flex-shrink: 0;
}

.countdown-display .countdown-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    text-shadow: 
        0 0 20px rgba(108, 92, 231, 0.7),
        0 0 40px rgba(108, 92, 231, 0.3);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    text-align: center;
}

.countdown-sep {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent);
    opacity: 0.5;
    margin: 0 2px;
}

.mission-started {
    text-align: center;
    padding: 16px;
    margin: 0 8px;
    background: rgba(0, 184, 148, 0.2);
    border: 1px solid var(--success);
    border-radius: 12px;
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
}

.mission-started i {
    margin-right: 8px;
    font-size: 16px;
}

/* ============================================
   TERMINAL LORE BLOCK
   ============================================ */
.terminal-block {
    background: rgba(10, 14, 28, 0.85);
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 
        0 0 20px rgba(108, 92, 231, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(108, 92, 231, 0.15);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: #ff5f56;
    box-shadow: 0 0 4px rgba(255, 95, 86, 0.5);
}

.terminal-dot.yellow {
    background: #ffbd2e;
    box-shadow: 0 0 4px rgba(255, 189, 46, 0.5);
}

.terminal-dot.green {
    background: #27c93f;
    box-shadow: 0 0 4px rgba(39, 201, 63, 0.5);
}

.terminal-title {
    margin-left: auto;
    font-size: 10px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
}

.terminal-body {
    padding: 16px;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.terminal-text {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #a8e6cf;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-cursor {
    display: inline-block;
    color: var(--accent);
    animation: cursorBlink 0.8s infinite;
    font-weight: 400;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.terminal-skip {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    border-top: 1px solid rgba(108, 92, 231, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.btn-skip {
    background: transparent;
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-skip:hover {
    background: rgba(108, 92, 231, 0.15);
    border-color: var(--accent);
    color: var(--text);
}

.btn-skip.hidden {
    display: none;
}

/* ============================================
   CTA BUTTON SECTION
   ============================================ */
.cta-section {
    padding: 8px 0 16px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.4s ease;
}

.btn-coming-soon {
    padding: 14px 32px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3) 0%, rgba(108, 92, 231, 0.15) 100%);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 
        0 0 20px rgba(108, 92, 231, 0.2),
        0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.btn-coming-soon i {
    font-size: 16px;
    opacity: 0.8;
}

.btn-coming-soon:disabled {
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .hero-title {
        font-size: 18px;
    }
    
    .countdown-display .countdown-value {
        font-size: 24px;
    }
    
    .countdown-sep {
        font-size: 20px;
    }
    
    .terminal-body {
        padding: 12px;
        max-height: 40vh;
    }
    
    .terminal-text {
        font-size: 11px;
        line-height: 1.5;
    }
    
    .moon-header {
        padding: max(8px, env(safe-area-inset-top, 8px)) 8px 8px;
    }
    
    .app-main {
        padding: 0 8px 12px;
    }
}

@media (max-width: 360px) {
    .countdown-display .countdown-value {
        font-size: 20px;
    }
    
    .countdown-sep {
        font-size: 16px;
    }
    
    .terminal-text {
        font-size: 10px;
    }
}

/* ============================================
   START MISSION BUTTON
   ============================================ */
.btn-start-mission {
    padding: 14px 32px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.5) 0%, rgba(138, 122, 255, 0.3) 100%);
    border: 1px solid rgba(108, 92, 231, 0.6);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 
        0 0 25px rgba(108, 92, 231, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.btn-start-mission:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.65) 0%, rgba(138, 122, 255, 0.45) 100%);
    box-shadow: 
        0 0 35px rgba(108, 92, 231, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.35);
    transform: translateY(-2px);
}

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

.btn-start-mission i {
    font-size: 16px;
}

.btn-start-mission.disabled {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.3) 0%, rgba(108, 92, 231, 0.15) 100%);
    border-color: rgba(108, 92, 231, 0.4);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-start-mission.disabled:hover {
    transform: none;
    box-shadow: 
        0 0 20px rgba(108, 92, 231, 0.2),
        0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Replay link */
.replay-link {
    margin-top: 12px;
    text-align: center;
}

.replay-link a {
    color: var(--text-muted);
    font-size: 11px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    opacity: 0.7;
}

.replay-link a:hover {
    color: var(--accent);
    opacity: 1;
}

.replay-link a i {
    font-size: 10px;
}

/* CTA section update for flex column */
.cta-section {
    flex-direction: column;
    align-items: center;
}

/* ============================================
   VIDEO OVERLAY MODAL
   ============================================ */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none; /* Hidden by default, shown via .is-open */
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-overlay.is-open {
    display: flex;
    animation: videoFadeIn 0.3s ease;
}

/* Animated background - moon image */
.video-overlay-bg {
    position: absolute;
    inset: 0;
    background: url('/img/moon.webp') center/cover no-repeat;
    transform: scale(1.12);
    z-index: 0;
    pointer-events: none;
    animation: videoBgFloat 22s infinite alternate ease-in-out;
}

/* Fallback for browsers without WebP */
@supports not (background-image: url('/img/moon.webp')) {
    .video-overlay-bg {
        background-image: url('/img/moon.jpg');
    }
}

/* Dark overlay on top of background */
.video-overlay-dark {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(5, 8, 22, 0.55) 0%,
        rgba(11, 16, 32, 0.60) 50%,
        rgba(0, 0, 0, 0.65) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Animated glow accents */
.video-overlay-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.25), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(0, 184, 148, 0.20), transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(9, 132, 227, 0.22), transparent 55%);
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: screen;
}

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

@keyframes videoBgFloat {
    0% { transform: scale(1.12) translate3d(0, 0, 0); }
    50% { transform: scale(1.14) translate3d(-8px, -10px, 0); }
    100% { transform: scale(1.13) translate3d(6px, 8px, 0); }
}

/* Video content container - transparent, centered */
.video-overlay-content {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
    background: transparent;
}

/* Controls above video */
.video-controls-top {
    position: absolute;
    top: max(16px, env(safe-area-inset-top, 16px));
    right: 16px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.video-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.video-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
}

.video-btn-close {
    background: rgba(255, 95, 86, 0.35);
    border-color: rgba(255, 95, 86, 0.55);
}

.video-btn-close:hover {
    background: rgba(255, 95, 86, 0.55);
    border-color: rgba(255, 95, 86, 0.75);
}

/* Video element - cinematic centered screen, transparent background */
#intro-video {
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 78vh;
    object-fit: contain;
    background: transparent;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .video-overlay-content {
        padding: 16px;
    }
    
    .video-controls-top {
        top: max(12px, env(safe-area-inset-top, 12px));
        right: 12px;
        gap: 8px;
    }
    
    .video-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    #intro-video {
        max-width: 96vw;
        max-height: 70vh;
        border-radius: 12px;
    }
}
