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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  min-height: 100vh;
  color: #ffffff;
}

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

/* Sticker overlay */
.sticker-overlay {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 1000;
  pointer-events: none;
}

.sticker-overlay img {
  width: 120px;
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  animation: floatAnimation 4s ease-in-out infinite;
}

@keyframes floatAnimation {
  0%, 100% { transform: translateY(0px) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(-3deg); }
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  margin-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-image {
  width: 180px;
  height: auto;
  object-fit: contain;
}

.subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wallet-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.wallet-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wallet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.wallet-btn.connected {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.disconnect-btn {
  background: transparent;
  color: #ff6b6b;
  border: 1px solid #ff6b6b;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.disconnect-btn:hover {
  background: rgba(255, 107, 107, 0.1);
  transform: translateY(-2px);
}

/* Main content */
main {
  flex: 1;
}

.section {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 48px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: visible;
}

.hidden {
  display: none;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 80px 0;
}

.hero h2 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 40px;
  font-weight: 500;
}

.cta-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(255, 107, 107, 0.3);
}

/* Alert */
.alert {
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.alert-warning {
  background: rgba(255, 107, 107, 0.1);
  border-left: 4px solid #ff6b6b;
}

.alert h3 {
  margin-bottom: 12px;
  color: #ff6b6b;
  font-weight: 700;
}

.alert p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  font-weight: 500;
}

/* Referral info */
.referral-info {
  margin-bottom: 48px;
}

.referral-info h3 {
  margin-bottom: 24px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.25rem;
}

.referral-link-container {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.referral-link {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-family: 'Monaco', 'Courier New', monospace;
}

.copy-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.load-stats-btn {
  margin-top: 30px;
  padding: 16px 36px;
  font-size: 1rem;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.load-stats-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.referral-details {
  display: flex;
  gap: 48px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.label {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.125rem;
}

/* Stats */
.stats-container h3 {
  margin-bottom: 24px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.25rem;
}

.commission-info {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 30px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.commission-info .label {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.commission-info .value {
  color: #4ade80;
  font-weight: 700;
  font-size: 1.2rem;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stat-card {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* Box types grid */
.box-stats h4 {
  margin-bottom: 24px;
  color: #ffffff;
  font-weight: 600;
  font-size: 1.125rem;
}

/* Commission breakdown */
.commission-breakdown {
  margin-top: 40px;
}

.commission-breakdown h4 {
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.commission-list {
  display: grid;
  gap: 16px;
}

.commission-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.commission-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 107, 107, 0.3);
}

.commission-coin {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coin-name {
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
}

.coin-symbol {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
}

.calculation-formula {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  font-family: 'Monaco', 'Courier New', monospace;
  margin-top: 4px;
}

.commission-amounts {
  text-align: right;
}

.token-amount {
  color: #4ade80;
  font-weight: 600;
  font-size: 1.1rem;
}

.usd-amount {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Loading indicator animation */
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.usd-amount:has-text('⏳'),
#totalEarnings:has-text('⏳') {
  animation: pulse 1.5s ease-in-out infinite;
}

.box-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.box-type-card {
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

.box-type-card:hover {
  transform: translateY(-4px) rotate(3deg);
}

.box-type-card:hover .box-type-image {
  transform: scale(1.1);
}

/* Sticker overlay on mousedown - stamped on the box */
.box-type-card .click-sticker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  width: 120px;
  height: 120px;
  background: url('BF_sticker-03.png') no-repeat center;
  background-size: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 10;
}

.box-type-card:active .click-sticker {
  opacity: 0.9;
  transform: translate(-50%, -50%) rotate(-15deg) scale(1.1);
}

.box-type-image {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
}

.box-type-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

.box-type-count {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Signing message */
.signing-message {
  background: rgba(255, 107, 107, 0.1);
  border: 2px solid #ff6b6b;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: center;
  animation: pulse 2s infinite;
}

.signing-message span {
  color: #ff6b6b;
  font-weight: 600;
  font-size: 0.95rem;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Loading */
.loader {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid #ff6b6b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#loading {
  text-align: center;
  padding: 60px;
}

#loading p {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 0 20px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  font-weight: 500;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 60px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .wallet-container {
    width: 100%;
    justify-content: center;
  }
  
  .section {
    padding: 30px 20px;
    border-radius: 16px;
  }
  
  .hero h2 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .stats-summary {
    grid-template-columns: 1fr;
  }
  
  .referral-details {
    flex-direction: column;
    gap: 20px;
  }
  
  .referral-link-container {
    flex-direction: column;
  }
  
  .copy-btn {
    width: 100%;
  }
  
  .box-types-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  .sticker-overlay {
    top: -5px;
    right: -5px;
  }
  
  .sticker-overlay img {
    width: 80px;
  }
}