:root {
  --bg: #0a1120;
  --bg2: #0f1a2e;
  --card: #132139;
  --card2: #1a2b47;
  --line: #233859;
  --text: #e9f0fb;
  --muted: #8fa3c2;
  --table: #1d4f9c;
  --table2: #2563c4;
  --ball: #d8f03a;
  --ball2: #f0ff8a;
  --win: #34d399;
  --loss: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding-bottom: calc(84px + var(--safe-b));
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ball); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.win { color: var(--win); } .loss { color: var(--loss); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: rgba(10,17,32,.86);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar .logo { font-weight: 800; letter-spacing: -.3px; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.topbar .logo .dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 12%, var(--ball2) 13%, var(--ball) 70%); box-shadow: 0 0 12px var(--ball); }
.topbar .spacer { flex: 1; }
.topbar .back { background: none; border: 0; font-size: 22px; padding: 0 6px 0 0; cursor: pointer; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section a { color: var(--ball2); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 10px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(15,26,46,.95); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + var(--safe-b));
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; position: relative; }
.nav a .ic { font-size: 20px; line-height: 1; filter: grayscale(.8); }
.nav a.active { color: var(--text); }
.nav a.active .ic { filter: none; }
.nav a.plus .ic {
  width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; filter: none;
  background: linear-gradient(145deg, var(--ball2), var(--ball)); color: #18210a; font-size: 30px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(216,240,58,.35), 0 0 0 5px var(--bg);
}
.badge {
  position: absolute; top: 0; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--loss); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--card2); border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; min-height: 44px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(145deg, var(--ball2), var(--ball)); border: 0; color: #18210a; }
.btn.green { background: var(--table2); border-color: var(--table2); }
.btn.danger { background: transparent; border-color: #7f2a2a; color: var(--loss); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

/* ---------- avatar ---------- */
.av {
  --c: var(--ball); flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; line-height: 1;
  font-size: 21px; background: color-mix(in srgb, var(--c) 22%, var(--card2)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent);
}
.av.sm { width: 30px; height: 30px; font-size: 16px; }
.av.lg { width: 72px; height: 72px; font-size: 38px; }
.av.xl { width: 92px; height: 92px; font-size: 50px; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 18px;
  background: linear-gradient(160deg, var(--table2), var(--table) 60%, #123a78);
  border: 1px solid #3a78d8;
}
.hero::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.25); }
.hero::after { content: ""; position: absolute; inset: 8px; border: 2px solid rgba(255,255,255,.35); border-radius: 14px; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .big { font-size: 40px; font-weight: 800; letter-spacing: -1px; }
.hero .kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero .kpi { background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px 10px; text-align: center; }
.hero .kpi b { display: block; font-size: 18px; }
.hero .kpi span { font-size: 11px; opacity: .8; }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }

/* ---------- form dots ---------- */
.form { display: inline-flex; gap: 3px; }
.form i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.form i.W { background: var(--win); } .form i.L { background: var(--loss); }

.streak { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.streak.up { background: rgba(52,211,153,.15); color: var(--win); }
.streak.down { background: rgba(248,113,113,.15); color: var(--loss); }

/* ---------- podium & ranking ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 8px 0 14px; }
/* columna centrada: el avatar (que es un bloque de ancho fijo) queda justo encima del nombre */
.podium .pl { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.podium .pl .name { font-weight: 700; font-size: 13px; margin-top: 6px; max-width: 100%; }
.podium .pl .pj { margin-top: 4px; }
.podium .step { align-self: stretch; margin-top: 8px; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: rgba(0,0,0,.55); }
.podium .p1 .step { height: 92px; background: linear-gradient(#fde68a, #f59e0b); }
.podium .p2 .step { height: 68px; background: linear-gradient(#e5e7eb, #9ca3af); }
.podium .p3 .step { height: 52px; background: linear-gradient(#fdba74, #c2410c); }
.podium .crown { font-size: 22px; display: block; margin-bottom: -4px; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li.me { background: rgba(216,240,58,.07); }
.li .pos { width: 22px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.li .elo { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
/* partidos jugados de cada uno en el ranking; en naranja si son menos de 5 (Elo aún poco fiable) */
.pj { font-size: 11px; font-weight: 700; line-height: 1.5; padding: 0 7px; border-radius: 999px; white-space: nowrap;
  background: var(--card2); color: var(--muted); border: 1px solid var(--line); text-shadow: none; }
.pj.few { color: var(--warn); border-color: #6b5314; background: rgba(251,191,36,.08); }
.tag { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.tag.pending { color: var(--warn); border-color: #6b5314; background: rgba(251,191,36,.08); }
.tag.disputed { color: var(--loss); border-color: #7f2a2a; background: rgba(248,113,113,.08); }
.tag.cancelled { text-decoration: line-through; }
.tag.confirmed { color: var(--win); border-color: #1d6b50; background: rgba(52,211,153,.08); }

/* ---------- match card ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.match .side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.match .side.r { flex-direction: row-reverse; text-align: right; }
.match .side .nm { font-weight: 600; min-width: 0; }
.match .side.lose .nm { color: var(--muted); font-weight: 500; }
.match .score { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 1px; }
.match .score .w { color: var(--text); } .match .score .l { color: var(--muted); }
.match-meta { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.sets-mini { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; font-variant-numeric: tabular-nums; }
.delta { font-size: 11px; font-weight: 700; }
.delta.p { color: var(--win); } .delta.n { color: var(--loss); }

.alert { border-color: #6b5314; background: linear-gradient(0deg, rgba(251,191,36,.06), rgba(251,191,36,.06)), var(--card); }
.alert.red { border-color: #7f2a2a; background: linear-gradient(0deg, rgba(248,113,113,.07), rgba(248,113,113,.07)), var(--card); }

/* ---------- new match ---------- */
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.pick button { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.pick button.on { border-color: var(--ball); background: rgba(216,240,58,.1); box-shadow: 0 0 0 1px var(--ball); }
.pick .nm { font-size: 12.5px; font-weight: 600; max-width: 100%; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card2); color: var(--text); }
.setrow { display: grid; grid-template-columns: 34px 1fr 20px 1fr 34px; gap: 6px; align-items: center; margin-top: 8px; }
.setrow .n { color: var(--muted); font-size: 12px; text-align: center; }
.stepper { display: grid; grid-template-columns: 38px 1fr 38px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.stepper input { border: 0; text-align: center; font-size: 22px; font-weight: 800; padding: 8px 0; background: transparent; border-radius: 0; font-variant-numeric: tabular-nums; }
.stepper.win { border-color: #1d6b50; } .stepper.win input { color: var(--win); }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.summary { text-align: center; padding: 16px; border-radius: 14px; background: var(--bg2); border: 1px dashed var(--line); font-weight: 600; }
.summary .res { font-size: 28px; font-weight: 800; }

/* ---------- elo chart ---------- */
.chart svg { width: 100%; height: 150px; display: block; }
.chart .axis { fill: var(--muted); font-size: 10px; }

/* ---------- achievements ---------- */
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ach > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.ach .e { font-size: 28px; }
.ach .n { font-size: 11.5px; font-weight: 700; margin-top: 2px; }
.ach .d { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.ach .off { opacity: .35; filter: grayscale(1); }

/* ---------- h2h ---------- */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; gap: 8px; }
.vs .big { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); }
.bar > div { height: 100%; transition: width .5s; }

/* ---------- timeline ---------- */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .ev { position: relative; padding: 4px 0 12px; }
.tl .ev::before { content: ""; position: absolute; left: -17px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); border: 2px solid var(--card); }
.tl .ev.match_created::before { background: var(--info); }
.tl .ev.match_confirmed::before, .tl .ev.auto_confirmed::before, .tl .ev.match_confirmed_by_admin::before { background: var(--win); }
.tl .ev.match_disputed::before, .tl .ev.match_cancelled::before { background: var(--loss); }
.tl .ev.match_edited::before { background: var(--warn); }
.diff { font-size: 12px; background: var(--bg2); border-radius: 8px; padding: 6px 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- matrix ---------- */
.matrix { overflow-x: auto; }
.matrix table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.matrix th, .matrix td { padding: 6px 8px; text-align: center; border: 1px solid var(--line); white-space: nowrap; }
.matrix th { color: var(--muted); font-weight: 600; position: sticky; left: 0; background: var(--bg); }
.matrix td.self { background: var(--card2); }

/* ---------- sheet / toast ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 640px; max-height: 90dvh; overflow-y: auto; background: var(--bg2); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); border: 1px solid var(--line); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px); animation: up .2s; }
.toast.err { background: var(--loss); color: #fff; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px 40px; max-width: 420px; margin: 0 auto; }
.auth .brand { text-align: center; margin-bottom: 26px; }
.auth .brand .ball { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #fff 0 10%, var(--ball2) 11%, var(--ball) 65%, #c2410c); box-shadow: 0 10px 40px rgba(255,122,26,.5); animation: bounce 1.6s infinite cubic-bezier(.5,0,.5,1); }
@keyframes bounce { 50% { transform: translateY(-14px); } }
.auth h1 { font-size: 28px; letter-spacing: -.5px; }
.err-msg { color: var(--loss); font-size: 13px; margin-top: 10px; min-height: 18px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .e { font-size: 40px; }
.menu .li { cursor: pointer; }
.menu .li .ic { font-size: 20px; width: 26px; text-align: center; }
.skel { height: 80px; border-radius: 16px; background: linear-gradient(90deg, var(--card), var(--card2), var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
@media (min-width: 700px) { body { padding-bottom: 100px; } }

/* ---------- v2: registro rápido ---------- */
.step-t { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; font-weight: 700; font-size: 16px; }
.step-t .n { width: 22px; height: 22px; border-radius: 50%; background: var(--ball); color: #18210a; font-size: 12px; display: grid; place-items: center; font-weight: 800; }
.pick button[disabled] { opacity: .3; }
.pick button.mate .role { color: var(--info); }
.pick button .role { font-size: 10.5px; color: var(--ball2); font-weight: 700; min-height: 13px; }
.pick button.mate { border-color: var(--info); background: rgba(96,165,250,.1); box-shadow: 0 0 0 1px var(--info); }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who button {
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; min-height: 120px; justify-content: center;
}
.who button.on { border-color: var(--win); background: rgba(52,211,153,.1); }
.who button.on::after { content: "🏆 Ganó"; font-size: 12px; color: var(--win); }
.who .avs { display: flex; }
.who .avs .av + .av { margin-left: -12px; }
.pts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pts button {
  aspect-ratio: 1.25; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 20px; font-weight: 800;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.pts button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pts button.deuce { grid-column: span 5; aspect-ratio: auto; padding: 12px; font-size: 14px; font-weight: 700; color: var(--warn); border-style: dashed; }
.final { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--bg2); border: 1px dashed var(--line); margin-top: 16px; }
.final .sc { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.final .who-n { font-size: 13px; color: var(--muted); max-width: 100px; text-align: center; }
details.more { margin-top: 14px; }
details.more summary { color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px 0; }
.sticky-cta { position: sticky; bottom: calc(78px + var(--safe-b)); z-index: 5; padding-top: 10px; background: linear-gradient(transparent, var(--bg) 30%); }

/* ---------- inicio: subida rápida ---------- */
.quick { border-radius: 20px; padding: 14px 14px 12px; background: var(--card); border: 1px solid var(--line); }
.quick .hd { display: flex; justify-content: space-between; align-items: center; }
.quick .hd a { color: var(--ball2); }
.quick .rivals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.quick .rv { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: 14px; font-size: 12.5px; font-weight: 600; min-width: 0; }
.quick .rv:active { background: var(--card2); }
.quick .rv span.ellipsis { max-width: 100%; }
.quick .rv.more .av { background: var(--bg2); box-shadow: inset 0 0 0 2px var(--line); color: var(--muted); font-size: 26px; }
.team { display: inline-flex; align-items: center; }
.team .av + .av { margin-left: -10px; }
.match .side .nm small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.kind-tag { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--info); }
.topbar .logo img { width: 24px; height: 24px; border-radius: 6px; }
.auth .brand-logo { width: 96px; height: 96px; border-radius: 24px; margin: 0 auto 16px; display: block; box-shadow: 0 12px 40px rgba(216,240,58,.25); animation: bounce 2.4s infinite cubic-bezier(.5,0,.5,1); }
.summary { text-align: center; padding: 16px; border-radius: 14px; background: var(--bg2); border: 1px dashed var(--line); font-weight: 600; }
.summary .res { font-size: 28px; font-weight: 800; }
#submit, #qs { scroll-margin-bottom: calc(110px + var(--safe-b)); }

/* ---------- pádel ---------- */
.btn.primary { color: #18210a; }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px 6px; }
.hero.court::before { left: 8px; right: 8px; top: 50%; bottom: auto; width: auto; height: 2px; }
.hero.court h2 { font-size: 22px; }
.hero .btn.ghost { border-color: rgba(255,255,255,.35); }
.card.next { border-color: #3a78d8; background: linear-gradient(160deg, rgba(37,99,196,.25), var(--card) 70%); }
.who button { min-height: 132px; }
.who button .tn { font-size: 14px; text-align: center; line-height: 1.25; }
.who .avs .av.lg { width: 56px; height: 56px; font-size: 30px; }
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.games button {
  border-radius: 18px; border: 2px solid var(--line); background: var(--card); padding: 14px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.games button b { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.games button span { font-size: 12px; color: var(--muted); }
.games button.on, .games button:active { border-color: var(--ball); background: rgba(216,240,58,.1); }
.who button[disabled], .games button[disabled] { opacity: .6; pointer-events: none; }
.deltas { display: flex; gap: 6px; }
.mcard .match .side .nm { font-size: 13.5px; line-height: 1.25; }
.mcard .match .score { font-size: 24px; }

.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip.pl { color: var(--text); opacity: .55; }
.chip.pl.on { opacity: 1; background: var(--card2); color: var(--text); border-color: var(--table2); font-weight: 600; }
.chip.pl small { margin-left: 4px; color: var(--muted); font-weight: 700; }
.chip.add { border-style: dashed; color: var(--ball); }

.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.tm { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; gap: 6px; }
.tm .lbl { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.tm.a .lbl { color: var(--ball); } .tm.b .lbl { color: var(--info); }
.vs-l { color: var(--muted); font-weight: 800; }
.slot { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 2px 6px; border-radius: 10px; background: var(--bg2); font-size: 13px; font-weight: 600; min-width: 0; }
.pick button.on.a { border-color: var(--ball); background: rgba(216,240,58,.1); box-shadow: 0 0 0 1px var(--ball); }
.pick button.on.b { border-color: var(--info); background: rgba(96,165,250,.12); box-shadow: 0 0 0 1px var(--info); }
.pick button.on.b .role { color: var(--info); }
.pick button .role { color: var(--ball); }

.pin { text-align: center; }
.pin .dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 4px; }
.pin .dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); font-style: normal; font-weight: 800; font-size: 14px; display: grid; place-items: center; }
.pin .dots i.on { background: var(--ball); border-color: var(--ball); color: #18210a; }
.pin .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 6px auto 0; }
.pin .pad button { height: 62px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); font-size: 24px; font-weight: 700; cursor: pointer; }
.pin .pad button:active { background: var(--card2); }
.auth .pick { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }

.toast { display: flex; align-items: center; gap: 12px; }
.toast-act { background: none; border: 0; color: var(--table2); font-weight: 800; cursor: pointer; padding: 0; }
.toast.err .toast-act { color: #fff; }
.sticky-sheet { position: sticky; bottom: calc(-20px - var(--safe-b)); margin: 14px -16px 0; padding: 10px 16px calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--bg2) 30%); }
.btn-li { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.list .btn-li:first-child { border-top: 0; }
ol.steps { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.install-banner { margin-bottom: 12px; }

/* Resultado: atajos por formato + entrada a mano */
.games-t { margin: 12px 2px 6px; font-weight: 600; }
.games.g3 { grid-template-columns: repeat(3, 1fr); }
.games.g3 button b { font-size: 28px; }
.manual { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.stepper { display: grid; grid-template-columns: 1fr 48px 64px 48px; align-items: center; gap: 8px; }
.stepper .lbl { font-weight: 700; font-size: 14px; }
.stepper button { height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: inherit; font-size: 24px; font-weight: 800; cursor: pointer; }
.stepper input { height: 48px; width: 100%; text-align: center; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: inherit; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.manual .err-msg { margin: 0; min-height: 0; }

/* ---------- botón rojo (terminar jornada) ---------- */
.btn.red { background: linear-gradient(145deg, #ef4444, #b91c1c); border: 0; color: #fff; font-weight: 800; box-shadow: 0 6px 20px rgba(220,38,38,.35); }

/* ---------- cosas que se tocan ---------- */
.av-edit { position: relative; display: inline-block; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.av-edit .pen {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ball); color: #18210a; font-size: 15px; font-weight: 800; box-shadow: 0 0 0 3px var(--bg); z-index: 2;
}
.hero h1 a { text-decoration: underline dotted rgba(255,255,255,.4); text-underline-offset: 4px; }
a.kpi, a.stat { color: inherit; }
a.kpi:active, a.stat:active { transform: scale(.97); }
.tap-pl { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-bottom: 10px; cursor: pointer; font-weight: 700; font-size: 14px; }
.tap-pl .delta { font-size: 12px; }
.card.req { margin-bottom: 8px; }
.card.req .av { display: inline-grid; vertical-align: middle; margin-right: 4px; }
.nav a .badge { top: 2px; }

/* ---------- avatares animados (no se paran nunca) ----------
   El círculo del avatar se pinta en ::after para que los efectos (::before y la llama) queden detrás.
   Medidas en % y em para que escalen igual en avatares pequeños y grandes. */
.av.fx { position: relative; isolation: isolate; background: transparent; box-shadow: none; overflow: visible; }
.av.fx::before, .av.fx::after { content: ""; position: absolute; pointer-events: none; border-radius: 50%; z-index: -1; }
.av.fx::after { inset: 0; background: color-mix(in srgb, var(--c) 22%, var(--card2)); }
.av.fx > i { position: absolute; pointer-events: none; font-style: normal; }

/* en racha (2+ victorias seguidas): fuego, esté donde esté en el ranking. Va por detrás del marco de oro, plata o bronce */
.av.hot::after { box-shadow: inset 0 0 0 2px #ffa31a, 0 0 12px 2px rgba(255,100,0,.65); animation: fx-hot-glow .9s ease-in-out infinite alternate; }
@keyframes fx-hot-glow {
  from { box-shadow: inset 0 0 0 2px #ff8a00, 0 0 9px 1px rgba(255,90,0,.55); }
  to   { box-shadow: inset 0 0 0 2px #ffd23f, 0 0 18px 5px rgba(255,60,0,.7); }
}
.av .flame { inset: -108% -30% 12% -30%; z-index: -2; transform-origin: 50% 100%; animation: fx-sway 1.9s ease-in-out infinite; }
.av .flame::before, .av .flame::after { content: ""; position: absolute; transform-origin: 50% 100%; }
/* llama exterior: lenguas rojas y naranjas */
.av .flame::before {
  inset: 0; border-radius: 50% 50% 40% 40% / 64% 64% 36% 36%;
  background:
    radial-gradient(30% 92% at 50% 100%, #ffb020 0%, #ff6a00 50%, rgba(230,30,0,0) 80%),
    radial-gradient(18% 74% at 30% 100%, #ffc23a 0%, #ff4d1a 50%, rgba(220,20,0,0) 80%),
    radial-gradient(18% 70% at 70% 100%, #ffc23a 0%, #ff4d1a 50%, rgba(220,20,0,0) 80%),
    radial-gradient(14% 50% at 12% 100%, #ff9a1f 0%, #e8340c 50%, rgba(200,20,0,0) 80%),
    radial-gradient(14% 52% at 88% 100%, #ff9a1f 0%, #e8340c 50%, rgba(200,20,0,0) 80%);
  filter: blur(1.3px) saturate(1.35);
  animation: fx-flame .46s ease-in-out infinite alternate;
}
/* núcleo: amarillo casi blanco, parpadea más rápido */
.av .flame::after {
  inset: 26% 24% 0 24%; border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
  background:
    radial-gradient(34% 80% at 50% 100%, #ffffff 0%, #fff6c2 30%, #ffd84a 58%, rgba(255,170,0,0) 82%),
    radial-gradient(22% 58% at 28% 100%, #fff1a0 0%, rgba(255,190,0,0) 78%),
    radial-gradient(22% 58% at 72% 100%, #fff1a0 0%, rgba(255,190,0,0) 78%);
  filter: blur(1px);
  animation: fx-core .31s ease-in-out infinite alternate, fx-sway 1.3s ease-in-out infinite reverse;
}
@keyframes fx-flame {
  0%   { transform: scaleY(.88) scaleX(1.04) skewX(-2deg); opacity: .86; }
  50%  { transform: scaleY(1.06) scaleX(.97) skewX(1.5deg); opacity: 1; }
  100% { transform: scaleY(1.17) scaleX(.94) skewX(-1deg); opacity: .94; filter: blur(1.7px) saturate(1.55) hue-rotate(-10deg); }
}
@keyframes fx-core {
  from { transform: scaleY(.84) scaleX(1.05); opacity: .85; }
  to   { transform: scaleY(1.12) scaleX(.93); opacity: 1; }
}
@keyframes fx-sway { 0%, 100% { translate: -1px 0; } 50% { translate: 1.5px -1px; } }
/* chispas que suben y se apagan */
.av .embers { position: absolute; display: block; left: 50%; bottom: 46%; width: .12em; height: .12em; border-radius: 50%; background: #ffd27a; box-shadow: 0 0 .15em #ff8a00; --dx: .25em; animation: fx-ember 1.5s ease-in infinite; }
.av .embers::before, .av .embers::after { content: ""; position: absolute; top: 0; width: 100%; height: 100%; border-radius: 50%; background: inherit; box-shadow: inherit; }
.av .embers::before { left: -.5em; --dx: -.3em; animation: fx-ember 1.9s ease-in .5s infinite; }
.av .embers::after { left: .42em; --dx: .2em; animation: fx-ember 1.7s ease-in 1s infinite; }
@keyframes fx-ember {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(var(--dx), -1.25em) scale(.3); opacity: 0; }
}

/* 1º: oro. Rayos que giran, aro dorado con un brillo que lo recorre y una estrella que orbita */
.av.fx1::before {
  inset: -42%;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,64,.95) 0 6deg, rgba(255,214,64,0) 9deg 24deg);
  -webkit-mask: radial-gradient(closest-side, transparent 52%, #000 62%, rgba(0,0,0,.6) 80%, transparent 100%);
          mask: radial-gradient(closest-side, transparent 52%, #000 62%, rgba(0,0,0,.6) 80%, transparent 100%);
  filter: drop-shadow(0 0 4px rgba(255,190,0,.8));
  animation: fx-rays 8s linear infinite, fx-gold-pulse 1.4s ease-in-out infinite alternate;
}
.av.fx1::after {
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.6) 48%, transparent 64%) 0 0 / 260% 100%,
              color-mix(in srgb, #fbbf24 28%, var(--card2));
  animation: fx-gold-shine 2.4s linear infinite, fx-gold-glow 1.4s ease-in-out infinite alternate;
}
.av .glint { inset: -14%; z-index: 1; animation: fx-rays 3.2s linear infinite; }
.av .glint::before {
  content: "✦"; position: absolute; left: 50%; top: 0; translate: -50% -50%;
  font-size: .42em; line-height: 1; color: #fff7cc; text-shadow: 0 0 .25em #ffd000, 0 0 .5em #ffb000;
  animation: fx-twinkle 1.6s ease-in-out infinite;
}
@keyframes fx-rays { to { rotate: 360deg; } }
@keyframes fx-gold-pulse { from { scale: .94; opacity: .8; } to { scale: 1.08; opacity: 1; } }
@keyframes fx-gold-shine { from { background-position: 160% 0, 0 0; } to { background-position: -110% 0, 0 0; } }
@keyframes fx-gold-glow {
  from { box-shadow: inset 0 0 0 2.5px #f59e0b, 0 0 8px 1px rgba(255,200,0,.5); }
  to   { box-shadow: inset 0 0 0 2.5px #fde68a, 0 0 18px 4px rgba(255,200,0,.75); }
}
@keyframes fx-twinkle { 0%, 100% { scale: .7; opacity: .7; } 50% { scale: 1.25; opacity: 1; } }

/* 2º: anillo de plata que gira y destella */
.av.fx2::before {
  inset: -4px;
  background: conic-gradient(from 0deg, #6b7280, #f9fafb, #9ca3af, #e5e7eb 40%, #4b5563, #ffffff 70%, #9ca3af, #6b7280);
  animation: fx-spin 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(229,231,235,.55));
}
.av.fx2::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); animation: fx-silver 2.2s ease-in-out infinite; }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@keyframes fx-silver { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* 3º: ondas de bronce que laten */
.av.fx3::after { box-shadow: inset 0 0 0 2px #d08a4a, 0 0 10px 2px rgba(205,127,50,.55); }
.av.fx3::before { inset: 0; border: 2px solid #e09b5a; animation: fx-ripple 1.8s ease-out infinite; }
@keyframes fx-ripple { 0% { transform: scale(1); opacity: .95; } 100% { transform: scale(1.55); opacity: 0; } }

/* filas del ranking de los 3 primeros */
.li.rk { position: relative; }
.li.rk1 {
  background: linear-gradient(110deg, transparent 30%, rgba(255,236,150,.2) 45%, transparent 60%) 0 0 / 250% 100%,
              linear-gradient(90deg, rgba(251,191,36,.2), rgba(251,191,36,.05) 50%, transparent);
  box-shadow: inset 3px 0 0 #fbbf24; animation: fx-shimmer 2.2s linear infinite;
}
.li.rk1 .elo { color: #fcd34d; text-shadow: 0 0 10px rgba(255,190,0,.55); }
.li.rk2 {
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.13) 45%, transparent 60%) 0 0 / 250% 100%, rgba(229,231,235,.05);
  box-shadow: inset 3px 0 0 #d1d5db; animation: fx-shimmer 2.6s linear infinite;
}
.li.rk2 .elo { color: #e5e7eb; }
@keyframes fx-shimmer { from { background-position: 150% 0, 0 0; } to { background-position: -100% 0, 0 0; } }
.li.rk3 { background: rgba(205,127,50,.07); box-shadow: inset 3px 0 0 #cd7f32; animation: fx-bronze 1.8s ease-in-out infinite; }
.li.rk3 .elo { color: #e09b5a; }
@keyframes fx-bronze { 0%, 100% { background-color: rgba(205,127,50,.05); } 50% { background-color: rgba(205,127,50,.16); } }
/* que listas y tarjetas no recorten las llamas ni los rayos */
.list:has(.av.hot), .list:has(.av.fx1), .hero:has(.av.hot), .hero:has(.av.fx1) { overflow: visible; }
.list > .li:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.list > .li:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
