body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* HUD Overlay */
.hud_container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to 3D canvas */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Top Panel */
.info_panel {
    /* background: rgba(0, 0, 0, 0.6); */
    /* color: white; */
    padding: 10px;
    text-align: left;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: start;
}

.pot_display {
    font-size: 1.5em;
    font-weight: bold;
    color: #ffd700;
}

.game_message {
    margin-top: 5px;
    font-style: italic;
    color: #aaa;
}

/* Best Score / To Beat */
.best_score_container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.best_score_avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid gold;
    background: #000;
}

.best_score_text {
    font-size: 0.9em;
    color: #eee;
    text-align: left;
    line-height: 1.2;
}

/* Players Area */
.players_area {
    position: absolute;
    top: 100px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.player_card {
    background: rgba(255, 255, 255, 0.9);
    padding: -1px;
    border-radius: 8px;
    width: 160px;
    /* Widen slightly */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.player_avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    object-fit: cover;
    border: 2px solid #555;
    flex-shrink: 0;
}

.player_card.active .player_avatar {
    scale: 1.5;
    transition: transform 0.2s;
}

.player_info {
    display: flex;
    flex-direction: column;
}

.player_card.active {
    transform: scale(1.05);
    border: 3px solid gold;
    font-weight: bold;
    background: #fff;
}

.player_card.active .player_avatar {
    border-color: gold;
}

/* Controls Area */
.controls_area {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    pointer-events: auto;
    /* Buttons must be clickable */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.game_btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    /* Improves touch response */
}

.game_btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game_btn:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
}

/* Modal Styling */
.modal_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal_content {
    background: rgba(0, 0, 0, 0.7);
    /* Dark Transparent */
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: auto;
    /* Adapts to content */
    min-width: 300px;
    transform: translateY(0);
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border: 2px solid #4CAF50;
    backdrop-filter: blur(5px);
}

.modal_content h2 {
    color: #fff;
    /* White text */
    font-size: 1.8em;
    margin: 0 0 10px 0;
}

.modal_content p {
    color: #eee;
    /* Light gray text */
    line-height: 1.4;
    font-size: 1em;
}

/* Pretty Continue Button */
.continue_btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    font-weight: bold;
    font-size: 0.9em !important;
    /* Even smaller text */
    padding: 8px 20px !important;
    /* Even smaller padding */
    margin-top: 15px;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.continue_btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.6);
    background: linear-gradient(135deg, #5dbf61 0%, #4CAF50 100%);
}

.continue_btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .players_area {
        top: 80px;
        right: 5px;
    }

    .player_card {
        width: 130px;
        font-size: 0.8em;
    }

    .game_btn {
        padding: 12px 24px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .info_panel {
        padding: 5px;
    }

    .pot_display {
        font-size: 1.2em;
    }

    .players_area {
        top: 70px;
        right: 5px;
        gap: 5px;
    }

    .player_card {
        width: 110px;
        gap: 5px;
    }

    .player_avatar {
        width: 30px;
        height: 30px;
    }

    .controls_area {
        gap: 10px;
        padding: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .game_btn {
        padding: 10px 20px;
        font-size: 0.9em;
        width: 100%;
        /* Full width buttons on very small screens for better touch */
        max-width: 200px;
    }

    .modal_content {
        padding: 15px 20px;
        min-width: 280px;
        max-width: 95%;
    }

    .modal_content h2 {
        font-size: 1.5em;
    }
}

/* Main Menu */
.main_menu_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.main_menu_content {
    background: rgba(30, 30, 40, 0.95);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
}

.main_menu_title {
    font-size: 3em;
    margin-bottom: 30px;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.form_group {
    margin-bottom: 25px;
    font-size: 1.2em;
    color: white;
}

.ai_input {
    width: 60px;
    padding: 5px;
    font-size: 1em;
    margin-left: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background: #222;
    color: white;
    text-align: center;
}

.start_btn {
    font-size: 1.2em;
    padding: 12px 30px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    width: 100%;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.start_btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #5dbf61, #4CAF50);
}

/* Menu Toggle Button (Top Right) */
.menu_toggle_btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;

    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffd700;
    padding: 5px 10px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    pointer-events: auto;
}

.menu_toggle_btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    color: #fff;
}

.player_stars div:nth-child(2) {
    margin-left: -10px;
}