/* Font Logic */
@font-face {
    font-family: 'PixelFont';
    src: url('assets/FONT.ttf') format('truetype');
}

/* --- Theming Variables (Resurrect 64 Palette) --- */
:root {
    /* Base Variables */
    --bg-overlay: rgba(46, 34, 47, 0.8);
    /* #2e222f Dark Purple/Black */
    --text-main: #c7dcd0;
    /* #c7dcd0 Light Greenish White */
    --primary: #30e1b9;
    /* Default Safe Cyan */
    --secondary: #1ebc73;
    /* Default Safe Green */
    --accent: #f9c22b;
    /* Yellow */
    --border: #165a4c;
    /* Dark Green */
    --shadow: rgba(48, 225, 185, 0.3);
    --sanity-bar-bg: #2e222f;
    /* Dark Base */
    --sanity-bar-fill: #30e1b9;
    /* Cyan fill default */
    --filter-bg: grayscale(100%) sepia(50%) hue-rotate(180deg);
}

/* STATE 1: SAFE (0-20%) - Cyan/Green */
body.state-safe {
    --primary: #30e1b9;
    /* #30e1b9 */
    --secondary: #1ebc73;
    /* #1ebc73 */
    --border: #165a4c;
    /* #165a4c */
    --filter-bg: grayscale(100%) sepia(50%) hue-rotate(90deg);
    --sanity-bar-fill: #30e1b9;
}

/* STATE 2: WARNING (20-90%) - Orange/Yellow */
body.state-warning {
    --bg-overlay: rgba(76, 62, 36, 0.8);
    /* #4c3e24 Brownish */
    --text-main: #fbff86;
    /* #fbff86 Pale Yellow */
    --primary: #f79617;
    /* #f79617 Orange */
    --secondary: #f9c22b;
    /* #f9c22b Gold */
    --border: #e6904e;
    /* #e6904e Light Brown */
    --shadow: rgba(247, 150, 23, 0.4);
    --sanity-bar-bg: #4c3e24;
    --sanity-bar-fill: #f79617;
    --filter-bg: grayscale(100%) sepia(80%) hue-rotate(320deg);
}

/* STATE 3: CRITICAL (90-100%) - Red/Crimson */
body.state-critical {
    --bg-overlay: rgba(69, 41, 63, 0.8);
    /* #45293f Dark Red/Purple */
    --text-main: #fca790;
    /* #fca790 Pale Red */
    --primary: #e83b3b;
    /* #e83b3b Red */
    --secondary: #ae2334;
    /* #ae2334 Crimson */
    --border: #753c54;
    /* #753c54 Dark Red */
    --shadow: rgba(232, 59, 59, 0.6);
    --sanity-bar-bg: #45293f;
    --sanity-bar-fill: #e83b3b;
    --filter-bg: grayscale(100%) sepia(100%) hue-rotate(0deg) saturate(300%);
}

/* --- Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: color 0.5s, background-color 0.5s, border-color 0.5s, box-shadow 0.5s;
}

body {
    background-color: #2e222f;
    /* Palette Black */
    color: var(--text-main);
    font-family: 'PixelFont', monospace;
    text-transform: uppercase;
    text-align: center;
    overflow-x: hidden;
}

/* --- Fixed Layers --- */

/* 1. Background (Behind everything) */
#fixed-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('assets/background2.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0.6;
    filter: var(--filter-bg);
    transition: filter 1s ease;
}

/* Removed manual body.drift-active #fixed-bg, handled by variable now */

/* 2. Frame (On top of everything, pass clicks through) */
#fixed-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('assets/Frame2.png');
    /* Or Menu_frame.png */
    background-size: 100% 100%;
    z-index: 999;
    pointer-events: none;
    /* Let clicks pass through */
}

/* --- UI Components --- */

/* Toggle Switch */
#drift-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(46, 34, 47, 0.9);
    /* Palette Dark */
    padding: 10px 20px;
    border: 4px solid var(--primary);
    /* Thicker border */
    /* border-radius removed for pixelated look */
    cursor: pointer;
}

#drift-status {
    font-size: 1rem;
    color: var(--primary);
    font-weight: bold;
}

/* System Integrity Badge */
#system-integrity {
    position: fixed;
    top: 10px;
    /* Even closer to top */
    right: 15px;
    /* Even closer to right */
    left: auto;
    /* Reset Left */
    z-index: 2000;
    background: transparent;
    /* No Frame */
    padding: 0;
    border: none;
    /* No Frame */
    font-size: 1.5rem;
    /* Even smaller */
    letter-spacing: 2px;
    font-weight: bold;
    text-shadow: 4px 4px 0px #2e222f;
    /* Palette Shadow */
}

/* --- UI Layers (Bar/Pointer) --- */
/* --- UI Layers (Bar/Pointer) --- */
/* Layer Order:
   1. Fill (Behind frame) -> z-index 1500
   2. Bar Frame (New_bar.png) -> z-index 1501
   3. Pointer (New_bar_pointer.png) -> z-index 1502
*/

#ui-layer-fill {
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    /* We have to guess the fill area since we don't have coords. 
       Assuming it's a bar at the bottom. */
    width: 60%;
    /* Guess */
    height: 40px;
    /* Guess */
    background-color: var(--sanity-bar-fill);
    z-index: 1500;
    transition: width 0.1s linear, background-color 0.5s;
    box-shadow: 0 0 20px var(--secondary);
    /* Glow */
}

#ui-layer-bar,
#ui-layer-pointer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Force stretch if user wants it "in place" and it's a HUD overlay */
    background-size: 100% 100%;
    background-position: center bottom;
    background-repeat: no-repeat;
    pointer-events: none;
}

#ui-layer-bar {
    background-image: url('assets/New_bar.png');
    z-index: 1501;
}

#ui-layer-pointer {
    background-image: url('assets/New_bar_pointer.png');
    z-index: 1502;
    transition: transform 0.1s linear;
}

/* --- Layout --- */
#promo-container {
    padding-top: 50px;
    /* Increased from 0px */
    padding-bottom: 250px;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

section {
    padding: 40px 40px;
    margin: 120px 0;
    /* Unified large gap for all sections */
}

/* Specific Gap Override for Hero (Restored) */
#hero {
    margin-top: 50px;
    /* Gap above logo */
    margin-bottom: 200px;
    /* Huge gap below logo (to first section) */
}

/* Critical Section (Bottom) - Override Removed to match uniform spacing */

/* --- Typography --- */
h1,
h2,
h3 {
    color: var(--primary);
    margin-bottom: 40px;
    text-shadow: 6px 6px 0px #2e222f;
    /* Palette Shadow */
    line-height: 1.4;
}

h2 {
    font-size: 6rem;
    margin-top: 0;
}

body.state-critical h2 {
    animation: glitch 0.5s infinite;
    /* Faster glitch */
}

@keyframes glitch {
    0% {
        transform: skewX(0deg);
    }

    2% {
        transform: skewX(-10deg);
        filter: blur(2px);
    }

    4% {
        transform: skewX(10deg);
    }

    6% {
        transform: skewX(0deg);
    }

    100% {
        transform: skewX(0deg);
    }
}

/* HUGE Title */
/* HUGE Title */
h3 {
    font-size: 3.5rem;
    /* Removed dashed border as requested */
    display: inline-block;
    padding-bottom: 10px;
}

p {
    font-size: 2.2rem;
    line-height: 1.0;
    /* Reduced from 1.2 */
    /* Reduced from 1.6 */
    margin-bottom: 30px;
    color: var(--text-main);
    background: rgba(46, 34, 47, 0.95);
    /* Palette Dark */
    padding: 30px;
    /* Slightly tighter padding */
    border: 4px solid var(--border);
    /* Thicker */
    box-shadow: 10px 10px 0px var(--shadow);
    /* border-radius removed */
}

.highlight {
    color: var(--secondary);
    text-decoration: none;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
    padding: 0 10px;
    /* border-radius removed */
}

/* --- New Asset Displays --- */
.asset-display-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    background: rgba(46, 34, 47, 0.6);
    /* Palette Dark */
    padding: 20px;
    /* border-radius removed */
    border: 4px solid var(--border);
    /* Thicker */
}

.asset-gif,
.asset-png {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(8px 8px 0px #2e222f);
    /* Palette Shadow */
}

.grey-tint {
    filter: grayscale(100%) brightness(0.8) drop-shadow(8px 8px 0px #2e222f);
    /* Maybe a slight tint of the palette grey? */
    /* Resurrect 64 Grey: #9babb2 */
}

/* --- CTA --- */
#enter-btn {
    background: var(--primary);
    border: 4px solid var(--text-main);
    /* Explicit border width */
    color: #ffffff;
    /* White Text */
    /* Palette Dark Text was #2e222f */
    box-shadow: 0px 10px 0px var(--border);
    font-family: 'PixelFont';
    font-size: 3rem;
    /* Huge Button */
    padding: 30px 60px;
    cursor: pointer;
    text-shadow: none;
    font-weight: bold;
    /* border-radius removed */
}

#enter-btn:hover {
    background: var(--secondary);
    box-shadow: 0px 6px 0px var(--border);
    transform: translateY(4px);
}

#enter-btn:active {
    transform: translateY(10px);
    box-shadow: none;
}

/* --- Logo Pulse --- */
.logo-pulse {
    width: 80%;
    max-width: 600px;
    animation: pulse 3s infinite ease-in-out;
    image-rendering: pixelated;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}