/* ==========================================================================
   SUBWAY SURFERS 3D WEB EDITION - DESIGN SYSTEM & UI STYLES
   ========================================================================== */

:root {
    --bg-dark: #0a0c16;
    --primary-neon: #ff0055;
    --secondary-neon: #00f0ff;
    --yellow-gold: #ffc700;
    --green-accent: #00ff66;
    --purple-accent: #9d00ff;

    --glass-bg: rgba(13, 16, 33, 0.75);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(16px);

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-neon-pink: 0 0 20px rgba(255, 0, 85, 0.5);
    --shadow-neon-blue: 0 0 20px rgba(0, 240, 255, 0.5);
    --shadow-gold: 0 0 15px rgba(255, 199, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-heading);
    color: #ffffff;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* 3D Canvas */
#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Dynamic Screen Vignette & FX Overlay */
.screen-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
    z-index: 5;
}

.flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.flash-overlay.coin-flash {
    background: radial-gradient(circle, rgba(255, 199, 0, 0.3) 0%, rgba(255, 199, 0, 0) 70%);
    opacity: 1;
}

.flash-overlay.powerup-flash {
    background: radial-gradient(circle, rgba(0, 240, 255, 0.4) 0%, rgba(0, 240, 255, 0) 70%);
    opacity: 1;
}

.flash-overlay.crash-flash {
    background: radial-gradient(circle, rgba(255, 0, 85, 0.6) 0%, rgba(255, 0, 85, 0) 80%);
    opacity: 1;
}

/* ==========================================================================
   HUD (HEADS-UP DISPLAY) STYLES
   ========================================================================== */

.hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-header {
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    padding: 10px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.score-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 20px;
    min-width: 140px;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1.5px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.multiplier-badge {
    background: linear-gradient(135deg, var(--primary-neon), #ff5500);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.2rem;
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-neon-pink);
    animation: pulseGlow 1.5s infinite alternate;
}

.coin-card {
    border-color: rgba(255, 199, 0, 0.4);
}

.coin-icon {
    color: var(--yellow-gold);
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(255, 199, 0, 0.8));
}

.hud-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.hud-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Powerup Timers HUD Grid */
.powerup-timers-container {
    position: absolute;
    top: 90px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 220px;
}

.powerup-timer-bar {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.powerup-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.powerup-name {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 2;
}

.powerup-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100%;
    background: rgba(0, 240, 255, 0.3);
    z-index: 1;
    transition: width 0.1s linear;
}

.hoverboard-hud {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

.hoverboard-badge {
    background: linear-gradient(90deg, #00f0ff, #9d00ff);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 8px 20px;
    border-radius: 20px;
    letter-spacing: 1px;
    box-shadow: var(--shadow-neon-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   TOUCH CONTROLS FOR MOBILE
   ========================================================================== */

.touch-controls-container {
    position: absolute;
    bottom: 25px;
    right: 25px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.85;
}

.touch-row {
    display: flex;
    gap: 8px;
}

.touch-btn {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(13, 16, 33, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.1s, transform 0.1s;
}

.touch-btn:active {
    background: var(--secondary-neon);
    color: #000000;
    transform: scale(0.92);
}

.board-btn {
    width: 80px;
    font-size: 0.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(157, 0, 255, 0.6), rgba(0, 240, 255, 0.6));
}

/* Hide touch controls on high resolution desktop unless active */
@media (min-width: 1024px) {
    .touch-controls-container {
        display: none;
    }
}

/* ==========================================================================
   OVERLAY SCREENS & GLASS CARDS
   ========================================================================== */

.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(6, 8, 18, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    border-radius: 24px;
    padding: 35px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Game Title & Logo Header */
.game-logo-container {
    margin-bottom: 25px;
}

.logo-subtitle {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--secondary-neon);
    display: block;
    margin-bottom: 4px;
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -1px;
    background: linear-gradient(180deg, #ffffff 30%, #ffc700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 15px rgba(255, 199, 0, 0.4));
}

.highlight-text {
    background: linear-gradient(180deg, var(--primary-neon) 20%, #ff5500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 15px rgba(255, 0, 85, 0.5));
}

.logo-subline {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
}

/* Score Banners */
.high-score-banner {
    background: rgba(255, 199, 0, 0.1);
    border: 1px solid rgba(255, 199, 0, 0.3);
    border-radius: 16px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.trophy-icon {
    font-size: 2rem;
    color: var(--yellow-gold);
    filter: drop-shadow(0 0 10px var(--yellow-gold));
}

.high-score-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

.high-score-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--yellow-gold);
}

.menu-coin-total {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 1.4rem;
}

/* Action Buttons */
.menu-buttons,
.pause-buttons,
.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: 16px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-neon), #ff5500);
    color: #ffffff;
    box-shadow: var(--shadow-neon-pink);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255, 0, 85, 0.7);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(255, 0, 85, 0.2);
    color: var(--primary-neon);
    border: 1px solid rgba(255, 0, 85, 0.4);
}

.btn-danger:hover {
    background: rgba(255, 0, 85, 0.4);
    color: #ffffff;
}

.pulse-btn {
    animation: pulseScale 2s infinite ease-in-out;
}

/* Controls Guide */
.controls-guide {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 14px;
    padding: 15px;
    text-align: left;
}

.controls-guide h3 {
    font-size: 0.85rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.key-item {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.key {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

/* ==========================================================================
   SHOP / GARAGE MODAL STYLES
   ========================================================================== */

.shop-card {
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 25px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 0, 85, 0.5);
}

.shop-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 199, 0, 0.15);
    border: 1px solid rgba(255, 199, 0, 0.3);
    padding: 8px 16px;
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 15px;
}

.shop-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.shop-tab {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.shop-tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.shop-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.shop-tab-content {
    display: none;
}

.shop-tab-content.active {
    display: block;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.shop-item-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.shop-item-card.equipped {
    border-color: var(--green-accent);
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.3);
}

.shop-item-card:hover {
    transform: translateY(-3px);
}

.item-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.item-name {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;

}

.item-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    margin-top: auto;
}

.item-btn.buy {
    background: var(--yellow-gold);
    color: #000000;
}

.item-btn.equip {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.item-btn.equipped-btn {
    background: var(--green-accent);
    color: #000000;
    cursor: default;
}

/* Upgrades List */
.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upgrade-row {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.upgrade-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upgrade-icon {
    font-size: 1.5rem;
    color: var(--secondary-neon);
}

.upgrade-title {
    font-weight: 800;
    font-size: 0.9rem;
}

.upgrade-level {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   GAME OVER MODAL STYLES
   ========================================================================== */

.new-score-badge {
    background: linear-gradient(90deg, #ffc700, #ff5500);
    color: #000000;
    font-weight: 900;
    font-size: 0.9rem;
    padding: 6px 16px;
    border-radius: 20px;
    width: fit-content;
    margin: 0 auto 15px auto;
    box-shadow: var(--shadow-gold);
    animation: bounce 1s infinite alternate;
}

.game-over-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-neon);
    text-shadow: var(--shadow-neon-pink);
    margin-bottom: 20px;
}

.game-over-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.final-stat-box {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 14px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.final-stat-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
}

.coin-text {
    color: var(--yellow-gold);
}

/* Custom Scrollbar for Shop */
.shop-body::-webkit-scrollbar {
    width: 6px;
}

.shop-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.shop-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Keyframe Animations */
@keyframes pulseGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
    }

    100% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(255, 0, 85, 0.9);
    }
}

@keyframes pulseScale {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-6px);
    }
}