:root {
  --bg: #f7fbff;
  --ink: #10253d;
  --muted: #61758d;
  --line: rgba(16, 37, 61, 0.08);
  --card: rgba(255, 255, 255, 0.78);
  --card-strong: #ffffff;
  --accent: #0f9cc4;
  --accent-deep: #1762cc;
  --navy: #10253d;
  --shadow: 0 28px 80px rgba(24, 52, 86, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(243, 250, 255, 0.96), rgba(233, 245, 255, 0.98)),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 16%, rgba(15, 156, 196, 0.16), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(23, 98, 204, 0.13), transparent 24%),
    radial-gradient(circle at 72% 76%, rgba(110, 221, 255, 0.18), transparent 24%);
}

.layout {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  position: relative;
  z-index: 1;
  display: grid;
  gap: 20px;
}

.layout-single {
  max-width: 980px;
}

.site-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.site-mark,
.site-link {
  text-decoration: none;
}

.site-mark {
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.site-link {
  color: var(--navy);
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.92rem;
  font-weight: 700;
}

.active-link {
  background: var(--navy);
  color: #fff;
}

.hero-card,
.profile-card,
.leaderboard-card,
.leaderboard-hero {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 22px;
  align-items: start;
  position: relative;
  overflow: hidden;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.eyebrow,
.mini-label {
  font-family: 'Trebuchet MS', 'Gill Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.hero-copy h1,
.leaderboard-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.support-copy,
.profile-feedback {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: var(--muted);
  line-height: 1.55;
}

.wave {
  position: absolute;
  border-radius: 999px;
  filter: blur(4px);
  pointer-events: none;
}

.wave-one {
  width: 380px;
  height: 160px;
  top: -54px;
  right: -70px;
  background: linear-gradient(135deg, rgba(111, 226, 255, 0.42), rgba(23, 98, 204, 0.16));
  transform: rotate(-14deg);
}

.wave-two {
  width: 320px;
  height: 120px;
  bottom: -44px;
  left: -56px;
  background: linear-gradient(135deg, rgba(15, 156, 196, 0.14), rgba(111, 226, 255, 0.34));
  transform: rotate(12deg);
}

.counter-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(241, 250, 255, 0.9));
  border: 1px solid rgba(16, 37, 61, 0.04);
  border-radius: 28px;
  padding: 24px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.count {
  min-height: 88px;
  display: flex;
  align-items: center;
  font-size: clamp(4rem, 11vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  color: transparent;
  background: linear-gradient(135deg, #0f9cc4 0%, #1762cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 700;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(31, 58, 92, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hero-meta {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.meta-card,
.stat-block {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
}

.meta-card-soft {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-value,
.stat-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  color: var(--navy);
}

.meta-title {
  font-size: 1.35rem;
  color: var(--ink);
}

.profile-card {
  padding: 28px;
  display: grid;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 251, 255, 0.82));
}

.profile-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.profile-heading h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-top: 6px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-detail {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
  color: var(--ink);
  font-size: 1rem;
  font-family: 'Trebuchet MS', 'Gill Sans', sans-serif;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.form-row,
.leaderboard-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.text-input {
  flex: 1 1 280px;
  min-width: min(280px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: 1rem 'Trebuchet MS', 'Gill Sans', sans-serif;
}

.text-input:focus {
  outline: 2px solid rgba(184, 92, 56, 0.22);
  border-color: rgba(184, 92, 56, 0.35);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  font: 700 0.95rem 'Trebuchet MS', 'Gill Sans', sans-serif;
  text-decoration: none;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(240, 248, 255, 0.98));
  color: var(--accent-deep);
  cursor: pointer;
  font: 700 1.1rem 'Trebuchet MS', 'Gill Sans', sans-serif;
}

.icon-button-muted {
  width: 38px;
  height: 38px;
  background: rgba(20, 32, 51, 0.06);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(23, 98, 204, 0.18);
}

.ghost-button {
  background: rgba(20, 32, 51, 0.08);
  color: var(--ink);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-feedback {
  min-height: 1.5em;
}

.settings-modal {
  width: min(520px, calc(100% - 24px));
  margin: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.settings-modal::backdrop {
  background: rgba(20, 32, 51, 0.4);
  backdrop-filter: blur(6px);
}

.settings-shell {
  background: var(--card-strong);
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(24, 40, 64, 0.24);
  display: grid;
  gap: 16px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.settings-header h3 {
  margin-top: 6px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.modal-field {
  display: grid;
  gap: 10px;
}

.profile-feedback[data-tone="success"] {
  color: #2f6d46;
}

.profile-feedback[data-tone="warning"] {
  color: #9a5222;
}

.leaderboard-hero {
  padding: 28px 30px;
  position: relative;
  overflow: hidden;
}

.leaderboard-card {
  padding: 18px;
}

.table-shell {
  overflow-x: auto;
  border-radius: 22px;
  background: var(--card-strong);
  border: 1px solid var(--line);
}

.leaderboard-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-family: 'Trebuchet MS', 'Gill Sans', sans-serif;
}

.leaderboard-table th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.leaderboard-table td {
  color: var(--ink);
}

.rank-cell,
.name-cell {
  font-weight: 700;
}

.leaderboard-loading {
  text-align: center;
  color: var(--muted);
}

.leaderboard-footer {
  justify-content: space-between;
  padding: 16px 8px 4px;
}

@media (max-width: 920px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-copy h1,
  .leaderboard-hero h1 {
    max-width: none;
  }

  .hero-meta,
  .profile-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .layout {
    width: min(100%, calc(100% - 20px));
    padding: 18px 0 28px;
    gap: 14px;
  }

  .site-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-heading {
    align-items: flex-start;
  }

  .hero-card,
  .profile-card,
  .leaderboard-card,
  .leaderboard-hero {
    border-radius: 22px;
  }

  .hero-card,
  .profile-card,
  .leaderboard-hero {
    padding: 22px;
  }

  .count {
    min-height: 72px;
    font-size: 3.4rem;
  }

  .wave-one {
    width: 220px;
    height: 92px;
    top: -26px;
    right: -42px;
  }

  .wave-two {
    width: 190px;
    height: 78px;
    left: -34px;
    bottom: -26px;
  }

  .form-row,
  .leaderboard-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-shell {
    padding: 20px;
    border-radius: 22px;
  }

  .text-input,
  .button {
    width: 100%;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 14px 12px;
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
