.sports-history-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--srh-border);
}

/* Los dos historiales comparten una fila en escritorio y se pueden recorrer
   horizontalmente en pantallas estrechas sin mezclar sus consultas ni su estado. */
.jugadas-history-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem;
}

.jugadas-history-block {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--srh-border);
  border-radius: 16px;
  background: var(--srh-card);
  color: var(--srh-text);
}

.jugadas-history-block > .monedero-header,
.jugadas-history-block > .sports-history-block__header {
  margin: 0 0 1rem;
}

.jugadas-history-heading {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  gap: .75rem;
}

.jugadas-history-heading > div:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.jugadas-history-block--hipicas .jugadas-history-panel,
.jugadas-history-block .sports-history-block__header + .jugadas-history-panel {
  min-width: 0;
}

.jugadas-history-row > .sports-history-block {
  margin-top: 0;
  padding-top: 1rem;
  border-top: 0;
}

@media (max-width: 759px) {
  .jugadas-history-row {
    display: flex;
    overflow-x: auto;
    gap: .75rem;
    padding-bottom: .35rem;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .jugadas-history-block {
    flex: 0 0 min(88vw, 520px);
    scroll-snap-align: start;
  }
}

.sports-history-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 1rem;
  padding: .8rem;
  border: 1px solid var(--srh-border);
  border-radius: 16px;
  background: linear-gradient(90deg, var(--srh-card), var(--srh-surface) 50%, var(--srh-card));
  box-shadow: var(--shadow-subtle, 0 4px 14px rgba(0, 0, 0, .18));
  color: var(--srh-text);
}

.sports-history-block__eyebrow {
  display: block;
  color: var(--srh-muted);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .11em;
}

.sports-history-block h2 {
  margin: 0;
  color: var(--srh-text);
  font-size: 1rem;
}
.sports-history-block__bat {
  display: block;
  width: 25px;
  height: 25px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(78%) sepia(94%) saturate(1111%) hue-rotate(359deg) brightness(104%) contrast(105%) drop-shadow(0 0 3px rgba(190, 210, 234, .42));
}
.sports-history-block__title { display: block; margin: .15rem 0 0; color: var(--srh-text); font-size: 1rem; font-weight: 800; line-height: 1.2; }

.sports-history-block__count {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--srh-muted);
  font-size: .78rem;
}

/* Aviso de premios pendientes: identifica de un vistazo en qué módulo está
   el ticket ganador, incluso después de limpiar el badge de la navegación. */
.jugadas-panel-alert {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 .26rem;
  flex: 0 0 auto;
  margin-left: .35rem;
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 999px;
  background: #ff1233;
  color: #fff;
  font-size: .62rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(255, 18, 51, .3), 0 0 19px rgba(255, 18, 51, .86);
  animation: jugadas-panel-alert-counter 1.65s ease-in-out infinite;
}

.jugadas-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
}

.jugadas-panel-alert__count {
  display: block;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

.jugadas-panel-alert[hidden] { display: none !important; }

@keyframes jugadas-panel-alert-counter {
  0%, 72%, 100% { transform: translateY(0) scale(1); }
  78% { transform: translateY(-2px) scale(1.1); }
  84% { transform: translateY(0) scale(1); }
  90% { transform: translateY(-1px) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .jugadas-panel-alert { animation: none; }
}

.sports-history-list { display: grid; gap: .65rem; }

.jugadas-history-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  gap: .75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.jugadas-history-toggle > div:nth-child(2) { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.jugadas-history-toggle .monedero-header__title { display: block; text-align: left; }
.jugadas-history-toggle .monedero-header__sub { display: block; text-align: left; }
.jugadas-history-toggle__chevron { width: 18px; height: 18px; flex: 0 0 18px; color: var(--srh-gold); transition: transform .18s ease; }
.jugadas-history-toggle[aria-expanded="true"] .jugadas-history-toggle__chevron { transform: rotate(180deg); }
.jugadas-history-toggle:focus-visible { outline: 3px solid rgba(190, 210, 234, .35); outline-offset: 4px; border-radius: 10px; }
.jugadas-history-panel[hidden] { display: none !important; }

.sports-history-card {
  width: 100%;
  padding: .85rem 1rem;
  border: 1px solid var(--srh-border);
  border-radius: 12px;
  background: var(--srh-card);
  color: var(--srh-text);
  text-align: left;
  box-sizing: border-box;
}

.sports-history-card__top,
.sports-history-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.sports-history-card__ticket { color: var(--srh-gold-ink, #435a74); font-size: .78rem; font-weight: 800; }
.sports-history-card__status { color: #8de0af; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.sports-history-card__selections { margin: .55rem 0; color: var(--srh-muted); font-size: .76rem; line-height: 1.4; }
.sports-history-card__bottom { color: var(--srh-muted); font-size: .7rem; }
.sports-history-card__bottom strong { color: var(--srh-text); font-size: .82rem; }
.sports-history-empty { color: var(--srh-muted); font-size: .8rem; }

@media (min-width: 760px) {
  .sports-history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Las tarjetas deportivas reutilizan exactamente la tarjeta del historial hípico. */
.sports-history-block .jugada-card--sports { min-width: 0; }
.sports-history-block .jugada-card__bet-chip--deportiva { color: #64b5f6; }
.sports-history-block .jugada-card--sports .jugada-card__bet-meta { color: var(--srh-muted); }

html[data-theme="light"] .sports-history-block {
  border-color: var(--srh-border);
}
html[data-theme="light"] .jugadas-history-block {
  border-color: var(--srh-border);
  background: var(--srh-card);
}
html[data-theme="light"] .sports-history-block__header {
  background: linear-gradient(90deg, var(--srh-card), var(--srh-surface) 50%, var(--srh-card));
  border-color: var(--srh-border);
  box-shadow: var(--shadow-subtle);
}
html[data-theme="light"] .sports-history-block__eyebrow,
html[data-theme="light"] .sports-history-block__count,
html[data-theme="light"] .sports-history-empty { color: var(--srh-muted); }
html[data-theme="light"] .sports-history-block h2 { color: var(--srh-text); }
html[data-theme="light"] .sports-history-block__title { color: var(--srh-text); }
html[data-theme="light"] .sports-history-block .jugada-card__bet-chip--deportiva { color: #005b9f; }

.sports-detail { display: grid; gap: .85rem; }
.sports-detail__ticket,
.sports-detail__summary > div,
.sports-detail__bet { padding: .75rem; border: 1px solid var(--srh-border); border-radius: 12px; background: var(--srh-surface); }
.sports-detail__ticket { display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.sports-detail__ticket span,
.sports-detail__summary span { color: var(--srh-muted); font-size: .68rem; }
.sports-detail__ticket strong { color: var(--srh-gold); font-size: .85rem; }
.sports-detail__summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.sports-detail__summary > div { display: grid; gap: .2rem; }
.sports-detail__summary strong { color: var(--srh-text); font-size: .78rem; }
.sports-detail__summary-item--expected {
  border-color: var(--srh-gold) !important;
  box-shadow: 0 0 0 2px rgba(190, 210, 234, .28), 0 0 22px rgba(190, 210, 234, .24);
}
.sports-detail__summary-item--expected span { color: var(--srh-gold-ink, var(--srh-gold)) !important; }
.sports-detail__summary-item--expected strong {
  color: var(--srh-gold);
  font-size: 1.56rem;
  line-height: 1.1;
}
.sports-detail__summary-item--gain-expected {
  border-color: #3980ff !important;
  animation: sports-expected-electric-pulse 1.7s ease-in-out infinite;
}
@keyframes sports-expected-electric-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(36, 107, 255, .38), 0 0 16px rgba(36, 107, 255, .48);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(36, 107, 255, .7), 0 0 32px rgba(36, 107, 255, .9), 0 0 52px rgba(36, 107, 255, .42);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sports-detail__summary-item--gain-expected { animation: none; box-shadow: 0 0 0 3px rgba(36, 107, 255, .56), 0 0 24px rgba(36, 107, 255, .72); }
}
.sports-detail h3 { margin: .2rem 0 -.3rem; color: var(--srh-text); font-size: .86rem; }
.sports-detail__bet { display: grid; gap: .45rem; }
.sports-detail__bet-head,
.sports-detail__selection { display: flex; justify-content: space-between; gap: .7rem; align-items: flex-start; }
.sports-detail__bet-head { padding-bottom: .45rem; border-bottom: 1px solid var(--srh-border); color: var(--srh-gold); font-size: .75rem; }
.sports-detail__bet-head span { color: var(--srh-muted); font-size: .7rem; }
.sports-detail__selection { padding: .35rem 0; }
.sports-detail__selection strong { display: block; color: var(--srh-text); font-size: .75rem; }
.sports-detail__selection small { display: block; margin-top: .12rem; color: var(--srh-muted); font-size: .65rem; }
.sports-detail__selection b { color: var(--srh-gold); font-size: .78rem; }
.sports-detail__muted { margin: 0; color: var(--srh-muted); font-size: .75rem; }

html[data-theme="light"] .sports-detail__ticket,
html[data-theme="light"] .sports-detail__summary > div,
html[data-theme="light"] .sports-detail__bet { background: var(--srh-surface); border-color: var(--srh-border); }
html[data-theme="light"] .sports-detail__summary strong,
html[data-theme="light"] .sports-detail h3,
html[data-theme="light"] .sports-detail__selection strong { color: var(--srh-text); }
html[data-theme="light"] .sports-detail__summary-item--expected strong { color: var(--srh-gold-ink); }

@media (max-width: 560px) {
  .sports-detail__summary { grid-template-columns: 1fr 1fr; }
}

/* Vista de jugadas: un selector y un panel por tipo en la misma página */
.jugadas-switcher { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
[data-jugadas-panel][hidden] { display: none !important; }
.jugadas-content > .sports-history-block { margin-top: 0; }

/* Resultado de cada selección (piernas) y estado de la apuesta */
.sports-detail__bet-head small { margin-left: auto; color: var(--srh-muted); font-size: .64rem; }
.sports-detail__bet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--srh-muted); font-size: .68rem; }
.sports-detail__selection + .sports-detail__selection { border-top: 1px solid var(--srh-border); }
.sports-detail__selection-side { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: .25rem; }
.sports-detail__motivo { font-style: italic; }
