/* ===== FONTS ===== */
/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0118;
  --surface: #10012a;
  --card: #160235;
  --card-hover: #1d0345;
  --border: #2e0660;
  --border-light: #4a0e8a;
  --primary: #a855f7;
  --primary-hover: #9333ea;
  --primary-light: rgba(168, 85, 247, 0.15);
  --accent: #f5a623;
  --accent-hover: #d97706;
  --text: #f0e6ff;
  --text-muted: #b89fd4;
  --text-dim: #7a5fa0;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.7);
  --glow: 0 0 28px rgba(168, 85, 247, 0.55);
  --glow-gold: 0 0 20px rgba(245, 166, 35, 0.4);
  --nav-height: 64px;
}

html { scroll-behavior: smooth; }

/* Ensure page content sits above the particle canvas (z-index: 0) */
main, #nav-container, #toast-container, footer, #site-footer {
  position: relative;
  z-index: 1;
}

body {
  background:
    radial-gradient(ellipse 110% 55% at 50% -8%, rgba(168, 85, 247, 0.25), transparent),
    radial-gradient(ellipse 50% 35% at 85% 55%, rgba(245, 166, 35, 0.08), transparent),
    radial-gradient(ellipse 45% 40% at 10% 75%, rgba(147, 51, 234, 0.1), transparent),
    var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== NAVIGATION ===== */
#nav-container nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 1, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text) !important;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

@keyframes brand-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.nav-brand span {
  background: linear-gradient(90deg, #c084fc, #f5a623, #a855f7, #fbbf24, #c084fc);
  background-size: 300% 300%;
  animation: brand-shimmer 5s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.2s;
  text-decoration: none !important;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--primary-light);
}

.nav-link.admin-link { color: var(--warning); }
.nav-link.admin-link:hover { background: rgba(245, 158, 11, 0.15); }

#site-footer {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  margin-top: 2rem;
}

.footer-donate-link {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-donate-link:hover { color: var(--text-muted); }

.nav-spacer { flex: 1; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nav-username {
  font-weight: 600;
  color: var(--accent);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge for pending items */
.badge-count {
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  min-width: 1.25rem;
  text-align: center;
  display: inline-block;
  line-height: 1.4;
}

/* ===== LAYOUT ===== */
.page { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-sm { max-width: 480px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-md { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem; }

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.section-title {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none !important;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #a855f7, #f5a623);
  color: white;
  border: none;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #9333ea, #d97706);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.5), 0 0 12px rgba(245, 166, 35, 0.3);
}

.btn-accent {
  background: var(--accent);
  color: var(--bg);
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--card); color: var(--text); border-color: var(--border-light); }

.btn-danger {
  background: var(--error);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-success {
  background: var(--success);
  color: #0f172a;
}
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-warning {
  background: var(--warning);
  color: #0f172a;
}
.btn-warning:hover:not(:disabled) { background: #d97706; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  padding: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-light); }

/* ===== CARDS ===== */
.card {
  background: rgba(22, 2, 53, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s;
}

.card:hover { border-color: var(--border-light); }
.card-link:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ===== ACHIEVEMENT CARDS ===== */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background: rgba(22, 2, 53, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
}

.achievement-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 0 24px rgba(168, 85, 247, 0.45), 0 0 48px rgba(168, 85, 247, 0.15), var(--shadow);
  transform: translateY(-3px);
  text-decoration: none;
  color: inherit;
}

.achievement-card.completed {
  border-color: rgba(234, 179, 8, 0.55);
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.2), 0 0 36px rgba(234, 179, 8, 0.08);
}

.achievement-card.completed:hover {
  border-color: rgba(234, 179, 8, 0.8);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.6), 0 0 22px rgba(234, 179, 8, 0.35), 0 0 48px rgba(234, 179, 8, 0.12), var(--shadow);
}

.achievement-card.objective {
  border-color: rgba(255, 255, 255, 0.45);
}

.achievement-card.objective:hover {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), var(--shadow);
}

.achievement-card.completed.objective {
  border-color: rgba(234, 179, 8, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 14px rgba(234, 179, 8, 0.2), 0 0 36px rgba(234, 179, 8, 0.08);
}

.achievement-card-logo {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--border-light);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.achievement-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
  box-sizing: border-box;
}

.achievement-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.achievement-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}

.achievement-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.achievement-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

/* ===== RARITY TIERS ===== */
.rarity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rarity-New { background: rgba(107,114,128,0.2); color: #9ca3af; border: 1px solid rgba(107,114,128,0.4); }
.rarity-Mundane { background: rgba(156,163,175,0.2); color: #d1d5db; border: 1px solid rgba(156,163,175,0.4); }
.rarity-Common { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.4); }
.rarity-Uncommon { background: rgba(59,130,246,0.2); color: #60a5fa; border: 1px solid rgba(59,130,246,0.4); }
.rarity-Rare { background: rgba(168,85,247,0.2); color: #c084fc; border: 1px solid rgba(168,85,247,0.4); }
.rarity-Legendary { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.4); }
.rarity-Mythic { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.4); }
.rarity-Unique {
  background: linear-gradient(90deg, rgba(236,72,153,0.2), rgba(124,58,237,0.2), rgba(6,182,212,0.2));
  color: #f9a8d4;
  border: 1px solid rgba(236,72,153,0.4);
}

.completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(34,197,94,0.15);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
}

.objective-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(6,182,212,0.15);
  color: var(--accent);
  border: 1px solid rgba(6,182,212,0.3);
}

/* ===== FORMS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.875rem;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; }
.form-select option { background: var(--surface); }

.form-hint { font-size: 0.8rem; color: var(--text-dim); }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.4);
  color: #f87171;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.form-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.4);
  color: #4ade80;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

/* ===== SEARCH & FILTER ===== */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 2.5rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--border-light); color: var(--text); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th {
  background: var(--surface);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ===== AUTH PAGES ===== */
.auth-container {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.auth-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

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

.auth-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 1.25rem 0;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  background: var(--card);
  padding: 0 0.75rem;
  position: relative;
}

/* ===== HERO / HOME ===== */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero-logo {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  line-height: 1;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.25rem; }

/* ===== ACHIEVEMENT DETAIL ===== */
.achievement-detail-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.achievement-detail-header.completed {
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: rgba(34, 197, 94, 0.04);
}

.achievement-detail-header.completed .achievement-detail-logo {
  border-color: rgba(234, 179, 8, 0.6);
  box-shadow: 0 0 18px rgba(234, 179, 8, 0.35), 0 0 40px rgba(234, 179, 8, 0.15);
}

.achievement-detail-logo {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  overflow: hidden;
}

.achievement-detail-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.achievement-detail-info { flex: 1; min-width: 0; }
.achievement-detail-name { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.achievement-detail-desc { color: var(--text-muted); font-size: 1rem; margin-bottom: 1rem; }
.achievement-detail-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.rarity-info {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.rarity-info-item { text-align: center; }
.rarity-info-value { font-size: 1.5rem; font-weight: 700; }
.rarity-info-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== PROFILE ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.profile-name { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.profile-meta { color: var(--text-muted); font-size: 0.875rem; display: flex; gap: 1rem; flex-wrap: wrap; }

.share-link-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== IMAGE GRID ===== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.proof-image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.proof-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
  cursor: pointer;
}

.proof-image-item:hover img { transform: scale(1.05); }

.proof-image-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.proof-image-item:hover .proof-image-actions { opacity: 1; }

.proof-image-private-tag {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0,0,0,0.7);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== ADMIN ===== */
.admin-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.admin-nav-item:hover { color: var(--text); background: var(--primary-light); }
.admin-nav-item.active { color: var(--primary); background: var(--primary-light); }

.admin-content { padding: 2rem 1.5rem; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value { font-size: 2.25rem; font-weight: 800; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.25rem; }

/* ===== SUGGESTION CARDS ===== */
.suggestion-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.suggestion-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.suggestion-logo-preview {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-dim);
  overflow: hidden;
}

.suggestion-logo-preview img { width: 100%; height: 100%; object-fit: cover; }

.suggestion-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* ===== USER ROLE BADGES ===== */
.role-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-admin { background: rgba(239,68,68,0.2); color: #f87171; }
.role-moderator { background: rgba(245,158,11,0.2); color: #fbbf24; }
.role-user { background: rgba(100,116,139,0.2); color: #94a3b8; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.empty-state-desc { font-size: 0.9rem; max-width: 320px; margin: 0 auto; }

/* ===== LOADING ===== */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
}

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

/* ===== CELEBRATION ===== */
@keyframes flashFade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes bannerPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9) translateY(-20px); }
}

@keyframes rainbowShift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.celebrate-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1000;
  pointer-events: none;
  font-size: clamp(1.25rem, 4vw, 2.25rem);
  font-weight: 900;
  padding: 1rem 2.5rem;
  border-radius: 20px;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 60px rgba(0,0,0,0.7);
  animation: bannerPop 3.2s cubic-bezier(0.22,1,0.36,1) forwards;
}

.celebrate-flash {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  animation: flashFade 0.7s ease forwards;
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: slideIn 0.3s ease;
  cursor: pointer;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #nav-container nav { padding: 0 1rem; gap: 1rem; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.82rem; }
  .nav-username { display: none; }

  .hero-title { font-size: 2rem; }
  .hero { padding: 3rem 1rem 2rem; }

  .achievements-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

  .achievement-detail-header { flex-direction: column; gap: 1rem; }
  .achievement-detail-logo { width: 120px; height: 120px; }

  .admin-grid { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 1rem; }

  .stats-bar { gap: 2rem; }

  .page, .page-md, .page-sm { padding: 1.5rem 1rem; }

  .auth-box { padding: 1.75rem; }
}

@media (max-width: 480px) {
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 1.75rem; }
  .hero-actions { flex-direction: column; }
}

/* ===== TIER NAVIGATION (integrated into header) ===== */
.tier-header-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

.tier-header-nav-center {
  flex: 1;
  min-width: 0;
}

.tier-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: color 0.2s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
  border-radius: var(--radius-sm);
  user-select: none;
  align-self: center;
}

.tier-nav-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.tier-nav-btn:disabled {
  opacity: 0.15;
  cursor: default;
}

.tier-dots {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.tier-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.tier-dot.done {
  background: rgba(34, 197, 94, 0.45);
}

.tier-dot.active {
  background: var(--primary);
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.5);
  transform: scale(1.3);
}

.tier-dot.done.active {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.tier-suggest-form {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 0.25rem;
}

/* ===== COMPLETION POPUP ===== */
@keyframes logoGoldGlow {
  0%   { filter: none; box-shadow: 0 0 0 rgba(234,179,8,0); border-color: var(--border); }
  100% { filter: sepia(1) saturate(5) brightness(1.3);
         box-shadow: 0 0 32px rgba(234,179,8,0.75), 0 0 70px rgba(234,179,8,0.35);
         border-color: rgba(234,179,8,0.7); }
}
@keyframes goldShimmer {
  0%, 100% { box-shadow: 0 0 32px rgba(234,179,8,0.75), 0 0 70px rgba(234,179,8,0.35); }
  50%       { box-shadow: 0 0 55px rgba(234,179,8,1),   0 0 110px rgba(234,179,8,0.5); }
}

.completion-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.completion-popup-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.completion-popup {
  background: var(--card);
  border: 1px solid rgba(234,179,8,0.35);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  transform: scale(0.75) translateY(20px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
}
.completion-popup-overlay.open .completion-popup {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.completion-popup-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(234,179,8,0.9);
  margin-bottom: 1.25rem;
}
.completion-popup-logo {
  width: 130px;
  height: 130px;
  margin: 0 auto 1.5rem;
  border-radius: var(--radius);
  overflow: visible;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  background: var(--surface);
  animation: logoGoldGlow 0.9s ease forwards 0.4s;
}
.completion-popup-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}
.completion-popup-logo.shimmer {
  animation: logoGoldGlow 0.9s ease forwards 0.4s, goldShimmer 2.2s ease-in-out infinite 1.3s;
}
.completion-popup-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
.completion-popup-text {
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.75;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.completion-popup-close {
  background: none;
  border: 1px solid rgba(234,179,8,0.4);
  color: rgba(234,179,8,0.9);
  padding: 0.5rem 1.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-top: 0.5rem;
}
.completion-popup-close:hover {
  background: rgba(234,179,8,0.12);
  border-color: rgba(234,179,8,0.7);
}

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.78rem; }
.font-bold { font-weight: 700; }
.font-mono { font-family: monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ===== ACHIEVEMENT TREE ===== */
#tree-container {
  position: relative;
  width: 100vw;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
  background: transparent;
}

#tree-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  background: transparent;
}

#tree-canvas:active { cursor: grabbing; }

#tree-controls {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  z-index: 10;
}

#tree-controls .btn {
  width: 2.5rem;
  height: 2.5rem;
  justify-content: center;
  font-size: 1.1rem;
  backdrop-filter: blur(8px);
  background: rgba(22, 2, 53, 0.8);
}

#tree-search {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 280px;
  max-width: calc(100vw - 2rem);
}

#tree-search .form-input {
  backdrop-filter: blur(8px);
  background: rgba(22, 2, 53, 0.85);
  text-align: center;
  font-size: 0.85rem;
}

.tree-tooltip {
  position: fixed;
  z-index: 20;
  background: rgba(22, 2, 53, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  max-width: 260px;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.tree-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: rgba(16, 1, 42, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-light);
  padding: 2rem 1.5rem;
  z-index: 15;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.tree-panel.open {
  transform: translateX(0);
}

.tree-panel-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.tree-panel-close:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.tree-panel-logo {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  margin: 0 auto 1.25rem;
}

.tree-panel-logo.completed {
  border-color: rgba(234, 179, 8, 0.6);
  box-shadow: 0 0 18px rgba(234, 179, 8, 0.35);
}

.tree-panel-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  #tree-search { width: 200px; }
  #tree-controls { bottom: 1rem; right: 1rem; }
  .tree-panel { width: 280px; }
}

/* ===== ACHIEVEMENT PICKER (autocomplete) ===== */
.picker-wrap {
  position: relative;
}

.picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.picker-option {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
}

.picker-option:hover {
  background: var(--primary-light);
  color: var(--text);
}
