/* ===== CSS Reset & Variables ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0F0D0C;
  --bg-alt: #14100F;
  --card: #1C1612;
  --card-alt: #221A15;
  --border: #362A22;
  --accent: #FF4655;
  --accent-hover: #E63946;
  --teal: #F4C430;
  --cyan: #FFD700;
  --blue: #FF4655;
  --text: #F2EAE6;
  --text-muted: #A89C97;
  --success: #F4C430;
  --danger: #C2524A;
  --warning: #FBBF24;
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  --font-pixel: 'Press Start 2P', cursive;
  --font-body: 'Inter', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --gradient-primary: linear-gradient(135deg, var(--accent-hover), var(--teal));
  --glow-purple: 0 0 14px rgba(255,70,85,.5), 0 0 30px rgba(255,70,85,.22);
  --glow-teal: 0 0 14px rgba(244,196,48,.5), 0 0 30px rgba(244,196,48,.22);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

/* Subtle scanline + grid texture — very low opacity arcade flavor */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 3px),
    linear-gradient(rgba(255,70,85,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,70,85,0.035) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ===== Scrollbar ===== */
* { scrollbar-width: thin; scrollbar-color: var(--accent) var(--bg); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--teal));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(var(--teal), var(--accent)); }

/* ===== Selection ===== */
::selection { background: rgba(255, 70, 85, 0.35); color: #fff; }

/* ===== Focus States (accessibility) ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.2);
  border-radius: var(--radius-sm);
}

/* ===== Utility ===== */
.pixel-text {
  font-family: var(--font-pixel);
  letter-spacing: 0.5px;
  line-height: 1.7;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(15, 13, 12, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}

.nav-logo {
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: 400;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 70, 85, 0.55)) drop-shadow(0 0 12px rgba(244, 196, 48, 0.3));
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  list-style: none;
}

.nav-links li a,
.nav-links li button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-links li a:hover,
.nav-links li button:hover {
  color: var(--text);
  background: rgba(255, 70, 85, 0.1);
  text-decoration: none;
}

.nav-links li a.active,
.nav-links li button.active {
  color: var(--text);
  background: rgba(255, 70, 85, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 70, 85, 0.4) inset, 0 0 12px rgba(255, 70, 85, 0.3);
  text-decoration: none;
}

.nav-links li .btn-logout {
  color: var(--danger);
}

.nav-links li .btn-logout:hover {
  background: rgba(194, 82, 74, 0.12);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  margin-left: auto;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, box-shadow var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--gradient-primary);
  color: #07060d;
}
.btn-primary:hover { box-shadow: var(--glow-purple); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.96); }

.btn-cta-pulse { animation: ctaPulse 2.6s ease-in-out infinite; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 70, 85, 0); }
  50% { box-shadow: var(--glow-purple); }
}

.btn-secondary {
  background: rgba(255, 70, 85, 0.07);
  color: var(--accent);
  border: 1px solid rgba(255, 70, 85, 0.5);
}
.btn-secondary:hover { background: rgba(255, 70, 85, 0.14); box-shadow: 0 0 10px rgba(255, 70, 85, 0.3); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(194, 82, 74, 0.5);
}
.btn-danger:hover { background: rgba(194, 82, 74, 0.12); box-shadow: 0 0 10px rgba(194, 82, 74, 0.3); }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-pop { animation: btnPop 0.3s ease; }
@keyframes btnPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ===== Forms ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--card-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select option {
  background: var(--card-alt);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -8px;
  margin-bottom: 8px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ===== Game Grid ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 22px rgba(255, 70, 85, 0.22);
}

.game-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--card-alt);
}

.game-cover-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--card-alt), #2A2018);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 18px;
  font-weight: 400;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 70, 85, 0.55);
}

.game-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.game-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 6px;
}

.game-actions {
  display: flex;
  gap: 4px;
}

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
}

.badge-playing { background: rgba(255, 70, 85, 0.15); color: var(--accent); border: 1px solid rgba(255, 70, 85, 0.45); box-shadow: 0 0 8px rgba(255, 70, 85, 0.25); }
.badge-completed { background: rgba(244, 196, 48, 0.15); color: var(--teal); border: 1px solid rgba(244, 196, 48, 0.45); box-shadow: 0 0 8px rgba(244, 196, 48, 0.25); }
.badge-dropped { background: rgba(194, 82, 74, 0.15); color: var(--danger); border: 1px solid rgba(194, 82, 74, 0.45); box-shadow: 0 0 8px rgba(194, 82, 74, 0.2); }
.badge-want_to_play { background: rgba(251, 191, 36, 0.15); color: var(--warning); border: 1px solid rgba(251, 191, 36, 0.4); box-shadow: 0 0 8px rgba(251, 191, 36, 0.2); }

.rating-text {
  font-size: 12px;
  color: var(--warning);
  font-weight: 700;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover { border-color: rgba(255, 70, 85, 0.4); box-shadow: 0 0 16px rgba(255, 70, 85, 0.12); }

.stat-number {
  font-family: var(--font-pixel);
  font-size: clamp(16px, 3.4vw, 24px);
  font-weight: 400;
  color: var(--accent);
  display: block;
  text-shadow: 0 0 10px rgba(255, 70, 85, 0.5);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* ===== Filter Tabs ===== */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.filter-tab:hover { border-color: var(--accent); color: var(--text); }
.filter-tab:active { transform: scale(0.95); }
.filter-tab.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #07060d;
  box-shadow: var(--glow-purple);
}

/* ===== Dashboard Header ===== */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-header h2 {
  font-size: 22px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 5, 0.82);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 70, 85, 0.18), 0 0 44px rgba(255, 70, 85, 0.1);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

/* ===== Search Results ===== */
.search-results {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
}

.search-results.visible { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255, 70, 85, 0.1); }

.search-result-item.selected { background: rgba(255, 70, 85, 0.18); }

.search-result-thumb {
  width: 36px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--card-alt);
}

.search-result-thumb-placeholder {
  width: 36px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--card-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--accent);
}

.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { font-size: 11px; color: var(--text-muted); }

/* ===== Landing Page ===== */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-nav {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 13, 12, 0.9);
  backdrop-filter: blur(10px);
}

.landing-nav .logo {
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: 400;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 70, 85, 0.55)) drop-shadow(0 0 12px rgba(244, 196, 48, 0.3));
  letter-spacing: 1px;
}

.landing-nav .nav-auth-links {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 70, 85, 0.1);
  border: 1px solid rgba(255, 70, 85, 0.35);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero h1 {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: clamp(15px, 4.2vw, 30px);
  line-height: 1.7;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 70, 85, 0.45)) drop-shadow(0 0 26px rgba(244, 196, 48, 0.25));
  margin-bottom: 20px;
  max-width: 760px;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 500px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.features {
  padding: 80px 20px;
  background: rgba(255, 70, 85, 0.02);
  border-top: 1px solid var(--border);
}

.features h2 {
  font-family: var(--font-display);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 40px auto 0;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.feature-card:hover { border-color: var(--accent); box-shadow: 0 0 24px rgba(255, 70, 85, 0.15); transform: translateY(-3px); }

.feature-icon {
  font-size: 32px;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 0 8px rgba(255, 70, 85, 0.4));
}

.feature-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Auth Pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 70, 85, 0.08);
}

.auth-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-card .auth-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== Main Content ===== */
.main-content {
  padding: 28px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Profile ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 20px;
  color: #07060d;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px rgba(255, 70, 85, 0.5), 0 0 18px rgba(255, 70, 85, 0.35);
}

.profile-info h2 { font-size: 22px; margin-bottom: 4px; font-family: var(--font-display); }
.profile-info p { font-size: 13px; color: var(--text-muted); }

.profile-bio {
  font-size: 14px;
  color: var(--text);
  margin-top: 6px;
  max-width: 480px;
  word-break: break-word;
}

/* ===== Leaderboard ===== */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: rgba(255, 70, 85, 0.04); }

.rank-badge {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-family: var(--font-pixel);
  background: var(--border);
  color: var(--text-muted);
}

.rank-1 { background: rgba(251, 191, 36, 0.18); color: #ffd24a; box-shadow: 0 0 14px rgba(255, 210, 74, 0.55); }
.rank-2 { background: rgba(209, 213, 219, 0.14); color: #e5e7eb; box-shadow: 0 0 12px rgba(229, 231, 235, 0.35); }
.rank-3 { background: rgba(217, 119, 6, 0.18); color: #e8923c; box-shadow: 0 0 12px rgba(232, 146, 60, 0.4); }
.rank-other { background: var(--border); color: var(--text-muted); }

.lb-cover {
  width: 36px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--card-alt);
}

.lb-cover-placeholder {
  width: 36px;
  height: 48px;
  border-radius: 4px;
  background: var(--card-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--accent);
}

/* ===== Follow Count Badge ===== */
.follow-count-badge {
  background: var(--border);
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  box-shadow: none;
}

/* ===== Discover / Users Grid ===== */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.user-card:hover { border-color: var(--accent); box-shadow: 0 0 18px rgba(255, 70, 85, 0.15); transform: translateY(-2px); }

.user-card-avatar {
  width: 56px;
  height: 56px;
  font-size: 16px;
  cursor: pointer;
}

.user-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
}

.user-card-name:hover { color: var(--accent); }

.user-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ===== Activity Feed ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color var(--transition);
}

.activity-item:hover { border-color: rgba(255, 70, 85, 0.35); }

.activity-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.activity-body a { font-weight: 600; }

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Comments ===== */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.comment-item {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comment-meta strong { color: var(--text); font-size: 13px; }

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}

.comment-delete:hover { color: var(--danger); }

.comment-text {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.65;
  filter: drop-shadow(0 0 10px rgba(255, 70, 85, 0.4));
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  font-family: var(--font-display);
}

.empty-state h3.pixel-text {
  font-size: clamp(11px, 3.2vw, 16px);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 70, 85, 0.4));
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* ===== Loading ===== */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 70, 85, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

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

/* ===== Toasts ===== */
#toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  min-width: 240px;
  max-width: 340px;
  animation: slideIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast-success { border-left: 3px solid var(--teal); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(244, 196, 48, 0.15); }
.toast-error { border-left: 3px solid var(--danger); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(194, 82, 74, 0.15); }

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

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

.toast.hiding { animation: slideOut 0.25s ease forwards; }

/* ===== Section Headings ===== */
.section-title {
  font-size: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-pixel);
  font-size: clamp(12px, 2.6vw, 16px);
  letter-spacing: 0.5px;
}

.section-title .count {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: normal;
}

/* ===== Manual Entry Toggle ===== */
.fallback-notice {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warning);
  margin-bottom: 16px;
}

/* ===== Range Slider ===== */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 70, 85, 0.55);
}

.rating-display {
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--accent);
  margin-top: 6px;
  text-shadow: 0 0 8px rgba(255, 70, 85, 0.5);
}

/* ===== Page Views ===== */
.page { display: block; }
.page.hidden { display: none; }

/* ===== Celebration micro-interaction ===== */
.celebrate-pop {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, 0);
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--teal);
  filter: drop-shadow(0 0 8px rgba(244, 196, 48, 0.65));
  pointer-events: none;
  white-space: nowrap;
  animation: celebratePop 0.8s ease-out forwards;
  z-index: 5;
}

@keyframes celebratePop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  30% { opacity: 1; transform: translate(-50%, -8px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}

/* ===== Initial Loading Screen ===== */
#initial-loader {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#initial-loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  font-family: var(--font-pixel);
  font-size: clamp(16px, 5vw, 26px);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 70, 85, 0.5)) drop-shadow(0 0 26px rgba(244, 196, 48, 0.3));
  animation: logoFlicker 1.8s ease-in-out infinite;
  letter-spacing: 1px;
}

@keyframes logoFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}

.loader-bar {
  width: 200px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}

.loader-bar-fill {
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--gradient-primary);
  border-radius: 4px;
  animation: loaderSlide 1.2s ease-in-out infinite;
}

@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.loader-text {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ===== Error / 404 / Connection-lost pages ===== */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 14px;
}

.error-page .error-icon {
  font-size: 48px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 12px rgba(255, 70, 85, 0.45));
}

.error-page .error-code {
  font-family: var(--font-pixel);
  font-size: clamp(26px, 9vw, 52px);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 70, 85, 0.5));
}

.error-page h2 {
  font-family: var(--font-pixel);
  font-size: clamp(11px, 3.2vw, 16px);
  letter-spacing: 1px;
}

.error-page p {
  color: var(--text-muted);
  max-width: 420px;
  font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(15, 13, 12, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px;
    gap: 2px;
  }

  .nav-links.open { display: flex; }

  .nav-links li a,
  .nav-links li button {
    padding: 10px 16px;
    width: 100%;
    text-align: left;
    border-radius: var(--radius-sm);
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .hero h1 { font-size: clamp(13px, 5vw, 22px); }
  .hero p { font-size: 16px; }

  .auth-card { padding: 28px 20px; }

  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .navbar { padding: 0 16px; }
  .main-content { padding: 20px 16px; }
  .users-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .profile-header {
    flex-wrap: wrap;
  }
  .profile-header > div:last-child {
    margin-left: 0 !important;
    width: 100%;
  }
  .nav-logo, .landing-nav .logo { font-size: 11px; }
  .section-title { font-size: 11px; }
}

@media (max-width: 375px) {
  .games-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

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