/* ==========================================================================
   El Trébol Dorado - sitio público
   Reproducción de la referencia visual: verde bosque + crema + dorado como acento.
   Medidas tomadas de la referencia a 1672 px de ancho (1 px ≈ 0.0598vw).
   ========================================================================== */

:root {
  --green-dark: #064e33;
  --green: #0b6845;
  --green-soft: #eaf4ee;

  --gold-dark: #a97816;
  --gold: #c99a2e;
  --gold-light: #e7c768;

  --cream: #f8f6ef;
  --white: #ffffff;

  --text-dark: #1a2820;
  --text-secondary: #69736d;

  --border-soft: #ddd5c1;

  /* derivados */
  --digit: #05301e;
  --ball-ring: #d6aa3c;
  --card-border: #ebe4d3;
  --card-shadow: 0 4px 16px rgba(60, 52, 30, 0.07);
  --radius: 18px;
  --font-serif: 'Cambria', Georgia, 'Palatino Linotype', 'Times New Roman', serif;
  --font-sans: 'Segoe UI', 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --ball-size: clamp(62px, 6.46vw, 112px);
  --card-img: clamp(78px, 6.88vw, 118px);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--cream);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--text-dark);
  background: linear-gradient(180deg, #faf8f2 0%, var(--cream) 100%);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--green);
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1522px;
  margin: 0 auto;
  padding: 0 36px;
  position: relative;
  z-index: 2;
}

.muted {
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ decoración */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('/images/bg-leaves.svg') center / cover no-repeat;
  opacity: 1;
}

.corner {
  position: fixed;
  bottom: 0;
  z-index: 1;
  width: clamp(120px, 15vw, 260px);
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: contain;
}

.corner-left {
  left: 0;
  height: clamp(86px, 10.7vw, 186px);
  background-image: url('/images/corner-left.svg');
  background-position: left bottom;
}

.corner-right {
  right: 0;
  height: clamp(137px, 17.1vw, 297px);
  background-image: url('/images/corner-right.svg');
  background-position: right bottom;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: relative;
  z-index: 3;
  color: var(--white);
  background:
    url('/images/clover-watermark.svg') right -22px center / clamp(84px, 6.6vw, 118px) no-repeat,
    url('/images/header-leaves.svg') left center / auto 100% no-repeat,
    radial-gradient(55% 160% at 6% 10%, rgba(90, 150, 110, 0.3), transparent 62%),
    linear-gradient(90deg, #235e3e 0%, #174e31 38%, #0f4428 70%, #0d3f25 100%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: clamp(84px, 5.86vw, 104px);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 1.02vw, 18px);
  text-decoration: none;
  color: var(--white);
}

.brand-logo {
  width: clamp(52px, 4.3vw, 76px);
  height: clamp(52px, 4.3vw, 76px);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, 0.4vw, 7px);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: clamp(25px, 2.5vw, 44px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-gold {
  background: linear-gradient(180deg, #f6e19a 0%, var(--gold-light) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tagline {
  font-size: clamp(8.5px, 0.66vw, 12px);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  padding-left: 0.38em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.08vw, 18px);
}

.server-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.clock-label {
  font-size: clamp(10px, 0.72vw, 12px);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
}

.clock-value {
  font-size: clamp(19px, 1.5vw, 26px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--white);
}

.clock-date {
  font-size: clamp(10px, 0.72vw, 12.5px);
  color: rgba(255, 255, 255, 0.9);
}

.header-divider {
  width: 1px;
  height: clamp(34px, 2.9vw, 50px);
  background: rgba(255, 255, 255, 0.3);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.08vw, 18px);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: clamp(40px, 2.87vw, 50px);
  padding: 0 clamp(16px, 1.2vw, 21px) 0 clamp(8px, 0.72vw, 13px);
  border-radius: 999px;
  border: 1.5px solid var(--gold-light);
  background: rgba(6, 78, 51, 0.25);
  color: var(--white);
  text-decoration: none;
  font-size: clamp(13px, 0.93vw, 16px);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-pill.active {
  color: var(--text-dark);
  border-color: transparent;
  background: linear-gradient(180deg, #f5d878 0%, #d8ac39 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.nav-pill.active:hover {
  transform: translateY(-1px);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: clamp(26px, 1.8vw, 30px);
  height: clamp(26px, 1.8vw, 30px);
}

.nav-pill-results:not(.active) {
  position: relative;
  overflow: hidden;
  color: var(--green-dark);
  font-weight: 700;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #ffffff 0%, #f6efd9 100%);
  box-shadow: 0 0 0 3px rgba(231, 199, 104, 0.28), 0 4px 12px rgba(0, 0, 0, 0.22);
  animation: results-ring 2.8s ease-in-out infinite;
}

.nav-pill-results:not(.active)::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: skewX(-20deg);
  animation: results-shine 4.5s ease-in-out infinite;
  pointer-events: none;
}

.nav-pill-results:not(.active):hover {
  background: linear-gradient(180deg, #ffffff 0%, #f1e5c0 100%);
  transform: translateY(-1px);
}

.nav-pill-results:not(.active) .nav-icon-results {
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-dark) 100%);
}

.nav-pill-results:not(.active) .nav-icon-results svg {
  width: 58%;
  height: 58%;
}

@keyframes results-ring {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(231, 199, 104, 0.28), 0 4px 12px rgba(0, 0, 0, 0.22);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(231, 199, 104, 0.12), 0 4px 12px rgba(0, 0, 0, 0.22);
  }
}

@keyframes results-shine {
  0%,
  60% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

.nav-icon-play {
  border-radius: 50%;
  background: var(--white);
  color: var(--text-dark);
  padding-left: 2px;
}

/* ------------------------------------------------------------------ botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 26px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

.btn-gold {
  color: #3a2f0e;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f5d878 0%, #d8ac39 100%);
  box-shadow: 0 4px 12px rgba(169, 120, 22, 0.22);
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(169, 120, 22, 0.3);
}

.btn-outline {
  color: var(--green-dark);
  background: var(--white);
  border-color: var(--border-soft);
}

.btn-outline:hover {
  border-color: var(--gold);
}

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ------------------------------------------------------------------ tarjetas */

.panel {
  position: relative;
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.08vw, 18px);
  padding: clamp(12px, 0.9vw, 17px) clamp(20px, 1.7vw, 30px) 0;
}

.panel-icon {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  flex: 0 0 auto;
}

.panel-icon svg {
  width: clamp(28px, 2.27vw, 40px);
  height: clamp(28px, 2.27vw, 40px);
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.4vw, 7px);
  min-width: 0;
}

.panel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(18px, 1.44vw, 25px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dark);
  line-height: 1.1;
}

.panel-subtitle {
  font-size: clamp(8.5px, 0.63vw, 11px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.state-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: clamp(8px, 0.66vw, 11px);
  height: clamp(32px, 2.33vw, 40px);
  padding: 0 clamp(14px, 1.2vw, 20px);
  border-radius: 999px;
  font-size: clamp(11px, 0.8vw, 13.5px);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #cfe3d6;
  white-space: nowrap;
}

.state-badge::before {
  content: '';
  width: clamp(9px, 0.66vw, 11px);
  height: clamp(9px, 0.66vw, 11px);
  border-radius: 50%;
  background: #0a7a3e;
}

.state-badge[data-state='drawing'] {
  color: #6b4d0c;
  background: #fbf3dc;
  border-color: #ecd9a4;
}

.state-badge[data-state='drawing']::before {
  background: var(--gold);
  animation: pulse 1.6s ease-in-out infinite;
}

.state-badge[data-state='result'] {
  color: var(--white);
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.state-badge[data-state='result']::before {
  background: var(--gold-light);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ------------------------------------------------------------------ home */

.home {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: clamp(14px, 1.26vw, 22px);
  padding-bottom: 18px;
  flex: 1;
}

/* --- próximo sorteo */

.next-bar {
  display: grid;
  grid-template-columns: 1.13fr 1fr 1.09fr;
  align-items: center;
  min-height: clamp(76px, 5.56vw, 96px);
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.next-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.1vw, 38px);
  padding: 4px 16px;
}

.next-item + .next-item {
  border-left: 1px solid #ece6d6;
  height: 64%;
}

.next-icon {
  display: grid;
  place-items: center;
  width: clamp(44px, 3.47vw, 60px);
  height: clamp(44px, 3.47vw, 60px);
  border-radius: 50%;
  background: #f7f1e1;
  color: #b0852a;
  flex: 0 0 auto;
}

.next-icon svg {
  width: 56%;
  height: 56%;
  stroke-width: 1.9;
}

.next-item:first-child .next-text {
  align-items: center;
}

.next-text {
  display: flex;
  flex-direction: column;
  gap: clamp(0px, 0.2vw, 4px);
}

.next-label {
  font-size: clamp(10.5px, 0.84vw, 14px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.next-time,
.countdown {
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: clamp(26px, 2.27vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--green-dark);
}

.countdown {
  color: var(--gold-dark);
}

.next-type {
  font-family: var(--font-serif);
  font-size: clamp(15px, 1.14vw, 20px);
  font-weight: 700;
  color: var(--text-dark);
}

/* --- balotera */

.draw-panel {
  padding-bottom: clamp(8px, 0.6vw, 11px);
}

.machine {
  position: relative;
  margin: clamp(8px, 0.72vw, 13px) auto 0;
  width: 72.6%;
}

.machine-glass {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(104px, 9.33vw, 162px);
  border-radius: 999px;
  padding: 10px clamp(20px, 5vw, 90px);
  background:
    url('/images/clover-watermark-green.svg') 4% 64% / clamp(50px, 5.4vw, 94px) no-repeat,
    url('/images/clover-watermark-green.svg') 96% 66% / clamp(54px, 6vw, 104px) no-repeat,
    radial-gradient(70% 55% at 50% 0%, rgba(120, 190, 145, 0.28), transparent 70%),
    radial-gradient(60% 60% at 50% 110%, rgba(0, 0, 0, 0.22), transparent 70%),
    linear-gradient(135deg, #1a6243 0%, #0f5a3b 45%, #0b5337 100%);
  border: 4px solid #d8ad45;
  box-shadow:
    inset 0 0 0 1.5px rgba(250, 232, 160, 0.75),
    inset 0 2px 0 2px rgba(255, 244, 200, 0.25),
    0 8px 16px rgba(40, 60, 30, 0.2);
}

.machine-base {
  width: 19%;
  min-width: 90px;
  height: clamp(6px, 0.48vw, 9px);
  margin: 0 auto;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #f3cf61, var(--gold));
}

.balls {
  position: relative;
  z-index: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(14px, 3.05vw, 54px);
  min-height: var(--ball-size);
}

.balls[data-count='5'],
.balls[data-count='6'] {
  --ball-size: clamp(50px, 5.4vw, 96px);
  gap: clamp(8px, 1.8vw, 32px);
}

.ball {
  position: relative;
  width: var(--ball-size);
  height: var(--ball-size);
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fbf8ee 45%, #f5f0df 100%);
  border: calc(var(--ball-size) * 0.072) solid var(--ball-ring);
  box-shadow:
    inset 0 0 0 2px rgba(255, 244, 205, 0.9),
    inset 0 -6px 10px rgba(150, 115, 40, 0.16),
    0 10px 18px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  transition: transform 0.25s ease;
}

/* sombra elíptica bajo cada bola, sobre la cápsula verde */
.ball::after {
  content: '';
  position: absolute;
  left: 8%;
  bottom: -22%;
  width: 84%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 20, 10, 0.45), transparent 70%);
  z-index: -1;
}

.ball-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.ball-digit {
  display: block;
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums;
  font-weight: 700;
  font-size: calc(var(--ball-size) * 0.55);
  line-height: 1;
  color: var(--digit);
}

/* Espera: movimiento lento y discreto */
.ball.spinning {
  animation: float 2.8s ease-in-out infinite;
}

.ball.spinning:nth-child(2n) {
  animation-delay: -0.9s;
}

.ball.spinning:nth-child(3n) {
  animation-delay: -1.8s;
}

.ball-digit.tick {
  animation: tick 0.18s ease-out;
}

/* Resultado: bola fija, número claro */
.ball.locked {
  animation: settle 0.45s ease-out;
  box-shadow:
    inset 0 0 0 2px rgba(255, 244, 205, 0.9),
    inset 0 -6px 10px rgba(150, 115, 40, 0.16),
    0 0 0 3px rgba(231, 199, 104, 0.35),
    0 10px 18px rgba(0, 0, 0, 0.25);
}

.balls.entering .ball {
  opacity: 0;
  transform: scale(0.8);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-4%) rotate(1.5deg);
  }
}

@keyframes tick {
  from {
    transform: translateY(-18%);
    opacity: 0.45;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes settle {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.draw-caption {
  margin: clamp(8px, 0.66vw, 12px) 16px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: clamp(14px, 1.02vw, 17.5px);
  min-height: 1.4em;
}

.draw-caption strong {
  color: var(--green-dark);
}

/* --- sorteo de animales */

.animal-panel {
  padding-bottom: clamp(10px, 1.08vw, 19px);
}

.panel-next {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.panel-next:not([hidden]) + .state-badge {
  margin-left: 14px;
}

.panel-next-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.panel-next-time {
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--green-dark);
}

.panel-next-countdown {
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: 700;
  color: var(--gold-dark);
}

.carousel-wrap {
  position: relative;
  margin-top: clamp(4px, 0.3vw, 6px);
}

.carousel {
  --gap: clamp(12px, 1.26vw, 22px);
  position: relative;
  margin: 0 clamp(40px, 3.2vw, 54px);
  height: calc(var(--card-img) + 46px);
  overflow: hidden;
  z-index: 0;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.carousel.dragging {
  cursor: grabbing;
}

.carousel-track {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 0;
  display: flex;
  gap: var(--gap);
  will-change: transform;
}

.animal-card {
  flex: 0 0 var(--card-img);
  width: var(--card-img);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 0.72vw, 13px);
  transition: transform 0.25s ease;
}

.animal-card img {
  width: var(--card-img);
  height: var(--card-img);
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #ecdcb0;
  background: #f3efe3;
  box-shadow: 0 2px 6px rgba(60, 52, 30, 0.12);
  pointer-events: none;
  -webkit-user-drag: none;
}

.animal-card span {
  font-size: clamp(12.5px, 0.9vw, 15.5px);
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.animal-card.is-center {
  transform: translateY(2px);
}

.animal-card.winner span {
  color: var(--green-dark);
  font-weight: 700;
}

/* Marco de la tarjeta seleccionada, con punta dorada inferior */
.carousel-frame {
  position: absolute;
  top: 2px;
  left: 50%;
  background: var(--white);
  z-index: -1;
  width: calc(var(--card-img) + 16px);
  height: calc(var(--card-img) + 16px);
  transform: translateX(-50%);
  border: 3px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(169, 120, 22, 0.18);
  pointer-events: none;
}

.carousel-frame::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -3px;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 11px solid var(--gold);
}

.carousel-arrow {
  position: absolute;
  top: calc(10px + var(--card-img) / 2 - 14px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--white);
  color: var(--text-dark);
  box-shadow: 0 2px 8px rgba(60, 52, 30, 0.12);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.carousel-arrow:hover {
  border-color: var(--gold);
  color: var(--green-dark);
}

.carousel-arrow:focus-visible {
  outline: 3px solid var(--gold-light);
}

.carousel-arrow.prev {
  left: 2px;
}

.carousel-arrow.next {
  right: 2px;
}

.animal-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vw, 44px);
  padding: 12px 20px 2px;
  animation: reveal 0.6s ease-out both;
}

.animal-result-image {
  width: clamp(110px, 10.5vw, 176px);
  height: clamp(110px, 10.5vw, 176px);
  border-radius: 50%;
  padding: 5px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 16px rgba(60, 52, 30, 0.18);
  flex: 0 0 auto;
}

.animal-result-image img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 4px solid var(--white);
}

.animal-result-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.animal-result-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--text-secondary);
}

.animal-result-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 2.6vw, 46px);
  letter-spacing: 0.05em;
  color: var(--green-dark);
  text-transform: uppercase;
  line-height: 1.05;
}

.animal-result-draw {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-dark);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.after-panel {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.btn-results {
  height: clamp(46px, 3.29vw, 56px);
  min-height: 0;
  padding: 0 clamp(28px, 2.9vw, 50px);
  font-size: clamp(14px, 1.05vw, 18px);
  letter-spacing: 0.03em;
  color: #3a2f0e;
}

.btn-results svg:first-child {
  color: #3a2f0e;
}

/* ------------------------------------------------------------------ resultados */

.results-page {
  padding-top: 26px;
  padding-bottom: 30px;
  flex: 1;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(28px, 2.4vw, 40px);
  color: var(--green-dark);
  letter-spacing: 0.02em;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 22px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.field input,
.field select {
  min-height: 44px;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--white);
  color: var(--text-dark);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--gold-light);
  outline-offset: 1px;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.result-day {
  margin-bottom: 22px;
}

.result-day-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--green-dark);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: 90px 110px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--white);
  box-shadow: var(--card-shadow);
}

.result-time {
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--green-dark);
}

.result-type {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

.mini-ball {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-variant-numeric: lining-nums;
  font-weight: 700;
  color: var(--digit);
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fbf8ee 45%, #f5f0df 100%);
  border: 3px solid var(--ball-ring);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18);
}

.result-animal {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-dark);
}

.result-animal img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid #e6d7ae;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.page-info {
  color: var(--text-secondary);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.error-page {
  padding-top: 60px;
  flex: 1;
}

/* ------------------------------------------------------------------ pie */

.site-footer {
  position: relative;
  z-index: 2;
  padding: 0 0 clamp(12px, 1.08vw, 18px);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.footer-line {
  flex: 0 1 176px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d9bd72, transparent);
}

.footer-text {
  font-size: clamp(9px, 0.63vw, 11px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #8f8a79;
  text-align: center;
}

/* ------------------------------------------------------------------ tablet */

@media (max-width: 1100px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .site-nav .header-divider {
    display: none;
  }

  .machine {
    width: 86%;
  }
}

@media (max-width: 900px) {
  :root {
    --ball-size: clamp(56px, 11vw, 96px);
    --card-img: clamp(76px, 12vw, 104px);
  }

  .header-inner {
    justify-content: center;
    padding: 10px 0;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }

  .next-bar {
    grid-template-columns: 1fr 1fr;
    padding: 8px 0;
  }

  .next-item.countdown-item {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid #ece6d6;
    height: auto;
    padding-top: 10px;
    margin-top: 8px;
  }

  .machine {
    width: 94%;
  }
}

/* ------------------------------------------------------------------ móvil */

@media (max-width: 640px) {
  :root {
    --ball-size: min(16vw, 72px);
    --card-img: 84px;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-right > .header-divider {
    display: none;
  }

  .server-clock {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 8px;
  }

  .site-nav {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  .nav-pill {
    padding: 0 14px 0 6px;
  }

  .brand-tagline {
    letter-spacing: 0.22em;
  }

  .next-bar {
    grid-template-columns: 1fr;
    padding: 4px 0;
  }

  .next-item {
    justify-content: flex-start;
    padding: 10px 18px;
  }

  .next-item + .next-item {
    border-left: 0;
    border-top: 1px solid #ece6d6;
    height: auto;
  }

  .next-item.countdown-item {
    margin-top: 0;
  }

  .panel-head {
    flex-wrap: wrap;
    padding: 14px 16px 0;
  }

  .panel-subtitle {
    letter-spacing: 0.18em;
  }

  .panel-next {
    order: 3;
    width: 100%;
    margin: 2px 0 0;
  }

  .machine {
    width: calc(100% - 20px);
  }

  .machine-glass {
    min-height: 0;
    padding: 12px 10px;
    background: linear-gradient(135deg, #0b5337 0%, #0f5f3e 50%, #126845 100%);
  }

  .balls {
    gap: 8px;
  }

  .carousel {
    margin: 0 26px;
  }

  .carousel-arrow {
    width: 34px;
    height: 34px;
    top: calc(10px + var(--card-img) / 2 - 17px);
  }

  .carousel-arrow.prev {
    left: 8px;
  }

  .carousel-arrow.next {
    right: 8px;
  }

  .animal-result {
    flex-direction: column;
    text-align: center;
  }

  .btn-results {
    padding: 0 18px;
    font-size: 13px;
  }

  .result-row {
    grid-template-columns: 70px 1fr;
    grid-template-areas:
      'time type'
      'result result';
  }

  .result-time {
    grid-area: time;
  }

  .result-type {
    grid-area: type;
    text-align: right;
  }

  .result-number,
  .result-animal {
    grid-area: result;
  }

  .field input,
  .field select {
    min-width: 0;
    width: 100%;
  }

  .field,
  .filter-actions {
    flex: 1 1 100%;
  }

  .footer-line {
    display: none;
  }

  .footer-text {
    letter-spacing: 0.14em;
  }

  .corner {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-pill-results:not(.active),
  .nav-pill-results:not(.active)::after {
    animation: none;
  }

  .ball.spinning,
  .state-badge[data-state='drawing']::before {
    animation: none;
  }
}

/* ==========================================================================
   Web (≥ 901 px): la página principal cabe completa en el viewport, sin scroll.
   --u = 1 px de la referencia (1672 × 941, más la barra de animales), escalado para caber en ancho y alto.
   En móvil (< 901 px) se mantiene la composición con desplazamiento.
   ========================================================================== */

@media (min-width: 901px) {
  :root {
    --vh: 100vh;
    --u: min(calc(100vw / 1672), calc(var(--vh) / 949));
  }

  @supports (height: 100dvh) {
    :root {
      --vh: 100dvh;
    }
  }

  /* --- estructura de pantalla completa */
  body.page-home {
    height: var(--vh);
    min-height: 0;
    overflow: hidden;
  }

  body.page-home .home {
    flex: 1 1 auto;
    min-height: 0;
    /* si sobra alto (pantallas más cuadradas que la referencia) el contenido se centra */
    justify-content: center;
    gap: calc(18 * var(--u));
    padding: calc(21 * var(--u)) 0 0;
  }

  body.page-home .container,
  .site-header .container,
  .site-footer .container {
    width: calc(1450 * var(--u));
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  /* --- encabezado */
  .site-header {
    background-size: calc(118 * var(--u)), auto 100%, auto, auto;
    background-position: right calc(-22 * var(--u)) center, left center, 0 0, 0 0;
  }

  .header-inner {
    min-height: calc(98 * var(--u));
    gap: calc(20 * var(--u));
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 0;
  }

  .header-right {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: calc(18 * var(--u));
  }

  .brand {
    gap: calc(16 * var(--u));
  }

  .brand-logo {
    width: calc(72 * var(--u));
    height: calc(72 * var(--u));
  }

  .brand-text {
    gap: calc(7 * var(--u));
  }

  .brand-name {
    font-size: calc(44 * var(--u));
  }

  .brand-tagline {
    font-size: calc(11 * var(--u));
  }

  .server-clock {
    width: auto;
    flex-direction: column;
    align-items: center;
  }

  .clock-label {
    font-size: calc(12 * var(--u));
  }

  .clock-value {
    font-size: calc(25 * var(--u));
  }

  .clock-date {
    font-size: calc(12.5 * var(--u));
  }

  .header-divider,
  .site-nav .header-divider,
  .header-right > .header-divider {
    display: block;
    height: calc(48 * var(--u));
  }

  .site-nav {
    width: auto;
    gap: calc(18 * var(--u));
  }

  .nav-pill {
    height: calc(48 * var(--u));
    gap: calc(10 * var(--u));
    padding: 0 calc(21 * var(--u)) 0 calc(13 * var(--u));
    font-size: calc(16 * var(--u));
    border-width: calc(1.5 * var(--u));
  }

  .nav-icon {
    width: calc(28 * var(--u));
    height: calc(28 * var(--u));
  }

  .nav-icon svg {
    width: calc(21 * var(--u));
    height: calc(21 * var(--u));
  }

  .nav-icon-play svg {
    width: calc(15 * var(--u));
    height: calc(15 * var(--u));
  }

  /* --- tarjetas */
  body.page-home .panel,
  body.page-home .next-bar {
    border-radius: calc(18 * var(--u));
  }

  body.page-home .panel-head {
    gap: calc(18 * var(--u));
    padding: calc(17 * var(--u)) calc(30 * var(--u)) 0;
  }

  body.page-home .panel-icon svg {
    width: calc(38 * var(--u));
    height: calc(38 * var(--u));
  }

  body.page-home .panel-heading {
    gap: calc(7 * var(--u));
  }

  body.page-home .panel-title {
    font-size: calc(25 * var(--u));
  }

  body.page-home .panel-subtitle {
    font-size: calc(11 * var(--u));
  }

  body.page-home .state-badge {
    height: calc(39 * var(--u));
    padding: 0 calc(20 * var(--u));
    gap: calc(11 * var(--u));
    font-size: calc(13.5 * var(--u));
  }

  body.page-home .state-badge::before {
    width: calc(11 * var(--u));
    height: calc(11 * var(--u));
  }

  /* --- próximo sorteo */
  body.page-home .next-bar {
    grid-template-columns: 1.13fr 1fr 1.09fr;
    min-height: calc(78 * var(--u));
    padding: 0;
  }

  body.page-home .next-item {
    gap: calc(36 * var(--u));
    padding: calc(4 * var(--u)) calc(16 * var(--u));
    justify-content: center;
  }

  body.page-home .next-item + .next-item {
    border-left: 1px solid #ece6d6;
    border-top: 0;
    height: calc(50 * var(--u));
  }

  body.page-home .next-item.countdown-item {
    grid-column: auto;
    margin-top: 0;
  }

  body.page-home .next-icon {
    width: calc(50 * var(--u));
    height: calc(50 * var(--u));
  }

  body.page-home .next-label {
    font-size: calc(13 * var(--u));
  }

  body.page-home .next-text {
    gap: calc(3 * var(--u));
  }

  body.page-home .next-time,
  body.page-home .countdown {
    font-size: calc(34 * var(--u));
  }

  body.page-home .next-type {
    font-size: calc(18 * var(--u));
  }

  /* --- balotera */
  body.page-home .draw-panel {
    padding-bottom: calc(11 * var(--u));
  }

  body.page-home .machine {
    width: 72.6%;
    margin-top: calc(13 * var(--u));
  }

  body.page-home .machine-glass {
    min-height: calc(156 * var(--u));
    padding: calc(10 * var(--u)) calc(90 * var(--u));
    border-width: calc(4 * var(--u));
    background-size: calc(94 * var(--u)), calc(104 * var(--u)), auto, auto, auto;
  }

  body.page-home .machine-base {
    height: calc(9 * var(--u));
    min-width: 0;
  }

  body.page-home .balls {
    --ball-size: calc(108 * var(--u));
    gap: calc(51 * var(--u));
  }

  body.page-home .balls[data-count='5'],
  body.page-home .balls[data-count='6'] {
    --ball-size: calc(92 * var(--u));
    gap: calc(30 * var(--u));
  }

  body.page-home .draw-caption {
    margin-top: calc(12 * var(--u));
    font-size: calc(17.5 * var(--u));
  }

  /* --- sorteo de animales */
  body.page-home .animal-panel {
    padding-bottom: calc(19 * var(--u));
  }

  body.page-home .panel-next-label {
    font-size: calc(12 * var(--u));
  }

  body.page-home .panel-next-time {
    font-size: calc(19 * var(--u));
  }

  body.page-home .panel-next-countdown {
    font-size: calc(16 * var(--u));
  }

  body.page-home .carousel-wrap {
    margin: calc(5 * var(--u)) 0 0;
  }

  body.page-home .carousel {
    --card-img: calc(115 * var(--u));
    --gap: calc(21 * var(--u));
    margin: 0 calc(54 * var(--u));
    height: calc(161 * var(--u));
  }

  body.page-home .carousel-track {
    top: calc(10 * var(--u));
  }

  body.page-home .animal-card {
    gap: calc(13 * var(--u));
  }

  body.page-home .animal-card img {
    border-radius: calc(10 * var(--u));
  }

  body.page-home .animal-card span {
    font-size: calc(15.5 * var(--u));
  }

  body.page-home .carousel-frame {
    top: calc(2 * var(--u));
    border-width: calc(3 * var(--u));
    border-radius: calc(12 * var(--u));
  }

  body.page-home .carousel-arrow {
    width: calc(40 * var(--u));
    height: calc(40 * var(--u));
    top: calc((10 + 115 / 2 - 14) * var(--u));
  }

  body.page-home .carousel-arrow svg {
    width: calc(18 * var(--u));
    height: calc(18 * var(--u));
  }

  body.page-home .carousel-arrow.prev {
    left: calc(2 * var(--u));
  }

  body.page-home .carousel-arrow.next {
    right: calc(2 * var(--u));
  }

  body.page-home .animal-result {
    padding: calc(6 * var(--u)) calc(20 * var(--u)) 0;
    gap: calc(40 * var(--u));
    min-height: calc(161 * var(--u));
  }

  body.page-home .animal-result-image {
    width: calc(150 * var(--u));
    height: calc(150 * var(--u));
    padding: calc(5 * var(--u));
  }

  body.page-home .animal-result-name {
    font-size: calc(44 * var(--u));
  }

  body.page-home .animal-result-label {
    font-size: calc(12 * var(--u));
  }

  body.page-home .animal-result-draw {
    font-size: calc(16 * var(--u));
  }

  /* --- botón y pie */
  body.page-home .after-panel {
    padding-top: 0;
  }

  body.page-home .btn-results {
    height: calc(55 * var(--u));
    padding: 0 calc(50 * var(--u));
    gap: calc(12 * var(--u));
    font-size: calc(18 * var(--u));
  }

  body.page-home .btn-results svg:first-child {
    width: calc(24 * var(--u));
    height: calc(24 * var(--u));
  }

  body.page-home .btn-results svg:last-child {
    width: calc(18 * var(--u));
    height: calc(18 * var(--u));
  }

  body.page-home .site-footer {
    padding: calc(12 * var(--u)) 0 calc(18 * var(--u));
  }

  .footer-inner {
    gap: calc(22 * var(--u));
  }

  .footer-line {
    display: block;
    flex-basis: calc(176 * var(--u));
  }

  .footer-text {
    font-size: calc(10.5 * var(--u));
  }

  .corner-left {
    width: calc(260 * var(--u));
    height: calc(186 * var(--u));
  }

  .corner-right {
    width: calc(260 * var(--u));
    height: calc(297 * var(--u));
  }
}
