:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --text: #102033;
  --muted: #607086;
  --border: #dce5ec;
  --primary: #0f766e;
  --primary-2: #115e59;
  --primary-soft: #dff7f3;
  --accent: #2563eb;
  --warning: #b45309;
  --warning-bg: #fff7ed;
  --success: #047857;
  --success-bg: #ecfdf5;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, .06);
  --radius: 20px;
  --radius-sm: 12px;
  --container: 1180px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #162033;
  --text: #e5eefb;
  --muted: #a7b3c5;
  --border: #263247;
  --primary: #2dd4bf;
  --primary-2: #5eead4;
  --primary-soft: rgba(45, 212, 191, .12);
  --accent: #60a5fa;
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, .12);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, .12);
  --danger: #f87171;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, .22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, .13), transparent 36rem),
    radial-gradient(circle at top right, rgba(37, 99, 235, .10), transparent 32rem),
    var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 999;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  font-size: 1.45rem;
}

.brand strong {
  display: block;
  font-size: 1.06rem;
  letter-spacing: -.02em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav a,
.theme-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 9px 11px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}

.top-nav a:hover,
.theme-toggle:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.theme-toggle {
  border-color: var(--border);
}

.hero {
  padding: 58px 0 36px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, .6fr);
  gap: 26px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.content-card,
.side-card,
.game-card,
.stat-card,
.share-box {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(26px, 5vw, 54px);
}

.hero-copy h1,
.page-title h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.04;
  letter-spacing: -.055em;
}

.hero-lead,
.page-title p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  font-size: .78rem;
}

.hero-actions,
.quick-actions,
.card-actions,
.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-actions {
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 18px;
  font-weight: 750;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.hero-panel {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.mini-stat {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 2px 12px;
  align-items: center;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 16px;
}

.mini-stat-icon {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  border-radius: 14px;
  font-size: 1.35rem;
}

.mini-stat-number {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
}

.mini-stat-label {
  color: var(--muted);
  font-size: .92rem;
}

.last-update {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
}

.section {
  padding: 38px 0;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2,
.share-box h2,
.side-card h2,
.legal-note h2,
.draw-day h2,
.contact-section h2,
.legal-content h2 {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -.03em;
}

.section-heading p {
  color: var(--muted);
  margin: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.game-card {
  padding: 18px;
  display: flex;
  gap: 14px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.game-card-icon {
  flex: 0 0 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--primary-soft);
  font-size: 1.35rem;
}

.game-card h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.game-card p {
  color: var(--muted);
  margin: 0 0 10px;
}

.game-card small {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: .9rem;
  font-weight: 750;
  text-decoration: none;
}

.chip:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.chip-muted {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
}

.stat-card {
  padding: 22px;
  display: grid;
  gap: 8px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
}

.stat-card strong {
  font-size: 1.6rem;
}

.stat-card span:last-child {
  color: var(--muted);
}

.number-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.number-pills span {
  display: inline-flex;
  min-width: 48px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 800;
}

.share-box {
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.share-box.compact {
  margin-top: 28px;
}

.share-box p {
  margin: 0;
  color: var(--muted);
}

.share-button {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
}

.share-button:hover {
  text-decoration: none;
  filter: brightness(1.07);
}

.share-button.native {
  width: auto;
  padding: 0 16px;
  gap: 8px;
  display: inline-flex;
  background: var(--primary);
  font-weight: 800;
}

.share-button.whatsapp {
  background: #25d366;
}

.share-button.facebook {
  background: #1877f2;
}

.share-button.x-twitter {
  background: #111;
}

.share-button.email {
  background: #64748b;
}

.site-footer {
  margin-top: 50px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--border);
}

.footer-grid {
  padding: 28px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.footer-grid p {
  max-width: 720px;
  color: var(--muted);
  margin: 8px 0 0;
}

.footer-grid nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 12px;
  color: var(--muted);
  font-size: .9rem;
}

.fine-print {
  color: var(--muted);
  font-size: .88rem;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  padding-top: 34px;
}

.page-layout.single {
  grid-template-columns: minmax(0, 900px);
  justify-content: center;
}

.content-card {
  padding: clamp(20px, 4vw, 34px);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 22px;
}

.page-title {
  margin-bottom: 22px;
}

.quick-actions {
  margin-bottom: 24px;
}

.draw-day {
  margin-top: 28px;
}

.draw-day-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.date-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.date-search.full {
  width: 100%;
}

.date-search input,
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.date-search input:focus,
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  margin-bottom: 18px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.result-header h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.result-header p {
  margin: 0;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 850;
}

.badge-ok {
  color: var(--success);
  background: var(--success-bg);
}

.badge-pending {
  color: var(--warning);
  background: var(--warning-bg);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.quiniela-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
}

.quiniela-table th,
.quiniela-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.quiniela-table th {
  background: var(--primary);
  color: #fff;
  font-size: .92rem;
  letter-spacing: .02em;
}

.quiniela-table tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
}

.quiniela-table tr:last-child td {
  border-bottom: 0;
}

.quiniela-table td:first-child {
  width: 120px;
  color: var(--muted);
  font-weight: 800;
}

.quiniela-table td:last-child strong {
  font-size: 1.15rem;
  letter-spacing: .04em;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  position: sticky;
  top: 96px;
}

.side-card {
  padding: 18px;
}

.clean-list {
  padding-left: 18px;
  margin: 0;
}

.clean-list li {
  margin-bottom: 6px;
}

.side-links {
  display: grid;
  gap: 8px;
}

.side-links a {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
}

.side-links a:hover {
  text-decoration: none;
  border-color: var(--primary);
}

.side-card.highlight {
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
}

.notice {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
  margin: 16px 0;
}

.notice p {
  margin: 8px 0 0;
}

.notice-warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 28%, var(--border));
}

.notice-success {
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
}

.legal-note {
  margin-top: 28px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-2);
}

.legal-note h2 {
  color: var(--text);
  font-size: 1.25rem;
}

.contact-section {
  margin-top: 22px;
}

.contact-form {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  font-weight: 760;
  color: var(--muted);
}

.contact-form textarea {
  resize: vertical;
}

.hidden-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.legal-content {
  margin-top: 42px;
  color: var(--muted);
}

.legal-content h2,
.legal-content h3 {
  color: var(--text);
}

.legal-content h3 {
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--surface);
  border-radius: 999px;
  padding: 10px 16px;
  z-index: 999;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .hero-grid,
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card.wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 28px;
  }

  .cards-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    flex-direction: column;
  }

  .draw-day-header,
  .result-header,
  .share-box,
  .footer-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .share-actions {
    justify-content: flex-start;
  }

  .page-layout {
    width: min(100% - 20px, var(--container));
  }

  .content-card {
    padding: 18px;
  }

  .quiniela-table td:first-child {
    width: 90px;
  }
}

@media (max-width: 430px) {
  .top-nav a,
  .theme-toggle {
    padding: 8px 9px;
    font-size: .92rem;
  }

  .hero-copy h1,
  .page-title h1 {
    font-size: 2rem;
  }

  .btn {
    width: 100%;
  }

  .share-button.native {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   Ajustes Quinielas - compartir compacto y estadísticas limpias
   ============================================================ */

.hero > .container > .hero-copy {
  width: 100%;
}

.stats-grid.stats-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.stat-card.only-numbers {
  min-height: 140px;
}

.share-box-slim {
  align-items: center;
}

.share-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.share-button {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  overflow: hidden;
}

.share-button svg {
  display: block;
  width: 22px;
  height: 22px;
}

.share-button.email {
  font-size: 1rem;
}

.share-button.native {
  gap: 0;
}

.share-actions-compact {
  gap: 8px;
}

.share-actions-compact .share-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
}

.share-actions-compact .share-button svg {
  width: 20px;
  height: 20px;
}

.share-actions-compact .share-button.native {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.share-actions-inline {
  justify-content: flex-start;
}

.draw-day-tools {
  display: grid;
  gap: 10px;
  justify-items: end;
  min-width: 230px;
}

.draw-day-tools .date-search {
  width: 100%;
  max-width: 240px;
}

.draw-day-tools .share-actions {
  width: 100%;
  max-width: 240px;
}

@media (max-width: 720px) {
  .draw-day-tools {
    justify-items: start;
    width: 100%;
    min-width: 0;
  }

  .draw-day-tools .date-search,
  .draw-day-tools .share-actions {
    max-width: none;
  }

  .share-box {
    gap: 14px;
  }

  .share-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .share-box {
    padding: 16px;
  }

  .share-box .share-actions,
  .share-actions-compact {
    flex-wrap: nowrap;
    gap: 7px;
  }

  .share-box .share-button,
  .share-actions-compact .share-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .share-box .share-button.native,
  .share-actions-compact .share-button.native {
    width: 38px;
    min-width: 38px;
    padding: 0;
    justify-content: center;
  }

  .share-box .share-button svg,
  .share-actions-compact .share-button svg {
    width: 19px;
    height: 19px;
  }
}

/* ============================================================
   Datos especiales de sorteos
   ============================================================ */

.result-special-row td {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)) !important;
}

.result-special-row td:first-child {
  color: var(--primary);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.result-letters-row td:last-child strong {
  font-size: 1.25rem;
  letter-spacing: .18em;
}

.result-extra-row td:last-child {
  color: var(--text);
  font-weight: 600;
}