body {
    margin: 0;
    overflow: hidden;
    background-color: #333;
    font-family: 'Arial', sans-serif;
    color: white;
}

canvas {
    display: block;
    background-color: #708D81;
}

/* Main Menu Styles */
#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex; /* Use flexbox for layout */
    background-color: #333; /* Fallback for transparency */
}

#menu-simulation-container {
    flex: 1; /* Takes 50% of the width */
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #708D81; /* World color for the simulation canvas */
}

#menuSimulationCanvas {
    /* The canvas will fill its container, so its dimensions will be set by JS */
    width: 100%;
    height: 100%;
}

#menu-buttons-container {
    flex: 1; /* Takes the other 50% of the width */
    height: 100%;
    background-color: #444; /* Solid color part */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#main-menu h1 {
    font-size: 3.6em;
    margin-bottom: 8px;
    color: #0081A7;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Small version label under the main title */
#menu-buttons-container .version {
    font-size: 0.9em;
    color: #cfeff6;
    margin-bottom: 42px;
    opacity: 0.9;
}

#menu-buttons-container button {
    width: 70%;
    padding: 15px 25px;
    margin: 10px 0;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    background-color: #F07167; /* A red-orange button color */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#menu-buttons-container button:hover {
    background-color: #E06157;
    transform: translateY(-2px);
}

#menu-buttons-container button:active {
    background-color: #C04137;
    transform: translateY(0);
}

/* Game UI styles (initially hidden) */
canvas#gameCanvas.hidden,
#ui-container.hidden,
#main-menu.hidden { /* Added main-menu.hidden */
    display: none;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#joystick-area {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    pointer-events: auto;
}

#joystick-base {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#joystick-nub {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#action-button-area {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#shoot-button {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: rgba(255, 80, 80, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 18px;
    font-weight: bold;
    user-select: none;
    -webkit-user-select: none; /* for Safari */
}

#shoot-button:active {
    background-color: rgba(255, 50, 50, 0.9);
}

#score-container {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 5px;
}

#respawn-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#respawn-overlay.hidden {
    display: none;
}

#respawn-box {
    text-align: center;
}

#respawn-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
}

@media (pointer: fine) {
    #joystick-area, #action-button-area {
        display: none;
    }
}

/* Small changelog button in top-left of the gray menu area */
#menu-buttons-container {
    flex: 1; /* Takes the other 50% of the width */
    height: 100%;
    background-color: #444; /* Solid color part */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    position: relative; /* allow absolute children */
}

#changelog-button.tiny {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 80px;
    padding: 2px 8px;
    font-size: 0.72em;
    background: #2f2f2f;
    color: #f1f1f1;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    cursor: pointer;
    box-shadow: none;
    height: auto;
    line-height: 1;
    text-align: center;
    overflow: hidden;
}

/* Discord top-right link */
#discord-link {
    position: absolute;
    top: 12px;
    right: 12px;
    display: block;
    width: 110px; /* small */
    height: auto;
    z-index: 30;
}
#discord-link img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Changelog overlay */
#changelog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#changelog-overlay.hidden {
    display: none;
}

#changelog-box {
    background: #2f2f2f;
    padding: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    color: white;
    min-width: 300px;
    text-align: left;
}

#changelog-box h2 {
    margin-top: 0;
    color: #F07167;
}

.changelog-text {
    background: rgba(255,255,255,0.03);
    padding: 8px;
    border-radius: 6px;
    color: #dfeff3;
    white-space: pre-wrap;
}

/* Settings overlay */
#settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#settings-overlay.hidden {
    display: none;
}

#settings-box {
    background: #2f2f2f;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    color: white;
    min-width: 260px;
    text-align: left;
}

#settings-box h2 {
    margin-top: 0;
    color: #F07167;
}

#settings-box label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

#settings-box button {
    margin-top: 16px;
    padding: 8px 12px;
    background: #0081A7;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}