:root {
  --green-950: #0b2417;
  --green-900: #123324;
  --green-800: #1a4530;
  --green-700: #23573d;
  --green-100: #dcefe3;
  --gold: #c9a44c;
  --gold-light: #e6c87a;
  --cream: #f7f3e9;
  --paper: #fffdf7;
  --ink: #1d2a22;
  --muted: #6b7a70;
  --red: #b3372f;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(11, 36, 23, .12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overscroll-behavior-y: contain; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

/* ---------- Pull to refresh ---------- */
#ptr {
  position: fixed; top: -64px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 90;
  background: var(--paper); color: var(--green-800);
  border: 1px solid var(--gold); border-radius: 999px;
  padding: 10px 18px; font: 700 13px 'Inter', sans-serif;
  box-shadow: 0 6px 18px rgba(11,36,23,.25);
  transition: none; pointer-events: none; opacity: 0;
}
#ptr .ptr-icon { display: inline-block; transition: transform .15s; font-size: 15px; }
#ptr.armed .ptr-icon { transform: rotate(180deg); }
#ptr.loading .ptr-icon { animation: ptrSpin .8s linear infinite; }
@keyframes ptrSpin { to { transform: rotate(360deg); } }

/* ---------- Header ---------- */
.topbar {
  background: linear-gradient(135deg, var(--green-950), var(--green-800));
  color: #fff;
  padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold));
  display: grid; place-items: center; font-size: 28px;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.brand h1 { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.brand h1 span { color: var(--gold-light); }
.tagline { font-size: 12px; opacity: .75; letter-spacing: .4px; }
.meeting-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.meeting-date { text-align: right; font-size: 13px; line-height: 1.5; opacity: .95; }
.meeting-date strong { display: block; font-size: 15px; color: var(--gold-light); }
.bet-cta {
  background: var(--gold); color: var(--green-950);
  padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: 14px;
  text-decoration: none; box-shadow: 0 3px 10px rgba(0,0,0,.3);
  transition: transform .15s, box-shadow .15s;
}
.bet-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.live-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: #c4302b; color: #fff;
  padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: 14px;
  text-decoration: none; box-shadow: 0 3px 10px rgba(0,0,0,.3);
  transition: transform .15s, box-shadow .15s;
}
.live-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(196,48,43,.5); }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,255,255,.6); }
  50% { opacity: .55; box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* ---------- Jackpots ---------- */
.jackpots {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: var(--green-900); padding: 10px 16px;
}
.jackpot {
  background: rgba(255,255,255,.07); border: 1px solid rgba(201,164,76,.4);
  color: #fff; border-radius: 10px; padding: 6px 14px; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; min-width: 120px;
}
.jackpot b { color: var(--gold-light); font-size: 15px; }
.jackpot-label {
  width: 100%; text-align: center; color: var(--gold-light);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px;
  margin-bottom: 2px;
}
.next-banner {
  background: var(--gold); color: var(--green-950); text-align: center;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
}
.next-banner a { color: var(--green-950); font-weight: 800; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 6px; padding: 14px 22px 0; max-width: 1180px; margin: 0 auto;
  overflow-x: auto;
}
.tabs button {
  border: none; background: #e9e2d0; color: var(--ink);
  font: 700 14px 'Inter'; padding: 12px 20px; cursor: pointer;
  border-radius: 12px 12px 0 0; white-space: nowrap;
  transition: background .15s;
}
.tabs button:hover { background: #ded4bc; }
.tabs button.active { background: var(--green-800); color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 22px 60px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

/* ---------- Race cards ---------- */
.race-card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 26px; overflow: hidden; border: 1px solid #e5ddc8;
}
.race-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--green-900), var(--green-700));
  color: #fff; padding: 14px 20px;
}
.race-num {
  font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 800;
  background: var(--gold); color: var(--green-950); border-radius: 10px;
  padding: 4px 14px; line-height: 1.2;
}
.race-title { flex: 1; min-width: 220px; }
.race-title h3 { font-size: 17px; }
.race-title .clasico { color: var(--gold-light); font-size: 14px; font-weight: 700; }
.race-title p { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.race-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 10px; font-size: 13px;
}
.race-meta .hora { font-size: 22px; font-weight: 800; color: var(--gold-light); line-height: 1; }
.race-meta .race-bet { display: inline-block; white-space: nowrap; }
.race-bet {
  background: transparent; border: 1.5px solid var(--gold); color: var(--gold-light);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 12.5px;
  text-decoration: none; transition: background .15s, color .15s;
}
.race-bet:hover { background: var(--gold); color: var(--green-950); }

.entries { width: 100%; border-collapse: collapse; }
.entries th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 10px 12px; border-bottom: 2px solid #e5ddc8;
}
.entries td { padding: 10px 12px; border-bottom: 1px solid #efe9d8; font-size: 14px; vertical-align: middle; }
.entries tr:last-child td { border-bottom: none; }
.entries tr:hover td { background: #f6f1e2; }
.horse-link { font-weight: 800; cursor: pointer; color: var(--green-800); }
.horse-link:hover { text-decoration: underline; }
.pais { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.saddle {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  font-weight: 800; font-size: 14px;
}
.comment { color: var(--muted); font-size: 12.5px; font-style: italic; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
}
.chip.indicado { background: var(--green-800); color: #fff; }
.chip.rival { background: var(--gold); color: var(--green-950); }
.chip.sorpresa { background: var(--red); color: #fff; }
.chip.estilo { background: #e9e2d0; color: var(--ink); font-weight: 600; }

.race-foot {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start;
  padding: 12px 20px; background: #f4efe1; border-top: 1px solid #e5ddc8; font-size: 12.5px;
}
.race-foot h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.race-foot .box { flex: 1; min-width: 200px; }
.tp-list span { display: inline-block; margin-right: 10px; white-space: nowrap; }
.tp-list b { color: var(--green-800); }
.apuestas-list { color: var(--muted); }
.nota { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ---------- Caballos tab ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input {
  flex: 1; min-width: 220px; padding: 12px 16px; border-radius: 10px;
  border: 1.5px solid #d8cfb6; font: 500 14px 'Inter'; background: var(--paper);
}
.toolbar input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.toolbar select {
  padding: 12px 14px; border-radius: 10px; border: 1.5px solid #d8cfb6;
  font: 700 14px 'Inter'; background: var(--paper); color: var(--ink);
  cursor: pointer; min-width: 190px;
}
.toolbar select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.video-link {
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
  color: #c4302b; font-weight: 800; text-decoration: none; white-space: nowrap; font-size: .95em;
}
.video-link:hover { text-decoration: underline; }

/* ---------- Detalle de carrera (calendario) ---------- */
.race-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.race-chips button {
  border: 1.5px solid #d8cfb6; background: var(--paper); border-radius: 10px;
  padding: 6px 12px; font: 800 13px 'Inter'; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.race-chips button small { font-size: 9.5px; font-weight: 600; color: var(--muted); }
.race-chips button.active { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.race-chips button.active small { color: rgba(255,255,255,.75); }
.rd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rd-titulo { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--green-900); margin: 0 0 6px; text-transform: none; letter-spacing: 0; }
.rd-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rd-tag { background: #e67e22; color: #fff; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; }
.rd-tag.oro { background: var(--gold); color: var(--green-950); }
.rd-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.video-btn {
  background: #c4302b; color: #fff; border: none; border-radius: 999px;
  padding: 9px 18px; font: 800 13px 'Inter'; cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(196,48,43,.35);
}
.video-btn:hover { background: #a82824; }
.video-btn.dia { background: var(--green-800); box-shadow: 0 3px 10px rgba(26,69,48,.3); }
.video-btn.dia:hover { background: var(--green-700); }
.pf-btn {
  background: var(--gold); color: var(--green-950); border: none; border-radius: 999px;
  padding: 9px 18px; font: 800 13px 'Inter'; cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(201,164,76,.4); margin-left: 8px;
}
.pf-btn:hover { background: var(--gold-light); }
/* el visor se adapta cuando muestra una foto en vez de video */
.video-frame.es-foto { aspect-ratio: auto; background: #fff; max-height: 82vh; overflow: auto; }
.video-frame.es-foto img { width: 100%; height: auto; display: block; }
.pf-nd { color: var(--muted); padding: 40px 20px; text-align: center; font-weight: 600; }
.video-nd {
  color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap;
  border: 1.5px dashed #d8cfb6; border-radius: 999px; padding: 8px 16px;
}
.rd-aviso {
  background: #fdf3d7; border: 1px solid var(--gold); color: #7a5c12;
  border-radius: 10px; padding: 8px 14px; font-size: 12.5px; font-weight: 700;
  text-align: center; margin-bottom: 12px;
}
.rd-tabla-tit {
  background: var(--green-950); color: #fff; text-align: center; font-weight: 800;
  font-size: 12px; letter-spacing: 1.5px; padding: 8px; border-radius: 10px 10px 0 0; margin-top: 14px;
}
table.rd-tabla { font-size: 12.5px; }
table.rd-tabla thead th { background: var(--green-800); color: #fff; border: none; padding: 8px 10px; }
table.rd-tabla tr.rd-ganador td { background: #eaf6ee; font-weight: 700; }
.rd-premio { color: #1e8449; font-weight: 800; }

/* ---------- Reproductor de carreras ---------- */
.video-layer {
  position: fixed; inset: 0; background: rgba(6,14,9,.92); z-index: 120;
  display: none; place-items: center; padding: 20px;
}
.video-layer.open { display: grid; }
.video-box { width: 100%; max-width: 1000px; }
.video-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: #fff; font-weight: 800; font-size: 15px; margin-bottom: 10px;
}
.video-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000;
  border-radius: 14px; overflow: hidden; border: 2px solid var(--gold);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; font-size: 12.5px; flex-wrap: wrap;
}
.video-foot a { color: var(--gold-light); font-weight: 800; }
.video-foot .muted { color: #8fa697; }
@media (max-width: 640px) { .video-head { font-size: 13px; } .video-layer { padding: 12px; } }
.stud-header {
  background: var(--green-100); border-left: 4px solid var(--green-700);
  border-radius: 0 10px 10px 0; padding: 10px 14px; margin-bottom: 14px;
  font-size: 14px; color: var(--green-900);
}
.subtabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.subtabs button {
  border: 1.5px solid #d8cfb6; background: var(--paper); border-radius: 999px;
  padding: 8px 16px; font: 700 13px 'Inter'; cursor: pointer; color: var(--ink);
}
.subtabs button.active { background: var(--green-800); border-color: var(--green-800); color: #fff; }

.horse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.horse-card {
  background: var(--paper); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid #e5ddc8; cursor: pointer;
  transition: transform .12s;
}
.horse-card:hover { transform: translateY(-3px); }
.horse-card h4 { font-size: 16px; color: var(--green-900); }
.horse-card .sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #e9e2d0;
}
.badge.hc { background: var(--green-100); color: var(--green-800); }
.badge.corre { background: var(--gold); color: var(--green-950); }

.section-card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid #e5ddc8; margin-bottom: 22px; overflow: hidden;
}
.section-card > h3 {
  background: linear-gradient(120deg, var(--green-900), var(--green-700)); color: #fff;
  padding: 12px 18px; font-size: 15px; letter-spacing: .3px;
}
.section-card .inner { padding: 14px 18px; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain th {
  text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 2px solid #e5ddc8; letter-spacing: .5px;
}
table.plain td { padding: 8px 10px; border-bottom: 1px solid #efe9d8; }
table.plain tr:hover td { background: #f6f1e2; }
table.plain td.num, table.plain th.num { text-align: right; font-variant-numeric: tabular-nums; }

.hc-group { margin-bottom: 14px; }
.hc-points {
  display: inline-block; min-width: 40px; text-align: center; font-weight: 800;
  background: var(--green-800); color: #fff; border-radius: 8px; padding: 3px 8px;
  margin-right: 8px; font-size: 13px;
}
.hc-horses { color: var(--ink); font-size: 13.5px; }
.hc-horses .in-program { font-weight: 700; color: var(--green-800); cursor: pointer; }
.hc-horses .in-program.corre { font-weight: 800; text-decoration: underline dotted var(--gold) 2px; }
.hc-horses .in-program:hover { text-decoration: underline; }
.hc-horses .hc-sin { color: #a99f88; }

/* ---------- Resultados ---------- */
.result-card .llegada td:first-child { width: 46px; }
.dividendos { background: #f4efe1; padding: 10px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid #e5ddc8; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,36,23,.55); backdrop-filter: blur(3px);
  display: none; place-items: center; z-index: 100; /* por encima de la barra inferior */
  padding: 20px;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--paper); border-radius: 18px; max-width: 860px; width: 100%;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.camp-grid {
  display: grid; grid-template-columns: repeat(6, auto); gap: 8px; justify-content: start;
}
.camp-grid > div {
  background: #f4efe1; border: 1px solid #e5ddc8; border-radius: 10px;
  padding: 8px 14px; text-align: center; display: flex; flex-direction: column;
}
.camp-grid b { color: var(--green-800); font-size: 16px; }
.camp-grid span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
table.actuaciones { font-size: 12.5px; white-space: nowrap; }
table.actuaciones .marcador { font-size: 11.5px; color: var(--muted); }
table.actuaciones .lleg-win { color: var(--green-800); }
table.actuaciones tr.ret td { color: var(--red); font-style: italic; }
@media (max-width: 640px) { .camp-grid { grid-template-columns: repeat(3, 1fr); } }
.modal-head {
  background: linear-gradient(120deg, var(--green-950), var(--green-700)); color: #fff;
  padding: 20px 24px; position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.modal-head h2 { font-family: 'Playfair Display', serif; font-size: 24px; }
.modal-head .sub { font-size: 13px; opacity: .85; margin-top: 3px; }
.modal-close {
  background: rgba(255,255,255,.15); border: none; color: #fff; width: 34px; height: 34px;
  border-radius: 50%; font-size: 17px; cursor: pointer; flex-shrink: 0;
}
.modal-body { padding: 18px 24px 24px; }
.modal-body h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  margin: 16px 0 6px;
}
.modal-body h4:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { font-weight: 600; }
.apronte-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; padding: 6px 0; border-bottom: 1px dashed #e5ddc8; flex-wrap: wrap; }
.apronte-row b { color: var(--green-800); }

/* ---------- Próximas ---------- */
.prox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 16px; }
.prox-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e5ddc8; padding: 18px; }
.prox-card h4 { color: var(--green-900); font-size: 15px; }
.prox-card .dest { color: var(--gold); font-weight: 800; font-size: 13px; margin: 6px 0 10px; }
.prox-card ul { margin-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }

footer { background: var(--green-950); color: rgba(255,255,255,.65); text-align: center; padding: 22px 20px; font-size: 12px; line-height: 1.8; }
footer .resp { color: var(--gold-light); font-weight: 700; }

/* ---------- Artículos ---------- */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.article-card {
  background: var(--paper); border: 1px solid #e5ddc8; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; transition: transform .12s;
}
.article-card:hover { transform: translateY(-3px); }
.art-seccion {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--gold);
}
.article-card h4 { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--green-900); line-height: 1.3; }
.art-autor { font-size: 12px; color: var(--muted); font-style: italic; }
.art-resumen { font-size: 13.5px; color: var(--muted); line-height: 1.55; flex: 1; }
.art-leer { font-size: 13px; font-weight: 800; color: var(--green-800); }
.article-body p { margin-bottom: 14px; font-size: 14.5px; line-height: 1.75; text-align: justify; }
.article-body p:first-child::first-letter {
  font-family: 'Playfair Display', serif; font-size: 42px; float: left; line-height: .9;
  padding-right: 8px; color: var(--green-800);
}
.art-thumb {
  margin: -18px -18px 12px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden;
  aspect-ratio: 16 / 9; background: #e9e2d0;
}
.art-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-figure { margin: 0 0 16px; }
.art-figure img { width: 100%; border-radius: 12px; display: block; }
.art-figure figcaption {
  font-size: 12px; color: var(--muted); padding: 6px 4px 0; line-height: 1.5; font-style: italic;
}
.art-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.art-nota {
  background: #f4efe1; border-left: 3px solid var(--gold); padding: 10px 14px;
  border-radius: 0 10px 10px 0; font-size: 13px !important; color: var(--muted);
}

/* ---------- La Polla: auth ---------- */
.signin-btn {
  background: transparent; border: 2px solid var(--gold); color: var(--gold-light);
  padding: 9px 18px; border-radius: 999px; font: 800 14px 'Inter'; cursor: pointer;
  transition: background .15s, color .15s;
}
.signin-btn:hover { background: var(--gold); color: var(--green-950); }
.user-chip {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1);
  border: 1px solid rgba(201,164,76,.5); border-radius: 999px; padding: 5px 10px 5px 5px;
  color: #fff; font-weight: 700; font-size: 13.5px;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--gold);
  color: var(--green-950); display: grid; place-items: center; font-weight: 800;
}
.user-chip button { background: none; border: none; color: var(--gold-light); font-size: 16px; cursor: pointer; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.auth-form input {
  padding: 12px 14px; border-radius: 10px; border: 1.5px solid #d8cfb6;
  font: 500 15px 'Inter'; background: var(--paper);
}
.auth-form input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.auth-submit {
  background: var(--green-800); color: #fff; border: none; padding: 13px 22px;
  border-radius: 10px; font: 800 15px 'Inter'; cursor: pointer; transition: background .15s;
}
.auth-submit:hover { background: var(--green-700); }
.auth-submit.ghost { background: transparent; border: 2px solid var(--green-800); color: var(--green-800); }
.auth-submit.ghost:hover { background: var(--green-100); }
.auth-err { color: var(--red); font-size: 13px; font-weight: 600; min-height: 18px; }
.auth-switch { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-switch a { color: var(--green-800); font-weight: 800; }
.mode-note {
  background: #fdf3d7; border: 1px solid var(--gold); border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; margin-bottom: 14px; color: #7a5c12;
}

/* ---------- La Polla: jugar ---------- */
.polla-hero {
  background: linear-gradient(135deg, var(--green-950), var(--green-700));
  color: #fff; border-radius: var(--radius); padding: 34px 28px; text-align: center;
  box-shadow: var(--shadow);
}
.polla-hero h2 { font-family: 'Playfair Display', serif; font-size: 28px; margin-bottom: 8px; }
.polla-hero p { opacity: .85; max-width: 560px; margin: 0 auto 18px; }
.score-rules {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px;
  max-width: 720px; margin: 0 auto 20px; font-size: 13px;
}
.polla-hero .score-rules div { background: rgba(255,255,255,.08); border: 1px solid rgba(201,164,76,.35); border-radius: 10px; padding: 8px; }
.score-rules b { color: var(--gold); font-size: 15px; margin-right: 4px; }
.polla-hero .score-rules b { color: var(--gold-light); }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-btns .auth-submit { background: var(--gold); color: var(--green-950); }
.hero-btns .auth-submit.ghost { background: transparent; border-color: var(--gold); color: var(--gold-light); }
.polla-top h2 { font-family: 'Playfair Display', serif; color: var(--green-900); }
.polla-top p { color: var(--muted); font-size: 13.5px; margin: 6px 0 18px; }
.pick-card {
  background: var(--paper); border: 1px solid #e5ddc8; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.pick-card.clasico { border: 2px solid var(--gold); }
.pick-head {
  padding: 12px 16px; background: #f4efe1; border-bottom: 1px solid #e5ddc8;
  font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pick-summary { margin-left: auto; color: var(--green-800); font-weight: 700; font-size: 12.5px; }
.pick-horses { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
.pick-horse {
  display: flex; align-items: center; gap: 8px; border: 1.5px solid #d8cfb6;
  background: var(--paper); border-radius: 999px; padding: 6px 14px 6px 6px;
  font: 700 13.5px 'Inter'; cursor: pointer; position: relative; transition: all .12s;
}
.pick-horse:hover { border-color: var(--green-700); }
.pick-horse.sel { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.pick-horse.sel.s2 { background: var(--green-700); }
.pick-horse.sel.s3 { background: #57755f; }
.slot-badge {
  background: var(--gold); color: var(--green-950); font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 2px 8px;
}
.bonus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; padding: 14px 16px; }
.bonus-grid label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.bonus-grid select { padding: 10px 12px; border-radius: 10px; border: 1.5px solid #d8cfb6; font: 600 14px 'Inter'; background: var(--paper); }
.polla-groups {
  background: var(--paper); border: 1px solid #e5ddc8; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-top: 22px;
}
.polla-groups h3 { color: var(--green-900); margin-bottom: 10px; }
.polla-groups ul { list-style: none; margin: 0 0 12px; }
.polla-groups li { padding: 8px 0; border-bottom: 1px dashed #e5ddc8; font-size: 14px; }
.polla-groups code { background: #f4efe1; padding: 2px 8px; border-radius: 6px; font-weight: 800; letter-spacing: 1px; }
.group-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.group-actions input {
  width: 110px; padding: 11px 12px; border-radius: 10px; border: 1.5px solid #d8cfb6;
  font: 800 14px 'Inter'; letter-spacing: 2px;
}
.mini-btn {
  background: var(--green-100); border: none; color: var(--green-800);
  font: 700 12px 'Inter'; padding: 4px 12px; border-radius: 999px; cursor: pointer;
}
.muted { color: var(--muted); font-size: 13px; }
.muted-cell { color: var(--muted); font-size: 12px; }

/* ---------- Apuestas: repartos del día ---------- */
.ap-card {
  background: #0a0f0c; border-radius: var(--radius); border: 2px solid var(--gold);
  padding: 18px 22px; margin-bottom: 16px; font-size: 20px;
  box-shadow: var(--shadow);
}
.ap-line { color: #e8f5ec; font-weight: 800; line-height: 1.5; margin: 10px 0; letter-spacing: .3px; }
.ap-titulo { color: var(--gold-light); text-transform: uppercase; font-size: 1.05em; }
.ap-sub { color: #9db8a6; font-size: .62em; font-weight: 600; }
.ap-alerta { color: #ff8a80; font-size: .82em; }
.ap-pool { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; border-bottom: 1px solid rgba(201,164,76,.2); padding-bottom: 8px; }
.ap-pool-name { color: var(--gold); text-transform: uppercase; font-size: .68em; min-width: 5.2em; }
.ap-combo { color: #fff; }
.ap-paga { color: #7dffb2; margin-left: auto; }
.ap-detalle { flex-basis: 100%; color: #9db8a6; font-size: .55em; font-weight: 600; }
@media (max-width: 640px) { .ap-card { font-size: 16px; padding: 14px 14px; } }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 16px; color: var(--green-900); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 420px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: #b9b09a;
}
.cal-cell.carrera {
  background: var(--green-100); color: var(--green-900); font-weight: 800; cursor: pointer;
  border: 1.5px solid var(--green-700);
}
.cal-cell.carrera:hover { background: var(--green-700); color: #fff; }
.cal-cell.sel { background: var(--green-800) !important; color: #fff !important; }
.cal-cell.hoy { outline: 2px solid var(--gold); }
.cal-detalle { margin-top: 12px; background: #f4efe1; border-radius: 10px; padding: 12px 14px; font-size: 14px; max-width: 560px; }
.cal-programa { margin: 8px 0 0 18px; font-size: 13px; line-height: 1.8; color: var(--ink); }

/* ---------- Stud bajo el caballo (móvil) ---------- */
.stud-sm { display: none; font-size: 12px; font-weight: 700; color: var(--green-800); margin-top: 1px; }
.stud-sm:empty { display: none !important; }
/* dato completado desde la base del hipódromo */
td.desde-bd { color: var(--green-800); }

/* ---------- Barra flotante (móvil) — estilo vidrio líquido ---------- */
.bottomnav {
  display: none; position: fixed; z-index: 60;
  left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: calc(100% - 20px);
  padding: 5px; gap: 2px;
  border-radius: 999px;
  background: rgba(14, 40, 27, .62);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, .38),
    0 2px 8px rgba(0, 0, 0, .2),
    inset 0 1px 0 rgba(255, 255, 255, .26),
    inset 0 -1px 0 rgba(0, 0, 0, .18);
}
.bottomnav button {
  background: none; border: none; cursor: pointer;
  color: rgba(255, 255, 255, .72); font: 800 0px 'Inter';
  padding: 10px 15px; border-radius: 999px;
  display: flex; align-items: center; gap: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s ease, color .18s ease, padding .18s ease;
}
.bottomnav button span { font-size: 21px; line-height: 1; }
.bottomnav button.active {
  background: rgba(255, 255, 255, .17);
  color: #fff; font-size: 11.5px; gap: 7px; padding: 10px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
}
.bottomnav button:active { transform: scale(.94); }
.more-sheet {
  display: none; position: fixed; right: 12px; bottom: 76px; z-index: 59;
  background: rgba(255, 253, 247, .82);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.6);
  overflow: hidden; min-width: 196px;
}
.more-sheet.open { display: block; }
.more-sheet button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid #efe9d8; padding: 14px 18px; font: 700 14.5px 'Inter';
  color: var(--ink); cursor: pointer;
}
.more-sheet button:last-child { border-bottom: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--green-900); color: #fff; padding: 12px 22px; border-radius: 999px;
  font: 700 14px 'Inter'; box-shadow: 0 8px 24px rgba(0,0,0,.35); opacity: 0;
  transition: all .25s; z-index: 100; border: 1px solid var(--gold);
}
.toast.err { background: var(--red); border-color: #fff3; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .tabs { display: none; }
  .bottomnav { display: flex; }
  /* Reserva la altura real de la barra + la franja del indicador de iOS */
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  main { padding-bottom: 30px; }
  .more-sheet { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  /* El modal ocupa la pantalla completa por encima de la barra */
  .modal-backdrop { padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal { max-height: calc(100vh - 24px - env(safe-area-inset-bottom, 0px)); }
  .video-layer { padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .stud-sm { display: block; }
  .race-meta { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .entries .hide-sm { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* ---------- Pronóstico por datos ---------- */
.chip.favorito { background: var(--green-800); color: #fff; }
.chip.rival-d { background: var(--gold); color: var(--green-950); }
.chip.sorpresa-d { background: #e9e2d0; color: var(--muted); }
.analisis { padding: 0 20px 12px; }
.analisis details { border: 1px dashed #d8cfb6; border-radius: 10px; background: #fbf8f0; }
.analisis summary {
  cursor: pointer; padding: 9px 14px; font-size: 12.5px; font-weight: 800;
  color: var(--green-800); list-style: none;
}
.analisis summary::-webkit-details-marker { display: none; }
.analisis summary::before { content: "▸ "; }
.analisis details[open] summary::before { content: "▾ "; }
.analisis-cuerpo { padding: 4px 14px 12px; }
.an-fila { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed #eee6d3; font-size: 13px; flex-wrap: wrap; }
.an-fila:last-of-type { border-bottom: none; }
.an-pos { min-width: 22px; font-weight: 800; color: var(--gold); }
.an-cab { min-width: 150px; color: var(--green-900); }
.an-razon { color: var(--muted); font-size: 12.5px; flex: 1; }
.an-nota { font-size: 11.5px; color: var(--muted); margin-top: 8px; font-style: italic; }

/* ---------- Galería de ganadores ---------- */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.gal-card {
  background: var(--paper); border: 1px solid #e5ddc8; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; margin: 0;
  transition: transform .12s;
}
.gal-card:hover { transform: translateY(-3px); }
.gal-foto { position: relative; aspect-ratio: 4/3; background: #e9e2d0; overflow: hidden; }
.gal-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-foto.sin-foto::after {
  content: "🏇"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 44px; opacity: .35;
}
.gal-num {
  position: absolute; top: 8px; left: 8px; background: var(--gold); color: var(--green-950);
  font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px;
}
.gal-clasico {
  position: absolute; top: 8px; right: 8px; background: var(--green-800); color: #fff;
  font-weight: 800; font-size: 10px; padding: 3px 8px; border-radius: 999px;
}
.gal-card figcaption { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.gal-card figcaption b { color: var(--green-900); font-size: 15px; }
.gal-datos { font-size: 12px; color: var(--muted); font-weight: 600; }
