:root {
  /* Paleta base = azules oficiales Anamnesis */
  --indigo:      #003C8C;  /* azul profundo */
  --indigo-2:    #0096D2;  /* azul claro (acento) */
  --navy:        #002d6b;  /* azul profundo más oscuro (títulos) */
  --navy-soft:   #005AA0;  /* azul medio */
  --gold:        #efb036;
  --gold-dark:   #b8860b;
  --ink:         #1f2740;
  --muted:       #8b90a8;
  --line:        #e6e8f0;
  --card:        #ffffff;
  --bg:          #f4f5fb;
  --shadow:      0 6px 22px rgba(40, 40, 90, .08);
  --radius:      16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Sora", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: "Sora", system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; }

/* ---------- Marca Anamnesis (colores oficiales) ---------- */
:root {
  --ana-azul-profundo: #003C8C;
  --ana-azul-medio:     #005AA0;
  --ana-azul-claro:     #0096D2;
  --ana-gris:           #5A5A5A;
}

/* ---------- Gate (registro por email) ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: linear-gradient(150deg, var(--ana-azul-profundo), var(--ana-azul-medio) 55%, var(--ana-azul-claro));
  overflow-y: auto;
}
.gate.hidden { display: none; }
.gate__card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 22px;
  padding: 34px 26px 26px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.gate__trophy { width: 54px; height: 54px; color: var(--gold); }
.gate__title { font-size: 30px; color: var(--ana-azul-profundo); margin: 8px 0 0; font-weight: 800; }
.gate__title span { color: var(--ana-azul-claro); }
.gate__lead { color: var(--ink); font-size: 15px; margin: 12px 0 22px; line-height: 1.45; }
.gate__lead strong { color: var(--ana-azul-medio); }
.gate__form { display: flex; flex-direction: column; gap: 12px; }
.gate__input {
  border: 2px solid #cfd8e6; border-radius: 12px; padding: 14px 16px;
  font-size: 16px; color: var(--ana-azul-profundo); text-align: center;
}
.gate__input:focus { outline: none; border-color: var(--ana-azul-medio); box-shadow: 0 0 0 4px rgba(0,90,160,.15); }
.gate__error { color: #e23b5a; font-size: 13px; font-weight: 600; margin: -4px 0 0; }
.gate__btn {
  border: 0; border-radius: 12px; padding: 15px 18px; cursor: pointer;
  background: linear-gradient(120deg, var(--ana-azul-profundo), var(--ana-azul-claro));
  color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .3px;
  transition: transform .08s, filter .15s;
}
.gate__btn:hover { filter: brightness(1.06); }
.gate__btn:active { transform: translateY(1px); }
.gate__note { color: var(--muted); font-size: 12.5px; margin: 16px 0 18px; }
.gate__brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  text-decoration: none; padding: 6px 8px; border-radius: 10px; transition: background .15s;
}
.gate__brand:hover { background: #f1f5fb; }
.gate__brand small { color: var(--ana-gris); letter-spacing: 2px; font-size: 11px; font-weight: 700; }
.gate__logo {
  height: 76px; width: auto; display: block;
  mix-blend-mode: multiply; /* funde el fondo blanco del PNG con la tarjeta */
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-weight: 700; font-size: 15px; }
.topbar__url   { font-size: 12px; color: var(--muted); }

/* ---------- Page ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 0 14px 60px; }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin: 14px 0 0;
  background: linear-gradient(120deg, var(--indigo), var(--indigo-2));
  color: #fff; border-radius: var(--radius); padding: 18px 18px;
  box-shadow: var(--shadow);
}
.banner__left { display: flex; align-items: center; gap: 12px; }
.banner__trophy { width: 38px; height: 38px; color: var(--gold); flex-shrink: 0; }
.banner__title {
  font-family: "Sora", system-ui, sans-serif; font-weight: 800;
  font-size: 24px; margin: 0; line-height: 1.05;
}
.banner__title span { color: var(--gold); }
.banner__sub { margin: 4px 0 0; font-size: 11px; letter-spacing: 1.5px; opacity: .85; text-transform: uppercase; }
.banner__brand {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 5px;
  text-decoration: none;
}
.banner__brand small { display: block; font-size: 10px; letter-spacing: 2px; opacity: .8; color: #fff; }

/* Pill blanco con el logo Anamnesis (banner y footer) */
.brand-logo {
  background: #fff; border-radius: 12px; padding: 8px 14px;
  display: inline-flex; align-items: center; box-shadow: var(--shadow);
}
.brand-logo img { height: 42px; width: auto; display: block; }
.brand-logo--lg { padding: 16px 32px; border-radius: 18px; }
.brand-logo--lg img { height: 66px; }

.brand {
  font-weight: 800; font-size: 22px; letter-spacing: -1px;
  background: #fff; color: var(--navy); padding: 6px 14px; border-radius: 12px;
  display: inline-block;
}
.brand::after { content: ""; } /* placeholder */
.brand--dark { background: #fff; color: var(--navy); }

/* ---------- Saved bar ---------- */
.saved {
  margin: 14px 0 0; font-size: 13px; color: var(--ink);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.saved__change {
  border: 0; background: none; color: var(--indigo-2);
  font-weight: 700; letter-spacing: .5px; cursor: pointer; font-size: 12px;
}
.cheer {
  font-weight: 800; color: var(--navy); margin: 8px 0 0;
  letter-spacing: .5px; font-size: 14px;
  display: flex; align-items: center; gap: 7px;
}
.cheer__flag {
  height: 15px; width: auto; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}

/* ---------- Hero ---------- */
.hero {
  margin: 16px 0 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.hero__quote {
  font-family: "Sora", system-ui, sans-serif; font-size: 26px; line-height: 1.25;
  margin: 0; color: var(--navy);
}
.hero__quote b, .hero__quote strong { color: var(--indigo-2); }
.hero__meta { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.hero__tz { margin: 6px 0 0; color: var(--indigo-2); font-size: 12.5px; font-weight: 600; }

/* meta de cada partido (fecha · hora · sede) */
.match-block { border-top: 1px dashed var(--line); }
.match-block:first-child { border-top: 0; }
.match-block .match { border-top: 0; padding-top: 2px; }
.match-meta {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 9px 12px 0; font-size: 11px; color: var(--muted); font-weight: 600;
}
.match-meta__venue { text-align: right; font-weight: 500; opacity: .85; }

/* ---------- Section titles ---------- */
.section-title {
  font-family: "Sora", system-ui, sans-serif; font-weight: 800;
  font-size: 30px; color: var(--navy); margin: 34px 0 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.section-title--ko { font-size: 30px; }
.section-title__note {
  font-family: "Sora", sans-serif; font-style: italic; font-weight: 500;
  font-size: 13px; color: var(--muted); margin-left: auto;
}
.bar {
  width: 6px; height: 1.1em; border-radius: 4px;
  background: var(--indigo-2); display: inline-block;
}
.round-title {
  font-family: "Sora", sans-serif; font-weight: 800; letter-spacing: 1px;
  font-size: 16px; color: var(--navy); text-transform: uppercase;
  display: flex; align-items: center; gap: 10px; margin: 28px 0 12px;
}
.round-title .bar { height: 1em; }

/* ---------- Group ---------- */
.group { margin-bottom: 26px; }
.group__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.group__badge {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  color: #fff; font-family: "Sora", system-ui, sans-serif; font-weight: 800;
  font-size: 24px; display: grid; place-items: center; box-shadow: var(--shadow);
}
.group__name { font-family: "Sora", system-ui, sans-serif; font-weight: 700; font-size: 22px; color: var(--navy); }

/* matches list */
.matches {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.match {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto auto 1fr;
  align-items: center; gap: 8px; padding: 11px 12px;
  border-top: 1px dashed var(--line);
}
.match:first-child { border-top: 0; }
.match__home { text-align: right; }
.match__away { text-align: left; }
.match__team { font-size: 14px; font-weight: 600; color: var(--ink); }
.flag {
  width: 26px; height: 18px; border-radius: 3px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06); vertical-align: middle;
}
.match__dash { color: var(--muted); font-weight: 700; }

.score {
  width: 40px; height: 40px; text-align: center; font-size: 17px; font-weight: 700;
  color: var(--navy); border: 2px solid #d8dbef; border-radius: 11px;
  background: #fff; -moz-appearance: textfield;
}
.score::-webkit-outer-spin-button,
.score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score:focus { outline: none; border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(0,150,210,.18); }

/* standings */
.standings {
  width: 100%; border-collapse: collapse; margin-top: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); font-size: 12.5px;
}
.standings th, .standings td { padding: 8px 6px; text-align: center; }
.standings thead th { background: #eef0fb; color: var(--navy-soft); font-weight: 700; }
.standings td.team, .standings th.team { text-align: left; padding-left: 10px; }
.standings tbody tr { border-top: 1px solid var(--line); }
.standings tbody tr.qualify { background: #f3f7ff; }
.standings .pos { color: var(--muted); font-weight: 700; width: 22px; }
.standings .pts { font-weight: 800; color: var(--navy); }
.standings .miniflag { width: 20px; height: 14px; border-radius: 2px; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }

/* ---------- Knockout cards ---------- */
.ko-round__title {
  font-weight: 800; letter-spacing: 1px; color: var(--navy);
  text-transform: uppercase; font-size: 14px; margin: 22px 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.ko-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.ko-card__top {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid #d8e6f5;
  background: linear-gradient(120deg, #e8f2fb, #f2f8fd);
  border-left: 4px solid var(--indigo-2);
}
.ko-card__tag { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--indigo); text-transform: uppercase; }
.ko-card__date { font-size: 12px; color: var(--navy-soft); font-weight: 600; }
.ko-card__venue { font-weight: 700; color: var(--ink); margin: 12px 16px 2px; font-size: 15px; }
.ko-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 8px 16px;
}
.ko-card .ko-row:last-child { padding-bottom: 14px; }
.ko-input {
  border: 0; border-bottom: 2px solid #c9cdee; background: transparent;
  font-size: 16px; font-weight: 600; color: var(--navy); padding: 6px 2px; width: 100%;
}
.ko-input::placeholder { color: #b9bdd6; font-weight: 500; }
.ko-input:focus { outline: none; border-bottom-color: var(--indigo-2); }

/* Cupo de 16avos: se auto-completa desde los grupos (no se escribe) */
.ko-slot {
  border-bottom: 2px solid #c9d6ea; padding: 7px 2px; min-height: 26px;
  font-size: 16px; font-weight: 600; color: #b9bdd6;
  display: flex; align-items: center; gap: 8px;
}
.ko-slot.filled { color: var(--navy); }
.ko-slot .flag { width: 26px; height: 18px; flex-shrink: 0; }

/* Selector de penales (aparece sólo si hay empate) */
.ko-pens {
  align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 16px 14px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.ko-pens__lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.ko-pen {
  border: 1.5px solid #c9d6ea; background: #fff; color: var(--navy-soft);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.ko-pen:hover { border-color: var(--indigo-2); }
.ko-pen.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.ko-score {
  width: 46px; height: 46px; border: 2px solid #d8dbef; border-radius: 12px;
  text-align: center; font-size: 18px; font-weight: 700; color: var(--navy);
  -moz-appearance: textfield;
}
.ko-score::-webkit-outer-spin-button, .ko-score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ko-score:focus { outline: none; border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(0,150,210,.18); }

/* ---------- Champion ---------- */
.champion {
  display: flex; align-items: center; gap: 14px; margin: 8px 0 4px;
  background: linear-gradient(120deg, #f6c244, var(--gold));
  border: 2px solid var(--gold-dark); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.champion__trophy { width: 44px; height: 44px; color: #5b4406; flex-shrink: 0; }
.champion__body { flex: 1; text-align: center; }
.champion__label { display: block; font-weight: 800; letter-spacing: 2px; color: #5b4406; font-size: 13px; }
.champion__slot {
  border-bottom: 2px solid #5b4406; background: transparent;
  text-align: center; font-size: 20px; font-weight: 700; color: rgba(91,68,6,.5);
  padding: 6px 2px; width: 90%; margin: 6px auto 0; min-height: 30px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.champion__slot.filled { color: #5b4406; }
.champion__slot .flag { width: 28px; height: 19px; }

/* ---------- Footer ---------- */
.footer {
  margin: 40px -14px -60px; padding: 36px 20px 44px; text-align: center;
  background: linear-gradient(120deg, var(--navy), var(--indigo-2));
  color: #fff;
}
.footer__flag {
  display: block; margin: 0 auto 14px; width: 46px; height: auto;
  border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.footer__quote { font-family: "Sora", system-ui, sans-serif; font-style: italic; font-size: 19px; margin: 0 0 22px; }
.footer__made { letter-spacing: 4px; font-size: 12px; opacity: .8; margin: 0 0 14px; }
.footer__brandbox { display: inline-block; text-decoration: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 420px) {
  .match { grid-template-columns: 1fr auto auto auto auto auto 1fr; gap: 5px; padding: 10px 8px; }
  .match__team { font-size: 12.5px; }
  .score { width: 34px; height: 34px; font-size: 15px; }
  .hero__quote { font-size: 22px; }
  .section-title { font-size: 26px; }
}
