:root{
  --bg1: #0f1113;
  --bg2: #16171a;
  --panel: rgba(255,255,255,0.03);
  --muted: rgba(255,255,255,0.6);
  --accent: #5865F2;
  --glass: rgba(255,255,255,0.03);
  --radius: 14px;
  --max-width: 1100px;
  --gap: 22px;
  font-family: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:#E9EEF8;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.45;
  font-size:16px;
}

/* layout */
.container{
  width: 92%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* header */
.site-header{
  position:sticky;
  top:0;
  z-index:30;
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(10,10,12,0.6), rgba(10,10,12,0.3));
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.site-header.small{padding:12px 0}
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--gap);
  padding:18px 0;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  color:inherit;
  text-decoration:none;
}
.logo{
  font-size:28px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
  width:56px;height:56px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.brand-title{font-weight:700}
.brand-sub{font-size:12px;color:var(--muted);margin-top:2px}

/* nav */
.nav{display:flex;align-items:center;gap:12px}
.nav-link{color:var(--muted);text-decoration:none;padding:8px;border-radius:8px}
.nav-link:hover{color: #fff;background: rgba(88,101,242,0.06)}

.btn{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border-radius:10px;border:1px solid transparent;
  background:transparent;color:inherit;cursor:pointer;text-decoration:none;
}
.btn:hover{transform:translateY(-2px)}
.btn-ghost{border:1px solid rgba(255,255,255,0.04);padding:8px 10px}
.btn-primary{
  background: linear-gradient(90deg, var(--accent), #6f7dfb);
  color:white;padding:10px 16px;border-radius:12px;font-weight:600;
  box-shadow: 0 8px 30px rgba(88,101,242,0.12);
}
.btn-outline{border:1px solid rgba(255,255,255,0.06);padding:9px 12px;border-radius:10px}

/* hero */
.hero{padding:56px 0 40px}
.hero-grid{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap:28px;
  align-items:start;
}
.hero-copy h1{font-size:30px;margin:0 0 12px}
.lead{color:var(--muted);margin:0 0 18px;font-weight:300}
.hero-actions{display:flex;gap:12px;margin-bottom:16px}
.features-list{margin:12px 0 0;padding-left:18px;color:var(--muted)}

/* card */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius:14px;padding:18px;border:1px solid rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.muted{color:var(--muted)}
.small{font-size:13px}
.stat{display:flex;flex-direction:column;padding:10px 0;border-top:1px dashed rgba(255,255,255,0.02)}
.stat:first-of-type{border-top:0}
.stat-value{font-size:20px;font-weight:700}
.stat-label{color:var(--muted);font-size:13px}

/* status badge */
.status-badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:20px;
  font-size:12px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.status-badge.online{
  background: rgba(67, 181, 129, 0.15);
  color: #43b581;
  box-shadow: 0 0 10px rgba(67, 181, 129, 0.2);
}
.status-badge.offline{
  background: rgba(240, 71, 71, 0.15);
  color: #f04747;
}

/* info section */
.info{padding:40px 0}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:12px}
.info-card{background:var(--glass);padding:18px;border-radius:12px;border:1px solid rgba(255,255,255,0.02)}

/* docs (privacy/terms) */
.docs{padding:36px 0 80px;max-width:900px}
.docs h1{margin-top:6px}
.docs section{margin:18px 0}
.docs p, .docs li{color: #dfe8f8}
.docs ul{padding-left:18px}

/* footer */
.site-footer{
  padding:18px 0 28px;margin-top:40px;border-top:1px solid rgba(255,255,255,0.03);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
}
.footer-inner{display:flex;justify-content:space-between;align-items:center;gap:12px;color:var(--muted);flex-wrap:wrap}
.footer-links a{color:var(--muted);text-decoration:none;margin-left:12px}

/* responsive */
@media (max-width:980px){
  .hero-grid{grid-template-columns: 1fr; }
  .grid-3{grid-template-columns:repeat(1,1fr)}
  .nav{display:flex;gap:8px}
  .brand-sub{display:none}
  .logo{width:46px;height:46px}
}

@media (prefers-reduced-motion: no-preference){
  .btn, .nav-link{transition: transform .18s ease, box-shadow .18s ease}
  .hero-copy h1{transition: color .25s}
}

/* ============================================
   LEADERBOARD PAGE STYLES
   ============================================ */

.leaderboard-section {
  padding: 40px 0 60px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.leaderboard-header h1 {
  margin: 0;
  font-size: 28px;
}

.leaderboard-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.lb-stat {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.lb-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.lb-stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.leaderboard-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.leaderboard-table-header {
  display: grid;
  grid-template-columns: 60px 1fr 100px 120px 1fr;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.leaderboard-body {
  max-height: 600px;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 60px 1fr 100px 120px 1fr;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  align-items: center;
  transition: background 0.15s ease;
}

.leaderboard-row:hover {
  background: rgba(255,255,255,0.02);
}

.leaderboard-row.top-3 {
  background: linear-gradient(90deg, rgba(var(--rank-color), 0.05), transparent);
}

.col-rank {
  font-weight: 700;
  font-size: 18px;
}

.col-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

.col-swears {
  font-weight: 600;
  font-size: 16px;
}

.col-word code {
  background: rgba(255,255,255,0.05);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.col-title {
  font-weight: 500;
  font-size: 13px;
}

/* Loading / Error / Empty states */
.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-state .btn {
  margin-top: 16px;
}

/* Leaderboard responsive */
@media (max-width: 768px) {
  .leaderboard-stats {
    flex-direction: column;
  }

  .leaderboard-table-header,
  .leaderboard-row {
    grid-template-columns: 50px 1fr 80px;
  }

  .col-word,
  .col-title {
    display: none;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ============================================
   DASHBOARD PAGE STYLES
   ============================================ */

.dashboard-section {
  padding: 40px 0 60px;
  min-height: 60vh;
}

/* Login prompt */
.login-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.login-card {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 16px;
  padding: 48px;
  text-align: center;
  max-width: 400px;
}

.login-card h1 {
  margin: 0 0 12px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 24px;
}

.btn-discord {
  background: #5865F2;
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s, transform 0.2s;
}

.btn-discord:hover {
  background: #4752C4;
  transform: translateY(-2px);
}

/* Dashboard header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.user-name {
  font-weight: 600;
}

/* Nav user */
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 20px;
}

.nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* Servers grid */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.server-card {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.server-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(88,101,242,0.3);
  transform: translateY(-2px);
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-icon span {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.server-info {
  flex: 1;
  min-width: 0;
}

.server-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-members {
  font-size: 13px;
  color: var(--muted);
}

.server-arrow {
  font-size: 18px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s;
}

.server-card:hover .server-arrow {
  opacity: 1;
}

/* Server detail */
.back-btn {
  margin-bottom: 20px;
}

.server-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.server-header h2 {
  margin: 0;
}

.server-detail-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.server-detail-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-detail-icon span {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.server-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

/* Empty/Error states */
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: #fff;
  margin: 0 0 8px;
}

.empty-state .btn,
.error-state .btn {
  margin-top: 16px;
}

/* Dashboard responsive */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .servers-grid {
    grid-template-columns: 1fr;
  }

  .server-stats {
    flex-direction: column;
  }

  .login-card {
    padding: 32px 24px;
    margin: 0 16px;
  }
}
