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

body {
    background: #0a0a0a;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    user-select: none;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(5, 5, 15, 0.92);
    backdrop-filter: blur(6px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    max-width: 480px;
    width: 90%;
    padding: 30px;
}

/* Title */
.game-title {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 6px;
    background: linear-gradient(180deg, #ff4444, #ff8800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 1.1rem;
    color: #888;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.game-over-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ff3333;
    margin-bottom: 20px;
}

.garage-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ffaa00;
    margin-bottom: 10px;
}

/* Coin display */
.coin-display {
    font-size: 1.3rem;
    color: #ffd700;
    margin-bottom: 24px;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 10px auto;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, #ff4444, #ff6600);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 28px rgba(255, 68, 68, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #333, #444);
    color: #ccc;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    color: #fff;
}

.controls-hint {
    margin-top: 28px;
    color: #555;
    font-size: 0.85rem;
    line-height: 1.8;
}

/* Stats Box */
.stats-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 18px 24px;
    margin-bottom: 24px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 1.05rem;
}

.stat-row span:first-child {
    color: #888;
}

.stat-row span:last-child {
    color: #ffd700;
    font-weight: 700;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
}

.tab-btn:hover:not(.active) {
    color: #aaa;
}

/* Garage Content */
.garage-content {
    max-width: 540px;
}

.tab-content {
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Car Card */
.car-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.car-card.selected {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.08);
}

.car-card.locked {
    opacity: 0.5;
}

.car-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    flex-shrink: 0;
}

.car-info {
    flex: 1;
    text-align: left;
}

.car-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.car-stats {
    font-size: 0.75rem;
    color: #777;
    line-height: 1.5;
}

.car-action {
    flex-shrink: 0;
}

.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-small:hover {
    transform: translateY(-1px);
}

.btn-buy {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
}

.btn-select {
    background: linear-gradient(135deg, #44ff44, #00cc00);
    color: #000;
}

.btn-selected {
    background: #333;
    color: #ffaa00;
    cursor: default;
}

.btn-locked {
    background: #222;
    color: #555;
    cursor: default;
}

/* Upgrade Row */
.upgrade-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 8px;
}

.upgrade-info {
    flex: 1;
    text-align: left;
}

.upgrade-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.upgrade-desc {
    font-size: 0.75rem;
    color: #666;
}

.upgrade-bar {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.upgrade-pip {
    width: 18px;
    height: 6px;
    background: #222;
    border-radius: 2px;
}

.upgrade-pip.filled {
    background: linear-gradient(135deg, #ffaa00, #ff6600);
}

.upgrade-action {
    flex-shrink: 0;
}

.btn-upgrade {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
}

.btn-maxed {
    background: #222;
    color: #555;
    cursor: default;
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 24px;
    z-index: 50;
    pointer-events: none;
}

#hud.hidden {
    display: none;
}

#hudLeft, #hudCenter, #hudRight {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#hudCenter {
    align-items: center;
}

#hudRight {
    align-items: flex-end;
}

#hudSpeed {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

#hudLevel {
    font-size: 0.9rem;
    color: #ffaa00;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

#hudDistance {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

#hudCoins {
    font-size: 1.2rem;
    color: #ffd700;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

#hudCoins::before {
    content: '\25C9 ';
}

#hudLives {
    font-size: 1.3rem;
    color: #ff3333;
    letter-spacing: 3px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

/* Level Banner */
#levelBanner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 80;
    pointer-events: none;
}

#levelBanner.hidden {
    display: none;
}

#levelBanner span {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: #ffaa00;
    text-shadow: 0 0 30px rgba(255, 170, 0, 0.6), 0 0 60px rgba(255, 170, 0, 0.3);
    animation: bannerPulse 0.6s ease-out;
}

@keyframes bannerPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
    .game-title { font-size: 2.8rem; }
    .game-over-title { font-size: 2.4rem; }
    .garage-title { font-size: 2rem; }
    .btn { font-size: 1rem; padding: 12px 20px; }
    #hudSpeed { font-size: 1.1rem; }
    #hudDistance { font-size: 1.2rem; }
}
