:root {
    --green-main: #16a34a;
    --yellow-main: #eab308;
    --yellow-dark: #713f12;
    --brown-main: #8B4513;
    --black-main: #333333;
    --bg-color: #f0fdf4;
    --text-color: #1f2937;
    --glass-bg: rgba(255, 255, 255, 0.9);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    user-select: none; -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body, html {
    width: 100%; height: 100%; overflow: hidden;
    background-color: var(--bg-color);
    background-image: radial-gradient(#15803d 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    color: var(--text-color);
}

#app {
    width: 100%; height: 100%; position: relative;
    max-width: 600px; margin: 0 auto;
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.9) 0%, rgba(220, 252, 231, 0.9) 100%);
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
}

.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 10;
}
.screen.active { opacity: 1; pointer-events: all; z-index: 20; }

.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 1.5rem; width: 90%; max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.hidden { display: none !important; }

.title-gradient {
    font-size: 2.2rem; font-weight: 900;
    background: linear-gradient(to right, var(--green-main), #10b981);
    -webkit-background-clip: text; color: transparent; margin-bottom: 0.5rem;
}
.subtitle { color: #4b5563; margin-bottom: 1.5rem; }
.logo { width: 70px; height: 70px; border-radius: 12px; margin-bottom: 1rem; }

/* Selector de niveles */
.level-selector h3 { font-size: 1.1rem; margin-bottom: 1rem; color: #374151; }
.level-btn {
    background: white; border: 2px solid #e5e7eb; border-radius: 12px;
    padding: 1rem; margin-bottom: 0.8rem; cursor: pointer; transition: all 0.2s;
    text-align: left;
}
.level-btn:hover { border-color: var(--green-main); background: #f0fdf4; transform: translateY(-2px); }
.level-btn strong { display: block; font-size: 1.2rem; color: var(--green-main); }
.level-btn span { font-size: 0.85rem; color: #6b7280; }

/* Botones */
.btn-primary, .btn-secondary, .btn-action {
    border: none; padding: 1rem; font-weight: 800; border-radius: 100px;
    cursor: pointer; width: 100%; margin-bottom: 0.8rem; transition: transform 0.1s;
}
.btn-primary { background: var(--green-main); color: white; }
.btn-primary:active { transform: scale(0.95); }
.btn-secondary { background: #e5e7eb; color: #4b5563; }
.btn-action { background: #3b82f6; color: white; width: auto; padding: 0.5rem 1rem; font-size: 0.9rem; margin: 0; box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
.btn-link { display: block; color: #6b7280; text-decoration: none; font-weight: 600; margin-top: 1rem; }

/* Cabecera del Juego */
.game-header {
    position: absolute; top: 1rem; width: 95%; padding: 0.5rem 1rem;
    display: flex; justify-content: space-between; align-items: center; border-radius: 100px;
}
.stat { font-size: 1.3rem; font-weight: 800; display: flex; align-items: center; gap: 0.4rem; }
.text-yellow { color: var(--yellow-main); } .text-red { color: #ef4444; }

/* Area de Juego */
#game-area {
    position: absolute; top: 5rem; bottom: 150px; width: 100%;
}

/* Bins (Contenedores) */
.game-footer {
    position: absolute; bottom: 0; width: 100%; padding: 1rem;
    background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
}
.bins-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    max-width: 600px; margin: 0 auto;
}
.bin { display: flex; flex-direction: column; align-items: center; position: relative; }
.bin-lid {
    width: 100%; height: 12px; border-radius: 5px 5px 0 0; margin-bottom: 2px;
    box-shadow: inset 0 2px 3px rgba(255,255,255,0.3); transition: transform 0.2s; transform-origin: left;
}
.bin-body {
    width: 90%; height: 90px; border-radius: 0 0 10px 10px; display: flex; justify-content: center; align-items: center;
    background: #374151; /* Dark grey container body */
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.4), 0 5px 10px rgba(0,0,0,0.15);
}
.bin-sticker {
    width: 85%; height: 75%;
    border: 2px solid white; border-radius: 4px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; font-weight: 900; text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.bin-sticker i { font-size: 1.5rem; margin-bottom: 2px; }
.bin-sticker span { font-size: 0.5rem; line-height: 1.1; letter-spacing: 0.5px; }

.bin-green .bin-lid { background: var(--green-main); }
.bin-green .bin-sticker { background: var(--green-main); }

.bin-yellow .bin-lid { background: var(--yellow-main); }
.bin-yellow .bin-sticker { background: var(--yellow-main); color: var(--yellow-dark); }

.bin-brown .bin-lid { background: var(--brown-main); }
.bin-brown .bin-sticker { background: var(--brown-main); }

.bin-black .bin-lid { background: var(--black-main); }
.bin-black .bin-sticker { background: var(--black-main); }

.bin.drag-over .bin-lid { transform: rotate(-20deg); }
.bin.drag-over { transform: scale(1.05); }

/* Residuos */
.residue {
    position: absolute; width: 70px; height: 70px; border-radius: 50%;
    background: white; display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; box-shadow: 0 8px 15px rgba(0,0,0,0.15);
    cursor: grab; z-index: 50; touch-action: none; transition: transform 0.1s;
}
.residue-img {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}
.residue-img img {
    /* Esto hace que el fondo blanco de cualquier JPG se vuelva transparente y se fusione con el fondo verde! */
    mix-blend-mode: multiply;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.2));
}
.residue:active { cursor: grabbing; transform: scale(1.1); }
.residue.anim-correct { animation: dropCorrect 0.3s forwards ease-in; }
.residue.anim-error { animation: shakeError 0.4s ease-in-out; background: #fee2e2; }

@keyframes dropCorrect { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(0); opacity: 0; } }
@keyframes shakeError { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* Pantalla Final */
.final-score { font-size: 1.8rem; font-weight: 900; color: var(--green-main); margin-bottom: 1rem; }
.educational-message { background: #e0f2fe; color: #0369a1; padding: 1rem; border-radius: 12px; font-weight: 600; font-size: 0.95rem; margin-bottom: 1.5rem; text-align: left; }

/* Feedback flotante */
#feedback-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
.feedback-text { position: absolute; font-weight: 900; font-size: 2rem; animation: floatUp 1s forwards ease-out; }
@keyframes floatUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-40px) scale(1.2); opacity: 0; } }
