@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Sans:wght@400;500;700&display=swap');

:root {
  --bg: #071422;
  --bg-2: #0b2434;
  --glass: rgba(10, 22, 35, 0.72);
  --line: rgba(132, 199, 255, 0.25);
  --text: #ecf6ff;
  --muted: #9fc2de;
  --accent: #15b8a6;
  --accent-2: #00d4ff;
  --ok: #2ee68f;
  --err: #ff5e63;
  --warn: #ffcf5f;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg-2));
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(129, 198, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(129, 198, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #1de9b6;
  top: -70px;
  left: -80px;
}

.orb-b {
  width: 340px;
  height: 340px;
  background: #17a2ff;
  right: -120px;
  bottom: -100px;
}

.game {
  width: min(1050px, 100%);
  margin: 0 auto;
  padding: 18px;
  position: relative;
  z-index: 1;
}

.glass {
  backdrop-filter: blur(10px);
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.header {
  border-radius: 18px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  color: #9deed9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
.value {
  font-family: 'Space Grotesk', sans-serif;
}

h1 {
  margin: 4px 0;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.rules {
  margin-top: 10px;
  border-radius: 14px;
  padding: 12px 14px;
}

.rules h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  color: #c9e2f7;
}

.stats {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border-radius: 14px;
  padding: 12px;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.value {
  margin: 4px 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
}

.mini {
  margin: 0;
  color: #d5eafd;
  font-size: 0.82rem;
}

.meter {
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms linear;
}

.controls {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  cursor: pointer;
  color: #062222;
  background: linear-gradient(135deg, #26e4cb, #72f0ff);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 212, 255, 0.25);
}

.btn.secondary {
  color: #e8f5ff;
  background: linear-gradient(135deg, #3f5b76, #6b86a2);
}

.btn.ghost {
  color: #dcf5ff;
  background: transparent;
  border: 1px solid rgba(157, 233, 255, 0.45);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pill {
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.82rem;
  background: rgba(66, 99, 127, 0.55);
  border: 1px solid rgba(157, 212, 255, 0.25);
}

.pill.muted {
  color: #c6dbef;
}

.play {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
}

.item-zone,
.bins,
.result,
.log {
  border-radius: 16px;
  padding: 12px;
}

.item-zone h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.item {
  min-height: 170px;
  border-radius: 14px;
  border: 2px dashed rgba(136, 206, 255, 0.55);
  background: linear-gradient(160deg, rgba(19, 57, 84, 0.95), rgba(10, 37, 56, 0.95));
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px;
  gap: 6px;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.item-code {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.item-name {
  font-size: 1rem;
  color: #d8ebfb;
}

.item.dragging {
  opacity: 0.65;
  transform: scale(0.98);
}

.item.enter {
  animation: pop 220ms ease;
}

.tip {
  margin: 10px 0 0;
  color: #a8cae4;
  font-size: 0.85rem;
}

.bins {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.bin {
  border: 1px solid rgba(139, 208, 255, 0.24);
  border-radius: 15px;
  background: linear-gradient(165deg, rgba(13, 34, 53, 0.92), rgba(9, 25, 41, 0.97));
  color: var(--text);
  padding: 13px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
  position: relative;
  overflow: hidden;
}

.bin:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(95, 218, 233, 0.78);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.26);
}

.bin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 45%);
  pointer-events: none;
}

.bin-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(67, 117, 152, 0.55);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
}

.bin-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.02rem;
}

.bin-desc {
  color: #b9d7ee;
  font-size: 0.82rem;
}

.bin.over {
  border-color: rgba(130, 255, 214, 0.9);
  box-shadow: 0 0 0 2px rgba(48, 230, 143, 0.2);
}

.bin.success {
  animation: pulse-ok 280ms ease;
}

.bin.error {
  animation: shake 280ms ease;
}

.result {
  margin-top: 12px;
}

.result h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.result-cell {
  background: rgba(12, 33, 49, 0.85);
  border: 1px solid rgba(136, 211, 255, 0.2);
  border-radius: 10px;
  padding: 9px;
}

.result-cell p {
  margin: 0;
  color: #bfd9ef;
  font-size: 0.82rem;
}

.result-cell strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.reward {
  margin-top: 10px;
  color: #7ff5b4;
  font-weight: 700;
}

.log {
  margin-top: 12px;
  max-height: 155px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.76rem;
  color: #b6d3eb;
}

.hidden { display: none; }

@keyframes pop {
  from { transform: scale(0.96); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes pulse-ok {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 0 0 2px rgba(46, 230, 143, 0.22); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@media (max-width: 980px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .play {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .game {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bins {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}
.item-media {
  width: 100%;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}

.item-media img {
  width: min(100%, 270px);
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(176, 225, 255, 0.45);
  box-shadow: 0 10px 20px rgba(4, 9, 16, 0.35);
}

.bin-art-wrap {
  position: relative;
  width: 100%;
  min-height: 96px;
  border-radius: 12px;
  border: 1px solid rgba(181, 230, 255, 0.35);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.bin-art {
  width: min(100%, 260px);
  max-height: 94px;
  object-fit: contain;
  border-radius: 10px;
}

.bin[data-type="organico"] .bin-art-wrap {
  background: linear-gradient(160deg, rgba(46, 230, 143, 0.32), rgba(30, 109, 63, 0.36));
}

.bin[data-type="reciclable"] .bin-art-wrap {
  background: linear-gradient(160deg, rgba(0, 212, 255, 0.3), rgba(28, 98, 156, 0.35));
}

.bin[data-type="peligroso"] .bin-art-wrap {
  background: linear-gradient(160deg, rgba(255, 94, 99, 0.3), rgba(140, 41, 44, 0.34));
}

.bin[data-type="no_reciclable"] .bin-art-wrap {
  background: linear-gradient(160deg, rgba(180, 188, 204, 0.35), rgba(98, 106, 124, 0.35));
}
.difficulty-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 6px 10px;
  background: rgba(56, 84, 106, 0.45);
  border: 1px solid rgba(157, 212, 255, 0.25);
  color: #d7ecff;
  font-size: 0.84rem;
}

.difficulty-select {
  appearance: none;
  border: 1px solid rgba(157, 212, 255, 0.35);
  border-radius: 8px;
  background: rgba(14, 31, 45, 0.9);
  color: #eaf7ff;
  padding: 6px 10px;
  font-size: 0.84rem;
}

.difficulty-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.difficulty-summary {
  margin: 10px 0 0;
  color: #b7d9ef;
  font-size: 0.86rem;
}
.legend {
  margin-top: 12px;
  border-radius: 16px;
  padding: 12px;
}

.legend h2 {
  margin: 0 0 10px;
  font-size: 1.02rem;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.legend-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(139, 208, 255, 0.24);
  background: linear-gradient(160deg, rgba(18, 45, 70, 0.85), rgba(10, 26, 41, 0.92));
}

.legend-icon {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(160, 218, 255, 0.25);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
}

.legend-icon img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
}

.legend-item strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 2px;
}

.legend-item p {
  margin: 0;
  color: #c6dff3;
  font-size: 0.8rem;
}

.legend-item.organico { border-color: rgba(46, 230, 143, 0.35); }
.legend-item.reciclable { border-color: rgba(0, 212, 255, 0.35); }
.legend-item.peligroso { border-color: rgba(255, 94, 99, 0.35); }
.legend-item.no-reciclable { border-color: rgba(255, 207, 95, 0.35); }

.round-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(157, 212, 255, 0.24);
  background: rgba(10, 32, 49, 0.75);
  color: #d2ebff;
  font-size: 0.82rem;
}

.bin[data-type="organico"] { border-top: 2px solid rgba(46, 230, 143, 0.9); }
.bin[data-type="reciclable"] { border-top: 2px solid rgba(0, 212, 255, 0.9); }
.bin[data-type="peligroso"] { border-top: 2px solid rgba(255, 94, 99, 0.9); }
.bin[data-type="no_reciclable"] { border-top: 2px solid rgba(255, 207, 95, 0.9); }

.value.pulse-up {
  animation: statUp 260ms ease;
}

.value.pulse-down {
  animation: statDown 260ms ease;
}

#timeCard.critical {
  border-color: rgba(255, 94, 99, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 94, 99, 0.25), 0 16px 30px rgba(0, 0, 0, 0.28);
}

@keyframes statUp {
  0% { transform: scale(1); color: var(--text); }
  50% { transform: scale(1.08); color: #9ff3cc; }
  100% { transform: scale(1); color: var(--text); }
}

@keyframes statDown {
  0% { transform: scale(1); color: var(--text); }
  50% { transform: scale(1.08); color: #ffb7ba; }
  100% { transform: scale(1); color: var(--text); }
}

@media (max-width: 620px) {
  .legend-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Ecotic Theme Refresh ---- */
:root {
  --ecotic-surface: rgba(13, 20, 52, 0.74);
  --ecotic-border: rgba(142, 190, 255, 0.28);
  --ecotic-glow: rgba(70, 108, 255, 0.35);
}

.game {
  padding: clamp(14px, 2vw, 24px);
}

.glass {
  background: linear-gradient(150deg, rgba(13, 21, 52, 0.82), rgba(21, 25, 72, 0.72));
  border: 1px solid var(--ecotic-border);
  box-shadow: 0 18px 40px rgba(4, 8, 24, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.header {
  border-radius: 20px;
  background: linear-gradient(130deg, rgba(22, 31, 86, 0.88), rgba(13, 23, 63, 0.8));
}

.stats .card {
  background: linear-gradient(165deg, rgba(18, 32, 86, 0.84), rgba(10, 23, 58, 0.88));
  border: 1px solid rgba(145, 197, 255, 0.22);
}

.controls {
  background: linear-gradient(160deg, rgba(11, 24, 59, 0.68), rgba(12, 30, 65, 0.6));
  border: 1px solid rgba(143, 197, 255, 0.18);
  border-radius: 14px;
  padding: 10px;
}

.item {
  border: 1px solid rgba(145, 197, 255, 0.3);
  background: radial-gradient(circle at 20% 20%, rgba(70, 118, 255, 0.18), transparent 55%),
    linear-gradient(160deg, rgba(21, 42, 95, 0.96), rgba(11, 29, 69, 0.94));
  box-shadow: 0 16px 28px rgba(3, 12, 35, 0.45);
}

.bins {
  gap: 12px;
}

.bin {
  border-radius: 16px;
  border: 1px solid rgba(157, 206, 255, 0.26);
  background: linear-gradient(165deg, rgba(12, 28, 69, 0.95), rgba(9, 22, 56, 0.96));
  box-shadow: 0 14px 28px rgba(2, 10, 29, 0.35);
}

.bin:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 32px rgba(3, 10, 30, 0.42), 0 0 0 1px rgba(166, 215, 255, 0.35);
}

.bin-art-wrap {
  border-radius: 14px;
  border: 1px solid rgba(173, 224, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 12px 22px rgba(0, 0, 0, 0.24);
}

.bin-title {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.legend {
  background: linear-gradient(160deg, rgba(14, 24, 64, 0.82), rgba(20, 24, 79, 0.74));
}

.result {
  background: linear-gradient(155deg, rgba(17, 30, 76, 0.85), rgba(15, 23, 60, 0.85));
}

.log {
  background: linear-gradient(165deg, rgba(10, 21, 53, 0.78), rgba(9, 17, 45, 0.9));
  border: 1px solid rgba(117, 180, 255, 0.18);
}

@media (max-width: 620px) {
  .controls {
    padding: 8px;
    gap: 7px;
  }

  .bin-title {
    font-size: 1.05rem;
  }
}

/* ---- Arcade Layer ---- */
.game {
  position: relative;
}

.game::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 24px;
  border: 1px solid rgba(129, 188, 255, 0.14);
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(56, 92, 211, 0.14), 0 0 40px rgba(58, 112, 255, 0.12);
}

.header h1 {
  text-shadow: 0 0 18px rgba(90, 154, 255, 0.45);
}

.subtitle {
  letter-spacing: 0.01em;
}

.stats .card {
  position: relative;
  overflow: hidden;
}

.stats .card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.13), transparent);
  animation: hudSweep 7s linear infinite;
  pointer-events: none;
}

.btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 280ms ease;
}

.btn:hover::after {
  left: 130%;
}

.item-zone h2,
.bins .bin-title,
.legend h2,
.result h3 {
  letter-spacing: 0.02em;
}

.item {
  position: relative;
}

.item::before {
  content: "OBJETIVO";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #a7d5ff;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(156, 213, 255, 0.4);
  background: rgba(9, 24, 57, 0.65);
}

.bin {
  transform-origin: center;
}

.bin:hover .bin-art-wrap {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 0 0 1px rgba(181, 228, 255, 0.35), 0 14px 24px rgba(0, 0, 0, 0.32);
}

.bin.over {
  transform: translateY(-4px) scale(1.01);
}

.bin-key {
  width: 28px;
  height: 28px;
  font-size: 0.86rem;
  border: 1px solid rgba(171, 220, 255, 0.38);
  box-shadow: 0 0 10px rgba(83, 154, 255, 0.35);
}

.result-cell {
  background: linear-gradient(165deg, rgba(13, 34, 77, 0.86), rgba(10, 24, 58, 0.86));
}

.log {
  border-radius: 14px;
}

@keyframes hudSweep {
  from { left: -120%; }
  to { left: 160%; }
}

@media (max-width: 620px) {
  .item::before {
    top: 8px;
    right: 8px;
    font-size: 0.58rem;
    padding: 3px 6px;
  }

  .stats .card::after {
    animation-duration: 9s;
  }
}

/* ---- Game HUD Panels ---- */
.game-panels {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.next-panel,
.boost-panel {
  border-radius: 12px;
  border: 1px solid rgba(156, 211, 255, 0.28);
  background: linear-gradient(155deg, rgba(11, 28, 70, 0.88), rgba(13, 22, 56, 0.88));
  padding: 10px;
}

.next-panel h3,
.boost-panel h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ad4ff;
}

.next-items {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.next-chip {
  min-width: 72px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(170, 223, 255, 0.25);
  background: rgba(13, 31, 77, 0.72);
  color: #e4f4ff;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.next-chip .emoji {
  font-size: 1rem;
}

.next-chip[data-type="organico"] { border-color: rgba(46, 230, 143, 0.45); }
.next-chip[data-type="reciclable"] { border-color: rgba(0, 212, 255, 0.45); }
.next-chip[data-type="peligroso"] { border-color: rgba(255, 94, 99, 0.45); }
.next-chip[data-type="no_reciclable"] { border-color: rgba(255, 207, 95, 0.45); }
.next-chip.done { opacity: 0.75; }

.boost-meter {
  height: 10px;
  margin-bottom: 8px;
}

.boost-meter span {
  width: 8%;
  background: linear-gradient(90deg, #3adf8f, #6cc4ff 56%, #c88bff);
  box-shadow: 0 0 12px rgba(108, 196, 255, 0.6);
}

.score-pop {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, 0) scale(0.7);
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(181, 232, 255, 0.45);
  background: rgba(10, 27, 63, 0.9);
  color: #dcf3ff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 220ms ease;
}

.score-pop.show {
  opacity: 1;
  transform: translate(-50%, -16px) scale(1);
}

.score-pop.ok { color: #9ff7c8; border-color: rgba(103, 250, 174, 0.55); }
.score-pop.err { color: #ffc0c3; border-color: rgba(255, 136, 142, 0.55); }
.score-pop.bonus { color: #ffe39c; border-color: rgba(255, 206, 96, 0.6); }

@media (max-width: 760px) {
  .game-panels {
    grid-template-columns: 1fr;
  }

  .score-pop {
    font-size: 1rem;
    top: 34%;
  }
}
