* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #040404;
    color: #fff;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

button {
    cursor: pointer;
}

#app,
.screen {
    position: absolute;
    inset: 0;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.hidden {
    display: none !important;
}


/* =========================================================
   MENU
========================================================= */

.menu-scene {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient( circle at 72% 48%, rgba(255, 155, 66, 0.12), transparent 20%), linear-gradient( 180deg, #151515 0%, #0b0b0b 55%, #030303 100%);
}

.menu-scene::before {
    content: "";
    position: absolute;
    left: 69%;
    top: 10%;
    width: 3px;
    height: 58%;
    background: #242424;
    box-shadow: 0 0 45px rgba(255, 157, 74, 0.15);
}

.menu-scene::after {
    content: "";
    position: absolute;
    left: calc(69% - 4px);
    top: 10%;
    width: 11px;
    height: 6px;
    background: #d19962;
    border-radius: 50%;
    box-shadow: 0 0 28px rgba(255, 175, 90, 0.85), 0 0 120px rgba(255, 133, 48, 0.32);
}

.menu-fog {
    position: absolute;
    inset: 0;
    background: radial-gradient( ellipse at 73% 70%, rgba(255, 255, 255, 0.04), transparent 32%);
    pointer-events: none;
}

.menu-content {
    position: relative;
    z-index: 2;
    width: min(620px, 90vw);
    height: 100%;
    margin-left: clamp(30px, 8vw, 145px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.eyebrow {
    display: block;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.24em;
}

.menu-copy h1 {
    margin: 0;
    font-size: clamp(62px, 8vw, 110px);
    line-height: 0.82;
    font-weight: 1000;
    letter-spacing: -0.06em;
}

.tagline {
    margin: 24px 0 42px;
    color: #aaa;
    font-size: 21px;
}

.menu-actions {
    width: 330px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-profile {
    display: block;
    margin-bottom: 4px;
}

.player-profile span,
.menu-best {
    display: block;
    color: #777;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.player-profile input {
    width: 100%;
    margin-top: 7px;
    padding: 12px 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    outline: 0;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.player-profile input:focus {
    border-color: rgba(255, 255, 255, 0.38);
}

.menu-best {
    margin: 2px 0 7px;
    color: #c9a56e;
}

.menu-footer {
    position: absolute;
    bottom: 30px;
    display: flex;
    gap: 8px;
    color: #666;
    font-size: 11px;
}


/* =========================================================
   BUTTONS
========================================================= */

.btn {
    width: 100%;
    padding: 15px 18px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #f2f2ef;
    color: #080808;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: #ddd;
}

.btn-link {
    margin-top: 8px;
    background: transparent;
    border: 0;
    color: #888;
}


/* =========================================================
   DIALOG
========================================================= */

.overlay-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient( circle at center, #151210, #050505 70%);
}

.dialog {
    width: min(620px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 42px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(9, 9, 9, 0.95);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
}

.dialog h2 {
    margin: 0 0 20px;
    font-size: clamp(34px, 5vw, 52px);
    letter-spacing: -0.05em;
}

.dialog p {
    color: #aaa;
    line-height: 1.65;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 25px 0;
    padding: 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #ccc;
    font-size: 13px;
}

.check-row input {
    width: 18px;
    height: 18px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 25px 0;
}

.controls-grid div {
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 7px;
}

kbd {
    padding: 5px 8px;
    border: 1px solid #444;
    border-radius: 5px;
    background: #171717;
    font-size: 11px;
    box-shadow: 0 2px 0 #000;
}

.controls-grid span {
    margin-left: 8px;
    color: #aaa;
    font-size: 13px;
}

.rules {
    padding: 20px;
    margin-bottom: 24px;
    background: rgba(130, 20, 20, 0.08);
    border: 1px solid rgba(255, 80, 80, 0.08);
    border-radius: 9px;
}

.rules strong {
    display: block;
    margin-top: 18px;
    font-size: 26px;
}


/* =========================================================
   GAME
========================================================= */

#gameContainer {
    position: absolute;
    inset: 0;
    background: #000;
}

#gameContainer canvas {
    display: block;
    width: 100%;
    height: 100%;
}


/* =========================================================
   HUD
========================================================= */

#hud {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.hud-objective {
    position: absolute;
    top: 24px;
    left: 24px;
}

.hud-objective small {
    display: block;
    color: rgba(255, 255, 255, 0.4);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.17em;
}

.hud-objective strong {
    display: block;
    margin-top: 5px;
    font-size: 18px;
    text-shadow: 0 2px 12px #000;
}

.hud-clock {
    position: absolute;
    right: 24px;
    top: 24px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 7px;
    font-size: 14px;
    font-weight: 800;
}

.hud-bars {
    position: absolute;
    left: 24px;
    bottom: 24px;
    width: 290px;
}

.bar-block {
    margin-top: 12px;
}

.bar-block span {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.bar {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
}

.bar-fill {
    height: 100%;
    transition: width 0.15s linear;
}

.bar-fill.stamina {
    width: 100%;
    background: linear-gradient( 90deg, #ffffff, #888);
}

.bar-fill.threat {
    width: 0%;
    background: linear-gradient( 90deg, #734040, #d43a3a);
}

.interaction {
    position: absolute;
    left: 50%;
    bottom: 110px;
    transform: translateX(-50%);
    padding: 9px 13px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    font-size: 11px;
    color: #ddd;
}

.game-message {
    position: absolute;
    left: 50%;
    bottom: 55px;
    transform: translateX(-50%);
    width: min(700px, 85vw);
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 14px #000;
}


/* =========================================================
   CHASE
========================================================= */

.chase-alert {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.chase-alert span,
.chase-alert strong {
    display: block;
}

.chase-alert span {
    font-size: clamp(28px, 5vw, 54px);
    font-weight: 900;
    letter-spacing: 0.13em;
    color: rgba(255, 255, 255, 0.65);
}

.chase-alert strong {
    font-size: clamp(75px, 13vw, 155px);
    line-height: 0.82;
    letter-spacing: -0.07em;
    font-weight: 1000;
}

.chase-alert.show {
    display: block !important;
    animation: chasePop 1s ease forwards;
}

@keyframes chasePop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.4);
    }
    20% {
        opacity: 1;
    }
    75% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.96);
    }
}


/* =========================================================
   END SCREENS
========================================================= */

.end-screen {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
}

.end-card {
    width: min(580px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 40px;
    text-align: center;
    background: #090909;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
}

.end-card h2 {
    margin: 4px 0 18px;
    font-size: clamp(38px, 6vw, 62px);
    line-height: 0.93;
    letter-spacing: -0.055em;
}

.end-card p {
    color: #aaa;
    line-height: 1.6;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 28px 0;
}

.stats div {
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 7px;
}

.stats span {
    display: block;
    color: #777;
    font-size: 9px;
    text-transform: uppercase;
}

.stats strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.score-total {
    margin: 20px 0 0;
    padding: 14px;
    border: 1px solid rgba(218, 64, 54, 0.28);
    border-radius: 9px;
    background: rgba(124, 19, 15, 0.16);
}

.score-total span {
    display: block;
    color: #a8847c;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.17em;
}

.score-total strong {
    display: block;
    margin-top: 3px;
    font-size: 34px;
}

.victory-score {
    border-color: rgba(108, 190, 125, 0.25);
    background: rgba(35, 104, 49, 0.13);
}

.ranking {
    margin: -12px 0 22px;
    color: #8e8e8e;
    font-size: 11px;
    line-height: 1.7;
}

.ranking strong {
    color: #d0d0d0;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {
    .menu-content {
        justify-content: flex-end;
        margin-left: 0;
        padding: 26px 20px 70px;
    }
    .menu-copy h1 {
        font-size: 62px;
    }
    .controls-grid {
        grid-template-columns: 1fr;
    }
    .dialog {
        padding: 26px;
    }
    .hud-bars {
        width: 190px;
        left: 14px;
        bottom: 18px;
    }
    .hud-objective {
        top: 14px;
        left: 14px;
    }
    .hud-clock {
        top: 14px;
        right: 14px;
    }
    .stats {
        grid-template-columns: 1fr;
    }
}
