html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #222;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    box-shadow: none;
    background-color: #008000; /* Green grass base */
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas if needed, though we use keyboard */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.menu-overlay {
    background-color: rgba(0, 0, 0, 0.85);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    color: white;
    pointer-events: auto;
    /* Scale based on game scale */
    transform: scale(var(--game-scale, 1));
    transform-origin: center;
    /* Fixed layout width for consistent scaling */
    width: 1000px;
}

.menu-title {
    font-size: 64px;
    margin-bottom: 30px;
    color: #fff;
    text-shadow: 0 0 20px #4facfe;
}

.menu-items-list {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    min-width: 800px;
}

#rotate-message {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    color: white;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-size: 24px;
    text-align: center;
}

.rotate-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

@media screen and (orientation: portrait) {
    #rotate-message {
        display: flex;
    }
}

.menu-item {
    font-size: 28px;
    margin: 5px;
    padding: 10px 20px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-items-list .menu-item {
    width: 100%;
    max-width: 400px;
    margin: 10px 0;
}

.menu-item.selected {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    color: #ffcc00;
    transform: scale(1.05);
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 24px;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
}

.power-bar-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 30px;
    background-color: rgba(0,0,0,0.5);
    border: 2px solid white;
    border-radius: 15px;
    overflow: hidden;
}

.power-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, lime, yellow, red);
}

#course-creator-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#course-creator-warning-overlay.hidden {
    display: none;
}

.overlay-content {
    background: #333;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    max-width: 80%;
    border: 3px solid #00AAFF;
}

.overlay-content h2 {
    color: #00AAFF;
    margin-bottom: 20px;
    font-size: 2em;
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.5;
}

.scannable-options {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.scannable-options button {
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    background: #444;
    color: white;
    border: 2px solid #666;
    border-radius: 8px;
    transition: all 0.2s;
}

.scannable-options button.scanned {
    border-color: #00AAFF;
    background: #005f99;
    transform: scale(1.05);
}

.scannable-options button:hover {
    background: #555;
}
