/* Misiones diarias y pase de batalla. Se carga después de style.css. */

/* El panel de misiones es una hoja inferior, igual que la tienda */
#quests {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 9;
  margin: 0 auto; width: 100%; max-width: 640px;
  box-shadow: 0 -6px 0 rgba(30,30,30,.12);
  border-radius: 22px 22px 0 0; border-bottom: 0; padding: 12px 14px calc(14px + var(--safe-bottom));
}

/* La tienda sigue siendo una sola fila aunque haya más cosméticos: se desliza en horizontal */
.shop-row {
  grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 24px) / 4);
  overflow-x: auto; scrollbar-width: none; padding-bottom: 6px;
}
.shop-row::-webkit-scrollbar { display: none; }

.item.pass-item { background: #FFF6D6; }
.item .tag { font-size: .62rem; font-weight: 900; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 0 6px; }

/* ---------- Misiones y pase ---------- */
#quests-body { max-height: min(52vh, 420px); overflow-y: auto; }
.quest {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow);
  padding: 8px 10px; margin-bottom: 8px;
}
.quest.done { background: #E8F8EC; }
.quest.claimed { opacity: .6; box-shadow: none; }
.quest .emo { font-size: 1.7rem; line-height: 1; }
.quest .qtext { font-weight: 700; font-size: .9rem; line-height: 1.2; }
.quest .qmeta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; font-size: .72rem; font-weight: 700; }
.quest .diff { border-radius: 999px; padding: 0 7px; border: 2px solid var(--ink); }
.quest .diff.easy { background: #DDF5E3; }
.quest .diff.medium { background: #FFF4D6; }
.quest .diff.hard { background: #FFE2E0; }
.qbar { display: block; height: 8px; border-radius: 4px; background: #E4E7F4; overflow: hidden; margin-top: 4px; }
.qbar > span { display: block; height: 100%; background: var(--blueberry); border-radius: 4px; transition: width .3s; }
.quest.done .qbar > span { background: var(--ok); }
.claim {
  border: 3px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 900; font-size: .8rem;
  background: var(--wapuu); box-shadow: var(--shadow); white-space: nowrap;
}
.claim:disabled { background: var(--paper); box-shadow: none; opacity: .55; cursor: default; }
.quest-foot { font-size: .78rem; text-align: center; opacity: .75; margin: 2px 0 0; }

.pass-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.pass-lvl {
  width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--ink); background: var(--wapuu);
  display: grid; place-items: center; text-align: center; line-height: 1; box-shadow: var(--shadow);
}
.pass-lvl small { display: block; font-size: .6rem; font-weight: 700; }
.pass-lvl strong { font-size: 1.35rem; font-weight: 900; }
.pass-prog { font-size: .78rem; font-weight: 700; }
.pass-prog .qbar { height: 10px; }
.pass-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 92px; gap: 8px;
  overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity;
}
.tier {
  scroll-snap-align: start; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; text-align: center;
  border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); position: relative;
}
.tier .tnum { font-size: .7rem; font-weight: 900; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 0 8px; }
.tier .emo { font-size: 1.8rem; line-height: 1.1; }
.tier .tname { font-size: .7rem; font-weight: 700; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center; }
.tier.locked { background: #EEF0F7; }
.tier.locked .emo { filter: grayscale(.7); opacity: .7; }
.tier.ready { background: #FFF6D6; border-color: var(--warn); animation: pulse 1.6s infinite; }
.tier.got { opacity: .55; box-shadow: none; }
.tier.special { border-color: var(--blueberry); }
.tier .claim { padding: 2px 8px; font-size: .7rem; }
.pass-note { font-size: .75rem; opacity: .75; margin: 2px 0 0; text-align: center; }

.icon-btn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--bad); color: var(--paper); border: 2px solid var(--ink);
  font-size: .7rem; font-weight: 900; line-height: 16px; display: grid; place-items: center;
}
.badge[hidden] { display: none; }

@media (max-width: 420px) {
  .hud-right { gap: 4px; }
  .icon-btn { width: 36px; height: 36px; font-size: 1rem; }
  .coins { padding: 5px 9px; font-size: .95rem; }
}
