/*
 * FaceRacer - Kafa Kontrol Oyunu
 * Copyright (c) 2026 Hakan Çetin
 * Tüm hakları saklıdır.
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* Turbo Bar */
.turbo-bar-container {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.turbo-bar {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid #444;
    overflow: hidden;
    position: relative;
}

.turbo-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #444, #888, #00ff88);
    border-radius: 8px;
    transition: width 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.turbo-fill.full {
    background: linear-gradient(90deg, #00ff88, #ffff00, #ff4444);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
    animation: turboPulse 0.5s ease infinite;
}

@keyframes turboPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.turbo-icon {
    font-size: 1.5rem;
    color: #ff6600;
    text-shadow: 0 0 10px rgba(255, 102, 0, 0.5);
    transition: all 0.3s ease;
    animation: flameFloat 1.2s ease-in-out infinite;
}

.turbo-icon.full {
    font-size: 2rem;
    color: #ff4400;
    text-shadow: 0 0 20px rgba(255, 68, 0, 0.8);
    animation: flamePulse 0.5s ease infinite;
}

@keyframes flamePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes flameFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.7; }
    50% { transform: translateY(-5px) scale(1.1); opacity: 1; }
}

.turbo-icon-secondary {
    font-size: 1.2rem;
    color: #ff4400;
    text-shadow: 0 0 8px rgba(255, 68, 0, 0.5);
    transition: all 0.3s ease;
    animation: flameFloat 1s ease-in-out infinite;
}

.turbo-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
    min-width: 50px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#cameraVideo {
    position: absolute;
    bottom: 135px;
    right: 30px;
    width: 110px;
    height: 88px;
    border-radius: 10px;
    border: 3px solid #00ff88;
    object-fit: cover;
    z-index: 100;
    transform: scaleX(-1);
    transition: all 0.5s ease;
}

#cameraVideo.calibrating {
    bottom: auto;
    right: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scaleX(-1);
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 4px solid #00ff88;
    z-index: 160;
}

#cameraVideo.calibrating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 20px #00ff88;
}

#calibrationOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 150;
}

#calibrationOverlay.hidden {
    display: none;
}

.calibration-content {
    text-align: center;
}

.calibration-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #00ff88;
}

.calibration-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #ccc;
}

.countdown {
    font-size: 5rem;
    font-weight: bold;
    color: #00ff88;
    margin-top: 20px;
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #00ff88;
}

#hud.hidden {
    display: none;
}

#hud h2 {
    margin-bottom: 10px;
    color: #00ff88;
}

.hud-item {
    margin: 10px 0;
    font-size: 1.1rem;
}

.hud-value {
    color: #00ff88;
    font-weight: bold;
}

#controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #00ff88;
}

#controls.hidden {
    display: none;
}

#controls h3 {
    color: #00ff88;
    margin-bottom: 10px;
}

#controls p {
    font-size: 0.9rem;
    margin: 5px 0;
    color: #ccc;
}

#startButton {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    font-size: 1.5rem;
    background: #00ff88;
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    z-index: 150;
    font-weight: bold;
    transition: all 0.3s;
}

#startButton:hover {
    background: #00cc6a;
    transform: translate(-50%, -50%) scale(1.05);
}

#startButton.hidden {
    display: none;
}

.nitro-active {
    animation: nitroPulse 0.5s infinite;
}

@keyframes nitroPulse {
    0%, 100% { box-shadow: 0 0 20px #ff6b00; }
    50% { box-shadow: 0 0 40px #ff6b00; }
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 300;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #00ff88;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive - Sadece mobil cihazlarda geçerli */
@media (max-width: 768px) {
    #hud {
        top: 10px;
        left: 10px;
        padding: 10px;
        font-size: 0.8rem;
        background: transparent;
        border: 1px solid rgba(0,255,136,0.3);
    }

    #hud h2 {
        display: none;
    }

    .hud-item {
        margin: 3px 0;
        font-size: 0.65rem;
    }

    /* Gereksiz elementleri gizle - Yaw, Pitch, Nitro, Raw values */
    .hud-item:nth-child(7), /* Yaw */
    .hud-item:nth-child(8), /* Pitch */
    .hud-item:nth-child(9), /* Nitro */
    .hud-item:nth-child(10)  /* Raw values */
    {
        display: none;
    }

    /* Mobilde Raw Yaw/Pitch satırını tamamen gizle */
    .hud-item:last-child {
        display: none !important;
    }

    #cameraVideo {
        width: 100px;
        height: 75px;
        bottom: 10px;
        right: 10px;
    }

    #cameraVideo.calibrating {
        width: 180px;
        height: 180px;
    }

    #controls {
        bottom: 10px;
        left: 10px;
        padding: 8px;
        font-size: 0.65rem;
    }

    #controls h3 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    #controls p {
        font-size: 0.6rem;
        margin: 2px 0;
    }

    #easyModeBtn {
        bottom: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 0.7rem;
    }

    .calibration-content h1 {
        font-size: 1.8rem;
    }

    .calibration-content p {
        font-size: 0.85rem;
    }

    .countdown {
        font-size: 2.5rem;
    }
}

/* Portrait Mode Optimizasyon - Dikey ekran için */
@media (orientation: portrait) {
    #hud {
        padding: 9px;
        font-size: 0.76rem;
    }

    .hud-item {
        font-size: 0.62rem;
        margin: 2px 0;
    }

    .hud-item:last-child {
        display: none;
    }

    #speedometer {
        padding: 9px 18px;
    }

    .speed-value {
        font-size: 34px;
    }

    .speed-unit {
        font-size: 11px;
    }

    #controls {
        padding: 7px;
        font-size: 0.62rem;
    }

    #controls h3 {
        font-size: 0.76rem;
    }

    #controls p {
        font-size: 0.57rem;
    }

    #turboBar {
        width: 180px !important;
    }

    #turboBarContainer {
        width: auto !important;
    }

    .turbo-icon {
        font-size: 1.2rem;
    }

    .turbo-icon.full {
        font-size: 1.6rem;
    }

    .turbo-icon-secondary {
        font-size: 1rem;
    }
}

/* Speedometer */
#speedometer {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.speed-value {
    font-size: 48px;
    font-weight: 800;
    font-family: 'Arial Black', 'Impact', sans-serif;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    line-height: 1;
}

.speed-unit {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
}

.speed-low {
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.speed-medium {
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.speed-high {
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

/* Mobil Speedometer */
@media (max-width: 768px) {
    #speedometer {
        bottom: 20px;
        right: 20px;
        padding: 10px 20px;
    }

    .speed-value {
        font-size: 36px;
    }

    .speed-unit {
        font-size: 12px;
    }
}

/* Car Selection */
.car-option:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

@media (max-width: 768px) {
    .car-option {
        width: 150px !important;
        padding: 15px !important;
    }
}

.car-select-btn.car-selected {
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.car-select-btn.car-locked {
    filter: grayscale(0.5);
}

.car-select-btn:not(.car-locked):hover {
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}
