/* ══════════════════════════════════════════════════════════════
   BATALLA DE AURA
   Oscuro por decisión de diseño: no hay variante clara.
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #08080e;
  --panel:     #0e0e18;
  --panel-2:   #141422;
  --line:      rgba(255, 255, 255, .08);
  --line-2:    rgba(255, 255, 255, .16);

  --txt:       #ECECF4;
  --dim:       #8E8EA8;
  --dim-2:     #5C5C76;

  --violet:    #8B5CF6;
  --fuchsia:   #E879F9;
  --cyan:      #22D3EE;
  --gold:      #FFC53D;
  --lime:      #A3E635;
  --rose:      #FB7185;

  --radius:    16px;
  --shell:     1340px;

  --ease:      cubic-bezier(.22, .8, .28, 1);
  --font:      'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display:   'Anton', 'Arial Narrow', var(--font);
  --mono:      'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* varias clases declaran display, y ganarían por orden de cascada */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--fuchsia); color: #0a0a12; }
:focus-visible { outline: 2px solid var(--fuchsia); outline-offset: 3px; border-radius: 6px; }
.country:focus-visible { outline-offset: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #24243c; border-radius: 99px; border: 3px solid var(--panel); }

/* banderas dibujadas en SVG (ver src/flags.js) */
.flag {
  display: inline-block; width: 1.5em; height: 1em;
  border-radius: 2px; vertical-align: -.14em; flex: none;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .3);
}

.av-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* ══════════ FONDO ══════════ */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.orb { position: absolute; border-radius: 50%; filter: blur(110px); }
.orb-1 { width: 48vw; height: 48vw; left: -14vw; top: -16vw; background: radial-gradient(circle, var(--violet), transparent 68%); opacity: .42; }
.orb-2 { width: 40vw; height: 40vw; right: -12vw; top: 6vh; background: radial-gradient(circle, var(--fuchsia), transparent 68%); opacity: .22; }

/* ══════════ TIPOGRAFÍA ══════════ */
.h1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 5.4vw, 4.8rem);
  line-height: .95; letter-spacing: -.01em; text-transform: uppercase; text-wrap: balance;
}
.h2 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.02; text-transform: uppercase; text-wrap: balance;
}
.aura-word {
  background: linear-gradient(100deg, var(--violet), var(--fuchsia) 40%, var(--gold) 70%, var(--fuchsia));
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 8s linear infinite;
}
@keyframes shine { to { background-position: 220% 0; } }

/* ══════════ BOTONES ══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font-size: .93rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
  transition: background .2s, border-color .2s, box-shadow .25s var(--ease), opacity .2s;
}
.btn-sm { padding: 8px 15px; font-size: .85rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-primary {
  color: #100620; font-weight: 700;
  background: linear-gradient(120deg, #D8B4FE, var(--fuchsia) 55%, var(--gold));
  box-shadow: 0 6px 26px -10px rgba(232, 121, 249, .8);
}
.btn-primary:hover { box-shadow: 0 10px 34px -10px rgba(232, 121, 249, 1); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--txt); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .78rem; color: var(--dim); transition: color .2s, border-color .2s; }
.chip:hover { color: var(--txt); border-color: rgba(255, 255, 255, .3); }
.chip-reset { color: var(--rose); border-color: rgba(251, 113, 133, .4); }

.seg { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.seg-b { flex: 1; padding: 7px 12px; border-radius: 8px; font-size: .82rem; color: var(--dim); white-space: nowrap; transition: background .2s, color .2s; }
.seg-b:hover { color: var(--txt); }
.seg-on { background: var(--panel-2); color: var(--txt); font-weight: 600; box-shadow: 0 0 0 1px var(--line-2) inset; }
.seg-wide .seg-b { font-size: .8rem; padding: 8px 6px; }

/* ══════════ TOPBAR + MARCA ══════════ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 24px;
  padding: 12px clamp(16px, 3vw, 30px);
  background: rgba(8, 8, 14, .8); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
/* Logotipo. Va en SVG con textLength para que las dos líneas midan
   exactamente lo mismo: en HTML quedaban de anchos distintos y se veía
   desprolijo. Sin ícono, el nombre alcanza. */
.brand { display: flex; align-items: center; flex: none; }
.brand-mark { display: block; width: 94px; height: 42px; overflow: visible; }
.brand-mark text {
  font-family: var(--display), 'Arial Narrow', sans-serif;
  font-size: 26px; letter-spacing: 0;
}
.bm-l1 { fill: var(--txt); }
.bm-l2 { fill: var(--fuchsia); transition: fill .25s; }
.bm-de { fill: var(--dim-2); }
.brand:hover .bm-l2 { fill: var(--gold); }

.nav { display: flex; gap: 20px; }
.nav a { font-size: .89rem; color: var(--dim); transition: color .2s; }
.nav a:hover { color: var(--txt); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ══════════ HERO ══════════ */
.hero {
  max-width: 880px; margin: 0 auto;
  padding: clamp(52px, 9vh, 104px) clamp(16px, 3vw, 30px) clamp(44px, 7vh, 76px);
  text-align: center;
}
.lede { max-width: 62ch; margin: 22px auto 0; color: var(--dim); font-size: 1.04rem; }
.lede b { color: var(--txt); font-weight: 600; }
.hero-cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 30px 0 42px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: left; }
.fact {
  display: block; width: 100%; padding: 15px 17px;
  border: 1px solid var(--line); border-radius: 13px;
  transition: border-color .2s, background .2s;
}
.fact b { display: block; font-size: 1.06rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.fact span { display: block; font-size: .76rem; color: var(--dim); margin-top: 4px; line-height: 1.4; }
.fact [data-fact="leader"] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-fact="total"], [data-fact="beat"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[data-fact="beat"] { color: var(--gold); }
.fact-tap { cursor: pointer; text-align: left; }
.fact-tap:hover { border-color: var(--fuchsia); background: rgba(232, 121, 249, .05); }

/* ══════════ STAGE ══════════ */
.stage {
  max-width: var(--shell); margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 30px);
  display: grid; grid-template-columns: minmax(0, 1fr) 462px;
  gap: 18px; align-items: start;
}
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px 15px; border-bottom: 1px solid var(--line);
}
.panel-title { font-family: var(--display); font-size: 1.25rem; text-transform: uppercase; }
.panel-sub { font-size: .8rem; color: var(--dim-2); margin-top: 2px; }

/* ── mapa ── */
.map-wrap { position: relative; padding: 12px 14px 16px; }
.map-inner { position: relative; }
.map-inner svg { display: block; width: 100%; height: auto; overflow: visible; }

.country {
  fill: var(--c-fill, #1b1b2e);
  stroke: rgba(255, 255, 255, .15); stroke-width: .9; stroke-linejoin: round;
  cursor: pointer;
  transition: fill .3s var(--ease), stroke .25s, opacity .25s, filter .3s var(--ease);
}
.country:hover { stroke: rgba(255, 255, 255, .55); }
.map-inner.has-active .country { opacity: .4; }
.map-inner.has-active .country.is-active { opacity: 1; }
.country.is-active {
  fill: var(--c-hot, var(--fuchsia)); stroke: #fff; stroke-width: 1.3;
  filter: drop-shadow(0 0 20px var(--c-glow, rgba(232, 121, 249, .8)));
}

/* marcadores del top 3: HTML sobre el SVG, porque los emoji dentro de
   <text> se dibujan monocromos */
.marks { position: absolute; inset: 0; pointer-events: none; }
.marker { position: absolute; transform: translate(-50%, -50%); transition: opacity .3s; }
.mk-face {
  position: absolute; left: 50%; top: 50%;
  display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: #0a0a13; border: 1.5px solid var(--m-color, var(--violet));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
  transition: transform .25s var(--ease);
}
.mk-lead { width: 31px; height: 31px; margin: -15.5px 0 0 -15.5px; font-size: 15px; z-index: 2; }
.mk-w { width: 20px; height: 20px; font-size: 10px; margin: -2px 0 0 -29px; z-index: 1; }
.mk-w3 { margin-left: 9px; }
.mk-md .mk-lead { width: 25px; height: 25px; margin: -12.5px 0 0 -12.5px; font-size: 12px; }
.mk-crown { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); font-size: 11px; font-style: normal; z-index: 3; }
.mk-dot {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--m-color, var(--violet));
  box-shadow: 0 0 0 2px rgba(10, 10, 19, .9);
}
.map-inner.has-active .marker { opacity: .25; }
.map-inner.has-active .marker.is-active { opacity: 1; }
.marker.is-active .mk-face { transform: scale(1.12); }
/* la corona vive dentro del círculo, que tiene overflow hidden */
.mk-lead { overflow: visible; }
.mk-lead .av-img { border-radius: 50%; }

.callout { pointer-events: none; }
.co-line { fill: none; stroke: rgba(255, 197, 61, .6); stroke-width: 1.1; stroke-dasharray: 3 3; }
.co-dot { fill: var(--gold); }
.co-tx {
  fill: var(--gold); font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; paint-order: stroke; stroke: rgba(8, 8, 14, .85); stroke-width: 3px;
}

.map-legend {
  position: absolute; left: 24px; bottom: 22px;
  display: flex; align-items: center; gap: 9px; pointer-events: none;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dim-2);
}
.lg-bar { width: 76px; height: 5px; border-radius: 99px; background: linear-gradient(90deg, #232340, var(--violet), var(--fuchsia), var(--gold)); }

/* tooltip */
.map-tip {
  position: absolute; z-index: 20; width: 252px; pointer-events: none;
  border: 1px solid var(--line-2); border-radius: 13px;
  background: rgba(10, 10, 20, .96); backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px -16px rgba(0, 0, 0, .9);
  padding: 12px 13px; overflow: hidden;
}
.tip-head { display: flex; align-items: center; gap: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.tip-flag { flex: none; line-height: 0; }
.tip-flag .flag { width: 26px; height: 17px; border-radius: 3px; }
.tip-id { min-width: 0; flex: 1; }
.tip-name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-meta { font-size: .69rem; color: var(--dim-2); }
.tip-rank { flex: none; font-family: var(--mono); font-size: .78rem; color: var(--gold); }
.tip-list { margin-top: 9px; display: grid; gap: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; font-size: .79rem; min-width: 0; }
.tip-pos { flex: none; font-family: var(--mono); font-size: .67rem; color: var(--dim-2); width: 12px; }
.tip-em { flex: none; width: 19px; height: 19px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: var(--panel-2); font-size: .7rem; }
.tip-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-au { flex: none; font-family: var(--mono); font-size: .73rem; font-variant-numeric: tabular-nums; }
.tip-empty, .tip-foot { font-size: .7rem; color: var(--dim-2); margin-top: 9px; }
.tip-foot { padding-top: 8px; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════ RANKING ══════════ */
.rail { position: sticky; top: 74px; display: flex; flex-direction: column; height: calc(100vh - 92px); min-height: 620px; }

.rail-head { display: flex; align-items: center; gap: 11px; padding: 15px 18px 12px; border-bottom: 1px solid var(--line); }
.rail-flag { font-size: 2rem; line-height: 1; flex: none; }
.rail-flag.is-flag { line-height: 0; }
.rail-flag .flag { width: 38px; height: 25px; border-radius: 4px; }
.rail-titles { min-width: 0; }
.rail-title { font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-sub { font-size: .78rem; color: var(--dim-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail-controls { display: grid; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rail-search {
  width: 100%; padding: 8px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  color: var(--txt); font: inherit; font-size: .84rem; outline: none; transition: border-color .2s;
}
.rail-search::placeholder { color: var(--dim-2); }
.rail-search:focus { border-color: var(--fuchsia); }
.rail-controls[data-hide-search] .rail-search { display: none; }

.rail-hint {
  padding: 11px 16px; font-size: .76rem; line-height: 1.45; color: var(--dim);
  background: rgba(232, 121, 249, .06); border-bottom: 1px solid var(--line);
}
.rail-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.rank { padding: 7px; }

.row {
  --accent: var(--violet);
  display: grid; grid-template-columns: 34px 40px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  padding: 9px; border-radius: 11px; border: 1px solid transparent; cursor: pointer;
  transition: background .18s, border-color .18s;
}
.row:hover { background: rgba(255, 255, 255, .045); border-color: var(--line); }
.row.is-mine { border-color: rgba(232, 121, 249, .35); background: rgba(232, 121, 249, .06); }
.row.just-in { animation: pop .6s var(--ease); }
@keyframes pop {
  0%   { background: rgba(255, 197, 61, .3); }
  100% { background: transparent; }
}

.row-rank { font-family: var(--mono); font-size: .88rem; font-weight: 700; color: var(--dim-2); text-align: center; font-variant-numeric: tabular-nums; }
.row.top .row-rank { color: var(--accent); }
.row-av {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-size: 1.2rem;
  background: var(--panel-2); position: relative; box-shadow: 0 0 0 1px var(--line) inset;
}
/* sin overflow:hidden, para que la corona pueda asomar; la imagen se
   redondea sola */
.row-av .av-img { border-radius: 10px; }
.row.top .row-av { box-shadow: 0 0 0 1.5px var(--accent) inset; }
.row-av-flag { background: none; box-shadow: none; }
.row-av-flag .flag { width: 36px; height: 24px; border-radius: 4px; }
.row.top .row-av-flag { box-shadow: none; }
.row-crown { position: absolute; top: -8px; right: -6px; font-size: .68rem; filter: drop-shadow(0 1px 2px #000); }

.row-main { min-width: 0; }
.row-name { font-size: .96rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; transition: color .18s; }
.row-link svg { width: 9px; height: 9px; flex: none; opacity: .45; transition: opacity .18s; }
.row-link:hover { color: var(--fuchsia); }
.row-link:hover svg { opacity: 1; }
.row-meta { font-size: .74rem; color: var(--dim-2); display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-tag { flex: none; text-transform: uppercase; letter-spacing: .07em; font-size: .59rem; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .06); }
.row-country { display: inline-flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.row-country span { overflow: hidden; text-overflow: ellipsis; }
.row-country .flag { width: 17px; height: 11px; }
.row-you { flex: none; color: var(--fuchsia); font-weight: 600; }

/* El número arriba y la acción abajo: en fila robaban ~60px de ancho al
   nombre del país, que terminaba cortado. El espacio se reserva siempre,
   así la altura de la fila no salta al pasar el mouse. */
.row-right { display: grid; justify-items: end; gap: 7px; }
.row-aura { font-family: var(--mono); font-size: .95rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.row.top .row-aura { color: var(--accent); }
.row-boost { color: var(--lime); font-family: var(--mono); font-size: .7rem; white-space: nowrap; }

/* Botones de fila. Antes eran links que solo aparecían al pasar el mouse:
   costaba verlos y acertarles. Ahora están siempre, con área de clic real. */
.row-btns { display: flex; gap: 5px; }
.rbtn {
  min-height: 27px; padding: 3px 12px; border-radius: 7px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04);
  font-size: .77rem; font-weight: 600; color: var(--dim); white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s;
}
.rbtn:hover { color: var(--txt); border-color: rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .1); }
.rbtn:active { transform: translateY(1px); }
.rbtn-go { color: var(--txt); border-color: rgba(232, 121, 249, .45); background: rgba(232, 121, 249, .14); }
.rbtn-go:hover { border-color: var(--fuchsia); background: rgba(232, 121, 249, .28); }
.rbtn-del { padding: 3px 9px; color: var(--dim-2); }
.rbtn-del:hover { color: var(--rose); border-color: rgba(251, 113, 133, .5); background: rgba(251, 113, 133, .12); }

/* Vista de aporte por país: el que va #1 del país se muestra con su logo. */
.row-pais { grid-template-columns: 34px 44px minmax(0, 1fr) auto; }
.row-pais .row-name { font-family: var(--display); font-size: 1.1rem; text-transform: uppercase; letter-spacing: .01em; font-weight: 400; }
.lider { display: flex; align-items: center; gap: 7px; margin-top: 3px; min-width: 0; }
.lider-av {
  position: relative; flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center; font-size: .8rem;
  background: var(--panel-2); box-shadow: 0 0 0 1.5px var(--accent) inset;
}
.lider-av .av-img { border-radius: 6px; }
.lider-av i { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font-size: .6rem; font-style: normal; }
.lider-nm { min-width: 0; font-size: .82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lider-au { flex: none; margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--accent); font-variant-numeric: tabular-nums; }

.rank-empty { padding: 40px 20px; text-align: center; color: var(--dim-2); font-size: .86rem; line-height: 1.6; }
.rank-empty code { font-family: var(--mono); color: var(--txt); }

.empty { padding: 44px 26px; text-align: center; }
.empty-t { font-family: var(--display); font-size: 1.25rem; text-transform: uppercase; }
.empty-p { font-size: .88rem; color: var(--dim); margin: 8px auto 18px; max-width: 34ch; }

/* "Flamengo ya está en el ranking": aparece mientras se escribe el nombre */
.dupe {
  margin: -2px 0 14px; padding: 12px 13px; border-radius: 12px;
  border: 1px solid rgba(255, 197, 61, .35); background: rgba(255, 197, 61, .07);
  animation: dupeIn .22s var(--ease);
}
@keyframes dupeIn { from { opacity: 0; transform: translateY(-4px); } }
.dupe-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin-bottom: 9px; }
.dupe-row { display: flex; align-items: center; gap: 10px; }
.dupe-av {
  flex: none; width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem;
  display: grid; place-items: center; background: var(--panel-2); box-shadow: 0 0 0 1px var(--line) inset;
}
.dupe-av .av-img { border-radius: 9px; }
.dupe-id { min-width: 0; flex: 1; }
.dupe-nm { font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dupe-meta { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--dim); }
.dupe-meta .flag { width: 16px; height: 11px; }
.dupe-foot { font-size: .73rem; color: var(--dim-2); margin-top: 9px; }
/* aviso, no bloqueo: hay un homónimo pero en otro país */
.dupe.is-info { border-color: rgba(139, 92, 246, .4); background: rgba(139, 92, 246, .08); }
.dupe.is-info .dupe-h { color: var(--violet); }

.field-hint { display: block; font-size: .72rem; color: var(--dim-2); margin-top: 6px; }

/* ── buscador de destino ── */
.picker { position: relative; }
.picker-btn {
  width: 100%; min-height: 46px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3);
  display: flex; align-items: center; gap: 10px; text-align: left;
  transition: border-color .2s;
}
.picker-btn:hover { border-color: rgba(255, 255, 255, .3); }
.picker-btn[aria-expanded="true"] { border-color: var(--fuchsia); }
.picker-btn > i { margin-left: auto; font-style: normal; color: var(--dim-2); font-size: .8rem; }
.picker-sel { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.picker-sel.is-empty { color: var(--dim-2); font-size: .95rem; }
.pk-selnm { font-size: .95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-selsub { display: flex; align-items: center; gap: 4px; font-size: .74rem; color: var(--dim-2); white-space: nowrap; }
.pk-selsub .flag { width: 15px; height: 10px; }

.picker-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2);
  box-shadow: 0 20px 50px -14px #000; overflow: hidden;
  animation: dupeIn .16s var(--ease);
}
.picker-search {
  width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .3); color: var(--txt); font: inherit; font-size: .9rem; outline: none;
}
.picker-search::placeholder { color: var(--dim-2); }
.picker-list { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; padding: 5px; }

.pk-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  border-radius: 9px; cursor: pointer;
}
.pk-item.is-hi { background: rgba(255, 255, 255, .07); }
.pk-item.is-on { background: rgba(232, 121, 249, .14); box-shadow: 0 0 0 1px rgba(232, 121, 249, .4) inset; }
.pk-av {
  flex: none; width: 30px; height: 30px; border-radius: 8px; font-size: .95rem;
  display: grid; place-items: center; background: var(--panel);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.pk-av .av-img { border-radius: 7px; }
.pk-av-flag { background: none; box-shadow: none; }
.pk-av-flag .flag { width: 28px; height: 19px; border-radius: 3px; }
.pk-id { min-width: 0; flex: 1; display: grid; }
.pk-id b { font-size: .87rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-id em { font-style: normal; font-size: .72rem; color: var(--dim-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-au { flex: none; font-family: var(--mono); font-size: .76rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.pk-none { padding: 22px 12px; text-align: center; color: var(--dim-2); font-size: .84rem; }

/* ── últimos aportes ── */
.aportes { border-top: 1px solid var(--line); padding: 13px 16px 16px; background: rgba(0, 0, 0, .22); }
.aportes-h {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim-2); margin-bottom: 9px;
}
.aportes-h span { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: .68rem; }
.aportes ul { display: grid; gap: 5px; }
.aportes li { display: flex; align-items: baseline; gap: 8px; font-size: .77rem; min-width: 0; }
.aportes li.is-mine .ap-name { color: var(--fuchsia); }
.ap-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-name i { font-style: normal; font-size: .62rem; color: var(--fuchsia); }
.ap-name em { font-style: normal; color: var(--dim-2); margin-left: 5px; }
.ap-when { flex: none; font-size: .68rem; color: var(--dim-2); }
.ap-amt { flex: none; font-family: var(--mono); font-size: .72rem; color: var(--lime); font-variant-numeric: tabular-nums; }

/* ══════════ SECCIONES ══════════ */
.section { max-width: var(--shell); margin: 0 auto; padding: clamp(64px, 10vh, 116px) clamp(16px, 3vw, 30px) 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px; }
.step { padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); }
.step-n { font-family: var(--mono); font-size: .74rem; color: var(--fuchsia); letter-spacing: .1em; }
.step h3 { font-size: 1.05rem; margin: 10px 0 6px; }
.step p { font-size: .89rem; color: var(--dim); }

.faq { margin-top: 14px; display: grid; gap: 6px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s; }
.faq details[open] { border-color: rgba(232, 121, 249, .3); }
.faq summary { cursor: pointer; list-style: none; padding: 15px 18px; font-size: .94rem; font-weight: 500; display: flex; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; margin-left: auto; font-family: var(--mono); color: var(--fuchsia); font-size: 1.15rem; transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { padding: 0 18px 16px; color: var(--dim); font-size: .89rem; max-width: 72ch; }

/* ══════════ CIERRE + FOOTER ══════════ */
.closer {
  max-width: var(--shell); margin: clamp(72px, 11vh, 130px) auto 0;
  padding: clamp(48px, 7vw, 80px) clamp(20px, 4vw, 40px);
  text-align: center; border-top: 1px solid var(--line);
}
.closer p { color: var(--dim); margin: 14px auto 28px; max-width: 46ch; }
.closer-cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }

.foot {
  max-width: var(--shell); margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 30px) 36px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: .78rem; color: var(--dim-2);
}
.foot-r { display: flex; gap: 16px; }
.foot-link { font-size: inherit; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; transition: color .2s; }
.foot-link:hover { color: var(--fuchsia); }

/* ══════════ MODALES ══════════ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 18px; }
.modal-bg { position: absolute; inset: 0; background: rgba(4, 4, 9, .82); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(440px, 100%); max-height: 92vh; overflow-y: auto;
  padding: 26px 26px 22px; border-radius: 18px;
  border: 1px solid var(--line-2); background: var(--panel);
  box-shadow: 0 40px 90px -30px #000;
  animation: modalIn .28s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px); } }
.modal-x { position: absolute; top: 15px; right: 17px; color: var(--dim-2); transition: color .2s; }
.modal-x:hover { color: var(--txt); }
.modal-eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--fuchsia); }
.modal-title { font-family: var(--display); font-size: 1.5rem; text-transform: uppercase; margin: 3px 0 16px; }
.modal-intro { font-size: .88rem; color: var(--dim); margin: -8px 0 18px; }
.modal-mode { margin-bottom: 18px; }
.modal-go { width: 100%; margin-top: 4px; }
.modal-note { font-size: .74rem; color: var(--dim-2); text-align: center; margin-top: 11px; line-height: 1.5; }
.modal-note:empty { display: none; }

.field { display: block; margin-bottom: 13px; }
.field-l { display: block; font-size: .71rem; text-transform: uppercase; letter-spacing: .11em; color: var(--dim-2); margin-bottom: 6px; }
.field-l i { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .7; }

.input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3);
  color: var(--txt); font: inherit; font-size: .95rem; outline: none; transition: border-color .2s;
}
.input:focus, .input-money:focus-within { border-color: var(--fuchsia); }
.input::placeholder { color: var(--dim-2); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
select.input { appearance: none; cursor: pointer; }
select.input option { background: var(--panel-2); }
.input-money { display: flex; align-items: center; gap: 8px; padding: 9px 14px; }
.input-money span { color: var(--dim-2); font-family: var(--mono); font-size: .95rem; }
.input-money input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--txt); font-family: var(--mono); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.field-e { display: none; font-size: .74rem; color: var(--rose); margin-top: 5px; }
.field.has-error .input, .field.has-error .input-money, .field.has-error .logo-preview { border-color: var(--rose); }
.field.has-error .field-e { display: block; }

/* logo: emoji o imagen subida */
.logo-pick { position: relative; display: flex; align-items: center; gap: 12px; }
.logo-preview {
  width: 48px; height: 48px; flex: none; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line-2); font-size: 1.3rem;
  /* El padding que traen los <button> por defecto (1px 6px) le comía el
     ancho a la imagen: con box-sizing border-box, su 100% daba 34px en vez
     de 48 y el escudo quedaba chico y deformado. */
  padding: 0;
  display: grid; place-items: center; transition: border-color .2s;
}
.logo-preview .av-img { width: 100%; height: 100%; }
.logo-preview:hover { border-color: var(--fuchsia); }
.logo-side { min-width: 0; display: grid; gap: 3px; }
.logo-up {
  display: inline-block; width: fit-content; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: var(--txt);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 11px;
  transition: border-color .2s, background .2s;
}
.logo-up:hover { border-color: var(--fuchsia); background: rgba(232, 121, 249, .08); }
.logo-tip { font-size: .71rem; color: var(--dim-2); }

.emoji-pop {
  position: absolute; left: 0; top: 100%; margin-top: 6px; z-index: 5;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  padding: 7px; border-radius: 12px; width: 246px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  box-shadow: 0 16px 40px -12px #000;
}
.emoji-pop button { width: 100%; aspect-ratio: 1; border-radius: 7px; font-size: 1.05rem; transition: background .15s; }
.emoji-pop button:hover { background: rgba(255, 255, 255, .1); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.quick button {
  padding: 8px 9px; border-radius: 8px; border: 1px solid var(--line);
  font-size: .75rem; font-family: var(--mono); color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.quick button:hover { color: var(--txt); border-color: var(--fuchsia); }
.quick button.is-on { color: var(--txt); border-color: var(--fuchsia); background: rgba(232, 121, 249, .16); }
/* el escape para poner cualquier número: ocupa el ancho entero */
.q-otro { grid-column: 1 / -1; border-style: dashed !important; }

/* ══════════ TOASTS ══════════ */
.toasts { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 250; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 460px; padding: 11px 20px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: 0 14px 40px -12px #000;
  font-size: .87rem; font-weight: 500; text-align: center;
  animation: toastIn .3s var(--ease);
}
.toast b { font-family: var(--mono); color: var(--gold); }
.toast.bad b { color: var(--rose); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ══════════ LO QUE ESTÁ PASANDO ══════════ */
.vivo-wrap { max-width: var(--shell); margin: 22px auto 0; padding: 0 20px; }
.vivo { padding: 18px 20px 20px; }
.vivo .panel-head { margin-bottom: 14px; }

/* el led: verde y latiendo mientras hay conexión, gris cuando no */
.vivo-led {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--lime);
  transition: color .3s;
}
.vivo-led i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 0 rgba(163, 230, 53, .6); animation: latir 2s infinite;
}
.vivo-led.is-off { color: var(--dim-2); }
.vivo-led.is-off i { background: var(--dim-2); animation: none; box-shadow: none; }
@keyframes latir {
  0%   { box-shadow: 0 0 0 0 rgba(163, 230, 53, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(163, 230, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0); }
}

.vivo-list { display: grid; gap: 2px; }
.vivo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 11px; min-width: 0;
  transition: background .2s;
}
.vivo-item:hover { background: rgba(255, 255, 255, .03); }
.vivo-av {
  width: 34px; height: 34px; flex: none; border-radius: 9px; overflow: hidden;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--panel-2); border: 1px solid var(--line);
}
.vivo-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.vivo-linea {
  font-size: .85rem; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vivo-linea b { color: var(--txt); font-weight: 600; }
.vivo-linea i { font-style: normal; font-size: .66rem; color: var(--fuchsia); }
.vivo-item.is-mine .vivo-linea { color: var(--txt); }
.vivo-when { font-size: .68rem; color: var(--dim-2); }
.vivo-amt { flex: none; font-family: var(--mono); font-size: .84rem; color: var(--gold); }
.vivo-vacio { font-size: .87rem; color: var(--dim-2); padding: 8px 2px 4px; line-height: 1.6; }

/* el aporte que acaba de entrar, para que se vea qué cambió */
.vivo-item.recien { animation: recien 2.2s var(--ease); }
@keyframes recien {
  0%   { background: rgba(232, 121, 249, .22); transform: translateX(-6px); }
  100% { background: transparent; transform: none; }
}

@media (max-width: 780px) {
  .vivo-wrap { padding: 0 14px; }
  .vivo-linea { font-size: .8rem; }
}

/* ══════════ EL PAGO NO SALIÓ ══════════ */
.modal-fallo { text-align: center; }
.fallo-mark {
  width: 54px; height: 54px; margin: 4px auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.4rem; font-weight: 700;
  color: var(--rose); background: rgba(251, 113, 133, .1);
  border: 1px solid rgba(251, 113, 133, .35);
}
.modal-fallo .modal-intro { margin-bottom: 20px; }

/* ══════════ LA FIESTA ══════════
   Se acreditó el aura. Es el único momento en que alguien pagó y hay que
   dárselo a entender sin ambigüedad, así que ocupa toda la pantalla. */
.fiesta { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; }
.fiesta-bg {
  position: absolute; inset: 0; background: rgba(4, 4, 9, .9);
  backdrop-filter: blur(10px); animation: fadeIn .35s var(--ease);
}
.fiesta-core {
  position: relative; display: grid; justify-items: center; text-align: center;
  animation: fiestaIn .5s var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fiestaIn { from { opacity: 0; transform: scale(.9); } }

/* el halo: rayos girando y anillos que salen del centro */
.fiesta-halo {
  position: absolute; top: 34px; left: 50%; width: 460px; height: 460px;
  transform: translate(-50%, -50%); pointer-events: none;
}
.fiesta-rays, .fiesta-ring { position: absolute; inset: 0; border-radius: 50%; }
.fiesta-rays {
  background: conic-gradient(from 0deg,
    transparent 0deg 8deg, rgba(232, 121, 249, .32) 8deg 13deg,
    transparent 13deg 30deg, rgba(255, 197, 61, .28) 30deg 34deg,
    transparent 34deg 55deg, rgba(139, 92, 246, .3) 55deg 61deg,
    transparent 61deg 90deg);
  background-size: 100% 100%;
  mask: radial-gradient(circle, transparent 14%, #000 34%, transparent 72%);
  animation: girar 14s linear infinite, fadeIn .8s var(--ease);
}
@keyframes girar { to { transform: rotate(360deg); } }

.fiesta-ring {
  border: 1.5px solid rgba(232, 121, 249, .5);
  animation: onda 2.4s var(--ease) infinite;
  opacity: 0;
}
.fiesta-ring:nth-child(3) { animation-delay: .8s; border-color: rgba(255, 197, 61, .45); }
.fiesta-ring:nth-child(4) { animation-delay: 1.6s; border-color: rgba(139, 92, 246, .45); }
@keyframes onda {
  0%   { transform: scale(.28); opacity: 0; }
  18%  { opacity: .9; }
  100% { transform: scale(1); opacity: 0; }
}

/* las chispas salen del escudo hacia afuera; el ángulo lo pone el JS */
.fiesta-chispas { position: absolute; top: 34px; left: 50%; width: 0; height: 0; }
.fiesta-chispa {
  position: absolute; font-size: .9rem; line-height: 1;
  transform: translate(-50%, -50%);
  animation: chispa 1.5s var(--ease) forwards;
}
@keyframes chispa {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.3); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(220deg) scale(1); }
}

.fiesta-av {
  position: relative; width: 116px; height: 116px; border-radius: 26px; overflow: hidden;
  display: grid; place-items: center; font-size: 3.2rem;
  background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: 0 0 0 6px rgba(139, 92, 246, .14), 0 30px 70px -20px #000;
  animation: sello .6s var(--ease) both;
}
@keyframes sello {
  0%   { transform: scale(.4) rotate(-9deg); opacity: 0; }
  60%  { transform: scale(1.09) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.fiesta-eyebrow {
  margin: 22px 0 0; font-size: .7rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--fuchsia);
}
.fiesta-num {
  margin: 2px 0 0; display: flex; align-items: baseline; gap: 10px;
  animation: latido .7s var(--ease) .18s both;
}
.fiesta-num b {
  font-family: var(--display); font-size: clamp(3.6rem, 14vw, 6.4rem); line-height: .95;
  background: linear-gradient(100deg, var(--violet), var(--fuchsia) 42%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.fiesta-num i { font-style: normal; font-size: 1.9rem; color: var(--gold); }
@keyframes latido {
  0%   { transform: scale(.7); opacity: 0; }
  55%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.fiesta-name {
  margin: 4px 0 0; font-family: var(--display); font-size: 1.5rem; text-transform: uppercase;
  letter-spacing: .01em;
}
.fiesta-rank { margin: 7px 0 0; font-size: .92rem; color: var(--dim); }
.fiesta-rank b { font-family: var(--mono); color: var(--gold); font-weight: 700; }
.fiesta-go { margin-top: 26px; min-width: 190px; }

@media (max-width: 560px) {
  .fiesta-halo { width: 330px; height: 330px; }
  .fiesta-av { width: 92px; height: 92px; font-size: 2.6rem; }
}

/* Quien pidió menos movimiento igual tiene que enterarse de que pagó:
   se queda el cartel, se van el giro, las ondas y las chispas. */
@media (prefers-reduced-motion: reduce) {
  .fiesta-rays, .fiesta-ring, .fiesta-chispa { animation: none; opacity: 0; }
  .fiesta-core, .fiesta-av, .fiesta-num { animation: fadeIn .2s both; }
}

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 1080px) {
  .stage { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; min-height: 0; }
  .rail-body { max-height: 560px; }
}
@media (max-width: 780px) {
  .nav { display: none; }
  .steps { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .map-legend { display: none; }
  .map-tip { width: 210px; }
  .foot { flex-direction: column; }
}
@media (max-width: 520px) {
  .modal-card { padding: 24px 20px 20px; }
  .logo-pick { flex-wrap: wrap; }
}

/* ══════════ MENOS MOVIMIENTO ══════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
