/* Reset suave */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fafafa;
  color: #111;
}

/* Layout principal */
.container {
  display: grid;
  grid-template-columns: 1fr 460px;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}




/* Zona del botón */


/* Botón */
#click-btn {
  font-size: 48px;
  padding: 32px 64px;
  border: 2px solid #111;
  background: transparent;
  cursor: pointer;
  letter-spacing: 2px;
}

#click-btn:hover {
  background: #111;
  color: #fff;
}


/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-weight: 500;
  color: #777;
  padding-bottom: 6px;
}

td {
  padding: 6px 0;
}

tbody tr:not(:last-child) td {
  border-bottom: 1px solid #eee;
}

tbody tr {
  transition: background-color 0.3s;
}

tbody tr:nth-child(1) {
  background: #ffeaa7;
}

@keyframes moveUp {
  0%   { background-color: #32e032; }
  100% { background-color: transparent; }
}

@keyframes moveDown {
  0%   { background-color: #db2f2f; }
  100% { background-color: transparent; }
}

tr.move-up {
  animation: moveUp 3s ease;
}

tr.move-down {
  animation: moveDown 3s ease;
}

.country-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-cell img {
  width: 20px;
  height: auto;
  border-radius: 2px;
}

#event-message {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  
  max-width: 80%;
  padding: 10px 18px;

  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;

  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);

  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

#event-message.show {
  opacity: 1;
  transform: translate(-50%, -10px);
}

.event-winner {
  color: #1a9b4a; /* verde */
  font-weight: 700;
}

.event-loser {
  color: #c0392b; /* rojo */
  font-weight: 700;
}


table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

th, td {
  padding: 6px 8px;
  text-align: left;
}

tbody tr:not(:last-child) {
  border-bottom: 1px solid #eee;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}




html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}


.container {
  display: grid;
  grid-template-columns: 1fr 460px;
  height: 100vh;
  overflow: hidden;
}


/* ===== LAYOUT GENERAL ===== */

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.container {
  display: grid;
  grid-template-columns: 1fr 460px;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.container {
  display: grid;
  grid-template-columns: 800px 1fr 460px;
  height: 100vh;
  overflow: hidden;
}




/* ===== ZONA DERECHA ===== */

.rankings {
  padding: 20px 30px 20px 20px;
  box-sizing: border-box;

  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;

  height: 100%;
  overflow: hidden;
}


/* ===== CARDS ===== */

.ranking-card {
  display: flex;
  flex-direction: column;

  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-height: 0;
}

.ranking-card h2 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===== SCROLL INTERNO ===== */

.table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ===== PODIUM ===== */

/* 🥇 Oro */
tbody tr:nth-child(1) {
  background: linear-gradient(90deg, #ffd700, #ffec8b);
  font-weight: 700;
}

/* 🥈 Plata */
tbody tr:nth-child(2) {
  background: linear-gradient(90deg, #cfd8dc, #eceff1);
  font-weight: 600;
}

/* 🥉 Bronce */
tbody tr:nth-child(3) {
  background: linear-gradient(90deg, #cd7f32, #e3a869);
  font-weight: 600;
}

/* ===== MEDALS ===== */

tbody tr:nth-child(1) td:first-child::before {
  content: "🥇 ";
}

tbody tr:nth-child(2) td:first-child::before {
  content: "🥈 ";
}

tbody tr:nth-child(3) td:first-child::before {
  content: "🥉 ";
}

@keyframes goldShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

tbody tr:nth-child(1) {
  background: linear-gradient(
    110deg,
    #ffd700 25%,
    #fff3b0 37%,
    #ffd700 63%
  );
  background-size: 200% 100%;
  animation: goldShine 3s linear infinite;
}

#confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 12px;
  opacity: 0.9;
  animation: fall 2.5s linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== MAP CARD ===== */

.map-card {
  height: 100%;
  padding: 20px 16px 20px 20px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;

  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);

  min-height: 0; /* 🔥 CLAVE */
}




.map-card h2 {
  margin: 0 0 12px;
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  color: #555;
}

#map-placeholder {
  flex: 1;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f0f0, #fafafa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.9rem;
}

#map {
  flex: 1;
  min-height: 0;

  border-radius: 12px;
  overflow: hidden;
}

/* ===== MAP COLUMN ===== */

.map-column {
  padding: 20px 20px 20px 30px; /* mismo aire que rankings */
  height: 100%;
  box-sizing: border-box;
}

/* ===== BUTTON REACTION ===== */

@keyframes buttonShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.button-shake {
  animation: buttonShake 0.4s ease;
}

/* ===== FOOTER LINKS UNDER BUTTON ===== */

.footer-links {
  position: absolute;
  bottom: 20px;

  display: flex;
  align-items: center;
  gap: 12px;

  font-size: 0.95rem;
  opacity: 0.85;
}

.footer-links a {
  color: #111;
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-links .separator {
  color: #999;
}

/* ===== X LOGO ===== */

.x-logo {
  width: 48px;
  height: auto;
  fill: #111;
  transition: transform 0.2s ease, opacity 0.2s ease;
}




.footer-links a:hover .x-logo {
  transform: scale(1.1);
  opacity: 0.8;
}

.x-logo {
  width: 40px;
  height: auto;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.x-logo:hover {
  transform: scale(1.1);
  opacity: 1;
}




.logo-title span {
  color: #ff4757; /* rojo click */
}




.logo-inner {
  animation: microShake 6s ease-in-out infinite;
}




.logo-inner {
  display: inline-block;   /* 🔥 CLAVE */
  animation: microShake 6s ease-in-out infinite;
  transform-origin: center center;
}

@keyframes microShake {
  0%, 100% {
    transform: rotate(0deg);
  }
  45% {
    transform: rotate(-3.6deg);
  }
  55% {
    transform: rotate(3.6deg);
  }
}




.logo-title span {
  color: #ff4757;
}



#click-btn {
  position: static;
  justify-self: center;
  align-self: center;
  font-size: 48px;
  padding: 32px 64px;
  border: 2px solid #111;
  background: transparent;
  cursor: pointer;
  letter-spacing: 2px;
}





.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.x-logo {
  width: 40px;
  height: auto;
  fill: #444;
  transition: transform 0.2s ease, fill 0.2s ease;
}

.x-logo:hover {
  transform: scale(1.1);
  fill: #000;
}


.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}


.center-column {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto 1fr auto;
  justify-items: center;
}

.button-area {
  height: 100vh;
}

.center-column {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto 1fr auto;
  justify-items: center;
}

.button-area {
  height: 100vh;
}

.center-column {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto 1fr auto;
  justify-items: center;
}

#click-btn {
  grid-row: 3;
  font-size: 48px;
  padding: 32px 64px;
  border: 2px solid #111;
  background: transparent;
  cursor: pointer;
  letter-spacing: 2px;
}

/* ===== LOGO / TITLE ===== */

.logo {
  margin-top: 36px;
  margin-bottom: 32px;
  text-align: center;
  pointer-events: none;
}

.logo-inner {
  display: inline-block;
  animation: microShake 6s ease-in-out infinite;
  transform-origin: center;
}

/* TÍTULO PRINCIPAL */
.logo-title {
  font-size: clamp(3.2rem, 4vw, 4.2rem);
  font-weight: 900;
  letter-spacing: 6px;
  line-height: 1;
  color: #111;
}

.logo-title span {
  color: #ff4757; /* rojo Click */
}

/* SUBTÍTULOS */
.logo-subtitle {
  margin-top: 8px;
  font-size: 0.95rem;
  color: #666;
  letter-spacing: 1px;
  font-style: italic;
}

/* ========================= */
/* 📱 RESPONSIVE — MOBILE */
/* ========================= */

@media (max-width: 900px) {

  body {
    overflow-y: auto;
  }

  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    overflow: visible;
  }

  /* MAPA */
  .map-column {
    order: 3;
    padding: 16px;
  }

  .map-card {
    height: 320px;
  }

  /* BOTÓN + LOGO */
  .button-area {
    order: 2;
    height: auto;
    padding: 24px 16px;
  }

  .center-column {
    height: auto;
    grid-template-rows: auto auto auto;
    row-gap: 24px;
  }

  #click-btn {
    font-size: 42px;
    padding: 28px 56px;
  }

  /* LOGO */
  .logo {
    margin-top: 16px;
    margin-bottom: 12px;
  }

  .logo-title {
    font-size: 2.6rem;
    letter-spacing: 4px;
  }

  /* FOOTER (X) */
  .footer-links {
    position: static;
    margin-top: 8px;
  }

  /* RANKINGS */
  .rankings {
    order: 4;
    grid-template-rows: auto auto;
    padding: 16px;
    gap: 16px;
    height: auto;
  }

  .ranking-card {
    height: 260px;
  }


}

.center-column {
  position: relative; /* 🔥 CLAVE ABSOLUTA */
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.seo-content {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
