/* ============================================================
   habitrpg/style.css  –  HabitRPG Global Styles
   Theme: Dark purple fantasy RPG aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── CSS Variables ── */
:root {
  --purple: #6F42C1;
  --purple-dark: #4A2880;
  --purple-light: #9B6EE8;
  --gold: #FFD700;
  --gold-dark: #D4A017;
  --green: #4CAF50;
  --red: #F44336;
  --blue: #2196F3;
  --pink: #E91E8C;
  --bg: #1A0A2E;
  --bg2: #2D1B4E;
  --bg3: #3D2460;
  --text: #F0E6FF;
  --text-dim: #A89BC2;
  --card: rgba(255,255,255,0.07);
  --card-border: rgba(255,255,255,0.12);
  --pixel: 'Press Start 2P', monospace;
  --body: 'Nunito', sans-serif;
}

/* ── Reset & Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Buttons ── */
.btn {
  font-family: var(--body);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.btn-danger {
  background: linear-gradient(135deg, var(--red), #C0392B);
  color: white;
}

.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(244,67,54,0.4); }

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover { color: var(--text); border-color: var(--purple-light); }

/* ── Containers ── */
.container {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  margin: 20px auto;
}

/* ── Titles ── */
.title {
    font-family: var(--pixel);
    font-size: 14px;
    color: #ff0000;
    margin-bottom: 20px;
}

/* ── Messages ── */
.message {
  margin-bottom: 20px;
  line-height: 1.6;
}

.error { color: var(--red); }
.success { color: var(--green); }

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.logo-icon {
  font-size: 32px;
  margin-right: 10px;
}

.logo-text {
  font-family: var(--pixel);
  font-size: 18px;
  color: var(--gold);
}

/* ── OTP Overrides (for OTP pages) ── */
:root {
  --otp-primary: var(--purple);
  --otp-primary-dark: var(--purple-dark);
  --otp-accent: var(--purple-light);
  --otp-bg: var(--bg);
  --otp-card-bg: var(--card);
  --otp-text: var(--text);
  --otp-muted: var(--text-dim);
  --otp-border: var(--card-border);
  --otp-error: var(--red);
  --otp-success: var(--green);
  --otp-warn: var(--gold);
  --otp-radius: 16px;
  --otp-shadow: 0 8px 40px rgba(111,66,193,0.10);
}

/* Background decorations */
body.otp-page::before {
  background: radial-gradient(circle, rgba(111,66,193,0.08) 0%, transparent 70%) !important;
}

body.otp-page::after {
  background: radial-gradient(circle, rgba(155,110,232,0.10) 0%, transparent 70%) !important;
}

/* Loading overlay */
.otp-loading-overlay {
  background: rgba(26,10,46,0.95) !important;
}

body.otp-page {
  font-family: var(--body);
}

.portal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon {
  font-size: 24px;
  margin-right: 8px;
}

.otp-brand .portal-name {
  font-family: var(--pixel);
  color: var(--gold);
}

.otp-card {
  max-width: 440px;
  padding: 32px;
  background: var(--otp-card-bg);
  border: 1px solid var(--otp-border);
  border-radius: var(--otp-radius);
}

.otp-card-header h1 {
  margin-bottom: 10px;
}

.otp-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.otp-field input {
  width: 100%;
  padding: 14px 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: var(--otp-text);
}

.otp-field input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.4);
}

.otp-btn {
  background: linear-gradient(135deg, var(--otp-primary), var(--otp-primary-dark));
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.otp-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(111,66,193,0.4);
}/* Status badges */
.status-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-badge.new {
  background: linear-gradient(135deg, #FFD700, #D4A017);
  color: #000;
}

.status-badge.already {
  background: #6F42C1;
  color: white;
}

/* ── Leaderboard ── */
.leaderboard-container {
  padding: 20px 0;
}

.leaderboard-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
}

.header-icon {
  font-size: 48px;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.5));
}

.header-title {
  font-family: var(--pixel);
  font-size: 24px;
  font-weight: bold;
  color: var(--gold);
  margin-bottom: 5px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  min-height: 90px;
  cursor: pointer;
}

.leaderboard-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.leaderboard-item::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  opacity: 0.6;
  z-index: 1;
}

.leaderboard-item.top-1::after {
  background: linear-gradient(45deg, #FFD700, #FFF);
  box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.leaderboard-item.top-2::after {
  background: linear-gradient(45deg, #C0C0C0, #FFF);
}

.leaderboard-item.top-3::after {
  background: linear-gradient(45deg, #CD7F32, #FFF);
}

.leaderboard-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.leaderboard-item::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--purple-light), var(--gold), var(--purple));
  border-radius: 22px;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
}

.leaderboard-item:hover {
  background: var(--bg2);
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 60px rgba(111, 66, 193, 0.4);
  border-color: var(--purple-light);
}

.leaderboard-item:hover::before {
  opacity: 1;
}

.leaderboard-item:hover::after {
  opacity: 0.3;
}

.leaderboard-item.top-1 {
  background: linear-gradient(135deg, #FFD700, #D4A017, #FFD700);
  color: #000;
  border: 3px solid #FFD700;
  box-shadow: 0 12px 40px rgba(255, 215, 0, 0.5);
  animation: championGlow 3s ease-in-out infinite alternate;
  position: relative;
}

.leaderboard-item.top-1::before {
  background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,215,0,0.1), rgba(255,255,255,0.1));
}

.leaderboard-item.top-2 {
  background: linear-gradient(135deg, #C0C0C0, #A8A8A8, #C0C0C0);
  color: #000;
  border: 3px solid #C0C0C0;
  box-shadow: 0 10px 35px rgba(192, 192, 192, 0.4);
}

.leaderboard-item.top-3 {
  background: linear-gradient(135deg, #CD7F32, #A0522D, #CD7F32);
  color: #000;
  border: 3px solid #CD7F32;
  box-shadow: 0 10px 35px rgba(205, 127, 50, 0.4);
}

@keyframes championGlow {
  0% { 
    box-shadow: 0 12px 40px rgba(255, 215, 0, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.8);
    transform: scale(1.02);
  }
  100% { 
    box-shadow: 0 12px 40px rgba(255, 215, 0, 0.5);
    transform: scale(1);
  }
}

.rank {
  font-family: var(--pixel);
  font-size: 20px;
  font-weight: bold;
  margin-right: 16px;
  min-width: 50px;
  text-align: center;
  z-index: 2;
  position: relative;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel);
  font-size: 24px;
  color: var(--gold);
  margin-right: 16px;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 18px rgba(111, 66, 193, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  z-index: 2;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
}

.avatar-placeholder::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(255,215,0,0.3), transparent);
  animation: rotate 4s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.leaderboard-item:hover .avatar-placeholder::before {
  opacity: 1;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.leaderboard-item:hover .avatar-placeholder {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(111, 66, 193, 0.6);
}

.user-info {
  flex: 1;
  z-index: 2;
  position: relative;
}

.username {
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 8px;
  color: inherit;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
  letter-spacing: 0.5px;
}

.user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 18px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.stat-value {
  color: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.leaderboard-item.top-1 .username,
.leaderboard-item.top-1 .stat-value {
  color: #000 !important;
  text-shadow: 1px 1px 2px rgba(255,215,0,0.3);
}

.leaderboard-item.top-2 .username,
.leaderboard-item.top-2 .stat-value {
  color: #000 !important;
  text-shadow: 1px 1px 2px rgba(192,192,192,0.3);
}

.leaderboard-item.top-3 .username,
.leaderboard-item.top-3 .stat-value {
  color: #000 !important;
  text-shadow: 1px 1px 2px rgba(205,127,50,0.3);
}

.rank {
  font-family: var(--pixel);
  font-size: 20px;
  font-weight: bold;
  margin-right: 16px;
  min-width: 50px;
  text-align: center;
  z-index: 1;
  position: relative;
}

.avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel);
  font-size: 24px;
  color: var(--gold);
  margin-right: 16px;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
  z-index: 1;
  position: relative;
}

.user-info {
  flex: 1;
  z-index: 1;
  position: relative;
}

.username {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 8px;
  color: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.user-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.stat-icon {
  font-size: 16px;
}

.stat-value {
  color: inherit;
}

.leaderboard-item.top-1 .username,
.leaderboard-item.top-1 .stat-value {
  color: #000 !important;
}

.leaderboard-item.top-2 .username,
.leaderboard-item.top-2 .stat-value {
  color: #000 !important;
}

.leaderboard-item.top-3 .username,
.leaderboard-item.top-3 .stat-value {
  color: #000 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .leaderboard-container {
    padding: 15px 0;
  }

  .leaderboard-header {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 16px;
  }

  .header-icon {
    font-size: 40px;
  }

  .header-title {
    font-size: 18px;
  }

  .header-subtitle {
    font-size: 13px;
  }

  .leaderboard-item {
    padding: 20px 16px;
    margin-bottom: 16px;
    border-radius: 16px;
    flex-direction: column;
    text-align: center;
    min-height: auto;
  }

  .leaderboard-item:hover {
    transform: translateY(-6px) scale(1.02);
  }

  .rank {
    font-size: 22px;
    margin-right: 0;
    margin-bottom: 12px;
    min-width: 50px;
  }

  .avatar-placeholder {
    width: 55px;
    height: 55px;
    margin-right: 0;
    margin-bottom: 12px;
    border-width: 2px;
  }

  .username {
    font-size: 19px;
    margin-bottom: 16px;
  }

  .user-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
  }

  .stat-item {
    padding: 8px 6px;
    font-size: 11px;
    min-width: auto;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s ease;
  }

  .stat-icon {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .leaderboard-container {
    padding: 10px 0;
  }

  .leaderboard-header {
    padding: 12px;
    margin-bottom: 16px;
  }

  .header-icon {
    font-size: 36px;
  }

  .header-title {
    font-size: 16px;
  }

  .leaderboard-item {
    padding: 16px 12px;
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .leaderboard-item:hover {
    transform: translateY(-4px) scale(1.01);
  }

  .rank {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .avatar-placeholder {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
  }

  .username {
    font-size: 17px;
    margin-bottom: 14px;
  }

  .user-stats {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stat-item {
    padding: 10px 8px;
    font-size: 12px;
    flex-direction: row;
    justify-content: center;
    min-width: 100px;
    border-radius: 10px;
    transition: all 0.2s ease;
  }

  .stat-icon {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .leaderboard-item {
    padding: 14px 10px;
    min-height: 90px;
  }

  .username {
    font-size: 16px;
  }

  .stat-item {
    padding: 8px 6px;
    font-size: 11px;
    min-width: 90px;
    border-radius: 8px;
  }

  .avatar-placeholder {
    width: 45px;
    height: 45px;
  }

  .rank {
    font-size: 18px;
  }
}

@media (max-width: 360px) {
  .leaderboard-item {
    padding: 14px 10px;
  }

  .username {
    font-size: 16px;
  }

  .stat-item {
    padding: 8px 6px;
    font-size: 11px;
    min-width: 90px;
    border-radius: 8px;
    transition: all 0.2s ease;
  }
}


