/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0f0f1e;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(180deg, #0f0f1e 0%, #1a1a2e 100%);
}

/* Screens */
.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

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

/* Start Screen */
.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
    margin-bottom: 10px;
}

.logo p {
    color: #888;
    font-size: 1rem;
    letter-spacing: 2px;
}

/* Buttons */
.btn {
    padding: 18px 50px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    color: white;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.2);
    margin-top: 15px;
}

/* Stats */
.stats {
    margin-top: 40px;
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    color: #ffa500;
    font-weight: bold;
}

.stat-label {
    color: #888;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* Game Screen */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* HUD */
#hud {
    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;
}

.hud-left, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score, .speed {
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.lives {
    font-size: 1.2rem;
}

/* Touch Controls */
#controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 20;
}

.control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
}

.control-btn.left, .control-btn.right {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.2);
}

.control-btn.boost {
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.5);
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.3);
}

.control-btn.boost:active {
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.8);
}

/* Game Over Screen */
#game-over-screen h2 {
    font-size: 2.5rem;
    color: #ff6b6b;
    margin-bottom: 30px;
}

.final-score {
    text-align: center;
    margin-bottom: 30px;
}

.final-score span:first-child {
    display: block;
    color: #888;
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}

#final-score {
    font-size: 3rem;
    color: #ffa500;
    font-weight: bold;
}

.medal {
    font-size: 4rem;
    margin-bottom: 30px;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* Install Prompt */
#install-prompt {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.9);
    padding: 15px 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.1);
}

#install-prompt span {
    color: #fff;
    font-size: 0.9rem;
}

#install-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

#dismiss-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 10px;
}

/* Responsive */
@media (min-width: 768px) {
    .logo h1 {
        font-size: 4rem;
    }
    
    .btn {
        padding: 20px 60px;
        font-size: 1.4rem;
    }
    
    .control-btn {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }
}

/* Landscape Mode Warning */
@media (orientation: landscape) and (max-height: 500px) {
    #game-container::before {
        content: "Please rotate to portrait mode 📱";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #1a1a2e;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 1.5rem;
        z-index: 1000;
    }
}
