#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: none; /* Let clicks pass through to canvas */
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes bounceIn {
    0% { transform: scale(0.1) translate(-50%, -50%); opacity: 0; }
    60% { transform: scale(1.2) translate(0, 0); opacity: 1; }
    100% { transform: scale(1) translate(0, 0); }
}

@keyframes bounceOut {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(1.5) translate(150%, 0); opacity: 0; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.blink {
    animation: blink 2s infinite ease-in-out;
}

/* Base Buttons */
button {
    padding: calc(10px * var(--ui-scale)) calc(16px * var(--ui-scale));
    font-size: calc(0.9rem * var(--ui-scale));
    border: none;
    border-radius: calc(8px * var(--ui-scale));
    background-color: var(--secondary-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    pointer-events: all;
    font-weight: bold;
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    background-color: #555;
}

button:hover, button:focus {
    background-color: var(--btn-color, var(--accent-color));
    outline: none;
}

button:active {
    transform: scale(0.95);
}

.menu-btn {
    flex: 1;
    padding: calc(8px * var(--ui-scale)) calc(4px * var(--ui-scale));
    white-space: normal;
    overflow: hidden;
    text-align: center;
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(44px * var(--ui-scale));
    font-size: calc(0.85rem * var(--ui-scale));
}

.menu-btn.icon-only {
    flex: 0 0 auto;
    padding: calc(10px * var(--ui-scale));
    width: calc(44px * var(--ui-scale));
    height: calc(44px * var(--ui-scale));
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.menu-btn.icon-only svg {
    width: 1.5em;
    height: 1.5em;
}

.icon-btn svg {
    width: 100%;
    height: 100%;
}

/* Replay Container */
#replay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#player-root {
    width: 100%;
    height: 100%;
}

#close-replay-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 101;
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}