/**
 * JUMP DASH - Styles
 * Complete styling for the game UI
 */

/* =============================================================================
   FONTS & RESET
   ============================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

/* =============================================================================
   BASE STYLES
   ============================================================================= */
body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    color: #fff;
}

/* =============================================================================
   GAME WRAPPER
   ============================================================================= */
.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 900px;
    padding: 20px;
}

.game-title {
    text-align: center;
    margin-bottom: 15px;
}

.game-title h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.5));
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* =============================================================================
   GAME CONTAINER & CANVAS
   ============================================================================= */
.game-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 70vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 0 0 4px #fff,
        0 0 0 8px #ff6b6b,
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(255, 107, 107, 0.3);
}

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

/* =============================================================================
   UI OVERLAY (HUD)
   ============================================================================= */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.score-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #feca57;
}

.score-display .label {
    font-size: 8px;
    color: #feca57;
    margin-bottom: 5px;
}

.score-display .value {
    font-size: 16px;
    color: #fff;
}

.stats-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.coins-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #feca57;
}

.coin-icon {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #ff8c00);
    border-radius: 50%;
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3);
}

.coins-value {
    font-size: 14px;
    color: #ffd700;
}

/* =============================================================================
   COMBO DISPLAY
   ============================================================================= */
.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    padding: 12px 20px;
    border-radius: 10px;
    transition: transform 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 15;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.5);
}

.combo-display.active {
    transform: translate(-50%, -50%) scale(1);
}

.combo-text {
    font-size: 14px;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

/* =============================================================================
   POWERUP INDICATOR
   ============================================================================= */
.powerup-indicator {
    background: rgba(72, 219, 251, 0.9);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 8px;
    color: #fff;
    display: none;
    animation: pulse 0.5s ease infinite alternate;
}

.powerup-indicator.active {
    display: block;
}

@keyframes pulse {
    from { transform: scale(1); opacity: 0.9; }
    to { transform: scale(1.05); opacity: 1; }
}

/* =============================================================================
   MODE TIMER & GOAL
   ============================================================================= */
#modeTimer,
#modeGoal {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    color: #48dbfb;
    border: 2px solid #48dbfb;
}

#modeGoal {
    top: 100px;
    color: #ff9ff3;
    border-color: #ff9ff3;
}

.hidden {
    display: none !important;
}

/* =============================================================================
   MENU OVERLAY (All Screens)
   ============================================================================= */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
}

.screen.hidden {
    display: none;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
.title {
    font-size: clamp(1.5rem, 6vw, 3rem);
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    color: #888;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-align: center;
}

/* =============================================================================
   MODE SELECTION
   ============================================================================= */
.mode-select {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 500px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
}

.mode-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.mode-name {
    font-size: 8px;
    color: #fff;
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 6px;
    color: #888;
}

/* =============================================================================
   DIFFICULTY SELECTION
   ============================================================================= */
.difficulty-select {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.difficulty-btn.active {
    background: rgba(254, 202, 87, 0.2);
    border-color: #feca57;
    color: #feca57;
}

/* =============================================================================
   TIME/VARIANT OPTIONS
   ============================================================================= */
.time-options,
.sprint-options,
.coin-rush-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.time-label {
    font-size: 8px;
    color: #888;
}

.time-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 8px 12px;
    background: rgba(72, 219, 251, 0.1);
    border: 2px solid rgba(72, 219, 251, 0.3);
    border-radius: 6px;
    color: #48dbfb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-btn:hover {
    background: rgba(72, 219, 251, 0.2);
}

.time-btn.active {
    background: rgba(72, 219, 251, 0.3);
    border-color: #48dbfb;
    box-shadow: 0 0 10px rgba(72, 219, 251, 0.3);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7rem, 2vw, 1rem);
    padding: 15px 40px;
    background: linear-gradient(180deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow:
        0 6px 0 #c44444,
        0 10px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #c44444,
        0 12px 25px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #c44444,
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn.secondary {
    background: linear-gradient(180deg, #666 0%, #555 100%);
    box-shadow:
        0 6px 0 #333,
        0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn.secondary:hover {
    box-shadow:
        0 8px 0 #333,
        0 12px 25px rgba(0, 0, 0, 0.4);
}

.btn-small {
    font-size: 10px;
    padding: 12px 24px;
}

.btn-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* =============================================================================
   MENU NAVIGATION
   ============================================================================= */
.menu-nav {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.menu-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
}

.menu-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
}

.menu-nav-icon {
    font-size: 20px;
}

/* =============================================================================
   CONTROLS HINT
   ============================================================================= */
.controls-hint {
    margin-top: 30px;
    font-size: 8px;
    color: #666;
    line-height: 2;
    text-align: center;
}

.controls-hint span {
    display: inline-block;
    background: #333;
    padding: 5px 10px;
    border-radius: 5px;
    color: #fff;
    margin: 0 3px;
}

/* =============================================================================
   GAME OVER / VICTORY SCREEN
   ============================================================================= */
.final-score {
    font-size: clamp(1rem, 4vw, 1.8rem);
    color: #feca57;
    margin: 20px 0;
    text-shadow: 0 0 20px rgba(254, 202, 87, 0.5);
}

.new-record {
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    color: #ff9ff3;
    animation: rainbow 1s ease infinite;
    margin-bottom: 20px;
}

@keyframes rainbow {
    0%, 100% { color: #ff6b6b; text-shadow: 0 0 20px rgba(255, 107, 107, 0.8); }
    25% { color: #feca57; text-shadow: 0 0 20px rgba(254, 202, 87, 0.8); }
    50% { color: #48dbfb; text-shadow: 0 0 20px rgba(72, 219, 251, 0.8); }
    75% { color: #ff9ff3; text-shadow: 0 0 20px rgba(255, 159, 243, 0.8); }
}

.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.stat {
    text-align: center;
    min-width: 70px;
}

.stat-value {
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    color: #48dbfb;
    text-shadow: 0 0 10px rgba(72, 219, 251, 0.5);
}

.stat-label {
    font-size: 6px;
    color: #666;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* =============================================================================
   BOTTOM STATS BAR
   ============================================================================= */
.bottom-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
    padding: 10px;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-label {
    font-size: 8px;
    color: #888;
    margin-bottom: 5px;
}

.stat-item .stat-value {
    font-size: 14px;
    color: #feca57;
}

/* =============================================================================
   SETTINGS SCREEN
   ============================================================================= */
.settings-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 400px;
}

.settings-section-title {
    font-size: 10px;
    color: #feca57;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

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

.setting-label {
    font-size: 8px;
    color: #ccc;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-value {
    font-size: 8px;
    color: #48dbfb;
    min-width: 40px;
    text-align: right;
}

/* Range slider styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Select styling */
select {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
}

select option {
    background: #1a1a2e;
}

/* Checkbox styling */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}

input[type="checkbox"]:checked {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
}

/* =============================================================================
   THEME GRID
   ============================================================================= */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.theme-btn.active {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.3);
}

.theme-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.theme-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.theme-name {
    font-size: 6px;
    color: #888;
    font-family: 'Press Start 2P', cursive;
}

/* =============================================================================
   LEADERBOARD SCREEN
   ============================================================================= */
.leaderboard-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-entry.new {
    background: rgba(255, 107, 107, 0.2);
    border-radius: 6px;
}

.leaderboard-entry .rank {
    font-size: 12px;
    color: #feca57;
    min-width: 40px;
}

.leaderboard-entry .score {
    font-size: 12px;
    color: #fff;
    flex: 1;
    text-align: center;
}

.leaderboard-entry .distance {
    font-size: 8px;
    color: #48dbfb;
    min-width: 60px;
    text-align: center;
}

.leaderboard-entry .date {
    font-size: 6px;
    color: #666;
    min-width: 60px;
    text-align: right;
}

.no-scores {
    text-align: center;
    color: #666;
    font-size: 10px;
    padding: 30px;
}

/* =============================================================================
   ACHIEVEMENTS SCREEN
   ============================================================================= */
.achievement-progress {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.achievement-progress-text {
    font-size: 8px;
    color: #888;
    margin-bottom: 8px;
    text-align: center;
}

.achievement-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.achievement-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #feca57);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.achievements-panel {
    width: 100%;
    max-width: 500px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.achievement-item.unlocked {
    border-color: #feca57;
    background: rgba(254, 202, 87, 0.1);
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-item .achievement-icon {
    font-size: 24px;
}

.achievement-item .achievement-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.achievement-item .achievement-name {
    font-size: 8px;
    color: #fff;
}

.achievement-item .achievement-desc {
    font-size: 6px;
    color: #888;
}

/* =============================================================================
   ACHIEVEMENT POPUP
   ============================================================================= */
#achievementPopup {
    position: fixed;
    top: 20px;
    right: -300px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(254, 202, 87, 0.95), rgba(255, 159, 67, 0.95));
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#achievementPopup.show {
    right: 20px;
}

#achievementPopup .achievement-icon {
    font-size: 32px;
}

#achievementPopup .achievement-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#achievementPopup .achievement-title {
    font-size: 6px;
    color: rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#achievementPopup .achievement-name {
    font-size: 10px;
    color: #000;
}

#achievementPopup .achievement-desc {
    font-size: 7px;
    color: rgba(0, 0, 0, 0.7);
}

/* =============================================================================
   TOUCH ZONE
   ============================================================================= */
.touch-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
}

/* =============================================================================
   SCROLLBAR STYLING
   ============================================================================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 107, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 107, 0.7);
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */
@media (max-width: 600px) {
    .game-wrapper {
        padding: 10px;
    }

    .ui-overlay {
        padding: 10px;
    }

    .score-display .value {
        font-size: 12px;
    }

    .coins-value {
        font-size: 10px;
    }

    .mode-select {
        gap: 6px;
    }

    .mode-btn {
        padding: 8px 12px;
        min-width: 70px;
    }

    .mode-icon {
        font-size: 18px;
    }

    .mode-name {
        font-size: 6px;
    }

    .menu-nav {
        flex-wrap: wrap;
        gap: 10px;
    }

    .stats {
        gap: 10px;
    }

    .settings-section {
        padding: 15px;
    }

    input[type="range"] {
        width: 80px;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.screen:not(.hidden) {
    animation: fadeIn 0.3s ease;
}
