/* ==========================================================================
   Motor de líneas MLB — apuestadepormlb.com
   Todo el CSS está scopeado bajo #mlb-motor
   Ajusta el bloque de variables para adaptarlo al tema.
   ========================================================================== */

#mlb-motor {
  /* --- Color --- */
  --mlbm-bg: #ffffff;
  --mlbm-surface: #f5f7fb;
  --mlbm-surface-2: #eaeef6;
  --mlbm-ink: #101c31;
  --mlbm-ink-soft: #56617a;
  --mlbm-line: #dde3ee;
  --mlbm-line-strong: #c3ccdd;
  --mlbm-accent: #b3202f;
  --mlbm-accent-soft: #fdeced;
  --mlbm-navy: #123a6b;
  --mlbm-navy-soft: #e8effa;
  --mlbm-good: #0f6b4f;
  --mlbm-good-soft: #e4f4ee;
  --mlbm-warn: #8f5a05;
  --mlbm-warn-soft: #fdf1dc;
  --mlbm-bad: #a41c2a;
  --mlbm-bad-soft: #fceaec;

  /* --- Tipografía --- */
  --mlbm-font: inherit;
  --mlbm-mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --mlbm-fs-base: 1rem;
  --mlbm-fs-sm: 0.875rem;
  --mlbm-fs-xs: 0.78rem;
  --mlbm-fs-h2: 1.6rem;
  --mlbm-fs-num: 1.5rem;
  --mlbm-lh: 1.55;

  /* --- Formas --- */
  --mlbm-radius: 12px;
  --mlbm-radius-sm: 8px;
  --mlbm-gap: 16px;
  --mlbm-pad: 20px;
  --mlbm-shadow: 0 1px 2px rgba(16, 28, 49, .06), 0 8px 24px rgba(16, 28, 49, .07);
  --mlbm-border: 1px solid var(--mlbm-line);
  --mlbm-maxw: 100%;

  box-sizing: border-box;
  max-width: var(--mlbm-maxw);
  margin: 40px 0;
  padding: 0;
  font-family: var(--mlbm-font);
  font-size: var(--mlbm-fs-base);
  line-height: var(--mlbm-lh);
  color: var(--mlbm-ink);
  background: var(--mlbm-bg);
  border: var(--mlbm-border);
  border-radius: var(--mlbm-radius);
  box-shadow: var(--mlbm-shadow);
  overflow: hidden;
}

#mlb-motor *,
#mlb-motor *::before,
#mlb-motor *::after { box-sizing: border-box; }

#mlb-motor p,
#mlb-motor h2,
#mlb-motor h3,
#mlb-motor h4,
#mlb-motor ul,
#mlb-motor ol,
#mlb-motor figure { margin: 0; padding: 0; }

#mlb-motor ul { list-style: none; }

/* ---------- Cabecera con costura de béisbol ---------- */

#mlb-motor .mlbm-head {
  position: relative;
  padding: var(--mlbm-pad);
  background: var(--mlbm-navy);
  color: #fff;
}

#mlb-motor .mlbm-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 6px;
  background-image:
    repeating-linear-gradient(115deg, var(--mlbm-accent) 0 9px, transparent 9px 20px),
    linear-gradient(var(--mlbm-accent-soft), var(--mlbm-accent-soft));
}

#mlb-motor .mlbm-kicker {
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #a9c4e8;
}

#mlb-motor .mlbm-title {
  margin-top: 6px;
  font-size: var(--mlbm-fs-h2);
  line-height: 1.2;
  font-weight: 800;
  color: #fff;
}

#mlb-motor .mlbm-sub {
  margin-top: 8px;
  max-width: 62ch;
  font-size: var(--mlbm-fs-sm);
  color: #cfe0f5;
}

/* ---------- Pestañas ---------- */

#mlb-motor .mlbm-tabs {
  display: flex;
  gap: 4px;
  padding: 10px var(--mlbm-pad) 0;
  background: var(--mlbm-surface);
  border-bottom: var(--mlbm-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

#mlb-motor .mlbm-tab {
  flex: 0 0 auto;
  padding: 11px 15px;
  font: inherit;
  font-size: var(--mlbm-fs-sm);
  font-weight: 700;
  color: var(--mlbm-ink-soft);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--mlbm-radius-sm) var(--mlbm-radius-sm) 0 0;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}

#mlb-motor .mlbm-tab:hover { color: var(--mlbm-ink); background: var(--mlbm-surface-2); }

#mlb-motor .mlbm-tab[aria-selected="true"] {
  color: var(--mlbm-navy);
  background: var(--mlbm-bg);
  border-bottom-color: var(--mlbm-accent);
}

/* ---------- Paneles ---------- */

#mlb-motor .mlbm-panel { padding: var(--mlbm-pad); }
#mlb-motor .mlbm-panel[hidden] { display: none; }

#mlb-motor .mlbm-block + .mlbm-block { margin-top: 22px; }

#mlb-motor .mlbm-h3 {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--mlbm-navy);
}

#mlb-motor .mlbm-lead {
  margin-top: 4px;
  font-size: var(--mlbm-fs-sm);
  color: var(--mlbm-ink-soft);
}

/* ---------- Formularios ---------- */

#mlb-motor .mlbm-grid {
  display: grid;
  gap: var(--mlbm-gap);
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#mlb-motor .mlbm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#mlb-motor .mlbm-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

#mlb-motor .mlbm-card {
  padding: 14px;
  background: var(--mlbm-surface);
  border: var(--mlbm-border);
  border-radius: var(--mlbm-radius-sm);
}

#mlb-motor .mlbm-card-team { border-top: 3px solid var(--mlbm-navy); }
#mlb-motor .mlbm-card-away { border-top-color: var(--mlbm-accent); }

#mlb-motor .mlbm-card-title {
  font-size: var(--mlbm-fs-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mlbm-navy);
}

#mlb-motor .mlbm-card-away .mlbm-card-title { color: var(--mlbm-accent); }

#mlb-motor .mlbm-field { margin-top: 12px; }

#mlb-motor .mlbm-label {
  display: block;
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  color: var(--mlbm-ink);
}

#mlb-motor .mlbm-hint {
  display: block;
  margin-top: 2px;
  font-size: var(--mlbm-fs-xs);
  font-weight: 400;
  color: var(--mlbm-ink-soft);
}

#mlb-motor input[type="number"],
#mlb-motor input[type="text"],
#mlb-motor select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: var(--mlbm-mono);
  font-size: 16px; /* evita el zoom automático en iOS */
  line-height: 1.3;
  color: var(--mlbm-ink);
  background: var(--mlbm-bg);
  border: 1px solid var(--mlbm-line-strong);
  border-radius: var(--mlbm-radius-sm);
  appearance: none;
  -webkit-appearance: none;
}

#mlb-motor select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mlbm-ink-soft) 50%),
                    linear-gradient(135deg, var(--mlbm-ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

#mlb-motor input[type="number"]:focus,
#mlb-motor input[type="text"]:focus,
#mlb-motor select:focus,
#mlb-motor .mlbm-tab:focus,
#mlb-motor button:focus {
  outline: 3px solid var(--mlbm-navy);
  outline-offset: 2px;
}

#mlb-motor input[type="number"]:focus:not(:focus-visible),
#mlb-motor select:focus:not(:focus-visible),
#mlb-motor .mlbm-tab:focus:not(:focus-visible),
#mlb-motor button:focus:not(:focus-visible) { outline: none; }

#mlb-motor input[type="number"]:focus-visible,
#mlb-motor select:focus-visible,
#mlb-motor .mlbm-tab:focus-visible,
#mlb-motor button:focus-visible {
  outline: 3px solid var(--mlbm-navy);
  outline-offset: 2px;
}

#mlb-motor .mlbm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

#mlb-motor .mlbm-btn {
  padding: 10px 18px;
  font: inherit;
  font-size: var(--mlbm-fs-sm);
  font-weight: 700;
  color: #fff;
  background: var(--mlbm-navy);
  border: 1px solid var(--mlbm-navy);
  border-radius: var(--mlbm-radius-sm);
  cursor: pointer;
  transition: background-color .18s ease;
}

#mlb-motor .mlbm-btn:hover { background: #0d2c53; }

#mlb-motor .mlbm-btn-ghost {
  color: var(--mlbm-navy);
  background: transparent;
}

#mlb-motor .mlbm-btn-ghost:hover { background: var(--mlbm-navy-soft); }

/* ---------- Marcadores de salida ---------- */

#mlb-motor .mlbm-out {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#mlb-motor .mlbm-stat {
  padding: 12px;
  text-align: center;
  background: var(--mlbm-surface);
  border: var(--mlbm-border);
  border-radius: var(--mlbm-radius-sm);
}

#mlb-motor .mlbm-stat-k {
  display: block;
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mlbm-ink-soft);
}

#mlb-motor .mlbm-stat-v {
  display: block;
  margin-top: 4px;
  font-family: var(--mlbm-mono);
  font-size: var(--mlbm-fs-num);
  font-weight: 700;
  line-height: 1.15;
  color: var(--mlbm-navy);
}

#mlb-motor .mlbm-stat-v-alt { color: var(--mlbm-accent); }

#mlb-motor .mlbm-stat-s {
  display: block;
  margin-top: 2px;
  font-size: var(--mlbm-fs-xs);
  color: var(--mlbm-ink-soft);
}

/* ---------- Tablas ---------- */

#mlb-motor .mlbm-tablewrap {
  margin-top: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: var(--mlbm-border);
  border-radius: var(--mlbm-radius-sm);
}

#mlb-motor table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--mlbm-fs-sm);
}

#mlb-motor caption {
  padding: 10px 12px;
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  text-align: left;
  color: var(--mlbm-ink-soft);
  background: var(--mlbm-surface);
  border-bottom: var(--mlbm-border);
}

#mlb-motor th,
#mlb-motor td {
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--mlbm-line);
}

#mlb-motor thead th {
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--mlbm-ink-soft);
  background: var(--mlbm-surface);
}

#mlb-motor tbody th[scope="row"] {
  text-align: left;
  font-weight: 700;
  color: var(--mlbm-ink);
  white-space: normal;
}

#mlb-motor tbody tr:last-child th,
#mlb-motor tbody tr:last-child td { border-bottom: 0; }

#mlb-motor td.mlbm-num { font-family: var(--mlbm-mono); }

#mlb-motor .mlbm-tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: var(--mlbm-fs-xs);
  font-weight: 700;
  border-radius: 999px;
}

#mlb-motor .mlbm-tag-good { color: var(--mlbm-good); background: var(--mlbm-good-soft); }
#mlb-motor .mlbm-tag-warn { color: var(--mlbm-warn); background: var(--mlbm-warn-soft); }
#mlb-motor .mlbm-tag-bad  { color: var(--mlbm-bad);  background: var(--mlbm-bad-soft); }

/* ---------- Histograma de carreras ---------- */

#mlb-motor .mlbm-hist {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 170px;
  margin-top: 14px;
  padding: 10px 8px 0;
  background: var(--mlbm-surface);
  border: var(--mlbm-border);
  border-radius: var(--mlbm-radius-sm);
}

#mlb-motor .mlbm-bar {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

#mlb-motor .mlbm-bar-fill {
  display: block;
  width: 100%;
  min-height: 2px;
  background: var(--mlbm-navy);
  border-radius: 3px 3px 0 0;
  transition: height .35s ease;
}

#mlb-motor .mlbm-bar-over .mlbm-bar-fill { background: var(--mlbm-accent); }
#mlb-motor .mlbm-bar-push .mlbm-bar-fill { background: var(--mlbm-warn); }

#mlb-motor .mlbm-bar-lbl {
  display: block;
  margin-top: 5px;
  font-family: var(--mlbm-mono);
  font-size: 10px;
  line-height: 1;
  text-align: center;
  color: var(--mlbm-ink-soft);
}

#mlb-motor .mlbm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: var(--mlbm-fs-xs);
  color: var(--mlbm-ink-soft);
}

#mlb-motor .mlbm-legend li { display: flex; align-items: center; gap: 6px; }

#mlb-motor .mlbm-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--mlbm-navy);
}

#mlb-motor .mlbm-dot-over { background: var(--mlbm-accent); }
#mlb-motor .mlbm-dot-push { background: var(--mlbm-warn); }

/* ---------- Aviso / nota ---------- */

#mlb-motor .mlbm-note {
  margin-top: 14px;
  padding: 12px 14px;
  font-size: var(--mlbm-fs-sm);
  color: var(--mlbm-ink-soft);
  background: var(--mlbm-navy-soft);
  border-left: 3px solid var(--mlbm-navy);
  border-radius: 0 var(--mlbm-radius-sm) var(--mlbm-radius-sm) 0;
}

#mlb-motor .mlbm-foot {
  padding: 16px var(--mlbm-pad);
  font-size: var(--mlbm-fs-xs);
  color: var(--mlbm-ink-soft);
  background: var(--mlbm-surface);
  border-top: var(--mlbm-border);
}

#mlb-motor .mlbm-foot p + p { margin-top: 6px; }

#mlb-motor .mlbm-foot strong { color: var(--mlbm-ink); }

#mlb-motor abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--mlbm-line-strong); cursor: help; }

#mlb-motor .mlbm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Adaptación móvil ---------- */

@media (max-width: 860px) {
  #mlb-motor .mlbm-out { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #mlb-motor .mlbm-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  #mlb-motor {
    --mlbm-pad: 14px;
    --mlbm-gap: 12px;
    --mlbm-fs-h2: 1.3rem;
    --mlbm-fs-num: 1.25rem;
    margin: 26px 0;
  }

  #mlb-motor .mlbm-grid,
  #mlb-motor .mlbm-grid-3,
  #mlb-motor .mlbm-grid-4,
  #mlb-motor .mlbm-out { grid-template-columns: minmax(0, 1fr); }

  #mlb-motor .mlbm-hist { height: 130px; gap: 2px; }
  #mlb-motor .mlbm-bar-lbl { font-size: 9px; }
  #mlb-motor .mlbm-tabs { padding-right: 8px; padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #mlb-motor *,
  #mlb-motor *::before,
  #mlb-motor *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
