html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    color: white;
    font-family: 'Arial', sans-serif;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior: none;
    overflow: hidden;
}

#main-menu {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 50, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}

#main-menu h1 {
    font-size: 60px;
    color: #ffd700;
    text-shadow: 2px 2px 5px #000;
    margin-bottom: 30px;
    text-align: center;
}

.menu-box {
    background: #222;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    width: 80%;
    max-width: 300px;
}

.menu-btn {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 10px;
    width: 100%;
}

.menu-btn:hover {
    background: #ffea00;
}

.menu-box input, .menu-box select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: none;
    border-radius: 5px;
    background: #111;
    color: white;
    box-sizing: border-box;
}

#ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* safe area padding for notches */
    padding-top: env(safe-area-inset-top, 0px);
    background-color: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    box-sizing: content-box;
}

#scoreboard {
    display: flex;
    align-items: center;
    background-color: #222;
    border-radius: 8px;
    padding: 5px 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    width: 95%;
    max-width: 600px;
    justify-content: center;
}

.team {
    font-size: clamp(12px, 3.5vw, 20px);
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    text-shadow: 1px 1px 2px black;
}

.red-team { background-color: #cc0000; }
.blue-team { background-color: #0044cc; }

.score {
    font-size: clamp(18px, 5vw, 32px);
    font-weight: bold;
    margin: 0 8px;
    background-color: #000;
    padding: 5px 10px;
    border-radius: 4px;
}

.timer {
    font-size: clamp(12px, 3vw, 20px);
    color: #aaa;
    margin: 0 5px;
}

#game-wrapper {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    bottom: env(safe-area-inset-bottom, 0px);
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container canvas {
    display: block;
}

#ui-layer {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.hidden { display: none !important; opacity: 0; }

#goal-text {
    font-size: clamp(40px, 15vw, 100px);
    font-weight: bold;
    color: yellow;
    text-shadow: 4px 4px 0px red, 8px 8px 0px black;
    animation: goalPop 2s ease-in-out;
    text-align: center;
}

#toggle-emoji-btn {
    /* Positioned relative to #game-wrapper which is position:relative */
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background-color: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255,255,255,0.7);
    font-size: 22px;
    color: white;
    cursor: pointer;
    z-index: 500;
    touch-action: manipulation;
}

#emoji-panel {
    /* Positioned relative to #game-wrapper */
    position: absolute;
    bottom: 72px;
    right: 16px;
    background-color: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    width: 140px;
    gap: 4px;
    z-index: 500;
}

.emoji-btn {
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

.emoji-btn:active {
    transform: scale(1.3);
}

.floating-emoji {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
}

@keyframes floatUp {
    0% { top: 30px; opacity: 1; transform: translateX(-50%) scale(0.5); }
    20% { transform: translateX(-50%) scale(1.5); }
    100% { top: 150px; opacity: 0; transform: translateX(-50%) scale(1); }
}

@keyframes goalPop {
    0% { transform: scale(0.1); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}
