/* =====================================================================
   Recargá Pilas 2026 — tokens y base compartida
   ===================================================================== */
@font-face { font-family: "Zurich Sans"; src: url("../fonts/ZurichSans-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Zurich Sans"; src: url("../fonts/ZurichSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Zurich Sans"; src: url("../fonts/ZurichSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Zurich Sans"; src: url("../fonts/ZurichSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Zurich Sans"; src: url("../fonts/ZurichSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Ogg"; src: url("../fonts/Ogg-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --night: #06122e;
  --night-2: #0b1c45;
  --deep: #23366f;
  --blue: #2167ae;
  --blue-2: #2d7ccc;
  --charge: #5bc2e7;
  --charge-soft: #a9def2;
  --ice: #f2f6fb;
  --ice-2: #e4ecf6;
  --paper: #ffffff;
  --ink: #0a1631;
  --ink-2: #33415f;
  --ink-3: #66728c;
  --line: #d6dfeb;
  --line-dark: rgba(255, 255, 255, .12);
  --ok: #1d9a5b;
  --warn: #d98a0b;
  --bad: #d0343b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(6, 18, 46, .06), 0 12px 32px -12px rgba(6, 18, 46, .18);
  --sans: "Zurich Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --serif: "Ogg", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --display: "Zurich Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display-weight: 700;
  --display-case: none;
  --fs: 1;
  --fb: 1;
  --tracking: 1;
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1240px;
  --ease: cubic-bezier(.22, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: calc(17px * var(--fb));
  line-height: 1.55;
  color: var(--ink);
  background: var(--ice);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.05; text-wrap: balance; font-family: var(--display); font-weight: var(--display-weight); letter-spacing: calc(-.02em * var(--tracking)); text-transform: var(--display-case); }
em { font-style: normal; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--charge); outline-offset: 3px; border-radius: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blue);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 18px; height: 8px; border-radius: 2px; background: currentColor; box-shadow: 21px 0 0 -1px transparent; }
.on-dark .eyebrow { color: var(--charge); }

/* Botones */
.btn {
  --bg: var(--blue); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0;
  background: var(--bg); color: var(--fg); font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease), background .2s, box-shadow .25s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(33, 103, 174, .7); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-charge { --bg: var(--charge); --fg: var(--night); }
.btn-ghost { --bg: transparent; --fg: currentColor; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px currentColor; background: rgba(127, 160, 210, .1); }
.btn-light { --bg: #fff; --fg: var(--night); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-danger { --bg: var(--bad); }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* Chips de estado */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5; letter-spacing: .01em; white-space: nowrap;
  background: var(--ice-2); color: var(--ink-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.free { background: #e3f5ec; color: #11774a; }
.chip.held, .chip.pendiente { background: #fdf1dc; color: #9a5d00; }
.chip.taken, .chip.baja { background: #fbe4e5; color: #a3242a; }
.chip.mine, .chip.confirmado { background: #e0eefb; color: var(--blue); }
.chip.disabled { background: #eceef2; color: #6b7280; }
.chip.plain::before { display: none; }

/* Formularios */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(33, 103, 174, .15); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(208, 52, 59, .12); }

/* Toast */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 14px 18px; border-radius: 14px; background: var(--night); color: #fff; font-size: 15px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .45); display: flex; gap: 12px; align-items: flex-start;
  animation: toastIn .35s var(--ease);
}
.toast.error { background: #5b1418; }
.toast.ok { background: #0e4d31; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* Modal genérico */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(4, 10, 28, .72); backdrop-filter: blur(6px); animation: fadeIn .25s; }
.modal-card { background: #fff; color: var(--ink); border-radius: 22px; width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .5); }
@keyframes fadeIn { from { opacity: 0; } }

/* Demo badge */
.demo-badge {
  position: fixed; z-index: 120; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: #fff3cd; color: #6b4b00; border: 1px solid #f0d58a; padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; display: inline-block; background: conic-gradient(var(--p) 0 62%, var(--s) 62% 100%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }

/* ---------- Visor 3D de camisetas ---------- */
.k3d { position: fixed; inset: 0; z-index: 180; background: radial-gradient(70% 70% at 50% 42%, #1a4a86 0%, #0b1f4a 45%, #040b1f 100%); color: #fff; display: grid; grid-template-rows: auto 1fr auto auto auto; animation: fadeIn .3s; font-family: var(--sans); }
.k3d-stage { position: absolute; inset: 0; }
.k3d-stage canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.k3d-stage canvas:active { cursor: grabbing; }
.k3d-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: rgba(255, 255, 255, .75); pointer-events: none; }
.k3d-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 0; pointer-events: none; }
.k3d-top > * { pointer-events: auto; }
.k3d-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--charge); }
.k3d-name { font-family: var(--display); font-weight: var(--display-weight); font-size: calc(clamp(26px, 3.4vw, 40px) * var(--fs)); letter-spacing: calc(-.03em * var(--tracking)); line-height: 1.05; margin-top: 4px; }
.k3d-sub { color: rgba(255, 255, 255, .7); font-size: 15px; }
.k3d-x { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 20px; cursor: pointer; }
.k3d-x:hover { background: rgba(255, 255, 255, .22); }
.k3d-bar { grid-row: 3; position: relative; z-index: 2; justify-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px; margin: 0 16px; border-radius: 16px; background: rgba(6, 18, 46, .72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, .1); }
.k3d-bar button { border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 11px; cursor: pointer; min-width: 40px; }
.k3d-bar button:hover { background: rgba(255, 255, 255, .1); }
.k3d-bar button.on { background: var(--charge); color: var(--night); }
.k3d-bar .sep { width: 1px; background: rgba(255, 255, 255, .15); margin: 4px 2px; }
.k3d-hint { grid-row: 4; position: relative; z-index: 2; text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, .6); padding: 8px 16px 0; pointer-events: none; }
.k3d-strip { grid-row: 5; position: relative; z-index: 2; display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); scrollbar-width: thin; }
.k3d-strip button { flex: none; width: 92px; border: 2px solid transparent; border-radius: 12px; background: rgba(255, 255, 255, .06); padding: 4px; cursor: pointer; }
.k3d-strip button.on { border-color: var(--charge); background: rgba(91, 194, 231, .15); }
.k3d-strip img { width: 100%; height: auto; aspect-ratio: 1480/970; object-fit: contain; }
.btn-3d { display: inline-flex; align-items: center; gap: 8px; }
.btn-3d svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .k3d-bar button { padding: 8px 10px; font-size: 13px; } .k3d-hint { display: none; } }

/* ---------- Torneo: zonas, partidos, llave, estadísticas ---------- */
.muted { color: var(--ink-3); }
.tz { background: #fff; border-radius: 18px; padding: 16px 18px; border: 1px solid #e3e9f2; min-width: 0; }
.tz-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tz-h h4 { font-family: var(--display); font-size: 18px; letter-spacing: -.01em; margin: 0; }
.t-scroll { overflow-x: auto; }
table.st { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.st th { font-size: 11.5px; color: var(--ink-3); font-weight: 600; padding: 6px 4px; text-align: center; }
table.st td { padding: 7px 4px; border-top: 1px solid var(--ice-2); text-align: center; }
table.st .l { text-align: left; }
table.st tr.q td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.st tr.q2 td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.tn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.zones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.mt { display: grid; grid-template-columns: 62px 1fr 92px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; background: #fff; border-radius: 14px; padding: 10px 14px; border: 1px solid #e3e9f2; }
.mt.is-live { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(217, 138, 11, .15); }
.mt-time { grid-row: span 2; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.mt-time small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.mt-team { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; font-size: 14.5px; }
.mt-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-team.b { justify-content: flex-end; text-align: right; flex-direction: row-reverse; }
.mt-team.w span:not(.muted) { color: var(--blue); }
.mt-score { font-family: var(--serif); font-size: 24px; text-align: center; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.mt-score small { display: block; font-family: var(--sans); font-size: 11px; color: var(--ink-3); }
.mt-score .vs { font-family: var(--sans); font-size: 13px; color: var(--ink-3); }
.mt-stage { grid-column: 2 / -1; font-size: 12px; color: var(--ink-3); text-align: center; }
.match-list { display: grid; gap: 8px; }
@media (max-width: 640px) { .mt { grid-template-columns: 1fr 70px 1fr; padding: 10px 12px; gap: 4px 6px; } .mt-time { grid-row: auto; grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; font-size: 13px; } .mt-time small { display: inline; } .mt-team { font-size: 13px; } .mt-score { font-size: 20px; } .mt-stage { grid-column: 1 / -1; } }

.bracket-scroll { overflow-x: auto; padding-bottom: 8px; }
.bracket { display: flex; gap: 28px; min-width: max-content; align-items: stretch; }
.br-col { display: flex; flex-direction: column; width: 220px; }
.br-h { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); text-align: center; margin-bottom: 10px; }
.br-body { flex: 1; display: flex; flex-direction: column; }
.br-pair { flex: 1; display: flex; flex-direction: column; justify-content: space-around; position: relative; padding: 6px 0; }
.br-pair:not(.single)::after { content: ""; position: absolute; right: -15px; top: 25%; bottom: 25%; border-right: 2px solid #b9c8dc; }
.br-col:not(.last):not(.champ) .bm::after { content: ""; position: absolute; right: -15px; top: 50%; width: 15px; border-top: 2px solid #b9c8dc; }
.br-col:not(:first-child) .bm::before { content: ""; position: absolute; left: -14px; top: 50%; width: 14px; border-top: 2px solid #b9c8dc; }
.bm { position: relative; background: #fff; border: 1px solid #d6dfeb; border-radius: 12px; overflow: visible; font-size: 13.5px; margin: 4px 0; box-shadow: 0 1px 2px rgba(6, 18, 46, .05); }
.bm.is-live { border-color: var(--warn); }
.bm.bye { opacity: .6; }
.bm-meta { font-size: 11px; color: var(--ink-3); padding: 5px 10px 0; min-height: 17px; }
.bm-t { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; }
.bm-t + .bm-t { border-top: 1px solid var(--ice-2); }
.bm-t.w { background: #eaf2fb; font-weight: 700; }
.bm-t.w .bm-n span:not(.muted) { color: var(--blue); }
.bm-t.tbd .bm-n { font-weight: 500; }
.bm-n { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.bm-n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-s { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.bm-s small { font-weight: 500; color: var(--ink-3); margin-left: 3px; font-size: 11px; }
.bm-s small::before { content: "("; } .bm-s small::after { content: ")"; }
.champ-card { background: linear-gradient(135deg, var(--night), var(--blue)); color: #fff; border-radius: 14px; padding: 16px; display: grid; gap: 6px; text-align: center; font-size: 26px; }
.champ-card b { font-size: 16px; font-family: var(--display); }
.br-third { margin-top: 18px; max-width: 240px; }
.br-third .bm::before, .br-third .bm::after { display: none; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: 18px; padding: 16px 18px; border: 1px solid #e3e9f2; }
.stat-card h4 { font-family: var(--display); font-size: 17px; margin: 0 0 8px; }
.stat-card ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.stat-card li { counter-increment: s; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--ice-2); font-size: 14px; }
.stat-card li:not(.muted)::before { content: counter(s); width: 20px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.stat-card li .tn { flex: 1; flex-wrap: wrap; font-weight: 600; }
.stat-card li .tn small { width: 100%; margin: 0; display: flex; gap: 6px; align-items: center; }
.stat-card .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card .nums b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 400; line-height: 1; }
.stat-card .nums span { font-size: 12.5px; color: var(--ink-3); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.subtabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.subtabs button.active { background: var(--night); color: #fff; border-color: var(--night); }
.legend-q { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }
.legend-q i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.mt-score .chip { font-family: var(--sans); font-size: 12px; }
