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

:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #21212f;
  --border: #2e2e42;
  --accent: #7c6af7;
  --accent2: #a78bfa;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --text: #e2e2f0;
  --muted: #8888aa;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── NAV ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 64px;
}

nav .brand {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

nav ul a {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

nav ul a:hover,
nav ul a.active {
  background: var(--surface2);
  color: var(--text);
}

nav .nav-user {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── LAYOUT ── */
.container {
  max-width: 900px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

/* ── HEADINGS ── */
h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* ── FLASH ── */
.flash-wrapper {
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.85rem 1.2rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash.success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid var(--green);
  color: var(--green);
}

.flash.danger {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid var(--red);
  color: var(--red);
}

.flash.info {
  background: rgba(124, 106, 247, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent2);
}

/* ── FORMS ── */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b87f7);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ── STAT BOXES ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
}

.stat-value.accent {
  color: var(--accent2);
}

.stat-value.green {
  color: var(--green);
}

/* ── PROGRESS BAR ── */
.progress-wrap {
  margin: 1.5rem 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 10px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.6s ease;
}

/* ── LEADERBOARD ── */
.leader-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  transition: transform 0.2s, border-color 0.2s;
}

.leader-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.leader-card.winner {
  border-color: var(--yellow);
  background: linear-gradient(135deg, var(--surface), rgba(251, 191, 36, 0.06));
}

.rank {
  font-size: 2rem;
  font-weight: 900;
  width: 2.5rem;
  text-align: center;
  color: var(--muted);
}

.rank.gold {
  color: var(--yellow);
}

.rank.silver {
  color: #94a3b8;
}

.leader-info {
  flex: 1;
}

.leader-name {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-gold {
  background: rgba(251, 191, 36, 0.2);
  color: var(--yellow);
}

.badge-goal {
  background: rgba(52, 211, 153, 0.2);
  color: var(--green);
}

.leader-stats {
  display: flex;
  gap: 2rem;
  margin-top: 0.75rem;
}

.ls {
  text-align: center;
}

.ls .lv {
  font-size: 1.4rem;
  font-weight: 800;
}

.ls .ll {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── LOGIN ── */
.login-wrap {
  max-width: 420px;
  margin: 5rem auto;
  padding: 0 1.5rem;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.5rem;
}

.login-logo p {
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ── MOBILE RESPONSIVENESS ── */
@media (max-width: 650px) {
  nav {
    flex-direction: column;
    height: auto;
    padding: 1.25rem 1rem;
    gap: 1rem;
    align-items: center;
  }

  nav .brand {
    flex: 0;
    font-size: 1.4rem;
    text-align: center;
    width: 100%;
  }

  nav .nav-user {
    display: none;
  }

  nav ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    overflow: visible;
    padding-bottom: 0;
  }

  nav ul a {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 0.5rem 0.9rem;
    border-radius: 99px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  nav ul a.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border-color: transparent;
    font-weight: 600;
  }

  .container {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .leader-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }

  .leader-stats {
    width: 100%;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  .rank {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.5rem;
  }

  .leader-card {
    position: relative;
  }

  .btn {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }

  form>div[style*="display:flex"] {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
}