body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    background-color: #e0f7fa;
    color: #333;
    text-align: center;
    margin: 0;
    padding: 10px;
    overflow-x: hidden;
    position: relative; /* Necesario para el fondo animado */
}

.container {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 20px auto;
    width: 90%;
    position: relative;
    z-index: 5; /* Asegura que el contenedor esté encima de las frutas */
}

h1, h2 { color: #00796b; }

.link { text-decoration: none; color: #ff9800; font-weight: bold; }

.select-box, input[type="text"] {
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid #00796b;
    border-radius: 10px;
    width: 90%;
    margin-bottom: 20px;
    text-align: center;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    background: white;
    padding: 10px;
    border-radius: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 5;
}
.game-header h2 { margin: 5px; font-size: 1.2rem; }
.points { color: #ff9800 !important; }
.timer-box { background: #ffebee; color: #c62828; padding: 5px 15px; border-radius: 20px; border: 2px solid #ef5350; }

.sara-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 10px;
    border-radius: 15px;
    margin: 10px auto;
    max-width: 600px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 3px solid #ff9800;
    position: relative;
    z-index: 5;
}
#sara-message { font-size: 1.1rem; font-weight: bold; flex: 1; padding: 0 10px; }

/* CONTENEDOR DE RESIDUOS */
.item-container {
    min-height: 200px;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    z-index: 5;
}

/* TARJETA DE RESIDUO */
.item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    cursor: grab;
    touch-action: none;
    z-index: 10;
    transition: transform 0.1s;
}
.item-card:active { cursor: grabbing; }

.sprite {
    width: 150px;
    height: 150px;
    background-size: 300% 300%;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: none;
}

.item-name {
    margin: 8px 0 0 0;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    text-transform: capitalize;
    background-color: rgba(255,255,255,0.7);
    padding: 2px 8px;
    border-radius: 8px;
    pointer-events: none;
}

.item-card.dragging { opacity: 0.8; transform: scale(1.1); }

.bg-blanco { background-image: url('../img/mapa_blanco.jpg'); }
.bg-verde  { background-image: url('../img/mapa_verde.jpg'); }
.bg-negro  { background-image: url('../img/mapa_negro.jpg'); }

.pos-1 { background-position: 0% 0%; }
.pos-2 { background-position: 50% 0%; }
.pos-3 { background-position: 100% 0%; }
.pos-4 { background-position: 0% 50%; }
.pos-5 { background-position: 50% 50%; }
.pos-6 { background-position: 100% 50%; }
.pos-7 { background-position: 0% 100%; }
.pos-8 { background-position: 50% 100%; }
.pos-9 { background-position: 100% 100%; }

/* CONTENEDORES */
.bins-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    position: relative;
    z-index: 5;
}
.bin {
    width: 140px;
    height: 180px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 4px dashed rgba(0,0,0,0.3);
    transition: all 0.2s;
    box-sizing: border-box;
}
.bin.drag-over { transform: scale(1.08); border-style: solid; box-shadow: 0 0 15px rgba(0,0,0,0.2); }
.bin h3 { margin: 0; font-size: 1.4rem; text-transform: uppercase; }

.bin-white { background-color: #f5f5f5; border-color: #9e9e9e; color: #333; }
.bin-green { background-color: #81c784; border-color: #388e3c; color: #333; }
.bin-black { background-color: #424242; color: white; border-color: #212121; }

.hidden { display: none !important; }
.btn { background: #ff9800; color: white; border: none; padding: 15px 30px; border-radius: 30px; font-size: 1.2rem; font-weight: bold; box-shadow: 0 4px 6px rgba(0,0,0,0.2); cursor: pointer; position: relative; z-index: 5;}

/* Ranking */
.ranking-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.ranking-table th, .ranking-table td { padding: 12px; border-bottom: 2px solid #eee; }
.ranking-table th { background-color: #00796b; color: white; }

/* =========================================
   ANIMACIÓN DE FRUTAS CAYENDO EN EL FONDO
   ========================================= */
.falling-fruits {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Hace que los clics ignoren las frutas */
    z-index: 0; /* Las pone completamente al fondo */
    overflow: hidden;
}
.falling-fruits span {
    position: absolute;
    display: block;
    font-size: 3rem; /* Tamaño de las frutas */
    animation: fall linear infinite;
    top: -10%;
    opacity: 0.4; /* Medio transparentes para no distraer demasiado */
}

@keyframes fall {
    0% { top: -10%; transform: rotate(0deg) translateX(0); }
    100% { top: 110%; transform: rotate(360deg) translateX(30px); }
}

/* Configuramos distintas velocidades, posiciones y tamaños para cada fruta */
.falling-fruits span:nth-child(1) { left: 5%;  animation-duration: 10s; animation-delay: 0s; }
.falling-fruits span:nth-child(2) { left: 15%; animation-duration: 15s; animation-delay: 2s; font-size: 4rem; }
.falling-fruits span:nth-child(3) { left: 25%; animation-duration: 12s; animation-delay: 4s; }
.falling-fruits span:nth-child(4) { left: 35%; animation-duration: 18s; animation-delay: 1s; font-size: 2.5rem; }
.falling-fruits span:nth-child(5) { left: 45%; animation-duration: 11s; animation-delay: 3s; }
.falling-fruits span:nth-child(6) { left: 55%; animation-duration: 14s; animation-delay: 5s; font-size: 5rem; }
.falling-fruits span:nth-child(7) { left: 65%; animation-duration: 16s; animation-delay: 0.5s; }
.falling-fruits span:nth-child(8) { left: 75%; animation-duration: 13s; animation-delay: 2.5s; font-size: 3.5rem; }
.falling-fruits span:nth-child(9) { left: 85%; animation-duration: 17s; animation-delay: 1.5s; }
.falling-fruits span:nth-child(10) { left: 95%; animation-duration: 12s; animation-delay: 3.5s; font-size: 4.5rem; }