/* ============================================
   1-Tap Runner - Main Styles
   ============================================ */

/* CSS Variables */
:root {
    --bg-dark: #001201;
    --bg-surface: #00420c;
    --bg-sky: #4a90a4;
    --bg-ground: #5d4e37;
    --character: #333333;
    --obstacle: #dc2626;
    --cashout: #22c55e;
    --cashout-light: #4ade80;
    --multiplier: #fad900;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --gold: #fad900;
    --gold-dark: #b8860b;
    --accent: #fad900;
    --accent-light: #fff8dc;
}

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

html {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent;
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    min-height: calc(100dvh - 3.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Screen states */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    z-index: 100;
}

.screen.hidden {
    display: none;
}

/* Loading Screen */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-surface);
    border-top-color: #fad900;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-screen p {
    margin-top: 20px;
    color: var(--text-secondary);
}

/* Login Screen */
.login-content {
    text-align: center;
    padding: 40px;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.login-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.login-content p {
    color: var(--text-secondary);
}

/* Game Container */
#game-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    padding-bottom: 20px;
}

#game-container.hidden {
    display: none;
}

/* Header */
#game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 10px;
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#balance-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
}

.balance-currency {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Stats Display */
#stats-display {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 10px;
}

.stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: 10px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

#multiplier-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
}

#distance-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Game Area */
#game-area {
    position: relative;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
}

/* Game Over Overlay */
#gameover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
}

#gameover-overlay.hidden {
    display: none;
}

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

.gameover-icon {
    display: block;
    font-size: 4rem;
    margin-bottom: 10px;
}

.gameover-title {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--obstacle);
    margin-bottom: 10px;
}

.gameover-distance {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

#final-distance {
    color: var(--text-primary);
    font-weight: 700;
}

/* Tap Hint */
#tap-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease infinite;
}

#tap-hint.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Action Buttons */
#action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#jump-button {
    flex: 1;
    padding: 20px;
    background: linear-gradient(135deg, #fad900 0%, #fff8dc 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

#jump-button:active {
    transform: scale(0.95);
}

#jump-button.hidden {
    display: none;
}

.jump-icon {
    font-size: 1.5rem;
}

.jump-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
}

#cashout-button {
    flex: 1;
    padding: 20px;
    background: linear-gradient(135deg, var(--cashout) 0%, var(--cashout-light) 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    animation: cashoutPulse 1s ease infinite;
}

@keyframes cashoutPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(34, 197, 94, 0.4); }
}

#cashout-button:active {
    transform: scale(0.95);
}

#cashout-button.hidden {
    display: none;
}

.cashout-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
}

#cashout-amount {
    font-size: 1.5rem;
    color: var(--gold);
}

/* Bet Controls */
#bet-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 10px;
}

#bet-controls.hidden {
    display: none;
}

.bet-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bet-buttons {
    display: flex;
    gap: 8px;
}

.amount-btn {
    padding: 10px 16px;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.amount-btn:hover {
    background: #003a0a;
}

.amount-btn.active {
    background: #fad900;
    border-color: #fff8dc;
    color: #001201;
}

.amount-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Start Button */
#start-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #fad900 0%, #fff8dc 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

#start-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(250, 217, 0, 0.4);
}

#start-button:disabled {
    background: var(--bg-dark);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#start-button.hidden {
    display: none;
}

/* Game Title */
.game-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    opacity: 0.6;
}

.title-icon {
    font-size: 1.5rem;
}

.title-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Win Display */
#win-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    padding: 25px 50px;
    border-radius: 20px;
    text-align: center;
    z-index: 50;
    opacity: 0;
    transition: all 0.3s ease;
}

#win-display.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#win-display.hidden {
    display: none;
}

.win-label {
    display: block;
    font-size: 1.2rem;
    color: var(--bg-dark);
    margin-bottom: 5px;
}

#win-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--bg-dark);
}

/* Message Display */
#message-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 12px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#message-display.visible {
    opacity: 1;
}

#message-display.hidden {
    display: none;
}

#message-text {
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particleFall 1.5s ease-out forwards;
}

@keyframes particleFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) rotate(720deg);
    }
}

/* Responsive */
@media (max-width: 380px) {
    .amount-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    #multiplier-value,
    #distance-value {
        font-size: 1.4rem;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}

#start-button { color: oklch(0.24 0.04 150); }
