:root {
  --navy: #14256b;
  --navy-2: #0d1a4d;
  --green: #1f8a3b;
  --green-2: #16702e;
  --red: #d42a2a;
  --bg: #f2f5fa;
  --card: #ffffff;
  --ink: #0f1a33;
  --muted: #5b6680;
  --line: #dde3ee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 26, 51, .06), 0 4px 14px rgba(15, 26, 51, .07);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.45;
}
a { color: var(--navy); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ------------------------ Cabeceras ------------------------ */
.hero {
  background: linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 45%, var(--green) 100%);
  color: #fff; padding: 22px 0 64px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -10% -60px -10%; height: 110px;
  background: var(--bg); border-radius: 50% 50% 0 0;
}
.hero .wrap { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; z-index: 1; }
.hero-logo {
  width: 132px; height: 132px; border-radius: 50%; background: #fff; padding: 3px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
}
.hero h1 { font-size: 1.9rem; margin: 14px 0 2px; letter-spacing: .5px; font-weight: 800; }
.hero p { margin: 0; opacity: .92; font-size: .95rem; }
.hero .date {
  display: inline-block; margin-top: 10px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255,255,255,.16); font-weight: 600; font-size: .85rem;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(90deg, var(--navy-2), var(--navy));
  color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.topbar .wrap { display: flex; align-items: center; gap: 10px; height: 56px; }
.topbar a.back {
  color: #fff; text-decoration: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; margin-left: -8px; font-size: 1.4rem;
}
.topbar a.back:active { background: rgba(255,255,255,.15); }
.topbar .title { font-weight: 700; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }

/* ------------------------ Aviso / en vivo ------------------------ */
.notice {
  margin: 0 0 14px; position: relative; z-index: 2;
  background: #fff7e0; border: 1px solid #f3d27a; color: #6b4e00;
  border-radius: 12px; padding: 10px 14px; font-size: .92rem;
}
.live-strip {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: #fff; border-radius: 12px; padding: 10px 14px; margin: 0 0 14px;
  box-shadow: var(--shadow); color: var(--ink); font-weight: 600; position: relative; z-index: 2;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none;
  box-shadow: 0 0 0 0 rgba(212,42,42,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(212,42,42,0); } 100% { box-shadow: 0 0 0 0 rgba(212,42,42,0); } }

/* ------------------------ Mosaicos ------------------------ */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 24px; position: relative; z-index: 2; }
.hero + main > :first-child { margin-top: -40px; }
.tile {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); padding: 16px 14px 14px; min-height: 128px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  transition: transform .12s ease;
}
.tile:active { transform: scale(.97); }
.tile .ic {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; background: var(--c, var(--navy));
}
.tile .ic svg { width: 26px; height: 26px; }
.tile b { font-size: 1.02rem; display: block; margin-top: 12px; }
.tile span { font-size: .8rem; color: var(--muted); }
.tile::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px;
  border-radius: 50%; background: var(--c, var(--navy)); opacity: .08;
}
.tile.wide { grid-column: span 2; min-height: 96px; flex-direction: row; align-items: center; gap: 14px; justify-content: flex-start; }
.tile.wide b { margin-top: 0; }
.tile .badge-live {
  position: absolute; top: 12px; right: 12px; background: var(--red); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .5px;
}

footer.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 12px 0 calc(24px + var(--safe-b)); }
footer.foot a { color: var(--muted); }

/* ------------------------ Tarjetas / botones ------------------------ */
.page { padding-top: 16px; padding-bottom: calc(28px + var(--safe-b)); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 1.1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 700;
  background: var(--navy); color: #fff; text-decoration: none; cursor: pointer; min-height: 46px;
}
.btn:active { filter: brightness(.9); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.ghost { background: #eef2f9; color: var(--navy); }
.btn.block { display: flex; width: 100%; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 3rem; }
.zoomable { border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.prose { white-space: pre-line; }

/* ------------------------ Lugares (hoteles / turismo) ------------------------ */
.place { padding: 0; overflow: hidden; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 4px; background: #e8edf5; }
.gallery img { flex: 0 0 88%; aspect-ratio: 4/3; object-fit: cover; scroll-snap-align: start; cursor: zoom-in; }
.gallery img:only-child { flex-basis: 100%; }
.place .body { padding: 14px 16px 16px; }
.place h3 { font-size: 1.1rem; }
.place .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ------------------------ Mapa de instalaciones ------------------------ */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.mapbox { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; touch-action: pan-x pan-y; }
.mapbox .inner { position: relative; transform-origin: 0 0; }
.mapbox img { width: 100%; user-select: none; -webkit-user-drag: none; }
.pin {
  position: absolute; transform: translate(-50%, -100%); border: 0; padding: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.pin .p {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--pc); display: grid; place-items: center; border: 2px solid #fff;
}
.pin .p i { transform: rotate(45deg); font-style: normal; font-size: 16px; }
.pin.sel .p { outline: 3px solid #ffd54a; }
.popup {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 60;
  background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 14px 16px;
  max-width: 560px; margin: 0 auto;
}
.popup .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 1.5rem; color: var(--muted); }
.legend-list { list-style: none; padding: 0; margin: 0; }
.legend-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.legend-list li:last-child { border-bottom: 0; }
.zoom-ctl { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.zoom-ctl button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; font-weight: 700; }

/* ------------------------ Fixture ------------------------ */
.tabs { display: flex; gap: 6px; background: #e3e9f3; padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 9px; font: inherit;
  font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; line-height: 1.15;
}
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.subtabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.round-title { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 8px; }
.round-title h3 { font-size: 1rem; color: var(--navy); margin: 0; }
.match { background: #fff; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.match .meta { display: flex; justify-content: space-between; gap: 8px; padding: 8px 14px 0; font-size: .75rem; color: var(--muted); }
.match .row { display: flex; align-items: center; padding: 6px 14px; gap: 10px; }
.match .row .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .row .sc { font-size: 1.25rem; font-weight: 800; min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.match .row .pen { font-size: .8rem; color: var(--muted); font-weight: 700; }
.match .row.win .name { color: var(--green-2); }
.match .row.win .name::after { content: " ✓"; }
.match .row.lose { opacity: .55; }
.match .row.tbd .name { color: var(--muted); font-weight: 500; font-style: italic; }
.match .foot { padding: 0 14px 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .72rem; letter-spacing: .3px; text-transform: uppercase; }
.status.en_juego { color: var(--red); }
.status.finalizado { color: var(--green-2); }
.status.pendiente { color: var(--muted); }
.match.live { outline: 2px solid var(--red); }
.champ {
  background: linear-gradient(135deg, #f8c93a, #f19e1c); color: #3b2500; text-align: center;
  border-radius: 16px; padding: 16px; margin-bottom: 14px; font-weight: 800; box-shadow: var(--shadow);
}
.champ .big { font-size: 2rem; }
.team-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 12px; }
.team-list li { break-inside: avoid; padding: 8px 10px; background: #fff; border-radius: 10px; margin-bottom: 8px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; }
.team-list li.out { opacity: .45; text-decoration: line-through; }
.updated { text-align: center; font-size: .75rem; color: var(--muted); margin: 6px 0 14px; }

/* ------------------------ Lightbox ------------------------ */
.lightbox { position: fixed; inset: 0; background: rgba(5,10,25,.94); z-index: 100; display: flex; align-items: center; justify-content: center; overflow: auto; }
.lightbox img { max-width: none; width: 100%; height: auto; touch-action: pinch-zoom; }
.lightbox .x { position: fixed; top: 10px; right: 12px; color: #fff; background: rgba(255,255,255,.15); border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.5rem; }

@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile.wide { grid-column: span 3; }
  .gallery img { flex-basis: 48%; }
}
.round-title, .match { scroll-margin-top: 70px; }
a.chip { text-decoration: none; }

/* ======================== ADMIN ======================== */
.adm .topbar .wrap { gap: 6px; }
.adm-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
.adm-nav a { flex: none; text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--navy); background: #fff; border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }
.adm-nav a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.flash { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-weight: 600; }
.flash.ok { background: #e3f5e8; color: #135a26; border: 1px solid #b7e2c3; }
.flash.err { background: #fde8e8; color: #8a1717; border: 1px solid #f5b8b8; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=tel], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid #c9d2e3; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9db4ff; border-color: #6d8ef0; }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { font-size: .9rem; max-width: 100%; }
.help { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #e8edf5; flex: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #eef2f9; color: var(--navy); }
.pill.red { background: #fde8e8; color: #8a1717; }
.pill.green { background: #e3f5e8; color: #135a26; }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash a { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px; text-decoration: none; color: var(--ink); }
.dash a b { display: block; }
.dash a span { font-size: .8rem; color: var(--muted); }
.dash a .e { font-size: 1.6rem; }
details.card > summary { font-weight: 700; cursor: pointer; list-style: none; }
details.card > summary::before { content: "▸ "; color: var(--muted); }
details.card[open] > summary::before { content: "▾ "; }
.imgs3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.imgs3 .slot { border: 1px dashed #c9d2e3; border-radius: 10px; padding: 6px; font-size: .8rem; }
.imgs3 img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; width: 100%; }

/* marcador en vivo */
.live-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.live-card.en_juego { outline: 2px solid var(--red); }
.live-card .hdr { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.sc-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 6px 0; }
.sc-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: #eef2f9; color: var(--navy); font-size: 1.4rem; font-weight: 800; }
.stepper button.plus { background: var(--navy); color: #fff; }
.stepper output { min-width: 34px; text-align: center; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pen-box { background: #fff7e0; border: 1px solid #f3d27a; border-radius: 12px; padding: 8px 10px; margin-top: 6px; }
.pen-box .stepper button { width: 38px; height: 38px; font-size: 1.1rem; }
.pen-box .stepper output { font-size: 1.2rem; }
.st-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.st-btns button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 4px; font: inherit; font-size: .82rem; font-weight: 700; color: var(--muted); }
.st-btns button.on[data-s=pendiente] { background: #eef2f9; color: var(--navy); border-color: #c9d2e3; }
.st-btns button.on[data-s=en_juego] { background: var(--red); color: #fff; border-color: var(--red); }
.st-btns button.on[data-s=finalizado] { background: var(--green); color: #fff; border-color: var(--green); }
.saving { font-size: .75rem; color: var(--muted); text-align: right; min-height: 1em; }
.toast { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); background: #1c2438; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 90; font-weight: 600; max-width: 92vw; }
.toast.err { background: #a11d1d; }

/* editor de fixture */
.m-edit { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.m-edit summary { display: flex; gap: 8px; align-items: center; cursor: pointer; list-style: none; }
.m-edit summary .t { flex: 1; font-weight: 600; font-size: .92rem; }
.m-edit form { margin-top: 8px; }
.editor-map { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: crosshair; }
.editor-map img { width: 100%; user-select: none; -webkit-user-drag: none; }

/* ------------------------ Auspiciantes ------------------------ */
.sponsors { margin: 8px 0 20px; text-align: center; }
.sponsors h2 { font-size: .72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.sp-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sp { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); min-height: 64px; }
.sp img { object-fit: contain; }
.sponsors.big .sp { min-width: 0; }
.sponsors.big .sp { min-height: 88px; padding: 14px 18px; flex: 1 1 40%; max-width: 48%; }
.sp-foot { padding-bottom: calc(16px + var(--safe-b)); }
.sp-foot .sponsors { margin: 4px 0 0; border-top: 1px solid var(--line); padding-top: 14px; }
.sp-foot .sp { box-shadow: none; border: 1px solid var(--line); min-height: 52px; padding: 6px 10px; }

/* ------------------------ Programa / precios en imagen ------------------------ */
.doc-page { padding-left: 8px; padding-right: 8px; }
.doc-img { margin: 0 0 12px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.doc-img img { width: 100%; height: auto; cursor: zoom-in; }
.lightbox { align-items: flex-start; }
.lightbox img { margin: auto 0; }

/* ------------------------ Mapa satelital (Instalaciones) ------------------------ */
.geomap-wrap { position: relative; }
.geomap { height: 62vh; min-height: 340px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #dfe6ee; z-index: 0; }
.adm-map { height: 58vh; cursor: crosshair; }
.locate { position: absolute; left: 10px; bottom: 30px; z-index: 500; border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: .88rem; font-weight: 700; background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: pointer; }
.locate.on { background: #2563eb; color: #fff; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--kc, var(--navy)); animation: none; box-shadow: none; }
.chip.on .dot { box-shadow: 0 0 0 2px #fff; }
.gpin { background: none; border: 0; }
.gpin .p { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pc); display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.gpin .p i { transform: rotate(45deg); font-style: normal; font-size: 16px; line-height: 1; }
.gpin.sel .p { outline: 3px solid #ffd54a; }
.gbadge { background: none; border: 0; }
.gbadge span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; background: var(--pc); color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 2px 8px 2px 4px; font-size: .72rem; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.gbadge i { font-style: normal; font-size: 14px; }
.gbadge b { font-weight: 700; }
.vhandle { background: #fff; border: 3px solid var(--navy); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 120px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 8px; font: inherit; font-size: .88rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.leaflet-container { font: inherit; }
.popup { z-index: 1000; }
