* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Chalkboard SE", "Trebuchet MS", sans-serif;
  background: linear-gradient(#bfe9ff, #e6ffd9);
  color: #1d3b2a;
  text-align: center;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.screen { display: none; min-height: 100vh; padding: 20px; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }
.hidden { display: none !important; }

h1 { font-size: clamp(2.5rem, 8vw, 4rem); margin: 0; color: #1b7a3a; text-shadow: 3px 3px 0 #fff; }
h2 { font-size: 2rem; margin: 0 0 10px; color: #1b7a3a; }
.sub { font-size: 1.3rem; }

.card {
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 8px 0 #9fd39a;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 1.3rem;
}

input {
  font: inherit;
  padding: 14px;
  border: 3px solid #9fd39a;
  border-radius: 14px;
  text-align: center;
}
input:focus { outline: 4px solid #ffd23f; }

.btn {
  font: inherit;
  font-size: 1.4rem;
  font-weight: bold;
  padding: 14px 24px;
  border: none;
  border-radius: 16px;
  background: #2fb35a;
  color: #fff;
  box-shadow: 0 6px 0 #1b7a3a;
  cursor: pointer;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #1b7a3a; }
.btn:focus-visible, .bin:focus-visible { outline: 4px solid #ffd23f; outline-offset: 3px; }
.btn-alt { background: #3a8dde; box-shadow: 0 6px 0 #22609c; }
.link { font: inherit; font-size: 1rem; background: none; border: none; color: #3a6b4a; text-decoration: underline; cursor: pointer; }

.mute { position: fixed; top: 10px; right: 10px; font-size: 1.6rem; background: #fff; border: none; border-radius: 50%; width: 50px; height: 50px; cursor: pointer; z-index: 10; box-shadow: 0 3px 0 #9fd39a; }

/* HUD */
.hud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 1.2rem; }
.hud span { background: #fff; padding: 8px 16px; border-radius: 999px; box-shadow: 0 3px 0 #9fd39a; }
#screen-game { justify-content: flex-start; gap: 10px; }

.timer { width: min(500px, 90%); height: 14px; background: #fff; border-radius: 999px; overflow: hidden; }
#timer-bar { height: 100%; width: 100%; background: #ffb020; transition: width 1s linear; }

.message { min-height: 2.6em; font-size: 1.4rem; font-weight: bold; margin: 6px 0; max-width: 700px; }
.message.ok { color: #1b7a3a; }
.message.bad { color: #c0392b; }

/* Objeto */
.stage { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.item {
  font-size: 110px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,.25));
  animation: pop .4s;
}
.item.dragging { cursor: grabbing; position: relative; z-index: 20; pointer-events: none; transition: none; }
.item.back { transition: transform .3s; }
.item-name { font-size: 1.3rem; margin: 4px 0 0; }
.hint { font-size: 1rem; opacity: .7; margin: 0; }

/* Contenedores */
.bins { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 1000px; margin-top: 10px; }
.bin {
  font: inherit;
  width: 120px;
  padding: 12px 6px 10px;
  border: none;
  border-radius: 12px 12px 20px 20px;
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: inset 0 -10px 0 rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .15s;
  text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}
.bin .icon { font-size: 2.6rem; }
.bin.over { transform: scale(1.12); }
.bin.right { animation: bounce .5s; }
.bin.wrong { animation: shake .4s; }

@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes bounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.stars { font-size: 3rem; margin: 0; letter-spacing: 6px; }
.trophy { font-size: 5rem; margin: 0; animation: bounce 1s infinite; }

/* Confeti */
.confetti { position: fixed; top: -20px; width: 12px; height: 18px; z-index: 30; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 600px) {
  .bin { width: 96px; font-size: .85rem; }
  .bin .icon { font-size: 2rem; }
  .item { font-size: 90px; }
}
