:root {
    --bg-color: #87CEEB;
    --ground-color: #8B4513;
    --ui-text-color: #333;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at top, #fff7e6, #ffe0b2);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#app-bar {
    height: 80px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
    z-index: 1500;
    position: relative;
}

.app-bar-content {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.app-bar-logo {
    height: 50px;
    width: auto;
}

.app-bar-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

#info-container {
    height: 80px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-shrink: 0;
    z-index: 1400;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.info-item {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    display: flex;
    gap: 10px;
    align-items: center;
}

.info-label {
    color: #555;
    font-size: 1rem;
}

#info-level-display {
    cursor: pointer;
    text-decoration: underline;
}

#game-container {
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    /* Ensure the game fits within the viewport both horizontally and vertically */
    /* Aspect ratio 800/800 = 1 */
    width: min(100%, calc(100vh - 160px));
    margin: auto;
}

canvas {
    background-color: var(--bg-color);
    display: block;
    width: 100%;
    height: auto;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas */
}

#toast-container {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
    width: min(240px, 80%);
    z-index: 2200;
}

.emoji-toast {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.emoji-toast.show {
    opacity: 1;
    transform: translateY(0);
}


/* Score board styles removed */

#game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    pointer-events: auto; /* Re-enable clicks for buttons */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hidden {
    display: none !important;
}

h2 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 2em;
}

button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #d35400;
}

.message-subtext {
    font-size: 0.85rem;
    color: #5c6b7a;
    line-height: 1.4;
    white-space: pre-line;
}

#main-menu, #multiplayer-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    min-width: 340px;
}

#main-menu {
    background-image: url('../assets/logo-cannon-chaos-party.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: min(90vw, 720px);
    height: min(80vh, 520px);
    justify-content: space-between;
}

#multiplayer-placeholder {
    background: rgba(255, 255, 255, 0.95);
}

#menu-canvas {
    display: none;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: auto;
}

.menu-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
}

.main-title {
    font-size: 3.2rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 18px rgba(255,140,0,0.9);
    margin: 0;
}

/* HUD Styles */
#game-hud {
    position: fixed;
    top: 160px;
    left: 0;
    z-index: 2000;
    pointer-events: none; /* Allow clicks to pass through wrapper */
    width: 100%;
    height: calc(100% - 160px);
}

#hud-toggle-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: transform 0.2s;
    color: #333;
    padding: 0;
}

#hud-toggle-btn:hover {
    transform: scale(1.1);
    background: white;
}

#emoji-menu {
    position: absolute;
    top: 60px;
    left: 10px;
    pointer-events: none;
    z-index: 0; /* Keep below HUD panel and toggle button */
}

#emoji-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    pointer-events: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

#emoji-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

#emoji-dropdown {
    position: absolute;
    top: 48px;
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    pointer-events: auto;
    min-width: 200px;
}

#emoji-dropdown.hidden {
    display: none !important;
}

.emoji-option {
    background: #f7f7f7;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 8px;
    font-size: 1.35rem;
    padding: 6px 0;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.emoji-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#hud-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

#hud-panel.expanded {
    transform: translateX(0);
}

.hud-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    gap: 15px;
}

.hud-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.hud-logo {
    max-width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: contain;
}

.hud-game-title {
    font-weight: bold;
    font-size: 1.3rem;
    color: #d35400;
    text-align: center;
    width: 100%;
}

.hud-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.hud-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0 5px;
}

.hud-close:hover {
    color: #333;
    background: none;
}

.hud-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hud-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.hud-label {
    font-weight: 600;
    color: #555;
}

.hud-value {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1rem;
}

.hud-action-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.hud-action-btn:hover {
    background: #2980b9;
}

.hud-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #95a5a6;
}

.room-code-btn {
    background: #27ae60;
    font-family: monospace;
    font-size: 1rem;
}

.room-code-btn:hover {
    background: #219150;
}

.copy-feedback {
    font-size: 0.8rem;
    color: #27ae60;
    width: 100%;
    text-align: center;
    display: none;
}

.hud-footer {
    padding: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

#leave-room-btn {
    background: #e74c3c;
}

#leave-room-btn:hover {
    background: #c0392b;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #hud-panel {
        width: 85%;
        max-width: 300px;
    }
    #countdown-text {
        font-size: 6rem;
    }
}

/* Countdown Overlay */
#countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 200;
    pointer-events: all; /* Block interaction */
}

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

#countdown-text {
    font-size: 12rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 4px 4px 0 #000, 
                 -1px -1px 0 #000,  
                 1px -1px 0 #000,
                 -1px 1px 0 #000,
                 1px 1px 0 #000;
    font-family: 'Arial Black', sans-serif;
    /* Animation will be handled by JS or simple CSS keyframes */
}

.countdown-animate {
    animation: countdown-pop 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes countdown-pop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}


���䴩�o�ӭn�D�C
