:root{
  --bg:#0b0f19; /* deep indigo/blue */
  --panel:#0f1524; /* card background */
  --text:#e6ecff; /* soft white */
  --muted:#9aa7c7; /* muted text */
  --railway:#7c3aed; /* railway-ish accent (purple) */
  --railway-2:#22d3ee; /* cyan accent */
  --border:#1b2440;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:linear-gradient(180deg, #0b0f19 0%, #0b0f19 60%, #0a0d16 100%);
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.container{max-width:1000px; margin:0 auto; padding:24px;}

.nav{position:sticky; top:0; z-index:10; background:rgba(11,15,25,0.75); backdrop-filter: blur(8px); border-bottom:1px solid var(--border);} 
.nav__inner{display:flex; align-items:center; justify-content:space-between;}
.brand{display:flex; align-items:center; gap:10px; font-weight:700; letter-spacing: .3px}
.brand__name{background: linear-gradient(90deg, var(--railway), var(--railway-2)); -webkit-background-clip:text; background-clip:text; color:transparent; font-size: 18px;}
.dot{width:10px; height:10px; border-radius:50%; background:radial-gradient(circle at 30% 30%, var(--railway-2), var(--railway)); box-shadow:0 0 10px var(--railway);} 
.nav__links a{color:var(--text); text-decoration:none; margin-left:18px; opacity:.9}
.nav__links a:hover{opacity:1; color:var(--railway-2)}
.nav__links{display:flex; align-items:center; gap:12px}
.auth-box{display:flex; align-items:center; gap:10px; margin-left:12px}
.btn{display:inline-block; padding:6px 10px; border:1px solid var(--border); border-radius:999px; text-decoration:none; color:var(--text); background:rgba(34,211,238,0.08)}
.btn:hover{background:rgba(34,211,238,0.15)}
.btn-login{border-color: var(--railway-2)}
.btn-logout{opacity:.85}
.avatar{width:22px; height:22px; border-radius:50%; border:1px solid var(--border); object-fit:cover}
.user-name{font-weight:600}

.card{background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:18px 18px 8px; margin-top:18px; box-shadow: 0 10px 30px rgba(10,13,22,0.6); position: relative; overflow: hidden;}
.card::before{content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%; background: radial-gradient(circle at 20% 80%, rgba(124,58,237,0.05) 0%, transparent 50%); pointer-events:none;}
.title{margin:0 0 10px 0; font-size:20px}
.muted{color:var(--muted)}

.chips{margin-top:10px}
.chip{display:inline-block; padding:4px 10px; border:1px solid var(--border); border-radius:999px; margin:0 8px 8px 0; background:rgba(124,58,237,0.12)}

.grid{display:grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap:10px}
.cmd{border:1px solid var(--border); border-radius:10px; padding:8px 10px; background:rgba(34,211,238,0.08); color:#dff8ff; cursor:pointer; transition:all 0.2s ease}
.cmd:hover{background:rgba(34,211,238,0.15); transform:translateY(-2px); box-shadow:0 4px 12px rgba(34,211,238,0.2)}

.footer{padding-top:8px; padding-bottom:24px; color:var(--muted)}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot.online {
  background-color: #28a745;
  box-shadow: 0 0 6px rgba(40, 167, 69, 0.6);
}

.status-dot.offline {
  background-color: #dc3545;
  box-shadow: 0 0 6px rgba(220, 53, 69, 0.6);
}

.status-dot.loading {
  background-color: #ffc107;
  box-shadow: 0 0 6px rgba(255, 193, 7, 0.6);
}

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

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

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

.modal-body {
  color: var(--text);
  line-height: 1.6;
}

.modal-body p {
  margin: 0 0 12px 0;
}

.modal-body code {
  background: rgba(34, 211, 238, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  color: var(--railway-2);
}

/* Leaderboard */
.lb-grid { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 16px;
  grid-auto-rows: minmax(0, 1fr);
}
.lb-grid > div {
  min-width: 0; /* Prevent grid blowout */
  overflow: hidden;
}
.lb-list { 
  margin: 8px 0 0; 
  padding-left: 16px;
  overflow-x: auto; /* Allow horizontal scroll if needed */
}
.lb-list li { 
  display: flex; 
  justify-content: space-between; 
  padding: 4px 0; 
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  min-width: 0; /* Prevent overflow */
}
.lb-list li .rank { 
  opacity: 0.8; 
  margin-right: 8px;
  flex-shrink: 0;
}
.lb-list li .nick { 
  flex: 1; 
  margin-left: 8px; 
  color: var(--text); 
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-list a.nick { text-decoration: none; color: var(--text); }
.lb-list a.nick:visited { color: var(--text); }
.lb-list a.nick:hover { color: var(--railway-2); }
.lb-list li .metric { 
  font-variant-numeric: tabular-nums; 
  margin-left: 8px;
  flex-shrink: 0;
}
@media (max-width: 768px) { 
  .lb-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px;
  } 
}
@media (max-width: 480px) { 
  .lb-grid { 
    grid-template-columns: 1fr;
    gap: 12px;
  } 
}

/* Limes claim animations */
.limes-box { 
  position: relative; 
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Claim button styles */
.claim-limes-btn {
  position: relative;
  padding: 6px 16px;
  background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
  border: none;
  border-radius: 50px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(132, 204, 22, 0.3);
  overflow: hidden;
}

.claim-limes-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.claim-limes-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(132, 204, 22, 0.4);
}

.claim-limes-btn:hover::before {
  width: 300px;
  height: 300px;
}

.claim-limes-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.claim-limes-btn.claiming {
  animation: buttonVanish 0.8s ease-out forwards;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

@keyframes buttonVanish {
  0% { 
    transform: scale(1) rotate(0deg); 
    opacity: 1;
    filter: blur(0px);
  }
  50% { 
    transform: scale(0.8) rotate(180deg); 
    opacity: 0.8;
    filter: blur(1px);
  }
  100% { 
    transform: scale(0) rotate(360deg); 
    opacity: 0;
    filter: blur(8px);
  }
}

/* Lime icon in button */
.claim-limes-btn .lime-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 16px;
}

/* Balance display enhancement */
.limes-balance-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(132, 204, 22, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(132, 204, 22, 0.3);
  font-size: 15px;
}

.limes-balance-container strong {
  color: #84cc16;
}

/* Lime burst animation */
.lime-burst {
  position: absolute;
  width: 32px;
  height: 32px;
  font-size: 24px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
}

.lime-burst.animate {
  animation: limeBurst 1.2s ease-out forwards;
}

@keyframes limeBurst {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
    opacity: 1;
  }
  60% {
    transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 0px))) scale(0.8) rotate(360deg);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--x, 0px)), calc(-150% + var(--y, 0px))) scale(0.4) rotate(720deg);
    opacity: 0;
  }
}

/* Balance animation */
.balance-glow {
  animation: balanceGlow 0.8s ease-out;
}

@keyframes balanceGlow {
  0% { text-shadow: 0 0 0 transparent; transform: scale(1); }
  50% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8); transform: scale(1.15); }
  100% { text-shadow: 0 0 0 transparent; transform: scale(1); }
}

/* Number counting animation */
#limesBalance {
  display: inline-block;
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  transition: transform 0.3s ease;
}

#limesBalance.counting {
  animation: countPulse 0.15s ease-out;
}

@keyframes countPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Awarded amount popup */
.award-popup {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  padding: 4px 12px;
  border-radius: 16px;
  font-weight: bold;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  animation: awardPop 1.5s ease-out forwards;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

@keyframes awardPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.1);
  }
  40% {
    transform: translateX(-50%) translateY(-15px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px) scale(0.8);
  }
}

/* Upgrades page */
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.upgrade-card {
  background: rgba(15, 21, 36, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.upgrade-card:hover {
  border-color: var(--railway-2);
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.1);
}

.upgrade-card.can-afford {
  border-color: rgba(34, 211, 238, 0.3);
}

.upgrade-card.upgrade-success {
  animation: upgradeSuccess 1s ease;
}

@keyframes upgradeSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); background: rgba(34, 211, 238, 0.1); }
  100% { transform: scale(1); }
}

.upgrade-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.upgrade-icon {
  font-size: 24px;
}

.upgrade-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.upgrade-value {
  font-size: 18px;
  font-weight: bold;
  color: var(--railway-2);
}

.upgrade-desc {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}

.upgrade-level {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
}

.level-label {
  color: var(--muted);
}

.level-bar {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--railway-2);
}

.upgrade-btn {
  width: 100%;
  padding: 10px 20px;
  border: 1px solid var(--railway-2);
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-btn:hover:not(:disabled) {
  background: rgba(34, 211, 238, 0.2);
  transform: translateY(-1px);
}

.upgrade-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
  background: transparent;
}

.upgrade-buy-btn {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--railway-2);
}

.upgrade-buy-btn:hover {
  background: rgba(34, 211, 238, 0.25);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

/* Profile page */
.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.profile-header img { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--railway); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.stat { text-align: center; padding: 16px; background: rgba(124,58,237,0.08); border-radius: 12px; border: 1px solid var(--border); }
.stat .label { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-size: 24px; font-weight: 700; }
.profile-upgrades { margin-top: 24px; }
.profile-upgrades .subtitle { margin: 0 0 12px; font-size: 18px; }
.upgrade-chips { display: flex; flex-wrap: wrap; gap: 8px; }

