@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    margin: 0; padding: 0; background: #000; overflow: hidden;
}

#rf-app {
    margin: 0; padding: 0; 
    background: #111; 
    color: white;
    font-family: 'Press Start 2P', cursive, sans-serif;
    display: flex; justify-content: center; align-items: center;
    width: 100vw; height: 100vh;
    position: relative;
    overflow: hidden; touch-action: none;
    box-sizing: border-box;
    user-select: none;
}

/* Container becomes the fullscreen target now */
#rf-game-container {
    display: flex; flex-direction: row;
    width: 100%; height: 100%;
    max-width: 900px;
    background: #222;
    position: relative;
}
#rf-game-container:fullscreen {
    max-width: none; width: 100vw; height: 100vh;
    justify-content: center; /* Center content in fullscreen */
}

#rf-game-wrapper {
    position: relative; flex-grow: 2; height: 100%;
    overflow: hidden; background: #000;
}

#rf-gameCanvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* Sidebar UI */
#rf-sidebar {
    width: 170px; background: #000; border-left: 4px solid #555;
    display: flex; flex-direction: column; padding: 15px;
    box-sizing: border-box; justify-content: flex-start; gap: 10px;
    z-index: 5;
    overflow-y: auto; /* Just in case content is tall */
}

/* MINI MAP STYLES */
#rf-minimap-container {
    width: 100%; height: 120px;
    background: #111; border: 2px solid #555;
    margin-bottom: 5px; position: relative;
}
#rf-minimap {
    width: 100%; height: 100%; display: block;
}

.rf-panel { text-align: center; }
.rf-label { color: #5dade2; font-size: 10px; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }
.rf-value { color: #fff; font-size: 12px; text-shadow: 2px 2px 0 #d32f2f; line-height: 1.5; }

.rf-fuel-container {
    width: 25px; height: 60px; border: 2px solid #fff; margin: 0 auto;
    position: relative; background: #333;
}
#rf-fuel-bar {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, #d32f2f 10%, #f1c40f 40%, #2ecc71);
    transition: height 0.2s, background 0.2s;
}

/* Overlays */
.rf-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); display: flex; flex-direction: column;
    align-items: center; justify-content: center; z-index: 20;
    text-align: center;
}
.rf-hidden { display: none !important; }

/* Start Screen */
#rf-start-screen {
    background: linear-gradient(135deg, #1a0b0b 0%, #7f0000 50%, #1a0b0b 100%);
    border: 4px solid #f1c40f;
    box-shadow: inset 0 0 50px #000;
}
#rf-start-screen::before {
    content: ''; position: absolute; top: 0; left: 50%; width: 60px; height: 100%;
    background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 40px, transparent 40px, transparent 80px);
    transform: translateX(-50%); z-index: -1;
}

.rf-game-title { 
    font-size: 32px; color: #ffeb3b; text-transform: uppercase; 
    text-shadow: 4px 4px 0px #b71c1c, 0 0 20px rgba(255, 235, 59, 0.6);
    transform: skew(-10deg); margin-bottom: 30px; border-bottom: 4px solid #fff; padding-bottom: 10px;
    line-height: 1.4;
}

.rf-crash-text { color: #e74c3c; font-size: 32px; text-shadow: 3px 3px #000; }
.rf-blink { animation: rf-blink 1s infinite; font-size: 11px; margin-bottom: 20px; line-height: 1.5; color: #fff; }
@keyframes rf-blink { 50% { opacity: 0; } }

.rf-btn-group { display: flex; flex-direction: column; gap: 10px; }

.rf-main-btn {
    background: #e67e22; border: 4px solid #fff; color: #fff;
    padding: 12px 20px; font-family: inherit; font-size: 12px;
    cursor: pointer; text-transform: uppercase;
    box-shadow: 0 4px #d35400; transition: transform 0.1s;
}
.rf-main-btn:active { transform: translateY(4px); box-shadow: 0 2px #d35400; }

.rf-secondary-btn {
    background: #2980b9; border: 3px solid #fff; color: #fff;
    padding: 8px 15px; font-family: inherit; font-size: 10px;
    cursor: pointer; text-transform: uppercase; box-shadow: 0 4px #1abc9c;
}

.rf-control-btn {
    background: none; border: 2px solid #fff; color: #fff; 
    font-size: 10px; cursor: pointer; padding: 5px; width: 100%;
    margin-bottom: 5px; text-transform: uppercase;
}
.rf-control-btn:hover { background: rgba(255,255,255,0.2); }

#rf-player-name {
    background: #000; border: 4px solid #fff; color: #f1c40f;
    font-family: inherit; font-size: 24px; text-align: center;
    width: 120px; padding: 5px; text-transform: uppercase;
    margin-bottom: 15px; letter-spacing: 5px;
}
#rf-score-table {
    margin-top: 15px; width: 90%; max-width: 400px;
    border-collapse: collapse; font-size: 10px;
}
#rf-score-table th { color: #e74c3c; border-bottom: 2px solid #fff; padding: 5px; }
#rf-score-table td { color: #fff; padding: 5px; border-bottom: 1px solid #333; }
#rf-score-table tr:first-child td { color: #f1c40f; }

#rf-bonus-msg {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #f1c40f; font-size: 20px; text-shadow: 3px 3px #d32f2f;
    pointer-events: none; z-index: 15;
}
.rf-animate-bonus { animation: rf-floatUp 1.5s forwards; }
@keyframes rf-floatUp {
    0% { opacity: 1; top: 50%; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; top: 30%; transform: translate(-50%, -50%) scale(1.5); }
}

/* MOBILE LAYOUT & RESPONSIVE */
@media (max-width: 700px) {
    #rf-game-container { flex-direction: column; }
    #rf-game-wrapper { border-bottom: 4px solid #555; }
    
    #rf-sidebar { 
        width: 100%; height: auto; 
        flex-direction: row; border-left: none; padding: 5px; 
        justify-content: space-around; align-items: center; gap: 5px; flex-wrap: wrap;
    }
    
    /* Move Minimap to top-right of game area on mobile */
    #rf-minimap-container {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 50px;
        height: 100px;
        z-index: 10;
        margin: 0;
        background: rgba(0,0,0,0.6);
        border: 1px solid #fff;
    }

    .rf-label { display: none; }
    .rf-fuel-container { width: 40px; height: 8px; margin-top: 2px; }
    #rf-fuel-bar { background: linear-gradient(to right, #d32f2f 10%, #f1c40f 40%, #2ecc71); }
    .rf-game-title { font-size: 20px; }
    .rf-control-btn { width: auto; font-size: 16px; padding: 5px 10px; }
}