/**
 * ============================================================
 *  Road Rush Racer – css/ui.css
 *  Turbo Carbon Screen Styling & Glassmorphism
 * ============================================================
 */

/* ── Screen Containers ── */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: radial-gradient(circle at center, rgba(16, 16, 20, 0.6) 0%, rgba(5, 5, 8, 0.9) 100%);
    backdrop-filter: var(--glass-blur);
    padding: 80px 40px 40px 40px; /* Increased top padding for coin display */
}

.screen.active {
    display: flex;
    animation: slideUp 0.5s ease-out;
}

.screen-title {
    font-family: var(--font-head);
    font-size: 56px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: -2px;
    text-transform: uppercase;
    margin-top: 20px; /* Shift down further */
    margin-bottom: 40px;
    transform: var(--skew-val);
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.screen-title span {
    color: var(--c-accent);
    text-shadow: var(--glow-accent);
}

/* ── Main Menu ── */
#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 280px;
}

#menu-buttons .btn {
    justify-content: flex-start;
    padding-left: 30px;
    font-size: 18px;
}

.menu-top-right {
    position: absolute;
    top: env(safe-area-inset-top, 15px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px; /* More compact */
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px; /* Smaller padding */
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 101;
    transition: all 0.2s ease;
}

.menu-top-right:hover {
    background: rgba(0, 0, 0, 0.5);
}

.menu-top-right .hud-coin-icon {
    font-size: 14px; /* Smaller icon */
}

.menu-top-right span#menu-coins, 
.menu-top-right span#garage-coins {
    font-size: 14px; /* Smaller text */
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* ── Overlays (Pause, Daily Reward) ── */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.overlay.show {
    display: flex;
}

.card {
    background: var(--c-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 30px;
    width: 320px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    transform: var(--skew-val);
}

.card>* {
    transform: skewX(10deg);
}

/* Un-skew children */

/* ── Car Selection ── */
#car-select-screen {
    padding-top: 20px;
}

#car-preview-wrap {
    width: 100%;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

#car-preview-canvas {
    filter: drop-shadow(0 0 15px var(--c-accent-glow));
}

#car-stats {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--c-text-dim);
    font-weight: 800;
    letter-spacing: 1px;
}

.stat-meter {
    width: 180px;
    height: 12px;
    display: flex;
    gap: 3px;
}

.stat-bar-segment {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
}

.stat-bar-segment.active {
    background: var(--c-accent);
    box-shadow: 0 0 5px var(--c-accent-glow);
}

.car-price-tag {
    font-family: var(--font-head);
    font-weight: 900;
    font-size: 20px;
    color: var(--c-gold);
    margin-bottom: 20px;
}

/* ── HUD ── */
#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#hud.active {
    opacity: 1;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-score-label {
    font-size: 10px;
    color: var(--c-text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
}

.hud-score-value {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 900;
    font-style: italic;
    color: #fff;
    line-height: 1;
}

.hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-coin-icon {
    color: var(--c-gold);
    font-size: 18px;
}

.hud-coin-value {
    font-family: var(--font-head);
    font-weight: 900;
    font-size: 18px;
}

/* Dashboard Speed Gauge */
.hud-bottom-center {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.speed-gauge-wrap {
    position: relative;
    width: 140px;
    height: 70px;
    overflow: hidden;
}

.speed-gauge-bg {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--c-accent);
    transform: rotate(-45deg);
}

.speed-value {
    position: absolute;
    bottom: 5px;
    width: 100%;
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 900;
    font-style: italic;
    color: #fff;
    text-shadow: var(--glow-accent);
}

.speed-unit {
    font-size: 10px;
    color: var(--c-text-dim);
    text-transform: uppercase;
    display: block;
    margin-top: -5px;
}

/* ── Power-up HUD ── */
#powerup-timers {
    position: absolute;
    left: 20px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.powerup-bar-wrap {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.powerup-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    transition: width 0.1s linear;
}

/* ── Game Over Screen ── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 300px;
    margin-bottom: 40px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.stat-box-val {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 900;
    color: var(--c-accent);
}

.stat-box-lab {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.6;
}

/* ── Settings Controls ── */
.setting-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--c-accent);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* ── Leaderboard ── */
#leaderboard-table {
    width: 320px;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-bottom: 30px;
}

.lb-row {
    background: rgba(255, 255, 255, 0.03);
    transform: var(--skew-val);
    transition: transform 0.2s;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.lb-row td {
    padding: 10px 15px;
    font-family: var(--font-head);
    font-weight: 700;
}

.lb-row td:first-child {
    border-radius: 4px 0 0 4px;
    color: var(--c-accent);
    font-style: italic;
}

.lb-row td:last-child {
    border-radius: 0 4px 4px 0;
    text-align: right;
    color: var(--c-gold);
}

/* ── Modals / Daily Reward ── */
#name-input-overlay .card {
    border: 2px solid var(--c-accent);
}

#name-input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    text-align: center;
    margin: 20px 0;
    outline: none;
}

#name-input:focus {
    border-color: var(--c-accent);
}

/* ── Utility Classes (Migrated from inline) ── */
.flex-row-gap { display: flex; gap: 10px; }
.flex-col-gap { display: flex; flex-direction: column; gap: 10px; }
.flex-col-gap-l { display: flex; flex-direction: column; gap: 12px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.w-280 { width: 280px; }
.w-320 { width: 320px; }
.w-full { width: 100%; }
.grid-span-2 { grid-column: span 2; }
.color-gold { color: var(--c-gold); }
.color-accent { color: var(--c-accent); }

/* Specific Component Styles */
.pause-title { font-size: 32px; margin-bottom: 20px; }
.hs-subtitle { font-size: 18px; }
.dr-title { font-size: 24px; }
.dr-amount { font-size: 40px; }
.center-text { text-align: center; }