* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #f59e0b;
  --accent-color: #10b981;
  --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: rgba(255, 255, 255, 0.15);
  --card-border: rgba(255, 255, 255, 0.3);
  --text-light: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.8);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glow: 0 0 20px rgba(99, 102, 241, 0.5);
}
 
body {
  font-family: 'Poppins', sans-serif;
  background: url('https://i.ibb.co/HLxPnJ10/backback.png') no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh;
  color: var(--text-light);
  overflow-x: hidden;
  position: relative;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: none;
  background-attachment: fixed;
  height: 100vh;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Header - Logo y botón About */
header {
  text-align: center;
  margin-bottom: 10px;
  padding: 10px 0;
  position: relative;
}

.logo {
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* Botón About */
.about-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  color: var(--text-light);
  padding: 10px 20px;
  border-radius: 25px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  cursor: pointer;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.about-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.about-btn:active {
  transform: translateY(0);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  color: var(--text-light);
  box-shadow: var(--shadow);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h2 {
  color: var(--secondary-color);
  margin: 0;
  font-size: 1.8rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--secondary-color);
  background: rgba(255, 255, 255, 0.1);
}

.modal-body p {
  margin-bottom: 15px;
  line-height: 1.6;
  text-align: center;
}

.modal-features {
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
}

/* Main Content */
main {
  text-align: center;
  margin-bottom: 20px;
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 60vh;
  padding-top: 20px;
}

/* Contador Flotante */
.floating-counter {
  position: absolute;
  top: -40px;
  font-size: 4rem;
  font-weight: 900;
  color: white;
  text-shadow: 
    3px 3px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
  z-index: 100;
  pointer-events: none;
  transition: transform 0.2s ease;
  transform-origin: center;
}

/* Efectos de rotación para el contador */
.floating-counter.rotate-left {
  transform: rotate(-5deg) translateX(-5px);
}

.floating-counter.rotate-right {
  transform: rotate(5deg) translateX(5px);
}

.floating-counter.rotate-center {
  transform: rotate(0deg) scale(1.05);
}

/* Efecto de agrandamiento para el contador */
.floating-counter.animating {
  animation: numberGrow 0.2s ease-in-out;
}

@keyframes numberGrow {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Cat Container */
.cat-container {
  position: relative;
  display: inline-block;
  margin: 100px 0 30px 0;
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  background: transparent !important;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000;
  will-change: transform;
}

.cat-container:active {
  transform: scale(0.95);
}

.cat-images {
  position: relative;
  width: 600px;
  height: 600px;
}

.cat-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.05s ease;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: opacity;
}

.cat-closed {
  opacity: 1;
}

.cat-open {
  opacity: 0;
}

.cat-container.active .cat-closed {
  opacity: 0;
}

.cat-container.active .cat-open {
  opacity: 1;
}

.click-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  font-size: 4rem;
  font-weight: bold;
  color: var(--secondary-color);
  opacity: 0;
  pointer-events: none;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  animation: floatUp 1s ease-out forwards;
  z-index: 10;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -200px) scale(1.5);
  }
}

/* Dashboard Minimizado */
.dashboard-minimized {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 600px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 15px 20px;
  box-shadow: 0 -5px 30px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: all 0.3s ease;
  cursor: pointer;
}

.dashboard-minimized .dashboard-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.dashboard-minimized .dashboard-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  gap: 15px;
}

.toggle-arrow {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
  color: var(--secondary-color);
  min-width: 20px;
}

/* Leaderboard Mini */
.leaderboard-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.top-country {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 15px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex: 1;
}

.trophy {
  font-size: 1.2rem;
}

.rank-number {
  font-weight: bold;
  color: gold;
  font-size: 1.1rem;
}

.country-flag-mini {
  width: 20px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.country-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.clicks-count {
  font-weight: bold;
  color: var(--secondary-color);
  font-size: 1rem;
  white-space: nowrap;
}

/* My Country Stats en Dashboard Mini */
.my-country-stats {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.my-mini-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 235, 59, 0.2);
  padding: 8px 15px;
  border-radius: 25px;
  border: 1px solid rgba(255, 235, 59, 0.5);
  white-space: nowrap;
}

.my-clicks-count {
  font-weight: bold;
  color: var(--secondary-color);
  font-size: 1.1rem;
  min-width: 50px;
  text-align: center;
}

/* Dashboard Expandido */
.dashboard-expanded {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 600px;
  background: var(--card-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 25px;
  box-shadow: 0 -10px 50px rgba(0,0,0,0.4);
  z-index: 1000;
  max-height: 70vh;
  overflow-y: auto;
}

.dashboard-expanded .dashboard-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.dashboard-expanded h2 {
  text-align: center;
  font-size: 1.5rem;
  color: var(--secondary-color);
  margin: 0;
  flex: 1;
}

/* Leaderboard Full */
.leaderboard-full {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.leaderboard-header-full {
  display: grid;
  grid-template-columns: 60px 1fr 100px;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

.rank-header {
  text-align: center;
}

.country-header {
  text-align: left;
  padding-left: 15px;
}

.clicks-header {
  text-align: right;
  padding-right: 10px;
}

.leaderboard-body-full {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 60px 1fr 100px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  align-items: center;
  transition: all 0.3s ease;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-item .rank {
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  text-align: center;
  gap: 6px;
}

/* ESTRELLAS SVG MEJORADAS PARA MEDALLAS */
.medal-icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.medal-gold {
  color: #FFD700; /* Oro brillante */
}

.medal-silver {
  color: #C0C0C0; /* Plata */
}

.medal-bronze {
  color: #CD7F32; /* Bronce */
}

.medal-other {
  color: rgba(255, 255, 255, 0.6);
}

/* Efectos de brillo para las estrellas top */
.leaderboard-item:nth-child(1) .medal-icon {
  animation: goldGlow 2s ease-in-out infinite alternate;
}

.leaderboard-item:nth-child(2) .medal-icon {
  animation: silverGlow 2.2s ease-in-out infinite alternate;
}

.leaderboard-item:nth-child(3) .medal-icon {
  animation: bronzeGlow 2.4s ease-in-out infinite alternate;
}

@keyframes goldGlow {
  0% {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) brightness(1);
    transform: scale(1);
  }
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8)) brightness(1.2);
    transform: scale(1.05);
  }
}

@keyframes silverGlow {
  0% {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) brightness(1);
  }
  100% {
    filter: drop-shadow(0 0 6px rgba(192, 192, 192, 0.6)) brightness(1.1);
  }
}

@keyframes bronzeGlow {
  0% {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) brightness(1);
  }
  100% {
    filter: drop-shadow(0 0 5px rgba(205, 127, 50, 0.5)) brightness(1.1);
  }
}

/* MEDALLAS MEJORADAS CON ESTRELLAS */
.leaderboard-item:nth-child(1) .rank {
  color: #FFD700;
  font-size: 1.3em;
  font-weight: 800;
}

.leaderboard-item:nth-child(2) .rank {
  color: #C0C0C0;
  font-size: 1.2em;
  font-weight: 800;
}

.leaderboard-item:nth-child(3) .rank {
  color: #CD7F32;
  font-size: 1.2em;
  font-weight: 800;
}

.leaderboard-item .country {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.country-flag {
  width: 28px;
  height: 21px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.leaderboard-item .clicks {
  font-weight: bold;
  color: var(--secondary-color);
  text-align: right;
  padding-right: 10px;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

/* ANIMACIONES PARA NÚMEROS */
.my-clicks-count.animating,
.clicks-count.animating,
.leaderboard-item .clicks.animating {
  animation: numberPulse 0.6s ease-in-out;
}

@keyframes numberPulse {
  0% {
    transform: scale(1);
    color: var(--secondary-color);
  }
  50% {
    transform: scale(1.15);
    color: #ffd54f;
    text-shadow: 0 0 8px rgba(255, 213, 79, 0.4);
  }
  100% {
    transform: scale(1);
    color: var(--secondary-color);
  }
}

/* Scrollbar */
.leaderboard-body-full::-webkit-scrollbar {
  width: 6px;
}

.leaderboard-body-full::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.leaderboard-body-full::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.leaderboard-body-full::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* RESPONSIVE - MÓVIL */
@media (max-width: 768px) {
  .logo {
    max-width: 250px;
  }
  
  /* POSICIÓN MEJORADA DEL BOTÓN ABOUT EN MÓVIL */
  .about-btn {
    position: fixed;
    top: auto;
    bottom: 80px;
    right: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    z-index: 999;
  }
  
  .cat-images {
    width: 400px;
    height: 400px;
  }
  
  .floating-counter {
    font-size: 3.5rem;
    top: -30px;
  }
  
  /* POSICIÓN MÁS BAJA DEL GATO EN MÓVIL */
  .cat-container {
    margin: 80px 0 30px 0;
  }
  
  main {
    margin-bottom: 10px;
    justify-content: flex-start;
    min-height: 50vh;
    padding-top: 10px;
  }
  
  .dashboard-minimized,
  .dashboard-expanded {
    width: 95%;
    max-width: 95%;
  }
  
  .dashboard-minimized .dashboard-content {
    flex-direction: row;
    gap: 10px;
  }
  
  .leaderboard-mini,
  .my-country-stats {
    width: auto;
    justify-content: center;
    flex: 1;
  }
  
  .top-country {
    padding: 6px 10px;
    gap: 5px;
  }
  
  .country-name {
    font-size: 0.75rem;
    max-width: 60px;
  }
  
  .clicks-count {
    font-size: 0.9rem;
  }
  
  .my-mini-stats {
    padding: 6px 10px;
    gap: 6px;
  }
  
  .my-clicks-count {
    font-size: 0.9rem;
    min-width: 40px;
  }
  
  .trophy {
    font-size: 1rem;
  }
  
  .rank-number {
    font-size: 0.9rem;
  }
  
  .country-flag-mini {
    width: 16px;
    height: 12px;
  }
  
  .leaderboard-header-full,
  .leaderboard-item {
    grid-template-columns: 50px 1fr 80px;
    padding: 10px 15px;
    font-size: 0.9rem;
  }
  
  .medal-icon {
    width: 18px !important;
    height: 18px !important;
  }
  
  /* Responsive para el modal */
  .modal-content {
    padding: 20px;
    width: 95%;
  }
  
  .modal-header h2 {
    font-size: 1.5rem;
  }
  
  .modal-body p {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 5px;
  }
  
  header {
    padding: 5px 0;
    margin-bottom: 5px;
  }
  
  .logo {
    max-width: 200px;
  }
  
  /* POSICIÓN MEJORADA DEL BOTÓN ABOUT EN MÓVILES PEQUEÑOS */
  .about-btn {
    bottom: 70px;
    right: 15px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .cat-images {
    width: 320px;
    height: 320px;
  }
  
  .floating-counter {
    font-size: 2.8rem;
    top: -20px;
  }
  
  /* POSICIÓN MÁS BAJA EN MÓVILES PEQUEÑOS */
  .cat-container {
    margin: 70px 0 20px 0;
  }
  
  main {
    margin-bottom: 5px;
    padding-top: 5px;
    min-height: 45vh;
  }
  
  .dashboard-minimized,
  .dashboard-expanded {
    width: 98%;
    max-width: 98%;
    padding: 10px 12px;
  }
  
  .dashboard-minimized .dashboard-content {
    gap: 8px;
  }
  
  .top-country {
    padding: 5px 8px;
  }
  
  .country-name {
    font-size: 0.7rem;
    max-width: 50px;
  }
  
  .my-mini-stats {
    padding: 5px 8px;
  }
  
  .leaderboard-header-full,
  .leaderboard-item {
    grid-template-columns: 40px 1fr 70px;
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  
  .country-flag {
    width: 24px;
    height: 18px;
  }
  
  .medal-icon {
    width: 16px !important;
    height: 16px !important;
  }
  
  /* Responsive para el modal */
  .modal-content {
    padding: 15px;
  }
  
  .modal-header h2 {
    font-size: 1.3rem;
  }
  
  .modal-body p {
    font-size: 0.85rem;
  }
  
  .feature-item {
    padding: 8px 10px;
    font-size: 0.9rem;
  }
  
  .feature-icon {
    font-size: 1.2rem;
  }
}

/* Fallback para medallas si los emojis no se muestran */
@supports not (content: "🥇") {
  .leaderboard-item:nth-child(1) .rank::before {
    content: "1st";
    color: #FFD700;
  }
  .leaderboard-item:nth-child(2) .rank::before {
    content: "2nd";
    color: #C0C0C0;
  }
  .leaderboard-item:nth-child(3) .rank::before {
    content: "3rd";
    color: #CD7F32;
  }
}
