/* ============================================================
   THE MAIN GAME LIST — dark theme, pastel green accent
   ============================================================ */

:root {
  --bg: #0d0f0e;
  --bg-elevated: #141715;
  --surface: #181d1a;
  --surface-hover: #1f2521;
  --border: #262d28;
  --border-soft: #1d231f;

  --accent: #9fe6b8;
  --accent-strong: #7bcf9a;
  --accent-wash: rgba(159, 230, 184, 0.1);
  --accent-wash-strong: rgba(159, 230, 184, 0.18);

  --text: #eef5f0;
  --text-muted: #9aa8a1;
  --text-faint: #647069;

  --tier-main: #9fe6b8;
  --tier-extra: #e6cf9f;
  --tier-legacy: #8a8f8d;

  --success: #8fd6a8;
  --warning: #e6cf9f;
  --error: #e69f9f;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --transition: all 0.18s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Roboto', system-ui, sans-serif;
  background: radial-gradient(circle at 20% 0%, #10140f 0%, var(--bg) 45%);
  color: var(--text);
  line-height: 1.55;
}

h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; }

a { color: var(--accent); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }

.brand-btn { background: none; border: none; cursor: pointer; padding: 0; }

.nav-group { position: relative; }
.nav-link-dev { color: var(--accent); }

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 200px;
  padding: 0.4rem;
  z-index: 1100;
  animation: fadeIn 0.15s ease;
}
.nav-dropdown.open { display: block; }

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.nav-dropdown-item:hover { background: var(--surface); color: var(--text); }
.nav-dropdown-item.active { color: var(--accent); background: var(--accent-wash); }

.profile-menu-wrap { position: relative; }
.profile-dropdown { left: auto; right: 0; }

/* ========== LANDING / INFORMATION ========== */
.landing-view { padding: 0; }
.landing-hero {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  animation: fadeIn 0.4s ease;
}
.landing-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.landing-hero p { color: var(--text-muted); max-width: 480px; margin: 0 auto 2rem; }
.btn-large { padding: 0.9rem 2.2rem; font-size: 1rem; }

.landing-changelog { max-width: 700px; margin: 0 auto; padding: 0 1.5rem 3rem; }
.landing-changelog h2 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--text-muted); }
.changelog-feed { display: grid; gap: 1rem; }
.changelog-entry {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  animation: fadeIn 0.25s ease backwards;
}
.changelog-entry h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.changelog-entry .ce-date { font-size: 0.75rem; color: var(--text-faint); margin-bottom: 0.5rem; }
.changelog-entry p { color: var(--text-muted); font-size: 0.88rem; }

/* ========== QUEUE FILTERS ========== */
.queue-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-select-sm {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
}
.filter-select-sm:focus { outline: none; border-color: var(--accent); }

.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.status-pill.pending { background: rgba(230, 207, 159, 0.15); color: var(--tier-extra); }
.status-pill.in_review { background: var(--accent-wash); color: var(--accent); }
.status-pill.approved { background: rgba(143, 214, 168, 0.15); color: var(--success); }
.status-pill.rejected { background: rgba(230, 159, 159, 0.15); color: var(--error); }

.claim-btn, .unclaim-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.claim-btn:hover { border-color: var(--accent); color: var(--accent); }
.unclaim-btn:hover { border-color: var(--error); color: var(--error); }

.face-picker, .coin-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.face-option, .coin-option {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.face-option:hover, .coin-option:hover { color: var(--text); }
.face-option.selected, .coin-option.selected { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }

/* ========== TIER COLORS (pending added) ========== */
.demon-row-rank.tier-pending { color: #b0b0b0; border-color: #b0b0b0; }
.tier-badge.tier-pending { background: rgba(176,176,176,0.12); color: #b0b0b0; border-color: #b0b0b0; }

.pending-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  background: rgba(230, 207, 159, 0.15);
  color: var(--tier-extra);
  border: 1px solid var(--tier-extra);
}

/* ========== ROLE BADGES ========== */
.role-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
  margin-top: 0.3rem;
}

/* ========== ROLE COLOR EDITOR ========== */
.role-color-editor { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.role-color-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
input[type="color"] {
  width: 40px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  padding: 2px;
}

/* ========== NAV LINK COLORS ========== */
.nav-link-dev { color: #A80000 !important; }
.nav-link-listmod { color: #00FFD5 !important; }

/* ========== CAPACITY WARNING ========== */
#editor-main-capacity-warning { margin-bottom: 1rem; }

/* ========== PENDING TAG GROUP toggle ========== */
#editor-pending-tag-group { transition: var(--transition); }

/* ========== DEVELOPER PANEL ========== */
.dev-content-grid { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ========== NAVBAR ========== */
.navbar {
  background: rgba(13, 15, 14, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0.9rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.navbar-brand h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent); background: var(--accent-wash); }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.auth-display {
  font-size: 0.82rem;
  color: var(--text-faint);
  padding: 0 0.5rem;
}

/* ========== BUTTONS ========== */
.btn-accent, .btn-ghost, .btn-ghost-sm, .btn-icon, .link-btn {
  font: inherit;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

.btn-accent {
  background: var(--accent);
  color: #07120c;
  border: none;
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  font-size: 0.9rem;
}
.btn-accent:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0) scale(0.97); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  font-size: 0.88rem;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-ghost-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
  overflow: hidden;
}
.btn-icon img { width: 100%; height: 100%; object-fit: cover; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  font-size: 0.85rem;
  display: block;
  margin: 1rem auto 0;
}
.link-btn:hover { color: var(--text); }

/* ========== APP SHELL / VIEWS ========== */
.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.75rem;
  min-height: calc(100vh - 64px);
}

.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

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

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.view-header { margin-bottom: 1.5rem; }
.view-header h2 { font-size: 1.6rem; font-weight: 800; color: var(--text); margin-bottom: 0.3rem; }
.view-header p { color: var(--text-muted); }

/* ========== LIST VIEW: two pane ========== */
#list-view.active {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 110px);
}

.list-pane {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.list-pane-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

#search-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
}
#search-input:focus { outline: none; border-color: var(--accent); }

.filter-row { display: flex; gap: 0.4rem; }

.filter-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }

.demon-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
}

.demon-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  animation: fadeIn 0.2s ease backwards;
}
.demon-row:hover { background: var(--surface); transform: translateX(2px); }
.demon-row.selected { background: var(--accent-wash); border-color: var(--accent); }

.demon-row-rank {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.demon-row-rank.tier-main { color: var(--tier-main); border-color: var(--tier-main); }
.demon-row-rank.tier-extra { color: var(--tier-extra); border-color: var(--tier-extra); }
.demon-row-rank.tier-legacy { color: var(--tier-legacy); border-color: var(--tier-legacy); }

.demon-row-face { flex-shrink: 0; display: flex; align-items: center; }
.coin-row { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 0.3rem; }

.demon-row-info { min-width: 0; }
.demon-row-info h4 { font-size: 0.92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demon-row-info p { font-size: 0.78rem; color: var(--text-faint); }

/* ========== DETAIL PANE ========== */
.detail-pane {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  position: relative;
}

.empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.empty-state-copy h2 { color: var(--text-muted); margin-bottom: 0.4rem; }
.empty-state-copy p { color: var(--text-faint); }

.detail-content { padding: 1.75rem; animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1); }

.mobile-back {
  display: none;
  background: none; border: none; color: var(--accent);
  font: inherit; font-weight: 600; cursor: pointer;
  margin-bottom: 1rem;
}

.detail-header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.3rem; }

.tier-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.tier-badge.tier-extra { background: rgba(230, 207, 159, 0.12); color: var(--tier-extra); border-color: var(--tier-extra); }
.tier-badge.tier-legacy { background: rgba(138, 143, 141, 0.12); color: var(--tier-legacy); border-color: var(--tier-legacy); }

.rank-pill {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.detail-header h2 { font-size: 1.5rem; font-weight: 800; flex-basis: 100%; }
.detail-sub { color: var(--text-faint); margin-bottom: 1.25rem; }

.video-frame {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.video-frame iframe { width: 100%; height: 100%; border: 0; }

.detail-tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border-soft); margin-bottom: 1.25rem; }
.tab-btn {
  background: none; border: none; color: var(--text-muted);
  font: inherit; font-weight: 700; font-size: 0.88rem;
  padding: 0.6rem 0.2rem; margin-right: 1.25rem;
  cursor: pointer; position: relative;
}
.tab-btn.active { color: var(--accent); }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent);
}

.tab-panel.hidden { display: none; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
}
.stat-value { display: block; font-family: 'Poppins', sans-serif; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; }

.meta-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.5rem; margin-bottom: 1.25rem; }
.meta-list dt { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 0.15rem; }
.meta-list dd { font-size: 0.92rem; font-weight: 600; }

.password-row {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.password-copy-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit; font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.password-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-icon { font-size: 0.9rem; }
.copy-confirm { color: var(--success); font-size: 0.82rem; font-weight: 700; }

.detail-description { color: var(--text-muted); margin-bottom: 1.25rem; }

.first-victor {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--accent-wash);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}
.fv-icon { font-size: 1.1rem; }

.rank-suggest-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem;
}
.rank-suggest-box h4 { font-size: 0.92rem; margin-bottom: 0.2rem; }

.inline-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.inline-form input { flex: 1; padding: 0.5rem 0.7rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }

.records-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.record-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.record-row .rec-player { font-weight: 700; }
.record-row .rec-meta { font-size: 0.8rem; color: var(--text-faint); }
.record-row a { font-size: 0.82rem; font-weight: 600; }

/* ========== LEADERBOARD ========== */
.leaderboard-list { list-style: none; display: grid; gap: 0.6rem; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: var(--transition);
}
.leaderboard-row:hover { border-color: var(--accent); transform: translateX(3px); }
.lb-rank { font-family: 'Poppins', sans-serif; font-weight: 800; color: var(--accent); text-align: center; }
.lb-name { font-weight: 700; }
.lb-tiers { font-size: 0.78rem; color: var(--text-faint); }
.lb-points { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--accent); text-align: right; }

/* ========== CLANS ========== */
.clans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.clan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}
.clan-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.clan-tag { display: inline-block; background: var(--accent-wash); color: var(--accent); font-weight: 800; font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 6px; margin-bottom: 0.5rem; }
.clan-card h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.clan-card .clan-points { color: var(--accent); font-weight: 700; }

/* ========== PROFILE ========== */
.profile-header {
  display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem;
  flex-wrap: wrap;
  animation: fadeIn 0.3s ease;
}
.profile-header img {
  width: 80px; height: 80px; border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface);
  object-fit: cover;
}
.profile-header h2 { font-size: 1.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.profile-header .flag { font-size: 1.3rem; }
.profile-header .gd-username { color: var(--text-faint); font-size: 0.9rem; font-weight: 500; }

.rank-badges { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.rank-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}
.rank-badge .rb-icon { color: var(--accent); }

.modal-content-wide { max-width: 640px; }

.rich-text {
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1.25rem;
}
.rich-text strong { color: var(--text); font-weight: 700; }
.rich-text ul { list-style: none; padding-left: 0; margin: 0.5rem 0; }
.rich-text li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.4rem;
}
.rich-text li::before {
  content: '';
  position: absolute;
  left: 0.2rem;
  top: 0.65em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.rules-edit-actions { display: flex; gap: 0.6rem; }
#rules-edit-textarea { font-family: 'Roboto', sans-serif; resize: vertical; min-height: 220px; }

.profile-bio {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.profile-bio strong { color: var(--text); font-weight: 700; }
.profile-bio.empty { color: var(--text-faint); font-style: italic; }

.completions-section h3 { font-size: 1.05rem; margin-bottom: 0.75rem; }
.completions-list { list-style: none; display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.completion-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  animation: fadeIn 0.2s ease backwards;
  transition: var(--transition);
}
.completion-row:hover { border-color: var(--accent); transform: translateX(2px); }
.completion-row .cr-title { font-weight: 700; font-size: 0.92rem; }
.completion-row .cr-meta { font-size: 0.78rem; color: var(--text-faint); }
.completion-row .cr-points { color: var(--accent); font-weight: 800; font-family: 'Poppins', sans-serif; }

/* ========== MODALS ========== */
.modal {
  position: fixed; inset: 0;
  background: rgba(5, 6, 5, 0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 1rem;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h2 { margin-bottom: 0.4rem; }

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.6rem; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.88rem; }

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }

.form-message { margin-top: 0.6rem; font-size: 0.85rem; display: none; }
.form-message.show { display: block; }
.form-message.error { color: var(--error); }
.form-message.success { color: var(--success); }

.divider { border: none; border-top: 1px solid var(--border-soft); margin: 1.5rem 0; }

.auth-prompt { text-align: center; padding: 1.5rem 0; }
.auth-prompt p { margin-bottom: 1rem; color: var(--text-muted); }

/* ========== ADMIN QUEUE ========== */
.admin-queue { display: grid; gap: 1rem; }
.admin-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.admin-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.admin-card h4 { font-size: 1rem; }
.admin-card .ac-meta { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.2rem; }
.admin-links { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; font-size: 0.85rem; }
.admin-actions { display: flex; gap: 0.6rem; }
.btn-approve, .btn-reject {
  flex: 1; padding: 0.5rem; border-radius: var(--radius-sm); border: 1px solid; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  background: transparent;
}
.btn-approve { color: var(--success); border-color: var(--success); }
.btn-approve:hover { background: rgba(143, 214, 168, 0.12); }
.btn-reject { color: var(--error); border-color: var(--error); }
.btn-reject:hover { background: rgba(230, 159, 159, 0.12); }

/* ========== ERROR / LOADING ========== */
.loading { text-align: center; padding: 2.5rem; color: var(--text-faint); }
.db-error {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-width: 320px;
  z-index: 3000;
  box-shadow: var(--shadow);
}
.db-error h2 { font-size: 0.95rem; color: var(--error); margin-bottom: 0.3rem; }
.db-error p { font-size: 0.85rem; color: var(--text-muted); }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .app-shell { padding: 1rem; }

  #list-view.active {
    grid-template-columns: 1fr;
    height: auto;
    gap: 0;
  }
  .list-pane { height: calc(100vh - 120px); border-radius: var(--radius-lg); }
  .detail-pane { display: none; }
  .detail-pane.mobile-open {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    height: calc(100vh - 64px);
    border-radius: 0;
    z-index: 500;
    animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .list-pane.mobile-collapsed { display: none; }
  .mobile-back { display: block; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-list { grid-template-columns: 1fr; }

  .leaderboard-row { grid-template-columns: 36px 1fr auto; padding: 0.85rem 1rem; gap: 0.6rem; }
  .clans-grid { grid-template-columns: 1fr 1fr; gap: 0.85rem; }
}

@media (max-width: 640px) {
  .navbar-container { flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 1rem; }
  .nav-menu {
    order: 3; flex-basis: 100%;
    gap: 0.2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link { white-space: nowrap; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
  .auth-display { display: none; }
  .navbar-brand h1 { font-size: 1rem; }

  .view-header h2 { font-size: 1.3rem; }
  .clans-grid { grid-template-columns: 1fr; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .stat-box { padding: 0.65rem; }
  .stat-value { font-size: 1.1rem; }

  .modal-content { padding: 1.25rem; max-height: 85vh; }

  /* All tap targets at least 44px tall on touch screens */
  .btn-accent, .btn-ghost, .btn-ghost-sm, .filter-btn, .tab-btn, .nav-link {
    min-height: 40px;
  }

  .profile-header { flex-direction: column; text-align: center; }
  .profile-header h2 { justify-content: center; }
  .profile-header button { margin: 0 auto !important; }

  .completion-row { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
}

@media (max-width: 380px) {
  .demon-row-info h4 { font-size: 0.85rem; }
  .filter-row { flex-wrap: wrap; }
  .filter-btn { flex: 1 1 calc(50% - 0.2rem); }
}
