/* ============================================================================
   HOMEPAGE — Full-screen animated landing scene
   ============================================================================ */

#screen-container:has(.hp-scene) {
    padding: 0;
    background: #0c0a08;
    overflow: hidden;
}

.hp-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    image-rendering: pixelated;
}

/* --- Sky --- */
.hp-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%;
    transition: background 60s linear;
}

/* --- Stars --- */
.hp-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    transition: opacity 8s ease;
}

.hp-star {
    position: absolute;
    background: #f0e4d0;
    image-rendering: pixelated;
}

@keyframes hp-twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* --- Celestial --- */
.hp-celestial {
    position: absolute;
    transition: top 120s linear, left 120s linear;
    image-rendering: pixelated;
}

@keyframes hp-sun-pulse {
    0%, 100% { filter: brightness(1.0); transform: scale(1); }
    50% { filter: brightness(1.15); transform: scale(1.06); }
}

@keyframes hp-moon-pulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

/* --- Clouds --- */
.hp-cloud {
    position: absolute;
    image-rendering: pixelated;
}

@keyframes hp-cloud-drift-1 {
    from { transform: translateX(0); }
    to { transform: translateX(140vw); }
}

@keyframes hp-cloud-drift-2 {
    from { transform: translateX(0); }
    to { transform: translateX(130vw); }
}

@keyframes hp-cloud-drift-3 {
    from { transform: translateX(0); }
    to { transform: translateX(150vw); }
}

/* --- Ground surface --- */
.hp-ground-surface {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 58%;
    pointer-events: none;
    z-index: 0;
}

/* --- World container --- */
.hp-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* --- Grass sway --- */
@keyframes hp-grass-sway {
    0% { transform: skewX(-1.5deg); }
    100% { transform: skewX(1.5deg); }
}

/* --- Plants --- */
.hp-plant {
    position: absolute;
    image-rendering: pixelated;
    display: block;
    pointer-events: none;
}

/* --- Judges --- */
.hp-judge {
    image-rendering: pixelated;
    pointer-events: none;
}

/* --- Title wrapper: dead center of viewport --- */
.hp-title-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 50;
    padding-bottom: 8%;
}

/* --- Title backdrop gradient --- */
.hp-title-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 90% 60% at 50% 42%,
        rgba(4, 3, 2, 0.72) 0%,
        rgba(4, 3, 2, 0.50) 25%,
        rgba(4, 3, 2, 0.28) 45%,
        rgba(4, 3, 2, 0.10) 65%,
        transparent 85%
    );
    pointer-events: none;
    z-index: -1;
}

/* --- Title block: stacked words, touching --- */
.hp-title-block {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: scale(0.7) translateY(16px);
    image-rendering: auto;
}

.hp-title-block.hp-title-in {
    opacity: 1;
    transform: scale(1) translateY(0);
    transition: opacity 1s ease-out, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hp-title-breathe {
    0%, 100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 20px rgba(200,160,64,0.3)); }
    50% { transform: scale(1.03); filter: brightness(1.08) drop-shadow(0 0 35px rgba(200,160,64,0.5)); }
}

.hp-title-block.hp-title-pulse {
    animation: hp-title-breathe 4s ease-in-out infinite;
}

.hp-title-word {
    font-family: 'Press Start 2P', monospace;
    color: #c8a040;
    text-align: center;
    letter-spacing: 3px;
    text-shadow:
        0 0 24px rgba(200, 160, 64, 0.65),
        0 0 48px rgba(200, 160, 64, 0.30),
        0 4px 0 #4a3010,
        0 5px 0 #3a2008,
        0 6px 10px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

.hp-title-ferns {
    font-size: clamp(36px, 8vw, 80px);
    line-height: 1.0;
}

.hp-title-with-friends {
    font-size: clamp(16px, 3.8vw, 38px);
    line-height: 1.0;
    margin-top: -2px;
    color: #b89038;
}

/* --- Splash text (Minecraft-style) --- */
.hp-splash {
    position: absolute;
    right: 4%;
    top: 34%;
    max-width: 22vw;
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(8px, 1.4vw, 13px);
    color: #ffe040;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.6;
    transform: rotate(-18deg) scale(0);
    transform-origin: center center;
    opacity: 0;
    text-shadow:
        0 2px 0 #806020,
        0 0 12px rgba(255, 224, 64, 0.4);
    pointer-events: none;
    image-rendering: auto;
    z-index: 2;
}

.hp-splash.hp-splash-in {
    opacity: 1;
    transform: rotate(-18deg) scale(1);
    transition: opacity 0.5s ease-out, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: hp-splash-pulse 1.5s ease-in-out 0.6s infinite;
}

@keyframes hp-splash-pulse {
    0%, 100% { transform: rotate(-18deg) scale(1); }
    50% { transform: rotate(-18deg) scale(1.12); }
}

/* --- Tagline --- */
.hp-tagline {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(7px, 1.4vw, 12px);
    color: #c8b090;
    text-align: center;
    margin-top: 16px;
    opacity: 0;
    letter-spacing: 3px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    image-rendering: auto;
}

.hp-tagline.hp-tagline-in {
    opacity: 1;
    transition: opacity 1.2s ease-out 0.4s;
}

/* --- Accent line --- */
.hp-accent-line {
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #c8a040 30%, #c8a040 70%, transparent);
    margin-top: 14px;
    opacity: 0;
    image-rendering: auto;
    box-shadow: 0 0 10px rgba(200, 160, 64, 0.5);
}

.hp-accent-line.hp-accent-in {
    width: clamp(140px, 45vw, 380px);
    opacity: 1;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s, opacity 0.8s ease-out 0.2s;
}

/* --- Play button --- */
.hp-play-wrap {
    pointer-events: auto;
    margin-top: 28px;
    opacity: 0;
    transform: translateY(14px);
}

.hp-play-wrap.hp-play-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease-out 0.6s, transform 0.8s ease-out 0.6s;
}

.hp-play-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(14px, 3vw, 22px);
    color: #f0e4d0;
    background: linear-gradient(180deg, #68a858, #4a8838);
    border: 3px solid #98d870;
    border-bottom-color: #3a6830;
    border-right-color: #3a6830;
    padding: 16px 52px;
    cursor: pointer;
    text-shadow: 0 2px 0 #2a5020;
    box-shadow:
        0 4px 0 #2a5020,
        0 6px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
    outline: none;
    transition: transform 0.1s, box-shadow 0.1s;
    image-rendering: auto;
}

.hp-play-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #2a5020,
        0 8px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: linear-gradient(180deg, #78b868, #5a9848);
}

.hp-play-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 #2a5020,
        0 3px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes hp-btn-glow {
    0%, 100% { box-shadow: 0 4px 0 #2a5020, 0 6px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15), 0 0 20px rgba(104,168,88,0); }
    50% { box-shadow: 0 4px 0 #2a5020, 0 6px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15), 0 0 40px rgba(104,168,88,0.35); }
}

.hp-play-btn.hp-btn-pulse {
    animation: hp-btn-glow 3s ease-in-out infinite;
}

/* --- Scanlines --- */
.hp-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.03) 3px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 55;
}

/* --- Vignette --- */
.hp-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
    z-index: 54;
}

/* --- Mobile portrait --- */
@media (max-width: 600px) {
    .hp-title-ferns {
        letter-spacing: 2px;
    }

    .hp-title-with-friends {
        letter-spacing: 1px;
    }

    .hp-play-btn {
        padding: 14px 36px;
    }

    .hp-ground-surface {
        height: 55%;
    }

    .hp-splash {
        right: 2%;
        top: 28%;
        max-width: 30vw;
        font-size: clamp(6px, 2vw, 9px);
    }

    .hp-title-backdrop {
        background: radial-gradient(
            ellipse 100% 55% at 50% 45%,
            rgba(4, 3, 2, 0.75) 0%,
            rgba(4, 3, 2, 0.45) 30%,
            rgba(4, 3, 2, 0.15) 55%,
            transparent 80%
        );
    }
}

/* --- Landscape / short viewport --- */
@media (max-height: 500px) {
    .hp-title-wrap {
        padding-bottom: 2%;
    }

    .hp-play-wrap {
        margin-top: 12px;
    }

    .hp-tagline {
        margin-top: 8px;
    }

    .hp-title-ferns {
        font-size: clamp(24px, 6vw, 44px);
    }

    .hp-title-with-friends {
        font-size: clamp(12px, 3vw, 24px);
    }
}
