body {
    margin: 0;
    background: #222;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#game-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 600px;
    /* Force wrapper size to base dimensions */
    height: 920px;
    transform-origin: top left;
}

#game-container {
    position: relative;
    width: 600px;
    height: 800px;
    border: 4px solid #333;
    background: #0044cc;
    /* Deep River Water */
}

#ui-panel {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 0;
    z-index: 10;
    font-weight: bold;
}

#gameCanvas {
    display: block;
}

/* Question Overlay */
#question-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    color: #333;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    width: 80%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    z-index: 20;
}

.hidden {
    display: none;
}

#options {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.option-btn {
    flex: 1;
    padding: 15px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background: #f1c40f;
    /* Yellow */
    color: #333;
    /* Dark text for contrast */
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
}

.option-btn:hover {
    background: #f39c12;
    /* Darker yellow on hover */
}

.fuel-bar-container {
    width: 100px;
    height: 15px;
    background: #444;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 3px;
}

.level-bar-container {
    width: 250px;
    height: 15px;
    background: #444;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 3px;
}

#fuel-fill {
    width: 100%;
    height: 100%;
    background: #f1c40f;
    transition: width 0.3s;
}

.bars-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.bar-label {
    display: flex;
    font-size: 14px;
    align-items: center;
    gap: 10px;
}

#level-fill {
    width: 0%;
    height: 100%;
    background: #3498db;
    /* Default Level 1 color */
    transition: width 0.3s, background 0.3s;
}

/* Win Overlay */
#win-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(46, 204, 113, 0.95);
    color: #fff;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    width: 80%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    z-index: 30;
    backdrop-filter: blur(5px);
}

#win-overlay h1 {
    font-size: 4em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#win-overlay h2 {
    font-size: 2.5em;
    margin: 10px 0 30px 0;
}

#restart-btn {
    padding: 15px 30px;
    font-size: 20px;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: #f1c40f;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

#restart-btn:hover {
    transform: scale(1.1);
    background: #f39c12;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    z-index: 25;
}

/* Game Over Overlay */
#game-over-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(192, 57, 43, 0.95);
    color: #fff;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    width: 80%;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    z-index: 30;
    backdrop-filter: blur(5px);
}

#game-over-overlay h1 {
    font-size: 4em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#game-over-overlay h2 {
    font-size: 2.5em;
    margin: 10px 0 30px 0;
}

#restart-btn-over {
    padding: 15px 30px;
    font-size: 20px;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: #f1c40f;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

#restart-btn-over:hover {
    transform: scale(1.1);
    background: #f39c12;
}

/* On-Screen Touch Controls */
#touch-controls {
    width: 600px;
    display: flex;
    justify-content: space-between;
    padding: 15px 10px;
    box-sizing: border-box;
    z-index: 15;
}

.left-controls button,
.right-controls button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #fff;
    font-size: 24px;
    font-weight: bold;
    color: white;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5), 0 10px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.left-controls button:active,
.right-controls button:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 rgba(0, 0, 0, 0.5), 0 4px 4px rgba(0, 0, 0, 0.3);
}

#fire-btn {
    background: #e74c3c;
    /* Red FIRE button */
}

.right-controls {
    display: flex;
    gap: 15px;
}

.right-controls button {
    background: #34495e;
}