:root {
  --bg: #050505; --card: #111211; --card2: #181a18; --line: #262926; --text: #f3f4f1; --muted: #8f958d;
  --lime: #c6f01f; --lime-d: #9fc20e; --lime-bg: rgba(198, 240, 31, .12);
  --red: #ff5f5f; --red-bg: rgba(255, 95, 95, .13); --amber: #ffb224; --amber-bg: rgba(255, 178, 36, .13);
  --radius: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Arial Black", "Segoe UI Black", Impact, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; gap: 18px;
  background: #000; }
.login img { width: min(240px, 60vw); height: auto; display: block; }
.login .card { width: 100%; max-width: 380px; }
.login .sub { color: var(--muted); text-align: center; margin: 0; font-size: 13px; }

/* ---------- layout ---------- */
.shell { max-width: 880px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  margin: 0 -16px; background: rgba(5, 5, 5, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top img { width: 40px; height: 40px; border-radius: 50%; }
.top .t { flex: 1; min-width: 0; }
.top .t b { display: block; font-family: var(--display); font-style: italic; text-transform: uppercase; letter-spacing: .02em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .t span { color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--card2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.lime { background: var(--lime-bg); color: var(--lime); border-color: rgba(198, 240, 31, .3); }
.chip.red { background: var(--red-bg); color: var(--red); border-color: rgba(255, 95, 95, .3); }
.chip.amber { background: var(--amber-bg); color: var(--amber); border-color: rgba(255, 178, 36, .3); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(10, 10, 10, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabs button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; background: none; border: 0; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--lime); background: var(--lime-bg); }
@media (min-width: 760px) {
  .tabs { position: sticky; top: 61px; bottom: auto; margin: 0 -16px; border-top: 0; border-bottom: 1px solid var(--line); padding: 6px 16px; justify-content: flex-start; z-index: 15; }
  .tabs button { flex-direction: row; flex: 0 0 auto; gap: 8px; padding: 8px 16px; font-size: 14px; max-width: none; }
  .tabs button svg { width: 20px; height: 20px; }
  .shell { padding-bottom: 40px; }
}
.view { padding-top: 18px; display: grid; gap: 14px; }
h2.sec { font-family: var(--display); font-style: italic; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; color: var(--lime); margin: 6px 2px -4px; }

/* ---------- tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.pad0 { padding: 0; overflow: hidden; }
.hero { background: linear-gradient(135deg, #1b2308 0%, #0e0f0d 60%); border-color: rgba(198, 240, 31, .28); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(198, 240, 31, .22), transparent 70%); }
.hero .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.hero .big { font-family: var(--display); font-size: clamp(34px, 9vw, 48px); line-height: 1.1; color: var(--lime); margin: 4px 0 10px; }
.hero .row { display: flex; gap: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .row div { font-size: 13px; color: var(--muted); }
.hero .row b { display: block; color: var(--text); font-size: 17px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.kpi .v { font-size: 24px; font-weight: 800; margin-top: 2px; }
.kpi .s { color: var(--muted); font-size: 12px; }
.bar { height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime-d), var(--lime)); border-radius: 99px; transition: width .5s; }
.bar.red i { background: var(--red); }
.split { display: grid; gap: 14px; }
@media (min-width: 760px) { .split { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- listas ---------- */
.list { display: grid; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.item:last-child { border-bottom: 0; }
button.item:active { background: var(--card2); }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .main span { color: var(--muted); font-size: 12.5px; }
.item .right { text-align: right; font-weight: 700; white-space: nowrap; }
.item .right small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--card2); border: 1px solid var(--line); color: var(--lime); flex: none; }
.avatar.red { color: var(--red); background: var(--red-bg); border-color: rgba(255, 95, 95, .3); }
.dots { display: flex; gap: 3px; margin-top: 6px; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.pagada { background: var(--lime); }
.dots i.parcial, .dots i.parcial_vencida { background: linear-gradient(90deg, var(--lime) 50%, var(--line) 50%); }
.dots i.vencida, .dots i.parcial_vencida { box-shadow: 0 0 0 1px var(--red); }
.dots i.en_curso { background: var(--amber); }
.dots i.na, .dots i.sin_cuota { opacity: .25; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 13px; }
.seg button.on { background: var(--lime); color: #101300; }

/* ---------- semanas (cuadrícula) ---------- */
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.wk { border-radius: 12px; padding: 8px 4px; text-align: center; background: var(--card2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.wk b { display: block; font-size: 14px; color: var(--text); }
.wk.pagada { background: var(--lime-bg); border-color: rgba(198, 240, 31, .5); } .wk.pagada b { color: var(--lime); }
.wk.vencida, .wk.parcial_vencida { background: var(--red-bg); border-color: rgba(255, 95, 95, .5); } .wk.vencida b, .wk.parcial_vencida b { color: var(--red); }
.wk.en_curso, .wk.parcial { background: var(--amber-bg); border-color: rgba(255, 178, 36, .5); } .wk.en_curso b, .wk.parcial b { color: var(--amber); }
.wk.na, .wk.sin_cuota { opacity: .35; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- gráficas ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.chart .bar-r { fill: var(--lime); }
.chart .bar-r.zero { fill: var(--line); }
.hbars { display: grid; gap: 12px; }
.hbar .top2 { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.hbar .top2 span { color: var(--muted); }

/* ---------- formularios ---------- */
.f { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.in { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--text); font-size: 16px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.in:focus { outline: 2px solid var(--lime); outline-offset: -1px; border-color: transparent; }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card2); color: var(--text); border-radius: 12px; padding: 11px 18px; font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--lime); color: #101300; border-color: var(--lime); }
.btn.primary:active { background: var(--lime-d); }
.btn.danger { color: var(--red); border-color: rgba(255, 95, 95, .4); background: var(--red-bg); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { background: var(--card2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-weight: 700; font-size: 13px; }
.quick button:active { border-color: var(--lime); color: var(--lime); }
.hint { font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.hint b { color: var(--lime); }
.err { color: var(--red); font-size: 13px; min-height: 1em; }
.fab { position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 25; border: 0; background: var(--lime); color: #101300; font-weight: 800; padding: 14px 20px; border-radius: 99px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .3); display: flex; gap: 8px; align-items: center; }
.fab svg { width: 20px; height: 20px; }
@media (min-width: 760px) { .fab { bottom: 28px; right: max(28px, calc((100vw - 880px) / 2 + 12px)); } }

/* ---------- hoja inferior (modal) ---------- */
.veil { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .66); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .2s; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 14px; }
.sheet h3 { font-family: var(--display); font-style: italic; text-transform: uppercase; font-size: 17px; margin-bottom: 14px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.sheet .acts .btn { flex: 1; }
@media (min-width: 760px) { .veil { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes fade { from { opacity: 0 } } @keyframes up { from { transform: translateY(30px); opacity: .5 } }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #f3f4f1; color: #0b0b0b; padding: 11px 18px; border-radius: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); color: #1a0000; }

.recibo { text-align: center; padding: 6px 0 4px; }
.recibo .ok { width: 56px; height: 56px; border-radius: 50%; background: var(--lime); color: #101300; display: grid; place-items: center; margin: 0 auto 10px; }
.recibo .ok svg { width: 30px; height: 30px; }
.recibo .m { font-family: var(--display); font-size: 34px; color: var(--lime); margin: 2px 0; }
.kv { display: grid; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.anulado { opacity: .55; text-decoration: line-through; }
.code { font-family: var(--display); font-size: 26px; letter-spacing: .14em; color: var(--lime); }
.pill-link { color: var(--lime); }

/* ---------- torneos y ranking ---------- */
.avatar.gold { background: linear-gradient(135deg, #ffe27a, #d9a400); color: #1a1300; border: 0; }
.avatar.silver { background: linear-gradient(135deg, #f1f1f1, #9ea3a8); color: #14161a; border: 0; }
.avatar.bronze { background: linear-gradient(135deg, #f0b07a, #a65f2b); color: #1c0f05; border: 0; }
.nivel { font-family: var(--display); font-size: 20px; line-height: 1; }
.trend.up { color: var(--lime); } .trend.down { color: var(--red); } .trend { font-size: 12px; font-weight: 700; }
.juego { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.juego:last-child { border-bottom: 0; }
.eq { min-width: 0; } .eq.der { text-align: right; }
.eq b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq small { color: var(--muted); font-size: 11.5px; }
.eq.gana b { color: var(--lime); }
.marc { display: flex; align-items: center; gap: 6px; }
.marc span { color: var(--muted); font-weight: 700; }
.sc { width: 54px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; font-size: 20px; font-weight: 800; color: var(--text); -moz-appearance: textfield; }
.sc::-webkit-outer-spin-button, .sc::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sc:focus { outline: 2px solid var(--lime); outline-offset: -1px; }
.sc.fix { border-color: transparent; background: none; font-size: 22px; width: auto; min-width: 28px; padding: 0 2px; }
.ronda-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 16px; background: var(--card2); border-bottom: 1px solid var(--line); }
.ronda-h b { font-family: var(--display); font-style: italic; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
.ronda-h span { color: var(--muted); font-size: 12px; text-align: right; }
.check { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.check:last-child { border-bottom: 0; }
.check .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: transparent; }
.check .box svg { width: 14px; height: 14px; }
.check.on .box { background: var(--lime); border-color: var(--lime); color: #101300; }
.check .main { flex: 1; min-width: 0; font-weight: 600; }
.pareja { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pareja:last-child { border-bottom: 0; }
.pareja .n { font-family: var(--display); color: var(--lime); width: 22px; flex: none; }
.pareja .gente { flex: 1; display: grid; gap: 6px; min-width: 0; }
.pareja .prom { text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.pareja .prom b { display: block; color: var(--text); font-size: 15px; }
.pick { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); text-align: left; width: 100%; font-weight: 600; }
.pick small { color: var(--muted); font-weight: 600; }
.pick.sel { border-color: var(--lime); background: var(--lime-bg); }
.podio { text-align: center; padding: 18px; border-radius: var(--radius); border: 1px solid rgba(255, 210, 74, .4); background: linear-gradient(135deg, rgba(255, 210, 74, .13), transparent); }
.podio .t { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #ffd24a; font-weight: 800; }
.podio .w { font-family: var(--display); font-style: italic; font-size: 22px; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats div { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 18px; } .stats span { font-size: 11px; color: var(--muted); }
@media (max-width: 420px) { .juego { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 8px; } .eq.der { text-align: center; } .eq b { white-space: normal; } }

/* ---------- pantalla de bienvenida ---------- */
#splash { position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center; transition: opacity .45s ease; }
#splash.fuera { opacity: 0; pointer-events: none; }
.s-logo { position: relative; width: min(320px, 74vw); aspect-ratio: 1; animation: s-entra .55s cubic-bezier(.2, .8, .2, 1) both; }
.s-logo img { display: block; width: 100%; height: 100%; }
@keyframes s-entra { from { opacity: 0; transform: scale(.88); } }
