* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }
html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: #0f172a;
    font-family: 'Segoe UI', system-ui, sans-serif; color: #fff;
}
#skyBackdrop {
    position: absolute; top: 0; left: 0; right: 0; height: 48%;
    background: linear-gradient(180deg, #070514 0%, #1e1b4b 45%, #ea580c 92%, #fdba74 100%);
    z-index: 0; pointer-events: none;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }

/* Join Screen */
#joinOverlay {
    position: absolute; inset: 0; background: rgba(9, 7, 20, 0.88);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 25; backdrop-filter: blur(10px); padding: 20px;
}
#joinOverlay h1 {
    font-size: 3.8rem; font-weight: 900; letter-spacing: 8px;
    background: linear-gradient(90deg, #ff3b30, #ff9500);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}
#joinOverlay p { color: #cbd5e1; margin-bottom: 20px; font-size: 0.9rem; letter-spacing: 2px; font-weight: 600; }

.join-panel {
    width: 100%; max-width: 430px; background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255,255,255,0.16); border-radius: 14px; padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.field-label { font-size: 0.72rem; font-weight: 800; color: #94a3b8; letter-spacing: 0.8px; }
.join-panel input, .gps-card input {
    width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid #334155;
    background: #0b1120; color: #fff; font-size: 0.95rem; outline: none; user-select: text; -webkit-user-select: text;
}
.join-panel input:focus, .gps-card input:focus { border-color: #f97316; }

.primary-btn {
    margin-top: 6px; padding: 14px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #ff3b30, #ff6b00);
    color: #fff; font-weight: 900; font-size: 1rem; cursor: pointer; letter-spacing: 1px;
}

.search-wrap { position: relative; width: 100%; }
.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; max-height: 190px; overflow-y: auto;
    background: #0f172a; border: 1px solid #475569; border-radius: 8px;
    z-index: 40; display: none; box-shadow: 0 12px 28px rgba(0,0,0,0.8);
}
.search-item {
    padding: 9px 12px; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.07);
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.search-item:hover { background: #1e293b; color: #facc15; }
.search-tag { font-size: 0.68rem; background: #334155; padding: 2px 6px; border-radius: 4px; color: #cbd5e1; }
.controls-hint { margin-top: 18px; font-size: 0.8rem; color: #94a3b8; text-align: center; }

/* HUD */
#hud {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: none; justify-content: space-between; align-items: flex-start;
    z-index: 10; pointer-events: none; gap: 10px;
}
.hud-card {
    background: rgba(11, 15, 28, 0.86); border: 1px solid rgba(255,255,255,0.16);
    padding: 10px 14px; border-radius: 12px; backdrop-filter: blur(8px);
    pointer-events: auto;
}
.gps-card { width: 290px; max-width: 52vw; }
.cash { color: #4ade80; font-weight: 900; font-size: 1.3rem; }
.stars { color: #facc15; font-size: 0.82rem; font-weight: 800; margin-top: 2px; letter-spacing: 0.5px; }
.meta { font-size: 0.75rem; color: #cbd5e1; margin-top: 3px; font-weight: 600; }
.location-badge { color: #38bdf8; font-weight: 800; font-size: 0.78rem; margin-top: 5px; }

/* Karma Meter */
.karma-row { margin-top: 6px; }
#hudKarmaLabel { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.5px; color: #e2e8f0; }
.karma-track {
    width: 100%; height: 7px; background: #1e293b; border-radius: 999px;
    overflow: hidden; margin-top: 3px; border: 1px solid rgba(255,255,255,0.12);
}
#hudKarmaFill {
    width: 50%; height: 100%;
    background: linear-gradient(90deg, #ef4444, #facc15, #22c55e);
    transition: width 0.25s ease;
}

/* Toast Banner */
#toastBanner {
    position: absolute; top: 122px; left: 50%; transform: translateX(-50%);
    background: rgba(9, 13, 24, 0.94); border: 1.5px solid #facc15; color: #facc15;
    padding: 9px 20px; border-radius: 999px; font-weight: 800; font-size: 0.86rem;
    z-index: 18; display: none; box-shadow: 0 10px 28px rgba(0,0,0,0.75);
    text-align: center; max-width: 90vw;
}

/* Fullscreen WASTED Banner */
#wastedOverlay {
    position: absolute; inset: 0; background: rgba(127, 29, 29, 0.62);
    display: none; flex-direction: column; align-items: center; justify-content: center;
    z-index: 30; backdrop-filter: blur(4px); pointer-events: none;
}
.wasted-title {
    font-size: 4.5rem; font-weight: 900; letter-spacing: 10px;
    color: #ef4444; text-shadow: 0 4px 24px #000;
}
.wasted-sub {
    margin-top: 8px; font-size: 1.1rem; font-weight: 800; color: #fef08a;
    background: rgba(0,0,0,0.75); padding: 8px 18px; border-radius: 8px;
}

/* GTA Circular Minimap Radar */
#radarWrapper {
    position: absolute; bottom: 20px; left: 20px;
    width: 152px; height: 152px; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
    overflow: hidden; z-index: 11; display: none; background: #090e17;
}
#minimap { width: 100%; height: 100%; pointer-events: none; }
#radarPlayerDot {
    position: absolute; top: 50%; left: 50%;
    width: 0; height: 0;
    border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 14px solid #ff3b30;
    transform: translate(-50%, -50%); z-index: 12; pointer-events: none;
}
#radarNorth {
    position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
    font-size: 10px; font-weight: 900; color: #facc15; z-index: 12;
}

/* Touch & Action Controls */
#touchControls { position: absolute; inset: 0; z-index: 12; pointer-events: none; display: none; }
#joystickZone {
    position: absolute; bottom: 24px; left: 188px; width: 112px; height: 112px;
    border-radius: 50%; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25);
    pointer-events: auto; touch-action: none;
}
#joystickKnob {
    position: absolute; top: 33px; left: 33px; width: 42px; height: 42px;
    border-radius: 50%; background: rgba(255, 59, 48, 0.9);
}
.action-btns {
    position: absolute; bottom: 24px; right: 20px; display: flex; flex-direction: column; gap: 8px;
    pointer-events: auto;
}
.action-btn {
    padding: 11px 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.28);
    background: rgba(15, 23, 42, 0.88); color: #fff; font-weight: 800; font-size: 0.8rem; cursor: pointer;
}
.btn-interact { border-color: #facc15; color: #facc15; }
.btn-horn { border-color: #38bdf8; color: #38bdf8; }
.btn-bribe { border-color: #f97316; color: #fdba74; }
#osmAttr { position: absolute; bottom: 4px; right: 8px; font-size: 10px; color: rgba(255,255,255,0.5); z-index: 9; }