/* RESET & CORE LAYOUT */
html, body {
    margin: 0;
    padding: 0;
    background-color: #000;
    overflow: hidden;
    width: 100%;
    height: 100%; 
    height: 100dvh; 
    font-family: 'Courier New', monospace;
    overscroll-behavior: none; 
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* LOADING SCREEN */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.1s ease-out;
    pointer-events: none;

    color: #F3E5AB; 
    font-family: 'Georgia', serif;
    font-size: 18px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: bold;
    text-shadow: 1px 0 rgba(255,0,0,0.5), -1px 0 rgba(0,0,255,0.5);
}

/* 3D STAGE & LAYERS */
#stage {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    overflow: hidden;
    background: #000;
    perspective: 1000px;
}

#layer-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;

    will-change: transform;
    background: #000;
    transform-style: preserve-3d;
}

.droste-img {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 100%;
    object-fit: cover; 
    object-position: center;

    transform: translate3d(-50%, -50%, 0);
    backface-visibility: hidden;
    pointer-events: none; 

    image-rendering: high-quality;
}

#layer-front { z-index: 2; }
#layer-back { z-index: 1; }

/* UI LAYERS & HINTS */
#ui-layer { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 10; 
    pointer-events: none; 
}

.glitch-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    color: #F3E5AB; 
    font-family: 'Georgia', serif;
    font-size: 18px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
    
    z-index: 100;
    pointer-events: none;
    display: none;
    width: 80%; 
    
    animation: text-seizure 2s infinite;
    text-shadow: 1px 0 rgba(255,0,0,0.5), -1px 0 rgba(0,0,255,0.5);
}

.glitch-hint.active {
    display: block;
}

@keyframes text-seizure {
    0% { transform: translate(-50%, -50%) skew(0deg); opacity: 1; }
    20% { transform: translate(-50.2%, -49.8%) skew(-1deg); opacity: 0.9; }
    40% { transform: translate(-49.8%, -50.2%) skew(1deg); opacity: 1; }
    60% { transform: translate(-50%, -50%) skew(0deg); filter: blur(0.5px); }
    80% { transform: translate(-50.1%, -50%) skew(0.5deg); filter: blur(0px); }
    100% { transform: translate(-50%, -50%) skew(0deg); }
}

/* LOGO STYLES */
.logo {
    position: absolute;
    top: 2%;
    right: 16%;
    width: 40%; 
    min-width: 350px; 
    max-width: 800px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.8));
    transition: width 0.3s ease, right 0.3s ease, transform 0.3s ease; 
    z-index: 20; 
    animation: logo-idle 4s infinite;
    pointer-events: none;
}

/* Glitch Class for Desktop */
.logo-active-glitch {
    animation: logo-hard-glitch 0.1s infinite !important;
}

/* --- MOBILE LOGO FIXES --- */
@media (max-aspect-ratio: 1.2) {
    .logo {
        width: 85%;
        min-width: 0;
        right: auto;
        left: 50%;
        top: 8%;
        transform: translateX(-50%); 
        animation: logo-idle-mobile 4s infinite;
    }

    /* FIX: Use a special mobile glitch that includes translateX(-50%) */
    .logo-active-glitch {
        animation: logo-hard-glitch-mobile 0.1s infinite !important;
    }
}

@keyframes logo-idle {
    0% { transform: skew(0deg); }
    95% { transform: skew(0deg); filter: none; }
    96% { transform: skew(2deg); filter: hue-rotate(90deg); }
    97% { transform: skew(-2deg); }
    100% { transform: skew(0deg); }
}

@keyframes logo-idle-mobile {
    0% { transform: translateX(-50%) skew(0deg); }
    95% { transform: translateX(-50%) skew(0deg); filter: none; }
    96% { transform: translateX(-50%) skew(2deg); filter: hue-rotate(90deg); }
    97% { transform: translateX(-50%) skew(-2deg); }
    100% { transform: translateX(-50%) skew(0deg); }
}

@keyframes logo-hard-glitch {
    0% { transform: translate(2px, 2px) skew(10deg); filter: drop-shadow(-5px 0 red) drop-shadow(5px 0 blue); }
    50% { transform: translate(-2px, -2px) skew(-10deg); filter: drop-shadow(5px 0 red) drop-shadow(-5px 0 blue); }
    100% { transform: translate(0, 0) skew(0deg); }
}

/* FIX: New animation that keeps the logo centered during the glitch */
@keyframes logo-hard-glitch-mobile {
    0% { transform: translateX(-50%) translate(2px, 2px) skew(10deg); filter: drop-shadow(-5px 0 red) drop-shadow(5px 0 blue); }
    50% { transform: translateX(-50%) translate(-2px, -2px) skew(-10deg); filter: drop-shadow(5px 0 red) drop-shadow(-5px 0 blue); }
    100% { transform: translateX(-50%) translate(0, 0) skew(0deg); }
}

/* INTERACTIVE BUTTONS & CTA */
#cta-container { 
    position: absolute; 
    bottom: 0; 
    right: 0; 
    width: 600px; 
    height: 600px; 
    pointer-events: none; 
    z-index: 30; 
}

@media (max-width: 600px) {
    #cta-container { width: 100%; height: 400px; }
}

.man-img { 
    position: absolute; 
    bottom: 0; 
    right: 0; 
    width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
    object-position: bottom right; 
    transform-origin: bottom right; 
    animation: breathe 6s ease-in-out infinite; 
}

@keyframes breathe { 
    0%, 100% { transform: scale(1); filter: brightness(1); } 
    50% { transform: scale(1.03); filter: brightness(1.05); } 
}

.steam-link { 
    position: absolute; 
    bottom: 30px; 
    right: 30px; 
    z-index: 31; 
    pointer-events: auto; 
    cursor: pointer; 
    transition: transform 0.2s ease; 
}

.steam-link:hover { transform: scale(1.05); }
.steam-img { width: 200px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }

@media (max-width: 600px) {
    .steam-link { bottom: 20px; right: 20px; }
    .steam-img { width: 150px; }
}

/* PRESS KIT BUTTON */
.presskit-link {
    position: absolute;
    bottom: 110px; 
    right: 30px;
    z-index: 31;
    
    pointer-events: auto; 

    width: 200px; 
    height: 65px; 
    
    display: flex;
    justify-content: center;
    align-items: center;

    background-color: #5c7e72; 
    border-radius: 8px;       
    box-shadow: 0 4px 10px rgba(0,0,0,0.5); 
    
    color: #F3E5AB;            
    font-family: 'Verdana', sans-serif; 
    font-weight: 900;          
    font-size: 22px;
    text-transform: uppercase;
    text-decoration: none;
    
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.presskit-link:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.presskit-link.active {
    background-color: #F3E5AB;
    color: #5c7e72;
    box-shadow: 0 0 15px rgba(243, 229, 171, 0.4);
}

@media (max-width: 600px) {
    .presskit-link {
        width: 150px;
        height: 50px;
        font-size: 16px;
        bottom: 80px; 
        right: 20px;
    }
}

/* STUDIO LINK */
.studio-link {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    z-index: 31;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.studio-link:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.studio-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6));
}

@media (max-width: 600px) {
    .studio-link {
        width: 60px;
        height: 60px;
        top: auto;   
        bottom: 15px;
        left: 15px;
    }
}

/* SCARE LAYER */
#scare-layer { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 50%; 
    height: 100%; 
    z-index: 5; 
    pointer-events: none; 
    display: flex; 
    align-items: flex-end; 
    justify-content: flex-start; 
}

.scare-img { 
    display: none; 
    max-height: 85vh; 
    width: auto; 
    opacity: 0.85; 
    mix-blend-mode: hard-light; 
    transform-origin: bottom center; 
    margin-left: -2%; 
    margin-bottom: -2%; 
    will-change: transform, opacity; 
}

@media (max-aspect-ratio: 1.0) {
    #scare-layer {
        width: 100%; 
        justify-content: center; 
    }
    .scare-img {
        margin-left: 0;
        max-height: 70vh; 
    }
}

/* DEBUG PANEL */
#debug-panel {
    position: absolute; top: 10px; left: 10px; color: #0f0; background: rgba(0,0,0,0.8);
    padding: 10px; border: 1px solid #0f0; z-index: 100; font-size: 14px;
    pointer-events: none; opacity: 0; transition: opacity 0.3s;
}

/* PRESS KIT OVERLAY */
#pk-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 50; /* Above UI, below Debug */
    display: flex;
    justify-content: flex-start; /* Align left */
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    
    pointer-events: none; 
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

#pk-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.pk-panel {
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    
    pointer-events: auto; 
    
    /* Droste Theme Colors */
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid #F3E5AB;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    border-radius: 12px;
    
    color: #F3E5AB;
    font-family: 'Georgia', serif;
    
    display: flex;
    flex-direction: column;
    position: relative;
    
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.pk-header-bar {
    padding: 20px;
    border-bottom: 1px solid rgba(243, 229, 171, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pk-title {
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 0 rgba(255,0,0,0.3), -2px 0 rgba(0,0,255,0.3);
}

.pk-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: 1px solid rgba(243, 229, 171, 0.3);
    color: #888;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Verdana', sans-serif;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s;
    border-radius: 6px; 
}

.lang-btn:hover { color: #F3E5AB; border-color: #F3E5AB; }
.lang-btn.active {
    background: #F3E5AB;
    color: #000;
}

.pk-close {
    background: none;
    border: none;
    color: #F3E5AB;
    font-size: 24px;
    cursor: pointer;
    margin-left: 10px;
    line-height: 1;
}
.pk-close:hover { color: #fff; text-shadow: 0 0 5px #fff; }

.pk-scroll-area {
    padding: 25px;
    overflow-y: auto;
    
    scrollbar-width: thin;
    scrollbar-color: #5c7e72 #111;
}

.pk-scroll-area::-webkit-scrollbar { width: 8px; }
.pk-scroll-area::-webkit-scrollbar-track { background: #111; }
.pk-scroll-area::-webkit-scrollbar-thumb { background: #5c7e72; border-radius: 4px; }

.pk-section { margin-bottom: 30px; }
.pk-section h3 {
    font-size: 16px;
    color: #5c7e72; /* Steam Green */
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-top: 0;
    letter-spacing: 1px;
}

.pk-text {
    font-size: 14px;
    line-height: 1.6;
    color: #ddd;
}

.pk-list {
    padding-left: 20px;
    margin-top: 10px;
}
.pk-list li {
    color: #ddd;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.pk-fact-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    border-bottom: 1px dashed #333;
    padding-bottom: 4px;
}
.pk-fact-label { color: #888; text-transform: uppercase; }
.pk-fact-val { color: #F3E5AB; text-align: right; }

.pk-btn-row {
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-top: 15px;
}

.pk-dl-btn {
    display: inline-block;
    background: #333;
    color: #F3E5AB;
    text-decoration: none;
    padding: 10px 15px;
    font-size: 12px;
    text-transform: uppercase;
    border: 1px solid #555;
    transition: all 0.2s;
    font-weight: bold;
    border-radius: 6px;
}

.pk-dl-btn:hover {
    background: #5c7e72;
    color: #fff;
    border-color: #fff;
}

/* Mobile Adjustments for Overlay */
@media (max-width: 768px) {
    #pk-overlay { justify-content: center; padding: 20px; }
    .pk-panel { width: 100%; max-height: 85vh; }
}