* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background-color: #0a0f25;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden; 
}

#top-container {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 33vh;           
  width: 100%;
  padding: 0 2vw;
}

#title {
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9vw;         
  font-weight: 800;
  color: #5de26b;         
  text-shadow: 0 3px 16px rgba(0,0,0,0.6);
}

#ranking {
  width: 50%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-evenly;
  gap: 10px;
}

#ranking > div {
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
}

.rank-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(145deg, #1e2a4f, #0a0f25); 
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 5px;
  will-change: transform;
}

.rank-card:nth-child(1) { flex: 1.4; height: 100%; }
.rank-card:nth-child(2) { flex: 1.2; height: 90%; }
.rank-card:nth-child(3) { flex: 1.0; height: 80%; }
.rank-card:nth-child(4) { flex: 0.9; height: 70%; }
.rank-card:nth-child(5) { flex: 0.8; height: 60%; }

.rank-card:hover { transform: translateY(-5px); box-shadow: 0 10px 28px rgba(93, 226, 107, 0.3); }

.rank-number {
  flex: 5; 
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #5de26b;
}
.rank-name {
  flex: 3; 
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
  padding: 0 6px;
}

.rank-score {
  flex: 2.4; 
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #5de26b;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.rank-card:nth-child(1) .rank-score { font-size: 2.4vw; }
.rank-card:nth-child(2) .rank-score { font-size: 2.2vw; }
.rank-card:nth-child(3) .rank-score { font-size: 2.0vw; }
.rank-card:nth-child(4) .rank-score { font-size: 1.8vw; }
.rank-card:nth-child(5) .rank-score { font-size: 1.6vw; }

.rank-total {
  flex: 0.6; 
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: rgba(255,255,255,0.86);
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 4px;
  font-size: clamp(10px, 0.8vw, 12px);
}

.rank-card:nth-child(1) .rank-number { font-size: 5vw; }
.rank-card:nth-child(2) .rank-number { font-size: 4.5vw; }
.rank-card:nth-child(3) .rank-number { font-size: 4vw; }
.rank-card:nth-child(4) .rank-number { font-size: 3.5vw; }
.rank-card:nth-child(5) .rank-number { font-size: 3vw; }

.rank-card.bump { animation: bump 650ms ease; box-shadow: 0 12px 28px rgba(93,226,107,0.35); }
@keyframes bump { 0%{transform:scale(1);} 30%{transform:scale(1.025);} 100%{transform:scale(1);} }

.rank-score.flash { animation: scoreFlash 1200ms ease; }
@keyframes scoreFlash {
  0%{ color:#b2ffbd; text-shadow:0 0 12px rgba(93,226,107,0.6);}
  60%{ color:#5de26b; text-shadow:0 0 6px rgba(93,226,107,0.3);}
  100%{ color:#5de26b; text-shadow:0 2px 10px rgba(0,0,0,0.35);}
}

#chartdiv {
  width: 100%;
  height: 67vh;
  overflow: hidden;
}

#payment-popup {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: none; /* controlado por .hidden */
  align-items: center; justify-content: center;
  z-index: 9999;
}
#payment-popup:not(.hidden) { display: flex; }

#popup-content {
  background: #1e2a4f;
  padding: 22px 30px;
  border-radius: 12px;
  position: relative;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#close-popup {
  position: absolute;
  top: 10px; right: 12px;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
}

.amount-controls {
  display: flex; gap: 10px;
  justify-content: center; margin-top: 6px;
}
.amount-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.amount-btn:hover {
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 14px rgba(93,226,107,0.25);
}
.amount-label { font-weight: 700; text-align: center; }
.amount-field { position: relative; display: flex; justify-content: center; }
#amount-input {
  padding: 10px 48px 10px 12px; 
  border-radius: 10px; border: none;
  width: 180px; text-align: left;
  font-weight: 700; font-size: 1rem; outline: none;
}
.currency-suffix {
  position: absolute;
  right: calc(50% - 90px + 12px); 
  top: 50%; transform: translateY(-50%);
  color: #0a0f25; background: #5de26b;
  border-radius: 8px; padding: 4px 8px;
  font-weight: 800; text-transform: lowercase;
  pointer-events: none;
}

#pay-button {
  padding: 10px 18px;
  border-radius: 8px; border: none;
  background: #5de26b; color: #0a0f25;
  font-weight: 700; cursor: pointer;
}


#terms-popup {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 10000; 
}
#terms-popup.hidden { display: none !important; }

#terms-popup-content {
  background: #1e2a4f;
  width: 92%; max-width: 640px; max-height: 82vh;
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
#terms-popup-content h2 {
  margin: 0; padding: 18px 24px 12px;
  text-align: center; font-size: 1.6rem;
  color: #5de26b;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
}
.terms-body {
  padding: 0 24px 16px 24px;
  overflow-y: auto; overscroll-behavior: contain;
  max-height: calc(82vh - 56px - 76px); 
  line-height: 1.45; font-size: 0.98rem;
}
.terms-body::-webkit-scrollbar { width: 8px; }
.terms-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 8px; }
.terms-body::-webkit-scrollbar-thumb { background: rgba(93,226,107,0.45); border-radius: 8px; }
.terms-body p { margin: 10px 0; }
.terms-body strong { color: #a7f0b1; font-weight: 800; }
.terms-actions {
  padding: 14px 24px 18px;
  display: flex; justify-content: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.22), rgba(0,0,0,0));
  border-top: 1px solid rgba(255,255,255,0.08);
}
#accept-terms-btn {
  padding: 12px 24px; border-radius: 10px; border: none;
  background: #5de26b; color: #0a0f25;
  font-weight: 800; font-size: 1rem; cursor: pointer;
  box-shadow: 0 0 12px rgba(93,226,107,0.35);
  transition: transform .08s ease, box-shadow .2s ease;
}
#accept-terms-btn:hover { box-shadow: 0 0 18px rgba(93,226,107,0.55); }
#accept-terms-btn:active { transform: scale(0.98); }

.hidden { display: none !important; }

@media (max-width: 720px) {
  html, body { overflow: auto; } 
  #top-container { flex-direction: column; height: auto; padding: 10px; }
  #title { width: 100%; font-size: 14vw; height: auto; }
  #ranking { width: 100%; flex-wrap: wrap; justify-content: center; height: auto; }
  #ranking > div { height: auto; align-items: stretch; }
  .rank-card:nth-child(1) .rank-number { font-size: 12vw; }
  .rank-card:nth-child(2) .rank-number { font-size: 10vw; }
  .rank-card:nth-child(3) .rank-number { font-size: 9vw; }
  .rank-card:nth-child(4) .rank-number { font-size: 8vw; }
  .rank-card:nth-child(5) .rank-number { font-size: 7vw; }

  .rank-card:nth-child(1) .rank-score { font-size: 6.4vw; }
  .rank-card:nth-child(2) .rank-score { font-size: 5.8vw; }
  .rank-card:nth-child(3) .rank-score { font-size: 5.2vw; }
  .rank-card:nth-child(4) .rank-score { font-size: 4.6vw; }
  .rank-card:nth-child(5) .rank-score { font-size: 4.2vw; }

  .rank-total { font-size: clamp(10px, 2.8vw, 12px); }
}

.rank-number.num-up {
  animation: numUp 550ms ease;
}
@keyframes numUp {
  0%   { transform: translateY(40%);  opacity: .7; }
  60%  { transform: translateY(-8%);  opacity: 1;  }
  100% { transform: translateY(0%);   opacity: 1;  }
}

.rank-number.num-down {
  animation: numDown 550ms ease;
}
@keyframes numDown {
  0%   { transform: translateY(-40%); opacity: .7; }
  60%  { transform: translateY(8%);   opacity: 1;  }
  100% { transform: translateY(0%);   opacity: 1;  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(93, 226, 107, 0.12), transparent 60%),
              radial-gradient(circle at 80% 70%, rgba(93, 226, 107, 0.08), transparent 60%);
  animation: auroraMove 20s ease-in-out infinite alternate;
  z-index: -1;
}
@keyframes auroraMove {
  0% { background-position: 20% 30%, 80% 70%; }
  50% { background-position: 25% 35%, 75% 65%; }
  100% { background-position: 20% 30%, 80% 70%; }
}

#title {
  background: linear-gradient(90deg, #5de26b, #9effa6, #5de26b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGlow 6s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 15px rgba(93,226,107,0.3); }
  50% { text-shadow: 0 0 30px rgba(93,226,107,0.6); }
}

.rank-card {
  transform-style: preserve-3d;
  transition: transform 0.5s ease, box-shadow 0.5s ease;
  perspective: 600px;
}
.rank-card:hover {
  transform: rotateY(4deg) translateY(-4px);
  box-shadow: 0 12px 28px rgba(93,226,107,0.35);
}

.rank-score {
  position: relative;
}
.rank-score::after {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(93,226,107,0.25), transparent 70%);
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
.rank-card:hover .rank-score::after {
  opacity: 0.6;
}

.rank-card:nth-child(1) .rank-score {
  color: #5de26b;
  text-shadow: 0 0 10px rgba(93, 226, 107, 0.4);
}

.rank-number {
  color: #5de26b;
  text-shadow:
    0 0 6px rgba(93, 226, 107, 0.25),
    0 0 12px rgba(93, 226, 107, 0.35),
    0 0 18px rgba(93, 226, 107, 0.45);
  font-weight: 800;
}

.rank-score {
  color: #5de26b;
  text-shadow:
    0 0 6px rgba(93, 226, 107, 0.25),
    0 0 12px rgba(93, 226, 107, 0.35);
  position: relative;
}

.rank-score::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(93,226,107,0.18), transparent 70%);
  opacity: 0;
  transition: opacity 1.5s ease;
  pointer-events: none;
}
.rank-card:hover .rank-score::after {
  opacity: 0.4;
}

#payment-popup {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#payment-popup:not(.hidden) {
  display: flex;
  opacity: 1;
}

#popup-content {
  position: relative;
  background: rgba(25, 35, 60, 0.95);
  border: 1px solid rgba(93, 226, 107, 0.15);
  border-radius: 16px;
  box-shadow: 0 0 28px rgba(93, 226, 107, 0.2);
  padding: 32px 38px;
  min-width: 340px;
  max-width: 400px;
  color: #fff;
  text-align: center;
  transform: scale(0.96);
  opacity: 0;
  animation: popupShow 0.5s ease forwards;
}
@keyframes popupShow {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#close-popup {
  position: absolute;
  top: 12px;
  right: 16px;
  color: #7ef28a;
  font-weight: 700;
  cursor: pointer;
  font-size: 1.3rem;
  transition: transform 0.2s ease, color 0.3s ease;
}
#close-popup:hover {
  transform: scale(1.2);
  color: #9effa6;
}

#popup-content h3 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: #9effa6;
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px rgba(93, 226, 107, 0.4);
}

.amount-label {
  font-weight: 700;
  margin-top: 8px;
  color: rgba(255,255,255,0.9);
}
.amount-field {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
#amount-input {
  padding: 10px 50px 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  width: 180px;
  outline: none;
  text-align: left;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
#amount-input:focus {
  border-color: #5de26b;
  box-shadow: 0 0 12px rgba(93,226,107,0.35);
}
.currency-suffix {
  position: absolute;
  right: calc(50% - 90px + 12px);
  top: 50%;
  transform: translateY(-50%);
  color: #0a0f25;
  background: #5de26b;
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 800;
  pointer-events: none;
}

.amount-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.amount-btn {
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(93, 226, 107, 0.1);
  border: 1px solid rgba(93, 226, 107, 0.25);
  color: #9effa6;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}
.amount-btn:hover {
  background: rgba(93, 226, 107, 0.25);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(93,226,107,0.3);
}

#pay-button {
  margin-top: 22px;
  padding: 12px 22px;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, #5de26b, #9effa6);
  color: #0a0f25;
  cursor: pointer;
  transition: all 0.35s ease;
  box-shadow: 0 0 20px rgba(93,226,107,0.35);
}
#pay-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 32px rgba(93,226,107,0.6);
}
#pay-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  #popup-content {
    width: 92%;
    padding: 26px;
  }
  #popup-content h3 {
    font-size: 1.25rem;
  }
}

#popup-content::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(93, 226, 107, 0.12) 20%,
    rgba(93, 226, 107, 0.4) 50%,
    rgba(158, 255, 166, 0.55) 80%,
    transparent 100%
  );
  background-size: 300% 300%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#payment-popup:not(.hidden) #popup-content::before {
  animation: borderFlow 7s linear infinite;
  opacity: 1;
}

@keyframes borderFlow {
  0% { background-position: 0% 50%; opacity: 0.45; box-shadow: 0 0 10px rgba(93,226,107,0.25); }
  50% { background-position: 100% 50%; opacity: 0.8; box-shadow: 0 0 20px rgba(93,226,107,0.4); }
  100% { background-position: 0% 50%; opacity: 0.45; box-shadow: 0 0 10px rgba(93,226,107,0.25); }
}

#popup-content > * {
  position: relative;
  z-index: 1;
}

#close-popup {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #7ef28a;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.3s ease, text-shadow 0.3s ease;
  z-index: 2; 
}
#close-popup:hover {
  transform: scale(1.2);
  color: #9effa6;
  text-shadow: 0 0 10px rgba(93,226,107,0.5);
}

#popup-content {
  box-shadow:
    0 0 25px rgba(93,226,107,0.18),
    inset 0 0 12px rgba(93,226,107,0.08);
}
