/* ── Topbar ──────────────────────────────────────── */
.topbar {
    background: rgba(15, 21, 32, 0.85);
    /* Slightly darker, cleaner */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    /* More subtle line */
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 50;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #c9972a;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: rgba(201, 151, 42, 0.15);
    transform: scale(1.05);
}

.brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.brand img {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(201, 151, 42, 0.4));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.brand:hover img {
    transform: rotate(-10deg) scale(1.1);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fef08a, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.user-nav {
    display: flex;
    gap: 0.25rem;
}

.user-nav-link {
    color: #94a3b8;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-nav-link:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.06);
}

.auth-nav {
    display: flex;
    gap: 1rem;
}

@media (max-width: 640px) {
    .user-nav {
        display: none;
    }
}

.auth-nav a,
.btn-logout {
    color: #fcd34d;
    padding: 0.5rem 1.25rem;
    border: 1px solid rgba(201, 151, 42, 0.3);
    background: rgba(201, 151, 42, 0.05);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-nav a:hover,
.btn-logout:hover {
    background: rgba(201, 151, 42, 0.15);
    border-color: #fcd34d;
    color: #fef3c7;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(201, 151, 42, 0.3);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .topbar {
        height: 58px;
        padding: 0 0.7rem;
    }

    .topbar-left {
        gap: 0.55rem;
    }

    .topbar-right {
        gap: 0.5rem;
    }

    .auth-nav {
        gap: 0.45rem;
    }

    .brand img {
        width: 28px;
        height: 28px;
    }

    .logo-text {
        font-size: 1.05rem;
    }

    .lang-btn {
        padding: 0.35rem 0.55rem;
        font-size: 0.95rem;
        gap: 0.3rem;
    }

    .lang-menu {
        min-width: 125px;
    }

    .auth-nav a,
    .btn-logout {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        border-radius: 7px;
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    .logo-text {
        display: inline-block;
        font-size: 0.92rem;
        letter-spacing: 0.2px;
    }

    .topbar-right {
        gap: 0.35rem;
    }

    .auth-nav a,
    .btn-logout {
        padding: 0.35rem 0.6rem;
        font-size: 0.76rem;
    }
}
/* Language Selector */
.lang-selector {
  position: relative;
  display: inline-block;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d0dce8;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(201, 151, 42, 0.3);
}

.lang-btn .caret {
  font-size: 0.7rem;
  color: #6888a0;
  transition: transform 0.2s;
}

.lang-selector.open .lang-btn .caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: 110%;
  right: 0;
  background: rgba(18, 24, 36, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.lang-selector.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  background: transparent;
  border: none;
  color: #d0dce8;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-option:hover {
  background: rgba(201, 151, 42, 0.15);
  color: #fcd34d;
}

@media (max-width: 768px) {
  .topbar-right {
    margin-left: auto;
  }

  .lang-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.95rem;
    gap: 0.3rem;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 0 0.55rem;
  }

  .topbar-left {
    gap: 0.45rem;
  }

  .brand img {
    width: 26px;
    height: 26px;
  }

  .lang-btn {
    padding: 0.32rem 0.45rem;
    font-size: 0.9rem;
  }

  .lang-btn .caret {
    display: none;
  }

  .auth-nav a,
  .btn-logout {
    padding: 0.33rem 0.5rem;
    font-size: 0.72rem;
    border-radius: 6px;
  }
}

.user-stats-minimal {
  display: flex;
  gap: 0.8rem;
  margin-right: 1.2rem;
  align-items: center;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 2px 10px;
  background: #1a2433;
  border: 1px solid #253548;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.stat-pill .label {
  color: #6888a0;
  font-size: 0.7rem;
}

.stat-pill .value {
  color: #c9972a;
}

.stat-pill.streak-pill {
  background: #2a1b16;
  border-color: #4d2a1a;
}

.stat-pill.streak-pill .value {
  color: #ff5722;
}


.stat-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xp-progress-container {
  width: 60px;
  height: 4px;
  background: #253548;
  border-radius: 2px;
  overflow: hidden;
}

.xp-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #c9972a, #ffeb3b);
  transition: width 0.3s ease-out;
}

