/* ==========================================
   ARABA SAVAŞI - STYLE
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #0a0a1a;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    touch-action: none;
}

canvas#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    background: #1a1a2e;
}

/* ==========================================
   OVERLAYS
   ========================================== */

.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 20, 0.92);
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.5s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================
   START SCREEN
   ========================================== */

.start-content {
    text-align: center;
    padding: 40px 50px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(30, 30, 60, 0.9), rgba(15, 15, 40, 0.95));
    border: 2px solid rgba(255, 100, 50, 0.3);
    box-shadow:
        0 0 60px rgba(255, 80, 30, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 480px;
    width: 90%;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-title {
    font-size: 2.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b35, #ff3860, #ffdd57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 8px;
    letter-spacing: -1px;
    line-height: 1.1;
}

.game-subtitle {
    color: #8888aa;
    font-size: 1.1rem;
    margin-bottom: 30px;
    font-weight: 400;
}

.player-name-box {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.player-name-box label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 600;
}

.name-input {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 107, 53, 0.4);
    border-radius: 12px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    padding: 0.6rem 1.2rem;
    width: 220px;
    outline: none;
    transition: all 0.3s;
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.name-input:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.player-name-box span {
    color: #8888aa;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.player-name-box strong {
    color: #ff6b35;
    font-size: 1.6rem;
    font-weight: 700;
}

.btn-start {
    background: linear-gradient(135deg, #ff6b35, #ff3860);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 4px 20px rgba(255, 56, 96, 0.4),
        0 0 0 0 rgba(255, 107, 53, 0);
    position: relative;
    overflow: hidden;
}

.btn-start::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.btn-start:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow:
        0 8px 30px rgba(255, 56, 96, 0.5),
        0 0 0 4px rgba(255, 107, 53, 0.2);
}

.btn-start:hover::after {
    transform: translateX(100%);
}

.btn-start:active {
    transform: translateY(0) scale(0.98);
}

.hint-text {
    color: #555577;
    font-size: 0.85rem;
    margin-top: 20px;
}

/* ==========================================
   CAR SELECT SCREEN
   ========================================== */

.car-select-content {
    max-width: 700px;
    padding: 30px 30px;
}

.select-title {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffdd57, #ff6b35, #ff3860);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.car-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px;
}

.car-grid::-webkit-scrollbar {
    width: 6px;
}

.car-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 3px;
}

.car-card {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.car-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, var(--car-glow, rgba(255, 107, 53, 0.1)), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.car-card:hover {
    border-color: rgba(255, 107, 53, 0.4);
    transform: translateY(-2px);
}

.car-card:hover::before {
    opacity: 1;
}

.car-card.selected {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.2);
}

.car-card.selected::before {
    opacity: 1;
}

.car-card-emoji {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

.car-card-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 10px;
}

.car-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.car-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #8888aa;
}

.car-stat-label {
    min-width: 46px;
    text-align: right;
}

.car-stat-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.car-stat-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.car-stat-bar.speed {
    background: linear-gradient(90deg, #00d26a, #47e87a);
}

.car-stat-bar.health {
    background: linear-gradient(90deg, #ff3860, #ff6b6b);
}

.car-stat-bar.damage {
    background: linear-gradient(90deg, #ff6b35, #ffaa00);
}

.car-stat-bar.handling {
    background: linear-gradient(90deg, #3860ff, #60a0ff);
}

.btn-fight {
    margin-top: 0;
}

/* ==========================================
   GAME OVER / WIN SCREENS
   ========================================== */

.gameover-content {
    border-color: rgba(255, 56, 96, 0.4);
    box-shadow:
        0 0 80px rgba(255, 30, 50, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

.gameover-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ff3860;
    margin-bottom: 20px;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(10px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

.win-content {
    border-color: rgba(255, 221, 87, 0.4);
    box-shadow:
        0 0 80px rgba(255, 200, 50, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

.win-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffdd57, #ff6b35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    animation: pulse 1s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.btn-win {
    background: linear-gradient(135deg, #ffdd57, #ff6b35);
}

.stats-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 20px 30px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-box p {
    color: #aaaacc;
    font-size: 1.15rem;
    margin: 8px 0;
}

.stats-box strong {
    color: #ffdd57;
    font-size: 1.3rem;
}

/* ==========================================
   HUD
   ========================================== */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    pointer-events: none;
}

.hud-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}

.hud-name {
    color: #ff6b35;
    font-weight: 700;
    font-size: 1rem;
    min-width: 100px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hud-health-container {
    flex: 1;
    max-width: 300px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00d26a, #47e87a);
    border-radius: 12px;
    transition: width 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 210, 106, 0.4);
}

.hud-health-bar.medium {
    background: linear-gradient(90deg, #ffaa00, #ffcc33);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.hud-health-bar.low {
    background: linear-gradient(90deg, #ff3860, #ff5555);
    box-shadow: 0 0 10px rgba(255, 56, 96, 0.4);
    animation: healthPulse 0.5s ease infinite;
}

@keyframes healthPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.hud-health-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.hud-score {
    display: flex;
    gap: 16px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hud-alive {
    position: fixed;
    top: 56px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #ffdd57;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 221, 87, 0.2);
}

.hud-boost {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 140px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 25px;
    border: 1px solid rgba(255, 107, 53, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    padding-bottom: 8px;
}

.hud-boost span {
    color: #ff6b35;
    font-size: 0.6rem;
    font-weight: 700;
    z-index: 2;
    margin-top: 4px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 1px;
}

.boost-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(0deg, #ff6b35, #ff3860);
    transition: height 0.2s ease;
    opacity: 0.6;
}

/* ==========================================
   SOUND TOGGLE
   ========================================== */

.hud-sound {
    position: fixed;
    top: 56px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: all;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    z-index: 55;
}

.hud-sound:hover {
    background: rgba(255, 107, 53, 0.3);
    border-color: rgba(255, 107, 53, 0.5);
}

.hud-sound.muted {
    opacity: 0.5;
}

/* ==========================================
   JOYSTICK
   ========================================== */

#joystickArea {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 60;
    touch-action: none;
}

#joystickBase {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(4px);
}

#joystickKnob {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.8), rgba(255, 56, 96, 0.6));
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    position: absolute;
    transition: none;
}

/* ==========================================
   BOOST BUTTON (MOBILE)
   ========================================== */

#boostBtn {
    position: fixed;
    bottom: 50px;
    right: 30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.7), rgba(255, 56, 96, 0.5));
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    z-index: 60;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.3);
    touch-action: none;
    cursor: pointer;
    transition: transform 0.1s;
}

#boostBtn:active {
    transform: scale(0.9);
    background: radial-gradient(circle, rgba(255, 107, 53, 1), rgba(255, 56, 96, 0.8));
}

/* ==========================================
   MINIMAP
   ========================================== */

#minimap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 160px;
    height: 160px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    z-index: 50;
}

#minimapCanvas {
    width: 100%;
    height: 100%;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 600px) {
    .game-title {
        font-size: 1.9rem;
    }

    .game-subtitle {
        font-size: 0.9rem;
    }

    .start-content {
        padding: 30px 24px;
    }

    .btn-start {
        padding: 14px 36px;
        font-size: 1.2rem;
    }

    .player-name-box strong {
        font-size: 1.3rem;
    }

    .hud-boost {
        display: none;
    }

    #minimap {
        width: 100px;
        height: 100px;
        bottom: 180px;
        right: 10px;
    }

    #minimapCanvas {
        width: 100px;
        height: 100px;
    }

    .hud-alive {
        top: 50px;
        right: 10px;
        font-size: 0.75rem;
    }

    .car-select-content {
        max-width: 95%;
        padding: 20px 16px;
    }

    .car-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .car-card {
        padding: 12px 8px;
    }

    .car-card-emoji {
        font-size: 2rem;
    }

    .car-card-name {
        font-size: 0.85rem;
    }

    .select-title {
        font-size: 1.6rem;
    }
}

/* FIRE BUTTON (MOBILE/TABLET) */
#fireBtn {
    position: fixed;
    bottom: 150px;
    right: 30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 56, 96, 0.7), rgba(170, 85, 255, 0.5));
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    z-index: 60;
    box-shadow: 0 0 30px rgba(255, 56, 96, 0.3);
    touch-action: none;
    cursor: pointer;
    transition: transform 0.1s;
}

#fireBtn:active {
    transform: scale(0.9);
    background: radial-gradient(circle, rgba(255, 56, 96, 1), rgba(170, 85, 255, 0.8));
}