:root {
    --bg: #0b0d10;
    --panel: rgba(16, 19, 24, 0.72);
    --accent: #eb0a1e;          /* toyota red */
    --accent-soft: rgba(235, 10, 30, 0.18);
    --text: #eef2f6;
    --muted: #9aa4b2;
    --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
}

#scene { display: block; position: fixed; inset: 0; cursor: none; }

.hidden { display: none !important; }

/* ── Overlays (full screen) ───────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(235,10,30,0.16), transparent 60%),
        linear-gradient(180deg, rgba(8,10,13,0.92), rgba(8,10,13,0.98));
    z-index: 50;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 34px 40px;
    min-width: 360px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
}

.logo {
    font-weight: 800;
    font-size: 52px;
    letter-spacing: 10px;
    color: var(--text);
    line-height: 1;
}
.logo.small { font-size: 30px; letter-spacing: 6px; }
.logo b { color: var(--accent); }

.subtitle {
    margin-top: 8px;
    color: var(--muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 12px;
    margin-bottom: 24px;
}

.card label {
    display: block;
    text-align: left;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.card input {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.4);
    color: var(--text);
    outline: none;
    text-align: center;
    letter-spacing: 1px;
}
.card input:focus { border-color: var(--accent); }

.card button {
    margin-top: 16px;
    width: 100%;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.card button:hover { background: #ff1c30; box-shadow: 0 12px 30px rgba(235,10,30,0.35); }
.card button:active { transform: translateY(1px); }

.hint { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hint b { color: var(--text); }

/* flag-captured overlay */
.flag-text {
    margin-top: 18px;
    font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #4dff88;
    background: rgba(77,255,136,0.08);
    border: 1px solid rgba(77,255,136,0.35);
    border-radius: 10px;
    padding: 14px 18px;
    word-break: break-all;
    user-select: all;
}
.flag-hint { margin-top: 12px; color: var(--muted); font-size: 13px; }

/* ── HUD ──────────────────────────────────────────────────────────────────── */
#hud {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 30;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 170px;
    backdrop-filter: blur(6px);
}
#hudName {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#hudSpeed {
    margin-top: 6px;
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
#hudSpeed .unit { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; }
#hudCoins {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 800;
    color: #ffd24a;
    font-variant-numeric: tabular-nums;
}
#hudCoins.goal { color: #4dff88; }
#hudGears {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 10px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
    font-size: 14px;
}
#hudDrift {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #4dff88;
    text-shadow: 0 0 12px rgba(77, 255, 136, 0.5);
}

/* ── Panels (controls help, driver list) ──────────────────────────────────── */
.panel {
    position: fixed;
    z-index: 30;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    backdrop-filter: blur(6px);
    max-height: 80vh;
    overflow: auto;
}
#controls { bottom: 18px; left: 18px; }
#controls .row { margin: 6px 0; color: var(--muted); }
#controls .row kbd {
    display: inline-block;
    min-width: 26px;
    text-align: center;
    padding: 2px 8px;
    margin-right: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
}

#driverList {
    top: 18px;
    right: 210px;
    width: 280px;
}
#driverList h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
#driverList .row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
#driverList .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
#driverList .name { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#driverList .speed { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Minimap ──────────────────────────────────────────────────────────────── */
.minimap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 30;
    background: rgba(10, 12, 16, 0.72);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(6px);
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
#toast .item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 14px;
    backdrop-filter: blur(6px);
    animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ── Crosshair ────────────────────────────────────────────────────────────── */
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.5);
    font-size: 22px;
    pointer-events: none;
    z-index: 20;
}

/* ── GTA 6 scctf additions ─────────────────────────────────────────────────── */
#hudHealth {
    margin-top: 8px;
    height: 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    overflow: hidden;
}
#healthFill {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #ff5555, #4dff88);
    transition: width 0.15s linear;
}
#hudHealthText {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
#hudModeFoot, #hudModeDrive {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
}
#hudModeFoot { color: #7ee787; }
#hudModeDrive { color: #4db8ff; }
#hudSpeed { margin-top: 4px; }

#prompt {
    position: fixed;
    bottom: 12vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

#killFeed {
    position: fixed;
    top: 210px;
    right: 18px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}
.kf-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-right: 3px solid var(--accent);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(6px);
    animation: toastIn 0.15s ease;
}
.kf-item .killer { color: #ff6f61; }
.kf-item .victim { color: #7ee787; }

#playerList {
    top: 18px;
    right: 210px;
    width: 320px;
}
#playerList h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
#playerList table.stats { width: 100%; border-collapse: collapse; font-size: 13px; }
#playerList table.stats th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    padding: 3px 6px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
}
#playerList table.stats td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,0.04); }

.death-card { border-color: rgba(255, 60, 60, 0.4); }
.death-killer {
    margin-top: 16px;
    font-size: 26px;
    font-weight: 700;
    color: #ff6f61;
}

/* ── economy / shop ────────────────────────────────────────────────────────── */
#hudMoney {
    margin-top: 6px;
    font-size: 14px;
    color: #feca57;
    font-weight: bold;
}
#deathMoney {
    margin-top: 6px;
    color: #feca57;
    font-size: 15px;
}
.kf-item .reward { color: #feca57; font-weight: bold; }

#shopPanel {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(40px) scale(0.92);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
    z-index: 40;
}
#shopPanel.open {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.shop-card {
    background: rgba(16, 19, 26, 0.94);
    border: 1px solid rgba(254, 202, 87, 0.5);
    border-radius: 10px;
    padding: 14px 18px;
    min-width: 340px;
    max-width: 420px;
    color: #e8ebf0;
    font-size: 13px;
}
.shop-head { display: flex; justify-content: space-between; align-items: baseline; }
.shop-title { font-size: 17px; font-weight: bold; color: #feca57; letter-spacing: 1px; }
.shop-money { color: #feca57; font-weight: bold; }
.shop-note { color: rgba(232,235,240,0.45); font-size: 11px; margin: 2px 0 8px; }
.shop-section { margin-top: 8px; }
.shop-sec {
    font-size: 11px; letter-spacing: 2px; color: rgba(232,235,240,0.55);
    border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 3px; margin-bottom: 6px;
}
.shop-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.shop-item { flex: 1; }
.shop-price { color: #feca57; }
.shop-row button, .shop-paint {
    background: #feca57; color: #16181d; border: 0; border-radius: 5px;
    padding: 4px 12px; font-weight: bold; cursor: pointer; font-size: 12px;
}
.shop-row button:disabled { background: #3a3f4a; color: #8a8f9a; cursor: default; }
.shop-cars { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.shop-car {
    display: flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 5px; cursor: pointer;
    border: 1px solid rgba(255,255,255,0.12); font-size: 12px;
}
.shop-car.sel { border-color: #feca57; background: rgba(254,202,87,0.12); }
.shop-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,0.3); }
.shop-swatches { display: flex; gap: 6px; margin-bottom: 9px; }
.shop-swatch {
    width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
    border: 2px solid rgba(255,255,255,0.15);
}
.shop-swatch.sel { border-color: #ffffff; }
.shop-paint { width: 100%; padding: 6px 0; }

/* browse mode: cursor only appears when the player asks for it (E) */
#shopPanel.open.browse { pointer-events: auto; }
.shop-row button { min-width: 150px; }

/* ── shop purchase highlight ─────────────────────────────────────────────── */
@keyframes shopRowFlash {
    0% { background: rgba(254, 202, 87, 0.45); box-shadow: 0 0 12px rgba(254, 202, 87, 0.6); }
    100% { background: transparent; box-shadow: none; }
}
.shop-row.flash { animation: shopRowFlash 1.1s ease-out; border-radius: 5px; }
@keyframes shopCardFlash {
    0% { box-shadow: 0 0 22px rgba(254, 202, 87, 0.75); border-color: #feca57; }
    100% { box-shadow: none; }
}
.shop-card.flash { animation: shopCardFlash 1.1s ease-out; }
@keyframes paintBtnFlash {
    0% { background: #ffffff; }
    100% { background: #feca57; }
}
.shop-paint.flash { animation: paintBtnFlash 0.8s ease-out; }

/* ── day phase HUD ───────────────────────────────────────────────────────── */
#dayPhase {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(232, 235, 240, 0.85);
}

/* ── cheat console (Z) ───────────────────────────────────────────────────── */
#cheatConsole {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(110%);
    width: 480px;
    background: rgba(10, 14, 20, 0.92);
    border: 1px solid rgba(90, 200, 250, 0.4);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 8px 10px;
    font-family: Consolas, monospace;
    color: #bfefff;
    z-index: 90;
    transition: transform 0.15s ease-out;
    pointer-events: none;
}
#cheatConsole.open { transform: translateX(-50%) translateY(0); pointer-events: auto; }
#cheatLog {
    max-height: 140px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 6px;
}
#cheatInput {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(90, 200, 250, 0.35);
    border-radius: 4px;
    color: #eaf7ff;
    font: 13px Consolas, monospace;
    padding: 6px 8px;
    outline: none;
}
#cheatInput:focus { border-color: rgba(120, 220, 255, 0.8); }
