/* ============================================================
   SnoringPanda — Global Stylesheet
   Dark Theme: bg #0f0f0f | text #f5f5f5 | accent #f2c94c
   Background: background.webp (full-page, cover, fixed on desktop)
   ============================================================ */

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

:root {
  --bg:         #0f0f0f;
  --bg-alt:     #1a1a1a;
  --bg-card:    rgba(0, 0, 0, 0.62);
  --text:       #f5f5f5;
  --text-muted: #9a9a9a;
  --accent:     #f2c94c;
  --accent-dim: #c8a535;
  --border:     rgba(255, 255, 255, 0.10);
  --nav-h:      60px;
}

/* ============================================================
   DOCUMENT ROOT — full-page background
   Background lives on body::before so it never competes with
   html's paint layer and works correctly in all browsers.
   ============================================================ */

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Dark fallback shown while image loads */
  background-color: #111;
  min-height: 100%;
}

body {
  background: transparent;
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

/* ── Background image layer ──────────────────────────────────
   Fixed pseudo-element: image stays put while content scrolls.
   z-index: -1 keeps it behind everything without needing
   z-index stacking on every child.
   ──────────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('/static/images/background.webp');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  /* Lighten the dark scrim — was 0.55, now 0.35 so image shows */
  background-color: rgba(0, 0, 0, 0.35);
  background-blend-mode: multiply;
  z-index: -1;
  pointer-events: none;
}

/* MOBILE: fixed pseudo-elements cause scroll jank on iOS.
   Switch to scroll + absolute so the image still fills the page. */
@media (max-width: 768px) {
  body::before {
    position: absolute;
    min-height: 100%;
    background-attachment: scroll;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

/* ============================================================
   TOP NAVIGATION
   ============================================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  /* Semi-transparent with blur so background shows through */
  background-color: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

/* Hamburger button (left on mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Logo / brand */
.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-right: auto;
}

.nav-logo:hover {
  color: var(--accent-dim);
}

/* Nav brand block (logo image + site name) */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  text-decoration: none;
}

.nav-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-brand__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-brand:hover .nav-brand__title {
  color: var(--accent-dim);
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: filter 0.15s, background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  filter: brightness(1.25);
  background-color: rgba(242, 201, 76, 0.10);
  color: var(--accent);
}

/* ============================================================
   MOBILE NAV
   ============================================================ */

@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background-color: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem 1rem;
  }

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

  .nav-links a {
    width: 100%;
    padding: 0.65rem 0.75rem;
  }

  /* Hamburger → X animation */
  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ============================================================
   HERO / CLAN HEADER
   ============================================================ */

.clan-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.clan-hero__emblem {
  display: block;
  /* Exact integer px — no vw/rem fractions that cause sub-pixel blur */
  width: 280px;
  height: 280px;
  object-fit: contain;
  margin: 0 auto 1.5rem;
  /* No filter at all — filter forces GPU compositing layer = softness */
  /* No image-rendering override — browser's default bicubic is best for
     high-res logos being downscaled (crisp-edges is for pixel art only) */
}

/* Shrink on small phones but stay at integer steps */
@media (max-width: 480px) {
  .clan-hero__emblem {
    width: 200px;
    height: 200px;
  }
}

/* Wordmark image — replaces the plain h1 text */
.hero-wordmark {
  width: min(680px, 82vw);
  height: auto;
  display: block;
  margin: 1.25rem auto 0.75rem auto;
  object-fit: contain;
  /* No filter/transform — keep rendering pipeline clean */
}

.clan-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
  font-family: 'Courier New', monospace;
  /* Link reset — never show default blue underline */
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  transition: color 0.2s, text-shadow 0.2s, background-color 0.2s;
}

.clan-hero__tag:hover,
.clan-hero__tag:focus-visible {
  color: #c8c8c8;
  text-shadow: 0 0 10px rgba(200, 200, 200, 0.35);
  background-color: rgba(255, 255, 255, 0.05);
  outline: none;
}

.clan-hero__tag-icon {
  font-size: 0.75em;
  opacity: 0.55;
  font-family: system-ui, sans-serif;       /* arrow from system font, not monospace */
  transition: opacity 0.2s, transform 0.2s;
  line-height: 1;
}

/* ============================================================
   SECTION CARDS
   ============================================================ */

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

@media (min-width: 600px) {
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .section-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(242, 201, 76, 0.15);
}

/* ── Clickable card variant ───────────────────────────────── */

a.card,
.card--link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

a.card *,
.card--link * {
  pointer-events: none;   /* prevent child element conflicts */
}

.card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 0.9rem;
  color: var(--accent);           /* SVGs using currentColor will inherit */
  font-size: 2rem;                /* emoji icons scale with this */
  line-height: 1;
}

.card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.card__desc {
  font-size: 0.875rem;
  color: #e5e7eb;
  line-height: 1.55;
}

.card__badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============================================================
   MEMBERS PAGE
   ============================================================ */

.members-page {
  padding: 1.5rem 0 3rem;
}

/* ── Clan summary banner ──────────────────────────────────── */

.clan-summary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}

.clan-summary__badge {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}

.clan-summary__info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.clan-summary__name {
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
}

.clan-summary__tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

.clan-summary__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin-top: 0.35rem;
}

.clan-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.clan-stat__icon { font-size: 0.85rem; line-height: 1; }
.clan-stat__value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.clan-stat__label { color: var(--text-muted); }

@media (max-width: 480px) {
  .clan-summary {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .clan-summary__stats { justify-content: center; }
}

/* ── Controls row (legend + sort card side-by-side) ──────── */

.controls-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

/* ── Member card grid ─────────────────────────────────────── */

.members-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .members-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 860px) {
  .members-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Individual member card ───────────────────────────────── */

.member-card {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.member-card:hover {
  border-color: rgba(242, 201, 76, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 201, 76, 0.10);
}

/* ── Card header: league icon + name/role + rank ─────────── */

.member-card__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.member-card__league {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-card__league img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.member-card__league-placeholder {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.member-card__identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.member-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  width: fit-content;
}

/* Role colour variants */
.member-role--leader   { background: rgba(242,201,76,0.22);  color: #f2c94c; }
.member-role--coLeader { background: rgba(229,156,50,0.22);  color: #e59c32; }
.member-role--admin    { background: rgba(100,180,255,0.18); color: #7dc4ff; }
.member-role--member   { background: rgba(255,255,255,0.07); color: #9a9a9a; }

/* Rank badge — top-right of header */
.member-rank {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  align-self: flex-start;
}

/* ── Stats grid ───────────────────────────────────────────── */

.member-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem 0.4rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.mstat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.77rem;
  white-space: nowrap;
}

.mstat__ico { font-size: 0.78rem; line-height: 1; }

.mstat__lbl {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Trophy stat gets gold colour */
.mstat--trophy .mstat__lbl { color: var(--accent); }

/* ── API error / empty state ──────────────────────────────── */

.api-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,80,80,0.25);
  border-radius: 12px;
  color: #fca5a5;
  max-width: 480px;
  margin: 2rem auto;
}

.api-error__icon { font-size: 2rem; }

/* clan-tag used in error messages */
.clan-tag {
  color: var(--accent);
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

/* ── Icon legend card ─────────────────────────────────────── */

.legend {
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 420px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.18s;
}

.legend:hover {
  border-color: rgba(250, 204, 21, 0.2);
}

.legend__toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Remove default <details> marker cross-browser */
.legend__toggle::-webkit-details-marker { display: none; }
.legend__toggle::marker               { display: none; }

.legend__toggle:hover { color: var(--accent); }

.legend__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.62rem;
  flex-shrink: 0;
  font-style: italic;
}

.legend__toggle-caret {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s;
  color: var(--accent);
}

details[open] .legend__toggle-caret { transform: rotate(180deg); }

.legend__body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.7rem;
  padding: 0.45rem 0.9rem 0.7rem;
  border-top: 1px solid var(--border);
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.legend__ico  { font-size: 0.8rem; line-height: 1; }
.legend__text { color: var(--text-muted); }

/* ── Sort card ────────────────────────────────────────────── */

.sort-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.9rem 0.7rem;
  transition: border-color 0.18s;
  min-width: 200px;
}

.sort-card:focus-within {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.15);
}

.sort-card__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.sort-card__select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255, 255, 255, 0.04);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23facc15'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 8px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s, background-color 0.18s;
  width: 100%;
}

.sort-card__select:hover {
  border-color: rgba(250, 204, 21, 0.4);
  background-color: rgba(255, 255, 255, 0.07);
}

.sort-card__select:focus {
  border-color: rgba(250, 204, 21, 0.6);
  background-color: rgba(255, 255, 255, 0.07);
}

.sort-card__select option {
  background: #1a1505;
  color: var(--text);
}

/* ── Controls row mobile stack ────────────────────────────── */

@media (max-width: 540px) {
  .controls-row {
    flex-direction: column;
  }
  .legend,
  .sort-card {
    max-width: 100%;
    width: 100%;
    min-width: unset;
  }
}

/* ============================================================
   CLAN PAGE — /clan
   Premium guild profile: dark, atmospheric, gold accents.
   ============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */

.clan-page {
  padding: 1.5rem 0 4rem;
}

/* ── Hero section ─────────────────────────────────────────── */

.clan-page__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  gap: 0.6rem;
}

.clan-page__badge {
  width: 120px;
  height: 120px;
  object-fit: contain;
  /* Subtle glow behind the badge */
  filter: drop-shadow(0 0 18px rgba(242, 201, 76, 0.30));
  margin-bottom: 0.5rem;
}

.clan-page__name {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 16px rgba(242, 201, 76, 0.25);
}

.clan-page__desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.65;
  margin-top: 0.15rem;
}

/* ── Pill badges row ──────────────────────────────────────── */

.clan-page__pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.clan-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  white-space: nowrap;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.clan-pill--level {
  background: rgba(242, 201, 76, 0.12);
  border-color: rgba(242, 201, 76, 0.35);
  color: var(--accent);
}

.clan-pill--type {
  background: rgba(100, 180, 255, 0.10);
  border-color: rgba(100, 180, 255, 0.30);
  color: #7dc4ff;
}

.clan-pill--location {
  background: rgba(160, 220, 120, 0.10);
  border-color: rgba(160, 220, 120, 0.28);
  color: #a8d87a;
}

.clan-pill--league {
  background: rgba(220, 160, 60, 0.12);
  border-color: rgba(220, 160, 60, 0.32);
  color: #e8b84b;
}

.clan-pill--capital {
  background: rgba(180, 120, 255, 0.12);
  border-color: rgba(180, 120, 255, 0.30);
  color: #c59fff;
}

/* Larger pill variant used in section headers */
.clan-pill--lg {
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
}

/* ── Label chips (with icon image) ───────────────────────── */

.clan-page__labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.clan-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.22rem 0.65rem 0.22rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(242, 201, 76, 0.09);
  border: 1px solid rgba(242, 201, 76, 0.25);
  color: var(--accent);
  white-space: nowrap;
}

.clan-label-chip__icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Stats grid ───────────────────────────────────────────── */

.clan-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}

@media (min-width: 560px) {
  .clan-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 860px) {
  .clan-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Individual stat card ─────────────────────────────────── */

.cstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  padding: 1.1rem 0.75rem 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.cstat:hover {
  border-color: rgba(242, 201, 76, 0.40);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 201, 76, 0.08);
}

/* Accented variant — war wins */
.cstat--highlight {
  border-color: rgba(242, 201, 76, 0.22);
  background: rgba(242, 201, 76, 0.06);
}

/* Fire variant — win streak */
.cstat--fire {
  border-color: rgba(255, 120, 40, 0.28);
  background: rgba(255, 120, 40, 0.06);
}

.cstat--fire .cstat__value {
  color: #ff9555;
}

/* Inline variant — used inside section cards */
.cstat--inline {
  flex-direction: row;
  text-align: left;
  padding: 0.7rem 1rem;
  gap: 0.55rem;
  align-items: center;
}

.cstat--inline .cstat__icon { font-size: 1.1rem; }
.cstat--inline .cstat__value { font-size: 0.95rem; }
.cstat--inline .cstat__label { font-size: 0.72rem; }

.cstat__icon {
  font-size: 1.5rem;
  line-height: 1;
}

.cstat__value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.cstat__denom {
  font-size: 0.75em;
  color: var(--text-muted);
  font-weight: 500;
}

.cstat__label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  line-height: 1.3;
}

/* War log visibility colours */
.cstat__value--public  { color: #6ee77b; }
.cstat__value--private { color: #ff8080; }

/* ── Section cards ────────────────────────────────────────── */

.clan-section {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.18s;
}

.clan-section:hover {
  border-color: rgba(242, 201, 76, 0.20);
}

.clan-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.clan-section__league-row {
  margin-bottom: 0.85rem;
}

.clan-section__sub-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Scoreboard ───────────────────────────────────────────── */

.clan-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  background: rgba(0, 0, 0, 0.30);
  border-radius: 10px;
  margin-bottom: 0.9rem;
}

.clan-scoreboard__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 70px;
}

.clan-scoreboard__val {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.clan-scoreboard__lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.clan-scoreboard__item--wins   .clan-scoreboard__val { color: #6ee77b; }
.clan-scoreboard__item--losses .clan-scoreboard__val { color: #ff8080; }
.clan-scoreboard__item--ties   .clan-scoreboard__val { color: #9a9a9a; }

.clan-scoreboard__sep {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.15);
  user-select: none;
  padding: 0 0.2rem;
  align-self: center;
  line-height: 1;
}

/* ── Win streak row ───────────────────────────────────────── */

.clan-section__streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.2rem;
}

.clan-section__streak-icon { font-size: 1rem; line-height: 1; }

.clan-section__streak-val {
  font-size: 1rem;
  font-weight: 800;
  color: #ff9555;
  font-variant-numeric: tabular-nums;
}

.clan-section__streak-lbl {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Capital meta row ─────────────────────────────────────── */

.clan-section__capital-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* ── District chips ───────────────────────────────────────── */

.clan-section__districts {
  margin-top: 0.25rem;
}

.clan-section__district-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.clan-district-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.73rem;
  color: var(--text);
  white-space: nowrap;
}

.clan-district-chip__name {
  color: var(--text);
  font-weight: 500;
}

.clan-district-chip__level {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.68rem;
}

/* ── Clan page mobile tweaks ──────────────────────────────── */

@media (max-width: 480px) {
  .clan-page__hero {
    padding: 2rem 0.5rem 1.5rem;
  }

  .clan-page__badge {
    width: 96px;
    height: 96px;
  }

  .clan-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .clan-section {
    padding: 1.1rem 1rem 1.2rem;
  }

  .clan-scoreboard__val {
    font-size: 1.5rem;
  }

  .clan-scoreboard__item {
    min-width: 56px;
  }
}

/* ============================================================
   PLAYER PAGE — /player/{tag}
   MMO character profile: dark, atmospheric, gold accents.
   ============================================================ */

/* ── Back link ─────────────────────────────────────────────── */

.player-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  margin-bottom: 1.25rem;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.player-back:hover {
  color: var(--accent);
  border-color: rgba(250,204,21,0.35);
  background: rgba(250,204,21,0.06);
}

/* ── Page wrapper ──────────────────────────────────────────── */
.player-page { padding: 1.25rem 0 4rem; }

/* ── Hero section ──────────────────────────────────────────── */
.player-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem 1.75rem;
  gap: 0.55rem;
}
.player-hero__league {
  width: 80px; height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(242,201,76,0.35));
  margin-bottom: 0.25rem;
}
.player-hero__name {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 14px rgba(242,201,76,0.22);
}
.player-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  user-select: none;
}
.player-hero__tag:hover {
  color: #c8c8c8;
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.player-hero__tag-copy {
  font-size: 0.7rem;
  color: #6ee77b;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.player-hero__tag-copy.visible { opacity: 1; }
.player-hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.player-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  white-space: nowrap;
}
.player-badge--th   { background: rgba(242,201,76,0.10); border-color: rgba(242,201,76,0.30); color: var(--accent); }
.player-badge--xp   { background: rgba(100,200,120,0.10); border-color: rgba(100,200,120,0.28); color: #7ed49a; }
.player-badge--role { background: rgba(220,160,60,0.10); border-color: rgba(220,160,60,0.28); color: #e8b84b; }
.player-badge--war  { background: rgba(255,100,100,0.08); border-color: rgba(255,100,100,0.22); color: #ff9090; }
.player-hero__clan {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: rgba(0,0,0,0.35);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 0.15rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s, background 0.18s;
}
.player-hero__clan:hover { border-color: rgba(250,204,21,0.3); background: rgba(250,204,21,0.05); }
.player-hero__clan-badge { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.player-hero__clan-name  { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.player-hero__clan-role  { font-size: 0.72rem; color: var(--text-muted); margin-left: 0.1rem; }
.player-hero__clan-arrow { font-size: 0.65rem; color: var(--text-muted); margin-left: auto; opacity: 0.6; }
.player-hero__labels {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem;
}
.player-label-chip {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.2rem 0.6rem 0.2rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(242,201,76,0.08);
  border: 1px solid rgba(242,201,76,0.22);
  color: var(--accent); white-space: nowrap;
}
.player-label-chip img { width: 16px; height: 16px; object-fit: contain; border-radius: 50%; }

/* ── Player stats grid ─────────────────────────────────────── */
.player-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 0.25rem 0 1.5rem;
}
@media (min-width: 480px) { .player-stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .player-stats-grid { grid-template-columns: repeat(5, 1fr); } }
.pstat {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.18rem; padding: 0.9rem 0.5rem 0.8rem;
  background: var(--bg-card);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 12px;
  transition: border-color 0.18s, transform 0.18s;
}
.pstat:hover { border-color: rgba(242,201,76,0.35); transform: translateY(-2px); }
.pstat__icon  { font-size: 1.3rem; line-height: 1; }
.pstat__value { font-size: 0.98rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.2; }
.pstat__label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; line-height: 1.3; }

/* ── Player section card ───────────────────────────────────── */
.player-section {
  background: var(--bg-card);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 1.3rem 1.4rem 1.4rem; margin-bottom: 1.1rem;
  transition: border-color 0.18s;
}
.player-section:hover { border-color: rgba(242,201,76,0.18); }
.player-section__title {
  font-size: 0.95rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.03em; margin-bottom: 1rem;
  padding-bottom: 0.55rem; border-bottom: 1px solid var(--border);
}

/* ── Heroes grid ───────────────────────────────────────────── */
.hero-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem;
}
@media (min-width: 480px) { .hero-grid { grid-template-columns: repeat(4, 1fr); } }
.hero-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.4rem; padding: 0.9rem 0.6rem 0.8rem;
  background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.18s, transform 0.18s;
}
.hero-card:hover { border-color: rgba(242,201,76,0.4); transform: translateY(-2px); }
.hero-card--maxed { border-color: rgba(110,231,123,0.35); background: rgba(110,231,123,0.05); }
.hero-card__name  { font-size: 0.73rem; font-weight: 700; color: var(--text); letter-spacing: 0.02em; line-height: 1.25; }
.hero-card__level { font-size: 0.85rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.hero-card--maxed .hero-card__level { color: #6ee77b; }
.hero-card__bar   { width: 100%; height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.hero-card__fill  { height: 100%; background: linear-gradient(90deg, #c09010 0%, #facc15 100%); border-radius: 3px; transition: width 0.4s ease; }
.hero-card--maxed .hero-card__fill { background: linear-gradient(90deg, #3a9a4a 0%, #6ee77b 100%); }
.hero-card__maxed-badge { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; color: #6ee77b; text-transform: uppercase; background: rgba(110,231,123,0.12); border-radius: 3px; padding: 0.06rem 0.3rem; }

/* ── Troops / Spells grid ──────────────────────────────────── */
.troop-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem;
}
@media (min-width: 480px) { .troop-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 680px) { .troop-grid { grid-template-columns: repeat(6, 1fr); } }
.troop-chip {
  display: flex; flex-direction: column; align-items: center; gap: 0.18rem;
  padding: 0.5rem 0.3rem 0.45rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 8px;
  text-align: center; cursor: default;
  transition: border-color 0.15s, background 0.15s;
}
.troop-chip:hover { border-color: rgba(242,201,76,0.28); background: rgba(242,201,76,0.04); }
.troop-chip--maxed { border-color: rgba(110,231,123,0.28); background: rgba(110,231,123,0.04); }
.troop-chip__name  { font-size: 0.58rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; line-height: 1.25; word-break: break-word; hyphens: auto; }
.troop-chip__level { font-size: 0.72rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.troop-chip--maxed .troop-chip__level { color: #6ee77b; }
.troop-chip__max-dot { width: 5px; height: 5px; background: #6ee77b; border-radius: 50%; flex-shrink: 0; }

/* ── Achievements ──────────────────────────────────────────── */
.achievement-list { display: flex; flex-direction: column; gap: 0.6rem; }
.achievement-item {
  padding: 0.65rem 0.9rem;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 9px;
  transition: border-color 0.15s;
}
.achievement-item:hover { border-color: rgba(242,201,76,0.2); }
.achievement-item--complete { border-color: rgba(242,201,76,0.18); background: rgba(242,201,76,0.04); }
.ach-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.ach-name     { font-size: 0.78rem; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.ach-stars    { font-size: 0.72rem; flex-shrink: 0; color: var(--accent); letter-spacing: 0.05em; }
.ach-progress { font-size: 0.68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-bottom: 0.3rem; }
.ach-bar  { height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden; }
.ach-fill { height: 100%; background: linear-gradient(90deg, #a07010 0%, #facc15 100%); border-radius: 2px; transition: width 0.4s ease; }
.achievement-item--complete .ach-fill { background: linear-gradient(90deg, #3a9a4a 0%, #6ee77b 100%); }

/* ── Clickable member cards ────────────────────────────────── */
a.member-card {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

/* ── Player page mobile tweaks ─────────────────────────────── */
@media (max-width: 480px) {
  .player-hero { padding: 1.5rem 0.5rem 1.25rem; }
  .player-hero__league { width: 64px; height: 64px; }
  .player-section { padding: 1rem 0.9rem 1.1rem; }
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
}
