/* Módulo Comunidad: rachas, misiones, pase de temporada, logros e invitaciones. Mismo lenguaje neobrutalista que style.css */

/* Los paneles del módulo viven dentro de .mod-extra (display: contents): se les da su columna en la rejilla aquí */
.mod-extra[data-mod="engagement"] > .c-4, .eg-page > .c-4 { grid-column: span 4; }
.mod-extra[data-mod="engagement"] > .c-6, .eg-page > .c-6 { grid-column: span 6; }
.mod-extra[data-mod="engagement"] > .c-8, .eg-page > .c-8 { grid-column: span 8; }
.mod-extra[data-mod="engagement"] > .c-12, .eg-page > .c-12 { grid-column: span 12; }
@media (max-width: 1100px) { .mod-extra[data-mod="engagement"] > .c-4, .eg-page > .c-4 { grid-column: span 6; } .mod-extra[data-mod="engagement"] > .c-8, .eg-page > .c-8 { grid-column: span 12; } }
@media (max-width: 700px) { .mod-extra[data-mod="engagement"] > section, .eg-page > section { grid-column: span 12 !important; } }

.eg-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.eg-head .cl-h { margin: 0; }
.eg-reset { background: var(--ink); color: var(--green); box-shadow: none; }

/* ---------- Racha ---------- */
.eg-flame-wrap { display: flex; align-items: center; gap: 16px; margin: 4px 0 14px; }
.eg-flame { position: relative; width: 96px; height: 120px; flex: none; filter: drop-shadow(3px 3px 0 var(--ink)); }
.eg-flame svg { width: 100%; height: 100%; transform-origin: 50% 100%; animation: eg-flick 1.6s ease-in-out infinite; }
.eg-flame b { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font: 400 34px/1 var(--brush); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.eg-fl-o { fill: var(--orange); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.eg-fl-i { fill: #ffe14d; stroke: var(--ink); stroke-width: 2; }
.eg-h1 .eg-fl-o { fill: #ff7a1c; }
.eg-h2 .eg-fl-o { fill: var(--pink); } .eg-h2 .eg-fl-i { fill: var(--orange); }
.eg-h3 .eg-fl-o { fill: #7b2cff; } .eg-h3 .eg-fl-i { fill: var(--lilac); }
.eg-h3 .eg-flame { animation: eg-glow 1.2s ease-in-out infinite alternate; }
.eg-off .eg-fl-o, .eg-off .eg-fl-i { fill: #a3a4ad; } .eg-off .eg-flame svg { animation: none; }
@keyframes eg-flick { 0%, 100% { transform: scale(1, 1) rotate(0); } 30% { transform: scale(1.03, .96) rotate(-2deg); } 60% { transform: scale(.97, 1.05) rotate(2deg); } }
@keyframes eg-glow { to { filter: drop-shadow(3px 3px 0 var(--ink)) drop-shadow(0 0 14px rgba(123, 44, 255, .7)); } }
@media (prefers-reduced-motion: reduce) { .eg-flame svg, .eg-h3 .eg-flame { animation: none; } }
.eg-streak-txt { display: grid; gap: 2px; }
.eg-mult { font: 400 54px/1 var(--brush); color: var(--orange); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.eg-off .eg-mult { color: var(--piece-h); }
.eg-ok { margin: 0 0 12px; padding: 8px 12px; background: var(--green); border-radius: var(--r-piece); box-shadow: var(--sh-piece); font-weight: 800; }
.eg-today { display: grid; gap: 6px; margin-bottom: 12px; }
.eg-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.eg-tier { display: grid; text-align: center; min-width: 58px; padding: 4px 8px; border-radius: 9px; background: var(--page); box-shadow: var(--sh-piece-on); font: italic 700 12px/1.2 var(--display); text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); }
.eg-tier b { font-size: 22px; color: var(--ink3); }
.eg-tier.on { background: var(--orange); color: var(--ink); box-shadow: var(--sh-piece); } .eg-tier.on b { color: var(--ink); }

/* ---------- Misiones ---------- */
.eg-mlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.eg-mlist li { display: grid; gap: 6px; padding: 12px 14px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); }
.eg-mlist li.done { background: #d9ffc9; }
.eg-mlist li.done .bar > i { background: linear-gradient(90deg, var(--green), #e6ff4d); }
.eg-mrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.eg-mrow b { font: italic 700 20px/1.05 var(--display); text-transform: uppercase; }
.eg-pts { flex: none; font: italic 700 15px var(--display); text-transform: uppercase; background: var(--pink); color: #fff; padding: 2px 8px; border-radius: 7px; box-shadow: var(--sh-piece-on); }
li.done .eg-pts { background: var(--green); color: var(--ink); }

/* ---------- Pase de temporada ---------- */
.eg-season-top { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; margin-bottom: 16px; }
.eg-lvl { display: grid; place-items: center; width: 118px; height: 118px; border-radius: 26px; transform: rotate(-4deg); background: var(--pink); color: #fff; box-shadow: var(--sh-panel); text-align: center; line-height: 1; }
.eg-lvl span { font: italic 700 14px var(--display); letter-spacing: .14em; margin-top: 10px; }
.eg-lvl b { font: 400 54px/1 var(--brush); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.eg-lvl i { font: italic 700 14px var(--display); margin-bottom: 10px; }
.eg-xp { display: grid; gap: 8px; }
.eg-track { display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 14px; scroll-snap-type: x proximity; }
.eg-node { position: relative; flex: none; display: grid; justify-items: center; align-content: start; gap: 6px; width: 46px; scroll-snap-align: start; }
.eg-node.rw { width: 128px; }
.eg-n { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--page); box-shadow: var(--sh-piece-on); font: italic 700 18px var(--display); color: var(--ink3); }
.eg-node.on .eg-n { background: var(--green); color: var(--ink); box-shadow: var(--sh-piece); }
.eg-node.rw .eg-n { border-radius: 10px; background: var(--orange); color: var(--ink); }
.eg-node.rw:not(.on) .eg-n { background: #ffd9a3; }
.eg-rw { display: grid; justify-items: center; text-align: center; gap: 4px; width: 100%; padding: 8px 6px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); }
.eg-rw b { font: 400 22px/1 var(--brush); color: var(--acc-text); }
.eg-rw span { font: italic 700 13px/1.1 var(--display); text-transform: uppercase; }
.eg-rw em { font: italic 700 13px var(--display); text-transform: uppercase; color: var(--ok); font-style: normal; }
.eg-rw .btn { width: 100%; min-height: 32px; padding: 5px 8px; font-size: 15px; animation: eg-bob 1.4s ease-in-out infinite; }
.eg-node.claimed .eg-rw { background: #d9ffc9; }
.eg-node.pop .eg-rw { animation: eg-pop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes eg-bob { 50% { transform: translateY(-2px); } }
@keyframes eg-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-3deg); } 100% { transform: scale(1); } }
.eg-burst { position: absolute; left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.eg-burst i { position: absolute; width: 9px; height: 9px; border-radius: 2px; box-shadow: 0 0 0 1.5px var(--ink); animation: eg-fly .85s ease-out forwards; }
@keyframes eg-fly { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(260deg); opacity: 0; } }
.eg-rwlist { display: flex; flex-wrap: wrap; gap: 10px; }
.eg-rwcard { display: grid; justify-items: center; gap: 4px; min-width: 120px; padding: 10px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); text-align: center; }
.eg-rwcard .eg-n { background: var(--orange); color: var(--ink); border-radius: 10px; }
.eg-rwcard b { font: 400 22px/1 var(--brush); color: var(--acc-text); }
.eg-rwcard span:last-child { font: italic 700 13px/1.1 var(--display); text-transform: uppercase; }

/* ---------- Logros ---------- */
.eg-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.eg-badge { --tc: #cd7f32; --tl: #f0b27a; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 12px 8px 10px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); }
.eg-badge.t-silver { --tc: #9aa3b2; --tl: #eef1f6; }
.eg-badge.t-gold { --tc: #e8a800; --tl: #fff1a8; }
.eg-medal { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--tl), var(--tc) 70%); box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 5px var(--tc), 0 0 0 6.5px var(--ink), 3px 4px 0 6.5px var(--ink); margin: 6px 0 8px; }
.eg-medal span { font-size: 30px; line-height: 1; }
.eg-badge.on .eg-medal { animation: eg-shine 3s ease-in-out infinite; }
.eg-badge b { font: italic 700 16px/1.05 var(--display); text-transform: uppercase; }
.eg-badge .fine { font-size: 11.5px; line-height: 1.25; }
.eg-tierlbl { font: italic 700 11px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink3); font-style: normal; }
.eg-badge.off { background: var(--page); }
.eg-badge.off .eg-medal { filter: grayscale(1) opacity(.55); }
.eg-badge.off b, .eg-badge.off .fine { opacity: .6; }
@keyframes eg-shine { 0%, 80%, 100% { transform: rotate(0); } 88% { transform: rotate(-8deg) scale(1.05); } 94% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .eg-badge.on .eg-medal, .eg-rw .btn { animation: none; } }

/* ---------- Invitaciones ---------- */
.eg-link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 12px; }
.eg-link code { flex: 1 1 180px; background: var(--ink); color: var(--green); padding: 8px 10px; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.eg-refstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.eg-refstats > div { display: grid; justify-items: center; padding: 8px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); }
.eg-refstats b { font: 400 28px/1 var(--brush); }
.eg-how { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink2); display: grid; gap: 3px; }

/* ---------- Clasificaciones ---------- */
.eg-lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.eg-lb li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece); }
.eg-pos { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--page); box-shadow: var(--sh-piece-on); font: italic 700 18px var(--display); }
.eg-lb li:nth-child(1) .eg-pos { background: #ffcf3f; } .eg-lb li:nth-child(2) .eg-pos { background: #d5dae2; } .eg-lb li:nth-child(3) .eg-pos { background: #e4a46a; }
.eg-lbf { display: inline-flex; align-items: center; gap: 4px; font: 400 20px/1 var(--brush); }
.eg-lbf svg { width: 18px; height: 22px; }
.eg-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.eg-recent li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--piece-h); border-radius: var(--r-piece); box-shadow: var(--sh-piece-on); font-size: 14px; }
.eg-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--orange); box-shadow: var(--sh-piece-on); font-size: 18px; }
.eg-recent li.t-gold .eg-ic { background: #ffcf3f; } .eg-recent li.t-silver .eg-ic { background: #d5dae2; } .eg-recent li.t-bronze .eg-ic { background: #e4a46a; }
.eg-explain p { margin: 0 0 10px; }

/* ---------- Admin ---------- */
.eg-adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.eg-adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.eg-adm-stats .big { font-size: 30px; }
.eg-adm-tbl input:not([type="checkbox"]), .eg-adm-tbl select { width: 100%; min-width: 120px; }
.eg-adm-tbl input.eg-s { min-width: 64px; max-width: 90px; }
.eg-acts { flex-wrap: nowrap; gap: 6px; }

@media (max-width: 700px) {
  .eg-season-top { grid-template-columns: 1fr; justify-items: center; }
  .eg-flame { width: 76px; height: 96px; }
  .eg-mult { font-size: 42px; }
}
/* Recompensas del pase (vista sin sesión): las tarjetas ocupan toda la fila */
.eg-rwlist .eg-rwcard { flex: 1 1 120px; }
/* Logros bloqueados: el texto se lee (antes gris claro sobre gris) */
.eg-badge.off b, .eg-badge.off .fine { opacity: .8; }
.eg-badge.off .eg-tierlbl { color: var(--ink2); }
/* Logros a todo el ancho: 9 columnas fijas (17 logros = 2 filas casi completas, sin una medalla suelta abajo) */
@media (min-width: 1300px) { .eg-achs.c-12 .eg-badges { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
/* Clasificaciones públicas: lista con su propio scroll para que el panel vecino no quede estirado y vacío */
.eg-leaders .eg-recent, .eg-leaders .eg-lb { max-height: 440px; overflow: auto; padding: 2px 6px 4px 2px; }
.eg-adm-tbl td { vertical-align: middle; }
