/* ---- CSS variables del sitio loteriasdominicanas.com ---- */
:root {
  --font-sans: 'Google Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Body (fondo blanco #ffffff) */
  --body-bg-from: #ffffff;
  --body-bg-to:   #ffffff;
  --body-text-color: #000000;
  --body-font-size: 16px;

  /* Nav principal (gradiente AZUL #3383d3 → #296097) */
  --nav-bg-from: #3383d3;
  --nav-bg-to:   #296097;
  --nav-text-color: #ffffff;
  --nav-font-size: 16px;
  --nav-sec-bg-from: #1e4d7c;
  --nav-sec-bg-to:   #1e4d7c;
  --nav-sec-text-color: #ffffff;

  /* Feed (cards beige claro #f6f6f6) */
  --feed-bg-from: #f6f6f6;
  --feed-bg-to:   #f6f6f6;
  --feed-text-color: #000000;

  /* Footer */
  --footer-bg-from: #333333;
  --footer-bg-to:   #333333;
  --footer-text-color: #ffffff;

  /* Borders */
  --border: #e4e4e7;

  /* Loteria-specific (default) */
  --company-background-color: #3383d3;
  --company-text-color: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--body-bg-from);
  color: var(--body-text-color);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ---- Sticky top nav (modelado de .main-navigation) ---- */
.main-nav {
  position: fixed; top: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, var(--nav-bg-from), var(--nav-bg-to));
  color: var(--nav-text-color);
  z-index: 50;
  border-bottom: 1px solid #1e4d7c;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  color: var(--nav-text-color);
}
.nav-brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
  object-fit: contain;
}
.nav-brand span {
  color: #ffffff;
}

.nav-menu {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0; padding: 0;
  flex: 1;
  justify-content: center;
}
.nav-menu a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--nav-text-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
}
.nav-menu a:hover {
  background: rgba(255,255,255,0.18);
}
/* ELIMINADO: .nav-menu a.active { background: rgba(255,255,255,0.25); } */

/* ---- Hamburger button (mobile only) - SIN RECUADRO ---- */
.nav-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  align-items: center;
  box-shadow: none !important;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
  transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- Mobile nav layout (≤ 700px) ---- */
@media (max-width: 700px) {
  .main-nav {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
  }
  .nav-brand { order: 1; font-size: 16px; }
  
  .nav-toggle {
    display: flex !important;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    order: 2;
    margin-left: auto;
  }
  
  .nav-menu {
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .3s ease, opacity .25s ease;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    margin-top: 4px;
  }
  .nav-menu.open {
    max-height: 60vh;
    opacity: 1;
    padding: 0;
  }
  .nav-menu a {
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 700;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  .nav-menu a:hover {
    background: transparent !important;
  }
  .nav-menu a.active {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  
  /* Empujar el contenido principal debajo de la barra */
  main, .detail { padding-top: 110px !important; }
}

/* ---- Main body container (mimic p-card) ---- */
main {
  padding-top: 100px; /* ESPACIO AÑADIDO para PC - más separación de la barra fija */
  max-width: 1750px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 64px;
}

/* p-card wrapper for the whole page */
.p-card {
  background: var(--feed-bg-from);
  color: var(--feed-text-color);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.p-card-header {
  background: linear-gradient(to bottom, var(--nav-bg-from), var(--nav-bg-to));
  color: var(--nav-text-color);
  padding: 20px 24px;
}
.p-card-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.025em;
}
.p-card-header .subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}
.p-card-body { padding: 0; }
.p-card-content { padding: 20px; }

.subtitle {
  color: #52525b;
  margin-bottom: 24px;
  font-size: 15px;
}

/* ---- Stats bar ---- */
.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
}
.stat .label {
  font-size: 11px;
  color: #52525b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.stat .value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-top: 4px;
  color: #18181b;
}
.stat .value.green { color: #16a34a; }
.stat .value.red { color: #dc2626; }

/* ---- Grid (modelado del feed) ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ---- Lottery grid (flat, single grid for the whole home) ---- */
.lottery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}
.lottery-grid .card {
  margin: 0;
}
@media (max-width: 900px) {
  .lottery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  main { padding-left: 0; padding-right: 0; padding-top: 16px; }
  .p-card-content { padding: 8px; }
  .p-card-header {
    padding: 4px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .p-card-header h1 { font-size: 14px; }
  .p-card-header .subtitle {
    font-size: 11px;
    white-space: nowrap;
  }
  .lottery-grid { grid-template-columns: 1fr; padding: 8px; gap: 10px; }
  .card { min-height: auto; }
}

/* ---- Card rediseñada: contenedor de cada lotería con sub-contenedores ---- */
.card {
  position: relative;
  background: #ffffff;
  border-radius: 10px;
  color: #18181b;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  border: 1px solid #e4e4e7;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  align-self: stretch;
  min-height: 220px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(0,0,0,0.10);
  border-color: var(--company-background-color);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--brand-color, #3383d3);
  flex-shrink: 0;
}
.card-head img {
  width: 62px; height: 62px;
  flex-shrink: 0;
}
.card-head .initials-fallback {
  width: 44px; height: 44px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #ffffff; font-weight: 700; font-size: 17px;
  border: 1px solid var(--border); flex-shrink: 0;
  letter-spacing: -0.5px;
}
.card-head .name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  color: var(--brand-fg, #18181b);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-head .fecha {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-fg, #18181b);
  flex-shrink: 0;
}
.card-head .fecha .no-data {
  font-size: 11px;
  color: #71717a;
  font-style: italic;
  font-weight: 400;
}
.card-count {
  font-size: 13px;
  color: #71717a;
  font-weight: 500;
  margin-left: 4px;
}

.card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  background: color-mix(in oklab, var(--company-background-color), white 92%);
  border-top: 1px solid color-mix(in oklab, var(--company-background-color), white 75%);
  min-height: 110px;
}
.card-body .nums {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-body .card-icon {
  width: 62px;
  height: 62px;
  align-self: flex-end;
  flex-shrink: 0;
}
.card-body .initials-fallback {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 17px;
  border: 1px solid var(--border);
  align-self: flex-end;
  letter-spacing: -0.5px;
}

/* ---- Lotería sorteada HOY (verde) / ayer o antes (gris) ---- */
.card.loteria-reciente {
  --company-background-color: #22c55e;
  --company-text-color:      #ffffff;
}
.card.loteria-anterior {
  --company-background-color: #a1a1aa;
  --company-text-color:      #ffffff;
}

/* ---- Score balls (modelado de .score-shape-circle) ---- */
.nums {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  width: 100%;
}
.ball {
  position: relative;
  --ball-bg: var(--company-background-color, #22c55e);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--ball-bg), white 10%) 50%,
    color-mix(in oklab, var(--ball-bg), black 10%) 50%
  );
  color: var(--company-text-color);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.ball::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0) 50%, rgba(255,255,255,0.05) 51%, rgba(255,255,255,0.15));
  pointer-events: none;
  z-index: 1;
}
.ball > span {
  position: relative;
  z-index: 2;
}
.ball.empty {
  background: #e4e4e7;
  color: #a1a1aa;
}
.ball.new {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 1px 3px rgba(0,0,0,0.15);
}

/* Balls con color fijo (Super Loto Más, MegaLotto) */
.ball.ball-7         { --ball-bg: #93c5fd; color: #1e3a8a !important; }
.ball.ball-7-yellow  { --ball-bg: #fde68a; color: #713f12 !important; }
.ball.ball-8         { --ball-bg: #fca5a5; color: #7f1d1d !important; }

/* Balls Juega + Pega +: 1ª-2ª azul claro, 3ª-4ª-5ª rojo claro */
.ball.ball-jpp-blue  { --ball-bg: #93c5fd; color: #1e3a8a !important; }
.ball.ball-jpp-red   { --ball-bg: #fca5a5; color: #7f1d1d !important; }
/* Balls Mega Millions, PowerBall, Loto 5: 6ª bola rojo claro */
.ball.ball-megaball  { --ball-bg: #fca5a5; color: #7f1d1d !important; }

/* Multiplier cuadrado (Power Play 2X/3X/4X/etc.) */
.ball.multiplier {
  border-radius: 8px !important;
  --ball-bg: #e5e7eb;
  color: #1f2937 !important;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
}

/* Colores específicos Kino TV en home: verde último sorteo, gris anteriores */
.card .nums .ball.home-kino-latest { --ball-bg: #22c55e; color: #ffffff; }
.card .nums .ball.home-kino-old     { --ball-bg: #a1a1aa; color: #ffffff; }

/* ---- Animación bola-por-bola al aparecer nuevos números ---- */
@keyframes ball-pop {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
.ball.popping {
  animation: ball-pop 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---- Detail page ---- */
.detail {
  padding-top: 100px; /* ESPACIO AÑADIDO para PC */
  max-width: 1750px;
  width: 100%;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 64px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--footer-text-color);
  text-decoration: none;
  font-size: 14px;
  margin-top: 16px;
}
.back:hover {
  background: var(--border);
  color: var(--body-text-color);
}

/* ---- History grid 3×3 (9 últimos sorteos de una lotería) — mismo estilo que lottery-grid del home ---- */
.history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}
.history-grid .card {
  margin: 0;
}
@media (max-width: 900px) {
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .history-grid { grid-template-columns: 1fr; padding: 8px; gap: 10px; }
  .history-grid .card { min-height: auto; }
}

/* ---- Footer (modelado de .footer del sitio de referencia) ---- */
footer {
  background: linear-gradient(to bottom, var(--footer-bg-from), var(--footer-bg-to));
  color: var(--footer-text-color);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  margin-top: 48px;
}
footer a { color: #fbbf24; text-decoration: none; }

/* ---- Stats bar (debajo del título) ---- */
.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: 8px;
  background: linear-gradient(to bottom, var(--feed-bg-from), var(--feed-bg-to));
  border: 1px solid var(--border);
}
.stat .label {
  font-size: 12px;
  color: var(--footer-text-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat .value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-top: 4px;
}

/* ---- SEO content sections (home + loteria) ---- */
.seo-section {
  max-width: 1100px;
  margin: 24px auto;
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: #18181b;
  line-height: 1.7;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.seo-section h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #18181b;
  letter-spacing: 0.01em;
}
.seo-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: #18181b;
}
.seo-section p {
  margin: 0 0 12px;
  color: #27272a;
  font-size: 15px;
}
.seo-section a {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.seo-section a:hover { color: #1e40af; }

.schedule-table-wrap { overflow-x: auto; }
.seo-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 6px;
  font-size: 14px;
}
.seo-section table th,
.seo-section table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.seo-section table th {
  background: var(--feed-bg-from);
  font-weight: 600;
  color: #18181b;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seo-section table td {
  color: #27272a;
}
.seo-section table tbody tr:hover {
  background: #f9fafb;
}
.seo-section .schedule-note {
  font-size: 13px;
  color: #52525b;
  font-style: italic;
  margin-top: 12px;
}
.seo-section .schedule-list {
  list-style: disc;
  padding-left: 22px;
  margin: 6px 0 12px;
}
.seo-section .schedule-list li {
  margin-bottom: 4px;
  color: #27272a;
}
@media (max-width: 700px) {
  .seo-section { padding: 18px 16px; margin: 16px 8px; }
  .seo-section h2 { font-size: 19px; }
  .seo-section table { font-size: 13px; }
  .seo-section table th, .seo-section table td { padding: 8px 10px; }
}

/* ---- Live event toast ---- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--company-background-color), color-mix(in oklab, var(--company-background-color), white 20%));
  color: var(--company-text-color);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  transform: translateX(120%);
  transition: transform .3s;
}
.toast.show { transform: translateX(0); }
.toast .lbl { opacity: .8; font-size: 12px; }
.toast .val { font-weight: 700; font-family: 'JetBrains Mono', monospace; }