* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'Oswald', sans-serif;
    color: #fff;
    user-select: none;
}

/* TITLE SCREEN */
#title-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
}

#title-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: 
        linear-gradient(180deg, #1a2a40 0%, #2a3520 30%, #4a3a10 60%, #1a1510 100%);
    opacity: 0.9;
}

#title-bg::before {
    content: '';
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 35%;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 40px,
            #1a1a2e 40px, #1a1a2e 42px,
            transparent 42px, transparent 80px
        ),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 120px,
            #222240 120px, #222240 160px,
            transparent 160px, transparent 200px
        );
    mask-image: linear-gradient(0deg, transparent 0%, #000 30%, #000 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(0deg, transparent 0%, #000 30%, #000 60%, transparent 100%);
}

#title-bg::after {
    content: '';
    position: absolute;
    bottom: 25%;
    left: 5%;
    width: 90%;
    height: 200px;
    background:
        linear-gradient(0deg, transparent 0%, #15152a 5%, #20203a 10%, #20203a 60%, transparent 60%) 0% 0% / 30px 100%,
        linear-gradient(0deg, transparent 0%, #1a1a30 5%, #252545 10%, #252545 80%, transparent 80%) 40px 0% / 50px 100%,
        linear-gradient(0deg, transparent 0%, #18182d 5%, #1e1e38 10%, #1e1e38 45%, transparent 45%) 100px 0% / 25px 100%,
        linear-gradient(0deg, transparent 0%, #1c1c35 5%, #232345 10%, #232345 70%, transparent 70%) 140px 0% / 45px 100%,
        linear-gradient(0deg, transparent 0%, #19192e 5%, #212140 10%, #212140 90%, transparent 90%) 200px 0% / 35px 100%;
    background-repeat: repeat-x;
    opacity: 0.7;
}

#title-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 20px;
}

#title-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #666;
    letter-spacing: 3px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

#title-main {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(38px, 7vw, 85px);
    color: #e8a020;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 4px 4px 12px rgba(232, 160, 32, 0.4);
    letter-spacing: 4px;
    transform: skewY(-2deg);
    line-height: 0.95;
}

#title-sub {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(24px, 5vw, 48px);
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 6px;
    transform: skewY(-2deg);
    margin-top: 5px;
}

#title-quote {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: #888;
    font-style: italic;
    margin: 20px 0 10px;
}

#title-highscore {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: #60d060;
    margin-bottom: 20px;
}

#start-btn {
    font-family: 'Oswald', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.7);
    border: 2px solid #555;
    padding: 14px 60px;
    cursor: pointer;
    letter-spacing: 4px;
    text-transform: uppercase;
    transition: all 0.2s;
    display: block;
    margin: 0 auto 24px;
}

#start-btn:hover {
    background: #e8a020;
    color: #000;
    border-color: #e8a020;
    transform: scale(1.05);
}

#controls-ref {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #777;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key {
    background: rgba(255,255,255,0.1);
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    color: #e8a020;
}

#title-footer {
    margin-top: 30px;
}

#title-footer a {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: #444;
    text-decoration: none;
}

#title-footer a:hover {
    color: #888;
}

/* GAME CONTAINER */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#scene-container {
    width: 100%;
    height: 100%;
}

#scene-container canvas {
    display: block;
}

/* HUD */
#hud {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud-top-left {
    position: absolute;
    top: 16px; left: 16px;
}

#health-bar-container {
    background: rgba(0,0,0,0.65);
    padding: 6px 12px;
    border-radius: 4px;
}

#health-bar-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: #999;
    letter-spacing: 2px;
    margin-bottom: 3px;
}

#health-bar-bg {
    width: 160px;
    height: 12px;
    background: #331111;
    border-radius: 2px;
    overflow: hidden;
}

#health-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #d03030, #50dd50);
    border-radius: 2px;
    transition: width 0.3s;
}

#hud-top-right {
    position: absolute;
    top: 16px; right: 16px;
    text-align: right;
}

#wanted-stars {
    background: rgba(0,0,0,0.65);
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
}

.star {
    font-size: 22px;
    color: #333;
    text-shadow: 1px 1px 0 #000;
    transition: color 0.2s, text-shadow 0.2s;
}

.star.active {
    color: #f0c020;
    text-shadow: 0 0 8px #f0c020, 0 0 16px #e8a010;
}

#money-display {
    font-family: 'Share Tech Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    color: #50dd50;
    text-shadow: 1px 1px 0 #000, 0 0 10px rgba(80,221,80,0.3);
    background: rgba(0,0,0,0.65);
    padding: 4px 12px;
    border-radius: 4px;
    margin-top: 6px;
    display: inline-block;
}

#hud-bottom-left {
    position: absolute;
    bottom: 16px; left: 16px;
}

#minimap {
    width: 160px; height: 160px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.7);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#hud-bottom-center {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}

#vehicle-indicator {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #ccc;
    background: rgba(0,0,0,0.65);
    padding: 6px 16px;
    border-radius: 4px;
    letter-spacing: 2px;
}

#district-display {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #e8a020;
    background: rgba(0,0,0,0.55);
    padding: 4px 12px;
    border-radius: 4px;
    letter-spacing: 3px;
    margin-top: 6px;
    text-transform: uppercase;
}

#humor-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Oswald', sans-serif;
    font-size: clamp(16px, 3vw, 28px);
    color: #e8a020;
    text-shadow: 2px 2px 4px #000;
    background: rgba(0,0,0,0.75);
    padding: 10px 30px;
    border-radius: 4px;
    text-align: center;
    letter-spacing: 2px;
    transition: opacity 0.5s;
    white-space: nowrap;
}

#humor-banner.hidden {
    opacity: 0;
    pointer-events: none;
}

#wasted-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(120, 0, 0, 0.4);
    transition: opacity 0.5s;
}

#wasted-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#wasted-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(60px, 15vw, 140px);
    color: #cc0000;
    text-shadow: 4px 4px 0 #000, 0 0 40px rgba(200,0,0,0.6);
    letter-spacing: 12px;
    animation: wastedPulse 0.5s ease-out;
}

#wasted-sub {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: #ff6666;
    margin-top: 10px;
}

@keyframes wastedPulse {
    0% { transform: scale(2); opacity: 0; }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 200px;
    pointer-events: none;
    z-index: 15;
}

#mobile-left {
    position: absolute;
    bottom: 30px; left: 20px;
    pointer-events: auto;
}

#joystick-area {
    width: 120px; height: 120px;
    position: relative;
}

#joystick-base {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-stick {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: 2px solid rgba(255,255,255,0.4);
    pointer-events: none;
}

#mobile-right {
    position: absolute;
    bottom: 30px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.mobile-btn {
    width: 70px; height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
}

.mobile-btn:active {
    background: rgba(232,160,32,0.4);
    border-color: #e8a020;
}

@media (max-width: 768px) {
    #mobile-controls {
        display: block;
    }
    #minimap {
        width: 120px; height: 120px;
    }
    #health-bar-bg {
        width: 100px;
    }
    #district-display {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    #hud-bottom-left {
        bottom: 190px;
    }
}