/* Global hidden class */
.hidden {
    display: none !important;
}

/* ===== 909 DAY RUNNER - IEST ARCADE STYLING ===== */
/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Roboto', 'Arial', sans-serif;
    background: #1a1a1a;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    --iest-display-font: Impact, "Arial Black", "Helvetica Neue", Arial, sans-serif;
    --iest-ui-font: "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

/* ===== CANVAS ===== */
#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* ===== SCREEN CONTAINERS ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 10, 0.95);
    /* Darker industrial BG */
    z-index: 100;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
    background: #0a0a0a;
}

.loader {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(15, 168, 176, 0.2);
    border-top: 8px solid #0fa8b0;
    /* IEST teal */
    border-radius: 0;
    /* Square for industrial look */
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(15, 168, 176, 0.5);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 30px;
    font-size: 1.5rem;
    color: #0fa8b0;
    font-family: var(--iest-ui-font);
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(15, 168, 176, 0.5);
}

/* ===== START SCREEN ===== */
#start-screen {
    position: relative;
    background: transparent;
}

/* Full-screen background image layer */
#start-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Static Background */
    background-image: url('assets/images/homepage/background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 0;
}

/* Animation Removed */

/* Ensure content is above background */
#start-screen>* {
    position: relative;
    z-index: 1;
}

.title-container {
    text-align: center;
    margin-bottom: 50px;
    border: 4px solid #0fa8b0;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 30px rgba(15, 168, 176, 0.2);
    transform: skew(-10deg);
    /* Industrial skew */
}

.game-title {
    font-family: var(--iest-display-font);
    font-size: 5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 4px 4px 0px #000, 0 0 20px rgba(15, 168, 176, 0.45);
    letter-spacing: 2px;
    margin-bottom: 0px;
    text-transform: uppercase;
    transform: skew(10deg);
    /* Un-skew text */
}

.game-subtitle {
    font-family: var(--iest-ui-font);
    font-size: 1.8rem;
    color: #0fa8b0;
    letter-spacing: 5px;
    text-transform: uppercase;
    transform: skew(10deg);
    text-shadow: 3px 3px 0 #000;
}

/* ===== INSTRUCTIONS ===== */
.instructions {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    padding: 30px;
    border-radius: 0;
    /* Sharp corners */
    margin-bottom: 40px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.instruction-title {
    font-family: var(--iest-ui-font);
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
    text-shadow: 0 0 12px rgba(15, 168, 176, 0.55);
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    background: #333;
    border: 2px solid #777;
    padding: 8px 15px;
    border-radius: 2px;
    font-family: var(--iest-ui-font);
    color: #fff;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 4px 0 #111;
}

.action {
    color: #aaa;
    font-family: var(--iest-ui-font);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.mobile-note {
    text-align: center;
    color: #666;
    font-family: var(--iest-ui-font);
    font-size: 0.8rem;
    margin-top: 15px;
    text-transform: uppercase;
}

/* ===== BUTTONS ===== */
.neon-btn {
    background: #0fa8b0;
    border: none;
    color: #000;
    padding: 15px 50px;
    font-size: 1.5rem;
    font-family: var(--iest-ui-font);
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 10px;
    border-radius: 0;
    transform: skew(-10deg);
    box-shadow: 5px 5px 0px #333;
}

.neon-btn:hover {
    background: #19c3cc;
    transform: skew(-10deg) translate(-2px, -2px);
    box-shadow: 7px 7px 0px #333;
}

.neon-btn:active {
    transform: skew(-10deg) translate(2px, 2px);
    box-shadow: 2px 2px 0px #333;
}

.neon-btn.secondary {
    background: #444;
    color: #fff;
    box-shadow: 5px 5px 0px #111;
}

.neon-btn.secondary:hover {
    background: #555;
    box-shadow: 7px 7px 0px #111;
}

/* ===== GAME HUD ===== */
#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    pointer-events: none;
}

#game-hud.hidden {
    display: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
    border-top: 4px solid #0fa8b0;
    /* IEST teal */
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #555;
    padding: 10px 20px;
    border-radius: 0;
    min-width: 140px;
    transform: skew(-10deg);
}

.hud-label {
    font-family: var(--iest-ui-font);
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-transform: uppercase;
    transform: skew(10deg);
}

.hud-value {
    font-family: var(--iest-display-font);
    font-size: 2rem;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    transform: skew(10deg);
}

.hud-bottom {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.shield-indicator,
.boost-indicator {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid;
    padding: 10px 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--iest-ui-font);
    text-transform: uppercase;
    transform: skew(-10deg);
}

.shield-indicator {
    border-color: #0fa8b0;
    color: #0fa8b0;
    box-shadow: 0 0 10px rgba(15, 168, 176, 0.3);
}

.boost-indicator {
    border-color: #0fa8b0;
    color: #0fa8b0;
    box-shadow: 0 0 10px rgba(15, 168, 176, 0.3);
}

/* ===== GAME OVER SCREEN ===== */
#gameover-screen {
    position: relative;
    background: transparent;
}

/* Full-screen background image layer */
#gameover-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Static Background */
    background-image: url('assets/images/homepage/background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 0;
}

/* Ensure content is above background */
#gameover-screen>* {
    position: relative;
    z-index: 1;
}

.gameover-title {
    font-family: var(--iest-display-font);
    font-size: 4.5rem;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 4px 4px 0 #000;
    letter-spacing: 0px;
    margin-bottom: 30px;
    text-transform: uppercase;
    border: 4px solid #ff3333;
    padding: 10px 30px;
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(-2deg);
}

.score-container {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    padding: 40px;
    border-radius: 0;
    margin-bottom: 40px;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
}

.score-label {
    font-family: var(--iest-ui-font);
    font-size: 1rem;
    color: #888;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.score-value {
    font-family: var(--iest-display-font);
    font-size: 3.5rem;
    color: #fff;
}

.new-record {
    margin-top: 20px;
    padding: 10px 30px;
    background: #0fa8b0;
    border: none;
    border-radius: 0;
    transform: skew(-10deg);
}

.record-text {
    font-family: var(--iest-ui-font);
    font-size: 1.2rem;
    color: #000;
    letter-spacing: 1px;
    text-transform: uppercase;
    transform: skew(10deg);
}

/* ===== CRASH MESSAGE ===== */
.crash-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    border: 4px solid #ff3333;
    padding: 40px;
    z-index: 300;
    transform: translate(-50%, -50%) skew(-5deg);
    box-shadow: 20px 20px 0 rgba(0, 0, 0, 0.5);
}

.crash-message.hidden {
    display: none;
}

.crash-text {
    font-family: var(--iest-display-font);
    font-size: 5rem;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 4px 4px 0 #000;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ===== POWER-UP MESSAGE & TIMER ===== */
.powerup-message {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) skew(-10deg);
    background: #0fa8b0;
    border: 4px solid #fff;
    padding: 10px 40px;
    border-radius: 0;
    font-family: var(--iest-ui-font);
    font-size: 2rem;
    color: #000;
    z-index: 200;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

.powerup-timer {
    display: none !important;
    /* User requested removal */
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ffcc00;
    border-radius: 0;
    transform: skew(-10deg);
}

.timer-bar-container {
    background: #333;
    border: 1px solid #555;
    border-radius: 0;
}

.timer-bar {
    border-radius: 0;
}

.timer-seconds {
    font-family: var(--iest-ui-font);
    color: #0fa8b0;
}

/* ===== FULL SCREEN BACKGROUND FIX ===== */
#start-screen,
#gameover-screen {
    /* Ensure full screen coverage */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    #start-screen {
        justify-content: flex-start;
        padding: 8vh 0 24px;
        overflow-y: auto;
    }

    .title-container {
        width: min(92vw, 560px);
        margin-bottom: 28px;
        padding: 18px 18px;
        border-width: 3px;
    }

    .game-title {
        font-size: clamp(2.35rem, 12vw, 3.5rem);
        line-height: 0.95;
        letter-spacing: 1px;
    }

    .game-subtitle {
        font-size: clamp(1rem, 4.8vw, 1.35rem);
        letter-spacing: 3px;
        margin-top: 10px;
    }

    .instructions {
        width: min(92vw, 560px);
        padding: 22px 18px;
        margin-bottom: 28px;
    }

    .instruction-title {
        font-size: clamp(1.15rem, 5.7vw, 1.6rem);
        line-height: 1.18;
        letter-spacing: 0.5px;
    }

    .control-grid {
        gap: 12px;
    }

    .key {
        min-width: 74px;
        padding: 9px 10px;
        font-size: 1rem;
    }

    .action {
        font-size: 0.78rem;
    }

    .mobile-note {
        font-size: 0.78rem;
        color: #b8b8b8;
    }

    .crash-text {
        font-size: 2.5rem;
    }

    .gameover-title {
        font-size: 2.5rem;
        /* Smaller Game Over title */
        border-width: 2px;
        padding: 5px 20px;
        margin-bottom: 20px;
    }

    .score-container {
        padding: 20px;
        width: 90%;
        /* Ensure it fits width */
        margin-bottom: 20px;
    }

    .score-value {
        font-size: 2.5rem;
        /* Smaller score numbers */
    }

    .score-label {
        font-size: 0.8rem;
    }

    .neon-btn {
        width: min(78vw, 360px);
        padding: 14px 18px;
        font-size: 1rem;
        margin: 5px;
        letter-spacing: 0.5px;
    }

    #gameover-screen .neon-btn {
        display: block;
        /* Stack buttons on mobile if needed */
        width: 80%;
        margin: 10px auto;
    }

    .crash-message {
        width: 90%;
        padding: 20px;
    }

    /* HUD Fixes for Mobile */
    .hud-top {
        padding: 10px;
        gap: 5px;
    }

    .hud-item {
        min-width: 0;
        /* Override 140px min-width */
        flex: 1;
        padding: 5px;
    }

    .hud-label {
        font-size: 0.6rem;
        white-space: nowrap;
    }

    .hud-value {
        font-size: 1.2rem;
    }
}

.gameover-title.destination-win {
    color: #0fa8b0;
    border-color: #0fa8b0;
    max-width: min(980px, 90vw);
    font-size: 2.6rem;
    line-height: 1.08;
    text-align: center;
    text-shadow: 4px 4px 0 #000, 0 0 18px rgba(15, 168, 176, 0.6);
}

.destination-celebration {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}

.destination-celebration span {
    position: absolute;
    top: -28px;
    width: 10px;
    height: 18px;
    background: #0fa8b0;
    box-shadow: 0 0 12px rgba(15, 168, 176, 0.75);
    animation: destination-confetti linear forwards;
}

.destination-celebration span:nth-child(3n) {
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
}

.destination-celebration span:nth-child(4n) {
    width: 14px;
    height: 14px;
    background: #e9bf3f;
    box-shadow: 0 0 12px rgba(233, 191, 63, 0.75);
}

@keyframes destination-confetti {
    0% {
        opacity: 0;
        transform: translate3d(0, -20px, 0) rotate(0deg);
    }

    12% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin));
    }
}

@media (max-width: 768px) {
    .gameover-title.destination-win {
        font-size: 1.75rem;
        padding: 8px 14px;
    }
}
