/*
* This file contains the updated CSS for the Watermelon Smash game.
* It includes new styles for the game area, player faces, and the watermelon animation.
*/

body {
    background-color: #F8F9FA;
    font-family: 'Inter', sans-serif;
}

.ttb-ws-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #FFD700, #FFC107);
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid #FFEB3B;
}

#ttb-names-input {
    width: 100%;
    height: 150px;
    margin-bottom: 15px;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    resize: none;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

#ttb-names-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
    outline: none;
}

#ttb-start-btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px #388E3C;
}

#ttb-start-btn:hover {
    background-color: #45A049;
    box-shadow: 0 2px #388E3C;
    transform: translateY(2px);
}

#ttb-smash-area {
    display: block;
    height: 500px;
    margin-top: 20px;
    position: relative;
    /* Added background image and styling */
    background-image: url('sprites/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px dashed #66BB6A;
}

/* New container for the face and name */
.ttb-ws-player-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.ttb-ws-face {
    width: 70px;
    height: 70px;
    position: relative;
    /* Removed border and box-shadow */
    /* Styles for the sprites */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Optional: add a subtle border or box-shadow */
}

/* Style the name text */
.ttb-ws-name {
    margin-top: 5px;
    color: #333;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    /* Added background for visibility */
    background-color: white;
    padding: 2px;
    border-radius: 4px;
}

/* Style the winner's name background */
.ttb-ws-player-container.ttb-ws-winner .ttb-ws-name {
    background-color: black;
    color: #FFC107;
}

.ttb-ws-player-container.ttb-ws-winner .ttb-ws-face {
    /* Background removed to ensure the sprite is visible */
    border: none;
}

.ttb-ws-player-container.ttb-ws-winner {
    animation: pulse 1s infinite;
}

.ttb-ws-player-container.ttb-ws-smashed {
    transform: scale(0);
    opacity: 0;
}

#ttb-winner-announcement {
    margin-top: 30px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #2E7D32;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    animation: fadeIn 1s ease-in;
}

/* Watermelon sprite and animation */
.ttb-ws-watermelon {
    position: absolute;
    width: 125px;
    height: 70px;
    background-image: url('sprites/watermelon-whole.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    /* This transition will make the watermelon fly in smoothly */
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* New class to make the whole watermelon disappear on impact */
.ttb-ws-smashed-whole {
    transform: scale(0) !important;
    opacity: 0 !important;
    transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

/* Custom Message Box */
#ttb-message-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.ttb-message-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90%;
    animation: popIn 0.3s ease-out;
}

.ttb-message-content p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.ttb-message-content.error p {
    color: #D32F2F;
}

.ttb-message-content button {
    padding: 10px 20px;
    background-color: #1976D2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.ttb-message-content button:hover {
    background-color: #1565C0;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
