/* Marcador — diseño base. Todos los colores y medidas están en tokens para rediseñar fácil. */
:root {
  --cal: #EEF1EC;        /* fondo: blanco frío de línea de cancha */
  --papel: #FFFFFF;      /* superficie de tarjetas */
  --tinta: #10231A;      /* texto */
  --tribuna: #6E7D75;    /* texto secundario */
  --linea: #D5DCD6;      /* bordes y divisores */
  --cesped: #1E7A4C;     /* en vivo */
  --reflector: #F5C518;  /* gol */
  --roja: #D7372B;
  --pista: #E2E8E2;      /* fondo de la línea de partido */

  --f: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 14px;
  --gap: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cal: #0D1813; --papel: #15241C; --tinta: #E8EEE9; --tribuna: #8C9C93;
    --linea: #24362C; --cesped: #3DBA78; --pista: #203128; --roja: #EF5548;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --cal: #0D1813; --papel: #15241C; --tinta: #E8EEE9; --tribuna: #8C9C93;
  --linea: #24362C; --cesped: #3DBA78; --pista: #203128; --roja: #EF5548;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cal); color: var(--tinta);
  font-family: var(--f); font-size: 16px; line-height: 1.4;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cesped); outline-offset: 2px; border-radius: 6px; }

#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) var(--gap) 24px; }

/* ---------- Cabecera y días ---------- */
.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.top h1 {
  margin: 0; font-size: 34px; line-height: 1; font-weight: 850;
  font-variation-settings: 'wdth' 70; letter-spacing: -0.01em;
}
.top .sub { color: var(--tribuna); font-size: 14px; }

.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--pista); padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.days a {
  text-align: center; padding: 8px 0 7px; border-radius: 9px; font-weight: 600; font-size: 15px; color: var(--tribuna);
}
.days a small { display: block; font-size: 11px; font-weight: 500; opacity: .8; }
.days a[aria-current="page"] { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 2px rgb(16 35 26 / .12); }

h2.section { font-size: 15px; font-weight: 700; margin: 26px 0 10px; color: var(--tinta); }
h2.section:first-of-type { margin-top: 0; }

/* ---------- Tarjeta de partido (tus equipos) ---------- */
.card {
  display: block; background: var(--papel); border-radius: var(--r);
  padding: 14px 16px 12px; margin-bottom: 10px; border: 1px solid var(--linea);
}
.card.live { border-color: color-mix(in srgb, var(--cesped) 45%, var(--linea)); }
.card .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--tribuna); margin-bottom: 8px; }
.card .meta .state { font-weight: 600; }
.card.live .meta .state { color: var(--cesped); }
.card.live .meta .state::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--cesped); margin-right: 6px; vertical-align: 1px; animation: pulse 2s ease-in-out infinite;
}
.row { display: grid; grid-template-columns: 6px 28px 1fr auto; align-items: center; gap: 10px; padding: 3px 0; }
.stripe { width: 6px; height: 28px; border-radius: 3px; background: linear-gradient(var(--c1) 0 50%, var(--c2) 50% 100%); }
.crest { width: 28px; height: 28px; object-fit: contain; }
.mono {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff; background: var(--c1); font-variation-settings: 'wdth' 75;
}
.team { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team.lost { color: var(--tribuna); font-weight: 500; }
.goals {
  font-size: 34px; line-height: 1; font-weight: 900; font-variation-settings: 'wdth' 62;
  font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; border-radius: 6px; padding: 0 4px;
}
.goals.flash { animation: flash 2.4s ease-out; }
.kick { font-size: 22px; font-weight: 800; font-variation-settings: 'wdth' 70; font-variant-numeric: tabular-nums; }

/* Línea de partido 0–90' */
.timeline { position: relative; height: 22px; margin: 10px 0 2px 44px; }
.timeline .track { position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--pista); border-radius: 2px; }
.timeline .done { position: absolute; left: 0; top: 10px; height: 2px; background: var(--tinta); border-radius: 2px; }
.card.live .timeline .done { background: var(--cesped); }
.timeline .half { position: absolute; left: 50%; top: 6px; width: 1px; height: 10px; background: var(--linea); }
.timeline .ev { position: absolute; transform: translateX(-50%); width: 8px; height: 8px; border-radius: 50%; background: var(--tinta); }
.timeline .ev.home { top: 1px; }
.timeline .ev.away { top: 13px; }
.timeline .ev.red { width: 5px; height: 8px; border-radius: 1px; background: var(--roja); }

/* ---------- Filas compactas (ligas) ---------- */
.league { margin-bottom: 18px; }
.league h3 { font-size: 13px; font-weight: 600; color: var(--tribuna); margin: 0 0 4px; }
.mini {
  display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid var(--linea); font-size: 15px;
}
.mini:last-child { border-bottom: 0; }
.mini .h { text-align: right; }
.mini .s { text-align: center; font-weight: 800; font-variation-settings: 'wdth' 70; font-variant-numeric: tabular-nums; font-size: 17px; }
.mini .s small { display: block; font-size: 11px; font-weight: 600; color: var(--cesped); font-variation-settings: 'wdth' 100; }
.mini .s.ns { font-weight: 600; color: var(--tribuna); font-size: 15px; }
.mini.lost-h .h, .mini.lost-a .a { color: var(--tribuna); }

.empty { color: var(--tribuna); padding: 40px 8px; text-align: center; }
.empty strong { display: block; color: var(--tinta); font-size: 17px; margin-bottom: 4px; }

/* ---------- Detalle ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--tribuna); font-size: 15px; margin-bottom: 16px; }
.hero { text-align: center; padding: 8px 0 18px; }
.hero .comp { color: var(--tribuna); font-size: 13px; margin-bottom: 14px; }
.hero .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.hero .side { display: grid; justify-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.hero .side .mono, .hero .side .crest { width: 52px; height: 52px; font-size: 16px; border-radius: 14px; }
.hero .score {
  font-size: 88px; line-height: .9; font-weight: 900; font-variation-settings: 'wdth' 62;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.hero .score .goals { font-size: inherit; min-width: 0; padding: 0 2px; }
.hero .score .sep { font-weight: 300; color: var(--tribuna); margin: 0 6px; position: relative; top: -0.06em; }
.hero .score.ns { font-size: 48px; color: var(--tribuna); }
.hero .clock { margin-top: 10px; font-weight: 700; color: var(--tribuna); }
.hero .clock.live { color: var(--cesped); }

.events { list-style: none; margin: 8px 0 0; padding: 0; position: relative; }
.events::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--linea); }
.events li { display: grid; grid-template-columns: 1fr 44px 1fr; align-items: center; padding: 8px 0; position: relative; }
.events .min {
  grid-column: 2; justify-self: center; background: var(--cal); font-weight: 800; font-variation-settings: 'wdth' 75;
  font-size: 14px; padding: 2px 0; z-index: 1;
}
.events .who { font-size: 15px; }
.events .who.home { grid-column: 1; grid-row: 1; text-align: right; padding-right: 10px; }
.events .who.away { grid-column: 3; grid-row: 1; padding-left: 10px; }
.events .marker { display: inline-block; vertical-align: -1px; }
.events .marker.red { width: 9px; height: 12px; background: var(--roja); border-radius: 2px; }

.actions { display: flex; gap: 8px; margin-top: 22px; }

/* ---------- Ajustes ---------- */
.panel { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 17px; margin: 0 0 6px; }
.panel p { margin: 0 0 12px; color: var(--tribuna); font-size: 14.5px; }
.panel ol { margin: 0 0 4px; padding-left: 20px; color: var(--tribuna); font-size: 14.5px; }
.field { display: flex; gap: 8px; }
input[type="password"], input[type="text"] {
  flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--linea); background: var(--cal); color: var(--tinta);
}
.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 650; cursor: pointer;
  background: var(--tinta); color: var(--cal);
}
.btn.ghost { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 1px var(--linea); }
.btn:disabled { opacity: .5; cursor: default; }
.stack { display: flex; flex-wrap: wrap; gap: 8px; }
.note { font-size: 13.5px; color: var(--tribuna); margin-top: 10px; min-height: 1em; }
.note.ok { color: var(--cesped); }
.note.err { color: var(--roja); }
dl.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14.5px; }
dl.stats dt { color: var(--tribuna); }
dl.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13.5px; padding: 5px 10px; border-radius: 999px; background: var(--pista); }
.chip.on::before { content: '🔔 '; }

/* ---------- Barra inferior ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 56px;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--cal) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linea);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--tribuna); padding: 2px 10px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--tinta); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes flash { 0%, 30% { background: var(--reflector); color: #10231A; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---------- El Utilero ---------- */
.chat-top { align-items: center; margin-bottom: 4px; }
.link { background: none; border: 0; color: var(--tribuna); font-size: 14px; cursor: pointer; padding: 6px 0; }
.chat-sub { color: var(--tribuna); font-size: 14.5px; margin: 0 0 18px; }
.thread { display: flex; flex-direction: column; gap: 8px; padding-bottom: 76px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 15.5px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--tinta); color: var(--cal); border-bottom-right-radius: 5px; }
.msg.ut { align-self: flex-start; background: var(--papel); border: 1px solid var(--linea); border-bottom-left-radius: 5px; }
.msg.err { color: var(--roja); }
.msg.typing { color: var(--tribuna); }
.msg.typing span { animation: pulse 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; } .msg.typing span:nth-child(3) { animation-delay: .4s; }
.sugg { margin: 4px 0 90px; }
.sugg .chip { border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); font: inherit; font-size: 14px; cursor: pointer; }
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 9;
  display: flex; gap: 8px; max-width: 560px; margin: 0 auto; padding: 10px var(--gap);
  background: color-mix(in srgb, var(--cal) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.composer input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); }
.composer .btn { border-radius: 999px; }
.tabbar { gap: 36px; }

/* Franja fija bajo la barra de estado del teléfono */
.statusbar-guard {
  position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); z-index: 20;
  background: color-mix(in srgb, var(--cal) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg .sources { display: block; margin-top: 4px; font-size: 13px; color: var(--tribuna); }
.msg .sources a { color: var(--tribuna); }

/* ---------- Login y bienvenida ---------- */
body.gate .tabbar { display: none; }
body.gate { padding-bottom: env(safe-area-inset-bottom); }
.gate-box { max-width: 420px; margin: 8vh auto 0; }
.gate-box.onb { margin-top: 3vh; }
.brand { font-size: 40px; line-height: 1; font-weight: 900; font-variation-settings: 'wdth' 66; margin: 0 0 12px; letter-spacing: -0.01em; }
.lead { color: var(--tribuna); font-size: 16.5px; margin: 0 0 22px; }
.fine { color: var(--tribuna); font-size: 13px; margin-top: 18px; }
.privacy { max-width: 420px; margin: 22px auto 0; }
.stack-v { display: grid; gap: 10px; }
.stack-v label, .inline span { font-size: 14px; font-weight: 600; }
.inline { display: grid; gap: 6px; margin-top: 18px; }
input[type="email"], input[type="search"], .code, .inline input {
  font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); width: 100%;
}
.code { font-size: 30px; font-weight: 800; letter-spacing: .35em; text-align: center; font-variation-settings: 'wdth' 75; font-variant-numeric: tabular-nums; }
.stack-v .btn, .onb-actions .btn { padding: 13px 16px; font-size: 16px; }
.dots { display: flex; gap: 6px; margin-bottom: 22px; }
.dots span { height: 4px; flex: 1; border-radius: 2px; background: var(--pista); }
.dots span.done { background: var(--tribuna); }
.dots span.on { background: var(--cesped); }
.onb-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 26px; }
.onb-actions .btn { flex: 1; }
.onb-actions .btn.ghost { flex: 0 0 auto; }
.onb-h { font-size: 13px; color: var(--tribuna); font-weight: 600; margin: 18px 0 8px; }

/* Buscador y filas de equipos */
.search { margin-top: 4px; }
.pick-list { margin-top: 6px; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--linea); cursor: pointer; }
.pick-row:last-child { border-bottom: 0; }
.pick-row .crest, .pick-row .mono { flex: 0 0 auto; }
.pick-name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-name small { display: block; font-weight: 400; font-size: 12.5px; color: var(--tribuna); }
.pick-add { color: var(--cesped); font-weight: 650; font-size: 14px; }
.pick-ok { font-size: 12px; font-weight: 700; color: var(--cesped); background: color-mix(in srgb, var(--cesped) 14%, transparent); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pick-tools { display: flex; align-items: center; gap: 6px; }
.pick-x, .bell { border: 0; background: var(--pista); color: var(--tinta); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; flex: 0 0 auto; }
.pick-x.sm { width: 20px; height: 20px; font-size: 10px; margin-left: 4px; background: transparent; }
.bell { background: transparent; font-size: 17px; }
.bell:not(.on) { opacity: .55; }
.chosen { margin-bottom: 6px; }
.chosen .pick-row { cursor: default; }
.mk-main { font-size: 12.5px; padding: 0; }
.kinds { margin: -4px 0 6px 40px; font-size: 12.5px; color: var(--tribuna); }

/* Chips de ligas */
.lchips { display: flex; flex-wrap: wrap; gap: 8px; }
.lchip { border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.lchip small { color: var(--tribuna); font-size: 12px; }
.lchip.on { background: var(--tinta); color: var(--cal); border-color: var(--tinta); }
.lchip.on small { color: color-mix(in srgb, var(--cal) 70%, transparent); }
.lchip.on .pick-x.sm { color: var(--cal); }

/* Administración */
.admin-user { display: block; line-height: 1.5; }
.admin-user small { color: var(--tribuna); }
.when { font-size: 11.5px; color: var(--tribuna); margin: 10px 0 2px; text-align: center; }

/* ---------- Don Carlo, el utilero ---------- */
.dc { flex: none; display: block; border-radius: 25%; }
.say { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; margin: 4px 0 22px; }
.say-text {
  margin: 0; background: var(--papel); border: 1px solid var(--linea); border-radius: 16px; border-top-left-radius: 5px;
  padding: 12px 15px; font-size: 16.5px; line-height: 1.45;
}
.gate-box .brand + .say { margin-top: 8px; }
.inline-h { display: block; font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dc-head { display: flex; align-items: center; gap: 12px; }
.dc-head h1 { margin: 0; }
.dc-role { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tribuna); }
.chat-top { margin-bottom: 18px; }
.ut-row { display: flex; align-items: flex-end; gap: 8px; align-self: flex-start; max-width: 92%; }
.ut-row .msg.ut { max-width: none; }
.tabbar svg.dc-tab { stroke: none; border-radius: 25%; }
.dc-bg { fill: #10231A; } .dc-cap { fill: #1E7A4C; } .dc-eye { fill: #EEF1EC; } .dc-mus { fill: #F5C518; }
.tabbar a:not([aria-current]) .dc-tab { filter: grayscale(1); opacity: .6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dc, :root:not([data-theme="light"]) .tabbar svg.dc-tab { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--cesped) 55%, transparent); }
}
:root[data-theme="dark"] .dc, :root[data-theme="dark"] .tabbar svg.dc-tab { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--cesped) 55%, transparent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--pista); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 9px 0; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--tribuna); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 2px rgb(16 35 26 / .12); }
