/* ===================== TOKENS ===================== */
:root {
  --bg: #F5F0E6;
  
  --surface: #FAF7F1;
  
  --surface2: #E9E0D3;
  
  --text: #4E342E;
 
  --muted: #8D7B6A;

  --accent: #A67C52;

  --gold: #D4AF37;
 
  --green: #39d353;
  --red: #ff5f56;
}

/* ===================== RESET / GLOBAL ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: .3s;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  opacity: .8;
}

/* ===================== PAGE‑LOAD ANIMATION ===================== */
.animate-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .65s ease-out, transform .65s ease-out;
}

.animate-item.in {
  opacity: 1;
  transform: none;
}

.cursor {
  display: inline-block;
  width: 1px;
  background: var(--text);
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}

/* ===================== NAVBAR ===================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  position: relative;
  z-index: 1100;
}

.logo img {
  width: 38px;
}
.nav-links {
  display: flex;
  gap: 2rem;
  font-weight: 600;
  align-items: center;
}

/* hamburger (mobile) */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  width: 24px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: .3s;
}

/* ===================== HERO ===================== */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin-inline: auto;
}

.hero-left {
  flex: 1 1 50%;
}

.hero-right {
  flex: 1 1 50%;
  display: flex;
  justify-content: center;
}

.hero-img {
  max-width: 480px;
  width: 100%;
  height: auto;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.05;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.subtitle {
  color: var(--muted);
  font-size: 2rem;
}

/* CTA button */
.cta-btn {
  margin-top: 2.5rem;
  padding: 1rem 2.8rem;
  border: none;
  border-radius: .9rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: .25s;
}

.cta-btn:hover {
  transform: translateY(-3px);
}

.cta-btn.full {
  width: 100%;
  margin-top: 1rem;
}

.important {
  color: var(--text);
}

/* Responsive hero */
@media(max-width:768px) {
  .hero {
    flex-direction: column;
    text-align: center;
  }
  .nav-links a {
    color: var(--surface2);
  }
  .hero-img {
    max-width: 100px;
  }

  .hero-title {
    font-size: 2.6rem;
  }
}

/* ===================== LEADERBOARD ===================== */
.leaderboard-section {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.leaderboard-container {
  width: 100%;
  max-width: 880px;
  background: var(--surface);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
  position: relative;
}

.board-title {
  text-align: center;
  font-size: 1.4rem;
  padding: 1rem 0;
  font-weight: 700;
  letter-spacing: .5px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

thead {
  background: var(--surface2);
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .04em;
}

th,
td {
  padding: 1rem;
  text-align: left;
}

.rank-cell {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

tbody tr {
  border-top: 1px solid var(--surface2);
  transition: .2s;
}

tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, .04);
}

tbody tr:hover {
  background: rgba(0, 0, 0, .08);
}

tbody {
  display: block;
  max-height: 780px;
  overflow-y: auto;
}

thead,
tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

/* custom scrollbar */
tbody::-webkit-scrollbar {
  width: 8px;
}

tbody::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border-radius: 4px;
}

tbody:hover::-webkit-scrollbar-thumb {
  background: var(--accent);
}

tbody {
  scrollbar-width: thin;
  scrollbar-color: var(--surface2) transparent;
}

tbody:hover {
  scrollbar-color: var(--accent) transparent;
}


.leaderboard-container.blurred table {
  filter: blur(6px);
  pointer-events: none;
}

/* ===================== PROJECT OVERLAY ===================== */
.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.project-overlay.hidden {
  display: none;
}

.overlay-inner {
  width: 90%;
  max-width: 720px;
}

.overlay-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--surface);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.project-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1rem;
  border-radius: .8rem;
  background: var(--surface2);
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: .2s;
}

.project-item:hover {
  background: var(--accent);
  color: #fff;
}

.project-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===================== FOOTER ===================== */
footer {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 2rem;
  font-size: .9rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

/* live/offline dot */
.status-indicator {
  position: absolute;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: relative;
}

.online {
  background: var(--red);
  animation: blink 1s infinite;
}

.offline {
  background: var(--red);
}

.online::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ripple 1.6s infinite;
}

/* ===================== MODALS (shared) ===================== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.hidden {
  display: none;
}

.modal-content {
  width: 90%;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  padding: 2rem;
  border-radius: 1rem;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--accent);
}

/* ===================== REGISTER FORM ===================== */
.register-form {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  margin-top: 1rem;
}

.register-form input {
  padding: .8rem 1rem;
  border-radius: .6rem;
  border: 2px solid var(--surface2);
  background: var(--surface2);
  color: var(--text);
  font-size: .9rem;
}

.register-form input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===================== DOCS EXTRAS ===================== */
.score-table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: .9rem;
}

.score-table th,
.score-table td {
  padding: .6rem 1rem;
  text-align: left;
}

.score-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, .04);
}

.highlight {
  background: var(--gold);
  color: #000;
  padding: 0 4px;
  border-radius: 4px;
}

/* ===================== ANIMATIONS ===================== */
@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .25;
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: .6;
  }

  70%,
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* ===================== EXTRA: mobile ≤ 768px ===================== */
.close-nav {
  display: none;
}

@media(max-width:768px) {
  .subtitle {
    font-size: 1.5rem;
  }

  .burger {
    display: flex;
  }

  /* burger → X animation */
  .burger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .burger.open span:nth-child(2) {
    opacity: 0;
  }

  .burger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* overlay mobile‑nav */
  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 1200;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.2rem;
    font-size: 1.4rem;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(8px);
    transform: translateY(-100%);
    transition: .3s;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  /* close (×) inside nav */
  .close-nav {
    display: block;
    position: absolute;
    top: 1.3rem;
    right: 1.8rem;
    font-size: 2.4rem;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    line-height: 1;
  }

  .close-nav:hover {
    color: var(--accent);
  }

  /* footer alignment */
  footer {
    justify-content: flex-end;
  }

  .footer-links {
    margin-left: auto;
  }
}