/* ═══════════════════════════════════════════════════════════════════
   2048.now - Main Stylesheet
   Warm beige theme
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #f0ebe3;
  --bg-surface:    #ece7de;
  --bg-card:       #e8e2d8;
  --bg-card-hover: #e2dbd2;
  --bg-hover:      #e2dbd2;
  --bg-sidebar:    #ece7de;
  --bg-topbar:     #ede8df;
  --border:        #ccc6bc;
  --border-light:  #c2bcb2;

  --accent:        #8b7355;
  --accent-hover:  #7a6345;
  --accent-light:  #a08565;
  --accent-glow:   rgba(139, 115, 85, 0.25);

  --cyan:          #2a8a9a;
  --cyan-hover:    #1e7a8a;
  --green:         #2d7a4f;
  --red:           #c0392b;
  --orange:        #d4580a;
  --yellow:        #c8920a;
  --gold:          #c4900a;

  --text-primary:   #111111;
  --text-secondary: #333333;
  --text-muted:     #666666;

  --sidebar-w:     240px;
  --sidebar-w-col: 64px;
  --topbar-h:      60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card:   0 2px 12px rgba(60,40,20,0.10);
  --shadow-popup:  0 6px 32px rgba(60,40,20,0.18);

  --transition: 150ms ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════
   LAYOUT SHELL
   ══════════════════════════════════════ */

.app-shell { display: flex; min-height: 100vh; }

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: var(--sidebar-w-col);
}

.topbar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: white;
  letter-spacing: -1px;
}

.topbar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-menu-toggle {
  display: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition);
}
.topbar-menu-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

.topbar-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px 9px 42px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--accent); }
.topbar-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg-card); color: var(--text-primary); }

.topbar-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--red);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-topbar);
}

.btn-signup {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.btn-signup:hover { border-color: var(--accent-light); color: var(--accent-light); }
.btn-login {
  background: var(--accent);
  color: white;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn-login:hover { background: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); }

.user-avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.user-avatar-btn:hover { border-color: var(--accent-light); }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 90;
  transition: width var(--transition);
  padding-bottom: 16px;
}

.sidebar.collapsed { width: var(--sidebar-w-col); }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 9px 0; margin: 1px 8px; }
.sidebar.collapsed .sidebar-link .sidebar-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.sidebar.collapsed .sidebar-link.active .sidebar-icon { background: rgba(139, 115, 85, 0.15); }
.sidebar.collapsed .sidebar-link.active { background: none; }

.sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  padding: 12px 16px 6px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0.7;
}
.sidebar.collapsed .sidebar-label { opacity: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(139, 115, 85, 0.14);
  color: var(--accent);
}

.sidebar-link.active .sidebar-icon { color: var(--accent); }
.sidebar-link.active .sidebar-link-text { color: var(--accent); }

.sidebar-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition);
}
.sidebar.collapsed .sidebar-link-text { opacity: 0; width: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-badge { display: none; }

/* ── Sidebar collapse toggle button ── */
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  width: calc(100% - 24px); height: 36px; margin: auto 12px 12px;
  background: rgba(139, 115, 85, 0.08); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  font-size: 12px; font-weight: 500;
  transition: color .2s, background .2s, border-color .2s;
}
.sidebar-collapse-btn:hover {
  background: rgba(139, 115, 85, 0.16);
  color: var(--accent);
  border-color: var(--accent);
}
.sidebar-collapse-icon { transition: transform .25s ease; flex-shrink: 0; }
.sidebar.collapsed .sidebar-collapse-icon { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-collapse-btn { width: 40px; margin: auto auto 8px; }
@media (max-width: 768px) { .sidebar-collapse-btn { display: none; } }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
  transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-col); }

/* ══════════════════════════════════════
   CARDS
   ══════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ── Game Mode Cards ── */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(139, 115, 85, 0.18);
}

.mode-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.mode-card-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%);
}

.mode-card-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}
.badge-hot    { background: var(--red);    color: white; }
.badge-new    { background: var(--accent); color: white; }
.badge-ng     { background: var(--cyan);   color: white; }
.badge-top    { background: var(--gold);   color: black; }
.badge-live   { background: var(--green);  color: white; }

.mode-card-info { padding: 12px; }
.mode-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.mode-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Featured Hero Card ── */
.hero-card {
  background: linear-gradient(135deg, #dfd8ce 0%, #e8e2d8 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  position: relative;
  margin-bottom: 32px;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-title span { color: var(--accent-light); }

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 420px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-board-preview {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(9, 28px);
  grid-template-rows: repeat(9, 28px);
  gap: 2px;
  opacity: 0.7;
}

.hero-cell {
  width: 28px; height: 28px;
  border-radius: 4px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.hero-cell.revealed { background: var(--bg-surface); }
.hero-cell.flag     { background: var(--bg-card); color: var(--red); }
.hero-cell.mine     { background: var(--red); }
.hero-cell.n1 { color: #3b82f6; }
.hero-cell.n2 { color: #22c55e; }
.hero-cell.n3 { color: var(--red); }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ── Page Hero Header ── */
.page-hero {
  display: flex; align-items: center; gap: 18px; margin-bottom: 8px;
}
.page-hero-icon {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(139,115,85,.30);
  background: rgba(139,115,85,.14);
}
.page-hero-icon svg { width: 28px; height: 28px; display: block; }
.page-hero-text h1 { margin: 0 0 2px; font-size: 24px; font-weight: 900; }
.page-hero-text p  { margin: 0; font-size: 13px; color: var(--text-muted); }

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  transition: color var(--transition);
}
.section-link:hover { color: var(--accent); }

/* ══════════════════════════════════════
   LEADERBOARD TABLE
   ══════════════════════════════════════ */

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.lb-table tbody tr:hover td { background: var(--bg-card-hover); }
.lb-table tbody tr:last-child td { border-bottom: none; }

.lb-rank {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 36px;
}
.lb-rank.gold   { color: var(--gold); }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #cd7c3a; }

.lb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.lb-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.lb-time {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-weight: 600;
  color: var(--green);
}

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: rgba(139,115,85,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

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

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-pill { border-radius: 999px; }
.btn-icon { padding: 10px; }

/* ══════════════════════════════════════
   FORMS
   ══════════════════════════════════════ */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control.is-invalid { border-color: var(--red); }
.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

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

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-base);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-popup);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-align: center;
}

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

.auth-divider {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 20px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ══════════════════════════════════════
   FLASH MESSAGES
   ══════════════════════════════════════ */

.flash-container {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.2s ease;
  cursor: pointer;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.flash-success { background: #d4edda; border: 1px solid #2d7a4f; color: #1a5c36; }
.flash-error   { background: #fce8e6; border: 1px solid var(--red); color: #7a2020; }
.flash-info    { background: #dbeafe; border: 1px solid #2563eb; color: #1e3a8a; }
.flash-warning { background: #fef3cd; border: 1px solid var(--orange); color: #7a3a08; }

/* ══════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════ */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-select {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* ══════════════════════════════════════
   ANNOUNCEMENTS
   ══════════════════════════════════════ */

.announcement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
}
.announcement-info        { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #1e40af; }
.announcement-warning     { background: rgba(212,88,10,0.08);  border: 1px solid rgba(212,88,10,0.25);  color: #7a3a08; }
.announcement-maintenance { background: rgba(200,146,10,0.08); border: 1px solid rgba(200,146,10,0.25); color: #7a5a08; }

/* ══════════════════════════════════════
   TAGS & BADGES (inline)
   ══════════════════════════════════════ */

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tag:hover { border-color: var(--accent); color: var(--accent-light); }
.tag-accent { background: rgba(139,115,85,0.12); border-color: var(--accent); color: var(--accent); }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-active    { background: rgba(34,197,94,0.15); color: var(--green); }
.status-suspended { background: rgba(249,115,22,0.15); color: var(--orange); }
.status-banned    { background: rgba(239,68,68,0.15);  color: var(--red); }
.status-new       { background: rgba(139,115,85,0.12); color: var(--accent); }
.status-open      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-resolved  { background: rgba(34,197,94,0.15);  color: var(--green); }
.status-closed    { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* ══════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 24px;
  justify-content: center;
}

.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  padding: 0 10px;
}
.page-btn:hover      { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active     { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn.disabled   { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════ */

.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.admin-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 0;
}
.admin-content { padding: 24px; overflow: auto; }

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   PROFILE
   ══════════════════════════════════════ */

.profile-header {
  background: linear-gradient(135deg, #dfd8ce, #e8e2d8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  border: 3px solid var(--accent-light);
}

.profile-username {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-rank {
  font-size: 14px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.profile-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-stat { text-align: center; }
.profile-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}
.profile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   BLOG
   ══════════════════════════════════════ */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.blog-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.blog-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card-hover));
  object-fit: cover;
}

.blog-card-body { padding: 16px; }

.blog-card-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   HELP CENTER
   ══════════════════════════════════════ */

.help-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.help-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}

.help-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.help-nav-link:last-child { border-bottom: none; }
.help-nav-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.help-nav-link.active { background: rgba(139,115,85,0.1); color: var(--accent); }

.help-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.help-content h1 { font-size: 26px; font-weight: 900; margin-bottom: 16px; }
.help-content h2 { font-size: 18px; font-weight: 800; margin: 28px 0 12px; color: var(--accent); }
.help-content p  { font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 12px; }
.help-content ul, .help-content ol { padding-left: 24px; margin-bottom: 12px; }
.help-content li { font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 4px; }
/* Blog article body links — underlined, accent colour, never on headings */
.help-content p a,
.help-content li a,
.help-content td a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.help-content p a:hover,
.help-content li a:hover,
.help-content td a:hover { color: var(--text-primary); }
.help-content h1 a,
.help-content h2 a,
.help-content h3 a,
.help-content h4 a { text-decoration: none; pointer-events: none; color: inherit; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */

.site-footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  margin-top: 48px;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 32px;
  max-width: 960px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.footer-link:hover { color: var(--accent-light); }

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   LANGUAGE SWITCHER
   ══════════════════════════════════════ */

.lang-dropdown {
  position: relative;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popup);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
  display: none;
}
.lang-menu.open { display: block; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background var(--transition);
  cursor: pointer;
}
.lang-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.lang-option.active { color: var(--accent-light); font-weight: 600; }

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-w-col); }
  .sidebar .sidebar-link-text,
  .sidebar .sidebar-label,
  .sidebar .sidebar-badge { opacity: 0; width: 0; overflow: hidden; }
  .main-content { margin-left: var(--sidebar-w-col); }
  .hero-board-preview { display: none; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 56px; }

  /* Sidebar overlay */
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); transition: transform 0.25s ease; z-index: 200; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .sidebar-link-text,
  .sidebar .sidebar-label,
  .sidebar .sidebar-badge { opacity: 1; width: auto; }

  /* Sidebar backdrop */
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

  /* Main content */
  .main-content { margin-left: 0 !important; padding: 16px; }
  .sidebar.collapsed ~ .main-content { margin-left: 0 !important; }

  /* Footer */
  .site-footer { margin-left: 0 !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 24px !important; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  /* Topbar */
  .topbar-menu-toggle { display: flex; }
  .topbar-search { max-width: 200px; }
  .topbar-logo { width: auto; }
  .topbar-logo .logo-text { display: none; }

  /* Hero */
  .hero-card { padding: 24px; flex-direction: column; }

  /* Help */
  .help-layout { grid-template-columns: 1fr; }
  .help-nav { position: static; }

  /* Stat grid */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Tables: horizontal scroll wrapper */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lb-table { min-width: 480px; }

  /* Cards containing tables: allow horizontal scroll */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Responsive grid utility */
  .responsive-grid { grid-template-columns: 1fr !important; }

  /* Filter bar wrap */
  .filter-bar { flex-wrap: wrap; gap: 6px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Cards grid (explore more, related pages) */
  [style*="grid-template-columns:repeat(auto-fill"] { grid-template-columns: 1fr 1fr !important; }

  /* Profile header */
  .profile-header { flex-direction: column; text-align: center; }
  .profile-header .lb-avatar { margin: 0 auto; }

  /* Mode cards */
  .mode-cards { grid-template-columns: 1fr 1fr; }

  /* Pagination compact */
  .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
}

@media (max-width: 480px) {
  .topbar-search { display: none; }
  .topbar-actions { gap: 2px; }
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
  .hero-title { font-size: 24px; }
  .hero-subtitle { font-size: 14px; }
  .mode-cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:repeat(auto-fill"] { grid-template-columns: 1fr !important; }

  /* Card body padding */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
}

/* ══════════════════════════════════════
   UTILS
   ══════════════════════════════════════ */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-accent  { color: var(--accent-light); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-gold    { color: var(--gold); }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 900; }
.hidden       { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ═══ Inline SVG Icons (emoji replacements) ═══════════════════════════════ */
.ico { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex-shrink: 0; }
.ico svg { display: block; }
.ico-sm svg { width: 14px; height: 14px; }
.ico-md svg { width: 18px; height: 18px; }
.ico-lg svg { width: 24px; height: 24px; }
.ico-xl svg { width: 36px; height: 36px; }
