/* Shitty Rider v1.0 - Mobile First CSS */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

body {
    background: #0a0a0a;
    color: #fff;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Typography */
h1 {
    font-size: clamp(1.8rem, 8vw, 3rem);
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

h2 {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    color: #00ffff;
    margin-bottom: 0.5rem;
}

/* Container */
.container {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 300px;
    text-decoration: none;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    color: #0a0a0a;
}

.btn-secondary {
    background: linear-gradient(90deg, #ffcc00, #ff8800);
    color: #0a0a0a;
}

.btn-danger {
    background: linear-gradient(90deg, #ff4444, #ff0066);
    color: #fff;
}

.btn:hover, .btn:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

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

/* Form elements */
select, input {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
}

select:focus, input:focus {
    border-color: #00ff88;
    outline: none;
}

label {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 0.3rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

/* High Scores */
.high-scores {
    background: #111;
    border-radius: 12px;
    padding: 1rem;
    width: 100%;
    max-width: 350px;
    border: 2px solid #222;
}

.high-scores h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #222;
    font-family: monospace;
}

.score-row:last-child {
    border-bottom: none;
}

.score-row.gold { color: #ffd700; }
.score-row.silver { color: #c0c0c0; }
.score-row.bronze { color: #cd7f32; }

.score-rank { width: 30px; }
.score-initials { width: 50px; text-align: center; }
.score-points { flex: 1; text-align: right; }
.score-ride { width: 50px; text-align: center; color: #888; }
.score-date { width: 50px; text-align: right; color: #666; font-size: 0.85em; }

/* Leaderboard */
.leaderboard-section {
    background: #111;
    border-radius: 12px;
    padding: 1rem;
    width: 100%;
    max-width: 450px;
    border: 2px solid #222;
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.leaderboard-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.leaderboard-table .score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.3rem;
    border-bottom: 1px solid #222;
    font-family: monospace;
    font-size: 0.9rem;
}

.leaderboard-table .score-row:last-child {
    border-bottom: none;
}

.leaderboard-table .score-row.header {
    color: #666;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 2px solid #333;
}

/* Game Canvas */
.game-container {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Game UI Overlay */
.game-ui {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.score-display {
    font-family: monospace;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.trick-display {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: monospace;
    font-size: clamp(1rem, 4vw, 1.6rem);
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 15;
}

.speed-bar {
    width: 100px;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.speed-bar-fill {
    height: 100%;
    background: #00ff88;
    transition: width 0.1s;
}

/* Game Over */
.gameover-container {
    text-align: center;
    padding: 2rem;
}

.final-score {
    font-size: clamp(2rem, 10vw, 4rem);
    font-weight: bold;
    color: #00ffff;
    margin: 1rem 0;
    font-family: monospace;
}

.initials-input {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0;
}

.initials-input input {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    text-align: center;
    text-transform: uppercase;
    font-family: monospace;
    font-weight: bold;
}

.new-highscore {
    color: #ffd700;
    font-size: 1.2rem;
    animation: pulse 1s infinite;
}

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

/* Status messages */
.status {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
    min-height: 1.5rem;
}

.status.error { color: #ff4444; }
.status.success { color: #00ff88; }

/* Touch hint */
.touch-hint {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Desktop adjustments */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
        gap: 1.5rem;
    }

    .btn {
        padding: 1.2rem 2.5rem;
        font-size: 1.2rem;
    }

    .high-scores {
        max-width: 400px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0.5rem;
    }

    h1 {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .high-scores {
        max-width: 250px;
    }
}
