/* Estilos específicos de vistas (grupo a): stats, history, global
   Prefijos: xa- (compartido), st- (estadísticas), hi- (historial), gl- (global) */

/* ---------- Compartido ---------- */
.xa-cols { display: grid; gap: 18px; margin-top: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.xa-cols > .card { min-width: 0; }
.xa-chart { position: relative; height: 230px; }
.xa-chart.sm { height: 180px; }
@media (min-width: 700px) { .xa-chart { height: 260px; } .xa-chart.sm { height: 200px; } }
.xa-dim { opacity: .55; transition: opacity .2s; pointer-events: none; }

/* KPIs dentro del hero */
.xa-kpis { position: relative; z-index: 1; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.xa-kpi { min-width: 0; padding: 12px 14px; border-radius: 14px; background: rgba(14, 12, 10, .38); border: 1px solid rgba(255, 255, 255, .05); }
.xa-kpi .stat-value { font-size: 22px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 700px) { .xa-kpi .stat-value { font-size: 24px; } }
@media (max-width: 399px) { .xa-kpi { padding: 10px 12px; } .xa-kpi .stat-value { font-size: 19px; } }

/* Resumen bajo la serie */
.xa-summary { display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 14px; overflow: hidden; background: var(--line-soft); border: 1px solid var(--line-soft); }
@media (min-width: 560px) { .xa-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.xa-summary > div { background: var(--bg-2); padding: 10px 12px; min-width: 0; }
.xa-summary > p { background: var(--bg-2); padding: 12px; }
.xa-summary span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.xa-summary b { display: block; font: 800 15.5px/1.3 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Donut + leyenda */
.xa-donut { display: grid; gap: 18px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 440px) { .xa-donut { grid-template-columns: 170px minmax(0, 1fr); } }
.xa-donut-wrap { position: relative; width: 170px; height: 170px; margin: 0 auto; }
.xa-donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.xa-donut-center b { font: 800 26px/1 var(--font-display); }
.xa-donut-center span { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.xa-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.xa-legend li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; padding: 4px 0; min-width: 0; }
.xa-legend li > i { flex: none; width: 10px; height: 10px; border-radius: 4px; background: var(--c); }
.xa-legend li b { min-width: 38px; text-align: right; }
.xa-legend li .muted { min-width: 52px; text-align: right; font-size: 12.5px; }

/* Datos curiosos */
.xa-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.xa-facts li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--text-2); }
.xa-facts li:first-child { padding-top: 0; }
.xa-facts li:last-child { border-bottom: 0; padding-bottom: 0; }
.xa-facts .e { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); }
.xa-facts b { color: var(--text); }

/* Posición en listas */
.xa-pos { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font: 800 13.5px var(--font-display); color: var(--text-2); background: var(--surface-2); flex: none; }
.xa-pos.top1 { background: linear-gradient(180deg, #ffd27a, #e9a62c); color: var(--amber-ink); }
.xa-pos.top2 { background: linear-gradient(180deg, #e6e9ef, #a9b0bc); color: #1d2026; }
.xa-pos.top3 { background: linear-gradient(180deg, #f0b48a, #b8703f); color: #2a1406; }
.xa-place { grid-template-columns: 28px minmax(0, 1fr) auto; }

/* ---------- Estadísticas ---------- */
.st-since { font-size: 20px !important; }
.st-gauge-track { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #6bd66b 0%, #6bd66b 18%, #f5b83d 26%, #ff6b4a 40%, #ff5a5a 100%); opacity: .9; }
.st-gauge-track i { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; translate: -50% -50%; background: var(--text); border: 3px solid var(--bg); box-shadow: 0 2px 8px rgba(0, 0, 0, .6); transition: left .8s var(--ease); }
.st-gauge-marks { position: relative; height: 18px; margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-gauge-marks span { position: absolute; translate: -50% 0; }
.st-gauge-marks span:first-child { translate: 0 0; }
.st-gauge-marks span:last-child { translate: -100% 0; }

.st-badges { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.st-badge { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-soft); min-width: 0; }
.st-badge.on { background: radial-gradient(160px 90px at 100% 0%, rgba(245, 184, 61, .16), transparent 70%), var(--surface); border-color: rgba(245, 184, 61, .3); }
.st-badge-emoji { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.st-badge.locked .st-badge-emoji { filter: grayscale(1); opacity: .45; }
.st-badge-name { font: 800 14.5px/1.2 var(--font-display); color: var(--text); }
.st-badge.locked .st-badge-name { color: var(--text-2); }
.st-badge-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.35; flex: 1; }
.st-badge .progress { height: 6px; margin-top: 8px; }
.st-badge.locked .progress > i { background: var(--text-3); }
.st-badge-prog, .st-badge-ok { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--text-3); margin-top: 6px; }
.st-badge-ok { color: var(--amber); }
.st-badge-prog svg, .st-badge-ok svg { width: 13px; height: 13px; flex: none; }

/* ---------- Historial ---------- */
.hi-filters { display: flex; gap: 8px; align-items: center; min-width: 0; }
.hi-filters .chips { flex: 1; min-width: 0; }
.hi-noloc { flex: none; }
@media (max-width: 599px) {
  .hi-filters { flex-direction: column; align-items: stretch; }
  .hi-noloc { align-self: flex-start; }
}
.hi-count { margin: 0 2px 4px; }
.hi-day { margin-top: 14px; }
.hi-day-head {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 5;
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap;
  padding: 10px 4px 8px; margin: 0 -4px;
  background: rgba(14, 12, 10, .9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
@media (min-width: 900px) { .hi-day-head { top: 0; } }
.hi-day-head h2 { font-size: 16.5px; }
.hi-day-tot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-3); font-weight: 700; }
.hi-day-tot b { color: var(--amber); }
.hi-row { cursor: pointer; align-items: flex-start; }
.hi-row:hover { background: var(--surface-2); }
.hi-row:focus-visible { outline-offset: -2px; border-radius: 0; }
.hi-row .drink-ico { margin-top: 1px; }
.hi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-width: 0; margin-top: 2px; }
.hi-place { max-width: 100%; min-width: 0; }
.hi-note { font-size: 12.5px; color: var(--text-2); font-style: italic; margin-top: 3px; }
.hi-addloc { margin-top: 8px; background: rgba(245, 184, 61, .14); color: var(--amber); border-color: rgba(245, 184, 61, .45); }
.hi-addloc:hover { background: rgba(245, 184, 61, .24); color: var(--amber-2); }
.hi-vals { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; font-size: 12px; color: var(--text-3); font-weight: 700; }
.hi-vals b { font: 800 14.5px var(--font-display); color: var(--text); }
.hi-more { display: flex; justify-content: center; padding: 22px 0 6px; min-height: 40px; }

/* ---------- Global ---------- */
.gl-hero { padding: 26px 22px; }
@media (min-width: 700px) { .gl-hero { padding: 34px 32px; } }
.gl-hero::before {
  content: ''; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 79, 139, .12), transparent 65%); pointer-events: none;
}
.gl-big { position: relative; z-index: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }
.gl-big .num {
  font: 800 clamp(52px, 15vw, 112px)/.95 var(--font-display); letter-spacing: -.04em;
  background: var(--grad-amber); -webkit-background-clip: text; background-clip: text; color: transparent;
  max-width: 100%; overflow-wrap: anywhere;
}
.gl-big small { font: 800 clamp(18px, 4vw, 26px)/1 var(--font-display); color: var(--text-2); }
.gl-eq { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--text-2); font-size: 14.5px; max-width: 640px; }
.gl-eq b { color: var(--text); }
.gl-eq-emoji { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: rgba(14, 12, 10, .4); border: 1px solid rgba(255, 255, 255, .06); }

.gl-live { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: 2px; box-shadow: 0 0 0 0 rgba(107, 214, 107, .6); animation: gl-pulse 2s infinite; }
@keyframes gl-pulse { 70% { box-shadow: 0 0 0 9px rgba(107, 214, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(107, 214, 107, 0); } }
@media (max-width: 559px) {
  .gl-24 { grid-template-columns: 1fr 1fr; }
  .gl-24 > :last-child { grid-column: 1 / -1; }
}

.gl-eqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.gl-eqs li { display: grid; grid-template-columns: 34px auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--text-2); }
.gl-eqs li:first-child { padding-top: 0; }
.gl-eqs li:last-child { border-bottom: 0; padding-bottom: 0; }
.gl-eqs .e { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); }
.gl-eqs b { font: 800 19px var(--font-display); color: var(--amber); white-space: nowrap; }

.gl-towns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.gl-towns li { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.gl-towns .xa-pos { margin-top: 1px; }
.hbar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: inherit; background: var(--grad-amber); }

.gl-mapcta { display: flex !important; align-items: center; gap: 14px; }
.gl-mapcta b { display: block; font-size: 15.5px; }
.gl-mapcta .muted { display: block; }
.gl-mapcta svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.gl-mapcta-ico { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: rgba(245, 184, 61, .12); }
