/* Base reset */
* { box-sizing:border-box; margin:0; padding:0; }
body {
 background:#000;
 color:#fff;
 font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
 font-size:18px;
 min-height:100vh;
 display:flex;
 align-items:center;
 justify-content:center;
 padding-bottom: 30px;
}
.container {
 width:100%;
 max-width:520px;
 padding:1.5rem;
}

/* X (Twitter) link in top right corner */
.x-link {
 z-index: 1000;
}

.x-link a {
 display: block;
 padding: 12px;
 background: rgba(255, 255, 255, 0.1);
 backdrop-filter: blur(10px);
 border: 1px solid rgba(255, 255, 255, 0.2);
 border-radius: 50%;
 color: #fff;
 text-decoration: none;
 transition: all 0.3s ease;
 width: 48px;
 height: 48px;
 display: flex;
 align-items: center;
 justify-content: center;
}

.x-link a:hover {
 background: rgba(255, 255, 255, 0.2);
 border-color: rgba(255, 255, 255, 0.4);
 transform: scale(1.1);
 box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.x-link svg {
 width: 20px;
 height: 20px;
 transition: transform 0.3s ease;
}

.x-link a:hover svg {
 transform: rotate(5deg);
}

/* Decorative elements on sides */
.decoration-left,
.decoration-right {
 position: fixed;
 top: 50%;
 transform: translateY(-50%);
 z-index: -1;
 opacity: 1;
 pointer-events: none;
}

.decoration-left {
 left: 80px;
}

.decoration-right {
 right: 80px;
}

.decoration-left img,
.decoration-right img {
  width: 160px;
  height: auto;
  border-radius: 8px;
}

/* Hide on mobile */
@media (max-width: 768px) {
 .decoration-left,
 .decoration-right {
   display: none;
 }
}

/* Increase size for very wide screens */
@media (min-width: 1400px) {
 .decoration-left img,
 .decoration-right img {
   width: 200px;
 }

 .decoration-left {
   left: 120px;
 }

 .decoration-right {
   right: 120px;
 }
}

/* Typography */
.title {
 text-align:center;
 font-size:2.25rem;
 margin-bottom:0.75rem;
}
.subtitle {
 text-align:center;
 margin-bottom:1.25rem;
 opacity:0.8;
 font-size:1.1rem;
}

/* Form */
.form-row {
 display: flex;
 gap: 0.75rem;
 margin-bottom: 1.5rem;
 width: 100%;
}
.wallet-input {
 flex: 1;
 min-width: 0;
 padding: 0.8rem;
 border: 1px solid #555;
 border-radius: 4px;
 background: #111;
 color: #fff;
 font-family: monospace;
 font-size: 0.98rem;
 transition: border-color .2s, background .2s;
}
.wallet-input:focus {
 outline: none;
 border-color: #fff;
 background: #222;
}
button.btn {
 flex: 0 0 auto;
 padding: 0.8rem 1rem;
 background: #fff;
 color: #111;
 border: none;
 border-radius: 4px;
 cursor: pointer;
 position: relative;
 overflow: hidden;
}
button.btn:disabled {
 opacity: 0.5;
 cursor: default;
}

/* Centered leaderboard button */
#showLeaderboardBtn {
 display: block;
 margin: 2rem auto 0 auto;
}

#showLeaderboardBtn:disabled,
#searchLbBtn:disabled,
#prevLb:disabled,
#nextLb:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Ripple effect */
.ripple {
 position: absolute;
 border-radius: 50%;
 background: rgba(0,0,0,0.2);
 transform: scale(0);
 animation: ripple 400ms linear;
}
@keyframes ripple {
 to { transform: scale(4); opacity: 0; }
}

/* Cards */
.card {
 background: #111;
 border: 1px solid #333;
 padding: 1.5rem;
 border-radius: 4px;
 margin-top: 1rem;
 opacity: 0;
 transform: translateY(12px);
 animation-fill-mode: forwards;
}
.loading-card {
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 height: 4rem;
 background: transparent;
 border: none;
 opacity: 1;
 transform: none;
}
.error-card {
 border-color: #e74c3c;
 color: #e74c3c;
 opacity: 1;
 transform: none;
}

/* Leaderboard section centering */
#leaderboardSection {
 text-align: center;
}

/* Leaderboard table centering */
#leaderboardTable {
 margin: 0 auto 1rem auto;
 border-collapse: collapse;
 width: 200%;
 max-width: 1100px;
 position: relative;
 left: 50%;
 transform: translateX(-50%);
 table-layout: auto;
 border: 1px solid #333;
 border-radius: 8px;
 overflow: hidden;
}

#leaderboardTable th,
#leaderboardTable td {
 padding: 0.75rem 2rem;
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
 border-bottom: 1px solid #333;
 text-align: center;
}

#leaderboardTable th {
 font-size: 1rem;
 font-weight: bold;
 background: #222;
 border-bottom: 2px solid #444;
}

#leaderboardTable tbody tr {
 background: #111;
 opacity: 0;
 transform: translateY(10px);
 animation: fadeInRow 0.3s ease-out forwards;
}

#leaderboardTable tbody tr:nth-child(even) {
 background: #181818;
}

#leaderboardTable tbody tr:hover {
 background: #333 !important;
 transition: background-color 0.2s ease;
}

/* Leaderboard table cell styles - CENTERED (removed specific text-align overrides) */
.wallet-cell {
 font-family: monospace;
 font-size: 0.9rem;
 min-width: 200px;
 position: relative;
}

.season1-points,
.season2-points,
.total-points,
.staking-points,
.rank-cell {
 min-width: 90px;
}

.tier-cell {
 min-width: 120px;
}

/* Copy icon styling */
.copy-icon {
 opacity: 0.3;
 cursor: pointer;
 margin-left: 0.5rem;
 font-size: 0.9rem;
 transition: opacity 0.2s ease, transform 0.2s ease;
 display: inline-block;
 user-select: none;
}

.copy-icon:hover {
 opacity: 1;
 transform: scale(1.1);
}

@keyframes fadeInRow {
 to {
   opacity: 1;
   transform: translateY(0);
 }
}

/* Staggered animation delays for rows */
#leaderboardTable tbody tr:nth-child(1) { animation-delay: 0.1s; }
#leaderboardTable tbody tr:nth-child(2) { animation-delay: 0.15s; }
#leaderboardTable tbody tr:nth-child(3) { animation-delay: 0.2s; }
#leaderboardTable tbody tr:nth-child(4) { animation-delay: 0.25s; }
#leaderboardTable tbody tr:nth-child(5) { animation-delay: 0.3s; }
#leaderboardTable tbody tr:nth-child(6) { animation-delay: 0.35s; }
#leaderboardTable tbody tr:nth-child(7) { animation-delay: 0.4s; }
#leaderboardTable tbody tr:nth-child(8) { animation-delay: 0.45s; }
#leaderboardTable tbody tr:nth-child(9) { animation-delay: 0.5s; }
#leaderboardTable tbody tr:nth-child(10) { animation-delay: 0.55s; }

/* Leaderboard pagination centering */
#leaderboardSection > div:last-child {
 text-align: center;
}

/* Footer disclaimer */
.disclaimer {
 position: fixed;
 bottom: 0;
 left: 0;
 right: 0;
 background: rgba(0, 0, 0, 0.9);
 backdrop-filter: blur(10px);
 border-top: 1px solid rgba(255, 193, 7, 0.3);
 color: #ffc107;
 padding: 0.5rem 1rem;
 text-align: center;
 font-size: 0.85rem;
 z-index: 999;
 opacity: 0.9;
}

@media (max-width: 768px) {
 .disclaimer {
   font-size: 0.75rem;
   padding: 0.6rem 0.8rem;
 }
}

/* Fade-in animation */
@keyframes fadeInUp {
 to { opacity: 1; transform: none; }
}
.fade-in {
 animation: fadeInUp .5s ease-out forwards;
}
.delay-1 { animation-delay: .15s; }
.delay-2 { animation-delay: .3s; }

/* Loading text */
.loading-text {
 color: #fff;
 font-size: 1.2rem;
 opacity: 0.9;
 font-weight: bold;
}

/* Copy notification */
.copy-notification {
 position: fixed;
 top: 20px;
 left: 50%;
 transform: translateX(-50%);
 background: rgba(0, 255, 0, 0.9);
 color: #000;
 padding: 0.5rem 1rem;
 border-radius: 4px;
 font-size: 0.9rem;
 font-weight: bold;
 z-index: 1001;
 opacity: 0;
 transition: opacity 0.3s ease;
}

.last-updated {
 text-align: right;
 font-size: 0.9rem;
 opacity: 0.7;
 margin-top: 0.75rem;
}

.x-top-right {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
}

.subscribe-text {
  color: #fff;
  font-size: 1rem;
  white-space: nowrap;
  opacity: 0.95;
}

/* Loading animation for cells */
.loading-cell {
  background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 20px;
  width: 80%;
  margin: 0 auto;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Styles for loading cells */
.loading-staking-points {
  position: relative;
  overflow: hidden;
}

.loading-staking-points::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 16px;
  background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px;
}

.loading-tier {
  position: relative;
  overflow: hidden;
}

.loading-tier::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 16px;
  background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px;
}

/* Animation for loaded data appearance */
.fly-data-loaded {
  animation: fadeInData 0.3s ease-out;
}

@keyframes fadeInData {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Last updated row with mini actions */
.last-updated-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.mini-actions {
  display: flex;
  gap: 0.5rem;
}

.mini-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  opacity: 0.6;
  color: #fff;
}

.mini-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.mini-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* Image modal styles */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-modal.show {
  opacity: 1;
}

.modal-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.generated-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border: 2px solid #333;
}

.copy-image-btn {
  background: #fff;
  color: #111;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-image-btn:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.copy-image-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Mobile responsive for last updated row */
@media (max-width: 768px) {
  .last-updated-row {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .mini-actions {
    align-self: flex-end;
  }

  .modal-content {
    max-width: 95vw;
  }

  .generated-image {
    max-height: 75vh;
  }
}

/* Buttons row for side-by-side buttons */
.buttons-row {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Make buttons in row consistent */
.buttons-row .btn {
  flex: 0 0 auto;
  min-width: 140px;
}

/* Remove the old centered leaderboard button styles and replace with: */
#showLeaderboardBtn,
#showStatsBtn {
  display: inline-block;
  margin: 0;
}

#showLeaderboardBtn:disabled,
#showStatsBtn:disabled,
#searchLbBtn:disabled,
#prevLb:disabled,
#nextLb:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Statistics section styling to match results */
#statsSection {
  margin-top: 1.5rem;
}

#statsSection .card {
  margin-bottom: 0;
  margin-top: 1rem;
}

/* Mobile responsive for buttons row */
@media (max-width: 768px) {
  .buttons-row {
    flex-direction: column;
    align-items: center;
  }

  .buttons-row .btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 768px) {
  .x-top-right {
    display: none;
  }
}

/* Complete mobile table fix - replaces existing mobile styles */
@media (max-width: 768px) {
  /* Container for horizontal scroll */
  .table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #333;
  }

  /* Reset table width and layout */
  #leaderboardTable {
    width: auto !important;
    min-width: 790px !important; /* Sum of all column widths */
    position: static !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    border: none !important;
    font-size: 0.85rem !important;
    overflow-x: visible !important;
    display: table !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }

  #leaderboardTable thead,
  #leaderboardTable tbody,
  #leaderboardTable tr {
    display: table-row !important;
    width: auto !important;
    table-layout: auto !important;
  }

  /* Adjust all cell padding */
  #leaderboardTable th,
  #leaderboardTable td {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* Fix header corner radius */
  #leaderboardTable th:first-child {
    border-top-left-radius: 8px !important;
  }

  #leaderboardTable th:last-child {
    border-top-right-radius: 8px !important;
  }

  /* Row backgrounds - alternating stripes */
  #leaderboardTable tbody tr {
    background: #111 !important;
  }

  #leaderboardTable tbody tr:nth-child(even) {
    background: #181818 !important;
  }

  #leaderboardTable tbody tr:hover {
    background: #333 !important;
  }

  /* Column widths using your preferred sizes */
  #leaderboardTable th:nth-child(1),
  #leaderboardTable td:nth-child(1) {
    min-width: 140px !important; /* Wallet column */
  }

  #leaderboardTable th:nth-child(1) {
    background: #222 !important;
  }

  #leaderboardTable tbody tr td:nth-child(1) {
    background: inherit !important; /* Inherit row background */
  }

  /* Points columns */
  #leaderboardTable th:nth-child(2),
  #leaderboardTable td:nth-child(2),
  #leaderboardTable th:nth-child(3),
  #leaderboardTable td:nth-child(3),
  #leaderboardTable th:nth-child(4),
  #leaderboardTable td:nth-child(4) {
    min-width: 100px !important;
  }

  /* Staking points column */
  #leaderboardTable th:nth-child(5),
  #leaderboardTable td:nth-child(5) {
    min-width: 140px !important;
  }

  /* Tier column */
  #leaderboardTable th:nth-child(6),
  #leaderboardTable td:nth-child(6) {
    min-width: 140px !important;
  }

  /* Rank column */
  #leaderboardTable th:nth-child(7),
  #leaderboardTable td:nth-child(7) {
    min-width: 70px !important;
  }

  /* Ensure copy icon is visible */
  .copy-icon {
    opacity: 0.6 !important;
    margin-left: 0.3rem !important;
    font-size: 0.8rem !important;
  }
}