/* ============================================================
   Deaths Edge — Guild Dashboard
   Full redesign: horizontal filter bar, portrait cards
   ============================================================ */

:root {
  --bg0: #0a0b0e;
  --bg1: #0f1117;
  --bg2: #141720;
  --bg3: #1c2030;
  --bg4: #252a3a;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.14);
  --gold: #c8a84b;
  --gold-light: #e8c96a;
  --gold-dim: rgba(200,168,75,0.3);
  --text-bright: #f0f2f8;
  --text: #b8bdd0;
  --text-dim: #6b7090;
  --red-bright: #e74c3c;
  --green: #2ecc71;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg0);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: linear-gradient(180deg, rgba(200,168,75,0.08) 0%, transparent 100%),
              var(--bg1);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.header-inner {
  max-width: 1800px;
  margin: 0 auto;
  padding: 16px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sword {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(200,168,75,0.6));
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(200,168,75,0.4);
  line-height: 1;
}

.subtitle {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.last-updated {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Guild stats bar in header */
.guild-stats {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  max-width: 1800px;
  margin: 0 auto;
}

.guild-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 24px;
  border-right: 1px solid var(--border);
  min-width: 100px;
}

.guild-stat:last-child { border-right: none; }

.guild-stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-weight: 600;
}

.guild-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold);
  margin-top: 2px;
  line-height: 1;
}

/* ============================================================
   FILTER BAR (horizontal)
   ============================================================ */
.filter-bar {
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-bar-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.filter-bar-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}

.filter-bar-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-pill {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.6;
}

.filter-pill:hover {
  border-color: var(--pill-color, var(--gold));
  color: var(--pill-color, var(--gold));
  background: rgba(255,255,255,0.05);
}

.filter-pill.active {
  background: var(--pill-color, var(--gold));
  border-color: var(--pill-color, var(--gold));
  color: #000;
  font-weight: 700;
}

.filter-pill.active .pill-count { opacity: 0.6; }

.pill-count {
  font-size: 0.6rem;
  opacity: 0.5;
  margin-left: 3px;
}

.level-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s;
  line-height: 1.6;
}

.level-btn:hover { border-color: var(--gold); color: var(--gold); }
.level-btn.active { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 700; }

/* Search */
.filter-search {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-bright);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  outline: none;
  width: 200px;
  line-height: 1.6;
}
.filter-search:focus { border-color: var(--gold); }
.filter-search::placeholder { color: var(--text-dim); }

/* Sort */
.sort-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-bright);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  line-height: 1.6;
}
.sort-select:focus { border-color: var(--gold); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-refresh {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.btn-refresh:hover { background: var(--gold); color: #000; }

.guild-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.3);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.guild-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.guild-toggle-btn:hover { color: var(--text-bright); background: rgba(255,255,255,0.06); }
.guild-toggle-btn.active { background: var(--bg3); color: var(--text-bright); border: 1px solid var(--border); }

.btn-compare-mode {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.6;
}
.btn-compare-mode:hover { border-color: var(--gold); color: var(--gold); }
.btn-compare-mode.active { background: rgba(200,168,75,0.15); border-color: var(--gold); color: var(--gold); font-weight: 700; }

/* ============================================================
   COMPARE BAR
   ============================================================ */
.compare-bar {
  background: rgba(200,168,75,0.08);
  border-bottom: 1px solid var(--gold-dim);
  padding: 10px 24px;
}

.compare-bar-inner {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.compare-name {
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 4px 16px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.85rem;
  min-width: 180px;
  text-align: center;
}

.vs {
  color: var(--red-bright);
  font-weight: 900;
  font-size: 1rem;
}

.btn-compare-go {
  background: var(--gold);
  border: none;
  color: #000;
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-compare-go:hover:not(:disabled) { filter: brightness(1.1); }
.btn-compare-go:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-cancel:hover { border-color: var(--red-bright); color: var(--red-bright); }

/* ============================================================
   ACTIVE CHIPS & RESULTS BAR
   ============================================================ */
.results-bar {
  max-width: 1800px;
  margin: 0 auto;
  padding: 10px 24px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 32px;
}

.result-count {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--chip-color, var(--border));
  color: var(--chip-color, var(--text));
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip-x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
}
.chip-x:hover { opacity: 1; }

.clear-all-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.15s;
}
.clear-all-btn:hover { border-color: var(--text); color: var(--text); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* ============================================================
   CHARACTER GRID — Portrait cards
   ============================================================ */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

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

.char-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px var(--class-color, var(--gold));
  border-color: var(--class-color, var(--gold));
}

.char-card.compare-selected {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px var(--gold), var(--shadow-card) !important;
}

/* Card top accent bar */
.char-card::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--class-color, var(--gold));
  opacity: 0.8;
}

/* Card portrait + info layout */
.card-body {
  display: flex;
  gap: 0;
}

.card-portrait {
  width: 90px;
  height: 110px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: var(--bg3);
}

.card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.card-portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--bg3), var(--bg4));
  color: var(--class-color, var(--gold));
  opacity: 0.4;
}

.card-portrait::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, var(--bg2));
}

.card-info {
  flex: 1;
  padding: 10px 12px 8px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.char-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.char-title-text {
  font-size: 0.65rem;
  color: var(--gold-light);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-level {
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
}

.badge-class {
  color: #000;
  font-weight: 800;
}

.badge-spec {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.badge-race {
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
}

/* ilvl prominently displayed */
.card-ilvl-block {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.char-ilvl {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--class-color, var(--gold));
  line-height: 1;
  text-shadow: 0 0 12px var(--class-color, rgba(200,168,75,0.4));
}

.char-ilvl-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Owner badge */
.char-owner {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 2px;
}

/* Stat bars at bottom */
.card-stats {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-bar-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  width: 38px;
  flex-shrink: 0;
  text-align: right;
}

.stat-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.bar-crit { background: #e74c3c; }
.bar-haste { background: #f39c12; }
.bar-mastery { background: #3498db; }
.bar-vers { background: #2ecc71; }

.stat-bar-value {
  font-size: 0.65rem;
  color: var(--text);
  width: 30px;
  flex-shrink: 0;
  font-weight: 600;
}

/* ============================================================
   EMPTY & LOADING STATES
   ============================================================ */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
  font-size: 1rem;
}

.empty-state a { color: var(--gold); text-decoration: none; }
.empty-state a:hover { text-decoration: underline; }

.loading-grid {
  display: contents;
}

.skeleton-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 160px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* ============================================================
   DETAIL MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--bg1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
}

.modal-wide { max-width: 900px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { border-color: var(--text-bright); color: var(--text-bright); }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-name {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-bright);
  line-height: 1;
}

.detail-title {
  font-size: 0.8rem;
  color: var(--gold-light);
  font-style: italic;
  margin-top: 4px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.detail-ilvl {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  text-align: right;
}

.detail-ilvl-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: right;
}

.section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 700;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gold-dim);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.stat-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}

.stat-box-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.stat-box-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-bright);
  margin-top: 4px;
}

.gear-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.gear-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.gear-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ilvl-cell { font-weight: 700; }
.q-Epic { color: #a335ee; }
.q-Rare { color: #0070dd; }
.q-Uncommon { color: #1eff00; }
.q-Common { color: #9d9d9d; }
.q-Artifact { color: #e6cc80; }
.socket-warn { color: #ffeb3b; margin-left: 4px; }

/* Compare modal */
.compare-val { font-size: 0.8rem; }
.compare-val.better { color: var(--green); font-weight: 700; }
.compare-val.worse { color: var(--red-bright); }
.compare-val.equal { color: var(--text-dim); }

/* ============================================================
   MOBILE
   ============================================================ */
/* === Mobile Responsiveness === */
@media (max-width: 768px) {
  /* Header: stack on small screens */
  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px 10px;
  }
  .header-title { flex: 1; min-width: 0; }
  h1 { font-size: 1.1rem; letter-spacing: 1px; }
  .subtitle { font-size: 0.65rem; }
  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .last-updated { font-size: 0.65rem; }

  /* Guild toggle: full width */
  .guild-toggle { width: 100%; }
  .guild-toggle-btn { flex: 1; text-align: center; padding: 6px 8px; font-size: 0.8rem; }

  /* Guild stats: wrap to 2-up grid */
  .guild-stats {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }
  .guild-stat {
    min-width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
    padding: 8px 12px;
  }
  .guild-stat-label { font-size: 0.62rem; }
  .guild-stat-value { font-size: 1rem; }

  /* View tabs: allow wrapping + smaller text */
  .view-tabs {
    padding: 0 12px;
    flex-wrap: wrap;
    gap: 0;
  }
  .view-tab {
    padding: 8px 12px;
    font-size: 0.72rem;
    flex: 1;
    text-align: center;
    white-space: nowrap;
  }

  /* Filter bar: stack sections vertically */
  .filter-bar {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }
  .filter-bar-section {
    width: 100%;
  }
  .filter-search {
    width: 100%;
    max-width: 100%;
  }
  .filter-bar-pills { flex-wrap: wrap; gap: 6px; }
  .filter-pill { font-size: 0.7rem; padding: 4px 10px; }

  /* Active chips */
  .results-bar { padding: 6px 16px; flex-wrap: wrap; gap: 6px; }

  /* Character grid: single column on phones */
  .main-content { padding: 12px 16px; }
  .character-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Character cards: adjust portrait size */
  .char-card { grid-template-columns: 56px 1fr; }
  .card-portrait { width: 56px; height: 64px; }
  .card-name { font-size: 0.9rem; }
  .char-ilvl { font-size: 1.8rem; }

  /* Leaderboard: scrollable table */
  #leaderboard-table { overflow-x: auto; }
  .lb-table { min-width: 500px; }
  .lb-val-cell { width: 160px; }

  /* Leaderboard controls: stack */
  .leaderboard-controls { flex-direction: column; gap: 12px; }

  /* Compare selection bar */
  .compare-bar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }

  /* Modals: slide up from bottom on mobile */
  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    padding: 20px 16px;
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }
  .detail-header { flex-direction: column; gap: 8px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gear-table { font-size: 0.72rem; }

  /* Back to top: smaller on mobile */
  #back-to-top { width: 36px; height: 36px; bottom: 16px; right: 16px; }
}

@media (max-width: 420px) {
  h1 { font-size: 0.95rem; }
  .guild-stat { min-width: 100%; }
  .view-tab { font-size: 0.65rem; padding: 8px 6px; }
  .character-grid { gap: 8px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* === Full-body hover tooltip === */
.fullbody-tip {
  position: absolute;
  z-index: 999;
  display: none;
  width: 200px;
  background: var(--bg1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  pointer-events: none;
}

.fullbody-tip img {
  width: 100%;
  display: block;
}

/* === View Tabs === */
.view-tabs {
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 0;
  max-width: 1800px;
  margin: 0 auto;
}

.view-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-dim);
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.view-tab:hover { color: var(--text-bright); }
.view-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* === Leaderboard === */
.leaderboard-controls {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.lb-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lb-table thead tr {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.lb-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  font-weight: 700;
}

.lb-rank-hd { width: 48px; text-align: center; }

.lb-row {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.12s;
}
.lb-row:hover { background: rgba(255,255,255,0.04); }
.lb-row:last-child { border-bottom: none; }

.lb-rank {
  text-align: center;
  font-size: 1.1rem;
  padding: 10px 8px;
  width: 48px;
}

.lb-char {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.lb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.lb-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.lb-name {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.lb-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.lb-owner-cell {
  padding: 10px 16px;
  font-size: 0.78rem;
  white-space: nowrap;
  width: 100px;
}

.lb-val-cell {
  padding: 10px 16px;
  width: 240px;
}

.lb-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.lb-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  opacity: 0.8;
}

.lb-val {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-bright);
  min-width: 60px;
  text-align: right;
}

.hidden { display: none !important; }

.content-cell {
  text-align: right;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-bright);
}

.content-total {
  font-weight: 800;
  font-size: 0.9rem;
}

/* ============================================================
   Pets Tab
   ============================================================ */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 16px 20px 40px;
}

.pet-card {
  background: var(--card-bg);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}

.pet-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.pet-quality-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  opacity: 0.8;
}

.pet-name {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 6px;
  margin-bottom: 6px;
}

.pet-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pet-fav {
  font-size: 0.7rem;
}

.pet-maxed {
  font-size: 0.62rem;
  background: var(--gold);
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.pet-level {
  font-size: 0.65rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
}

.pet-rarity {
  font-size: 0.62rem;
  opacity: 0.8;
  margin-left: auto;
}

/* === Back to top button === */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border-bright);
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, background 0.15s;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
#back-to-top:hover { background: var(--bg3); }

/* === Raid Progress Tab === */
.raid-header-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.raid-table { width: 100%; }

.raid-table-header, .raid-row {
  display: grid;
  grid-template-columns: 220px 120px 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.raid-table-header {
  font-size: 0.65rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.raid-row:hover { background: rgba(255,255,255,0.02); border-radius: 6px; }

.raid-char-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.raid-progress-text {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-left: 6px;
  white-space: nowrap;
}

.raid-progress-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.raid-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.raid-boss-cells, .raid-boss-cells-header {
  display: flex;
  gap: 3px;
}

.raid-boss-header {
  flex: 1;
  min-width: 32px;
  font-size: 0.58rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px;
  color: var(--text-dim);
}

.raid-cell {
  flex: 1;
  min-width: 32px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.raid-kill {
  background: rgba(39,174,96,0.25);
  color: #27ae60;
  border: 1px solid rgba(39,174,96,0.3);
}

.raid-miss {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.06);
}

@media (max-width: 768px) {
  .raid-table-header, .raid-row {
    grid-template-columns: 140px 80px 1fr;
    gap: 8px;
  }
  .raid-boss-header { min-width: 22px; font-size: 0.5rem; }
  .raid-cell { min-width: 22px; font-size: 0.6rem; height: 20px; }
}
