/* ═══════════════════════════════════════════════════════════════════
   PALIA HUB — styles.css
   Visual theme modeled after heartopia.gg · Palia fan guide
   ═══════════════════════════════════════════════════════════════════
   TABLE OF CONTENTS
   01. CSS Variables & Design Tokens
   02. Reset & Base
   03. Layout & Containers
   04. ── NAVIGATION ──
       04a. Top Utility Bar
       04b. Main Site Nav (white, fixed)
       04c. Dropdown Menus
       04d. Mobile Sidebar Nav
   05. Hero Sections
   06. Breadcrumbs
   07. Cards & Route Grids
   08. Stats Display Blocks
   09. Tables (responsive, zebra)
   10. Code Display Blocks
   11. FAQ Accordion (pure CSS)
   12. Callouts & Notices
   13. Badges & Tags
   14. Buttons & Forms
   15. Sidebar & Table-of-Contents
   16. Footer (3-column)
   17. Page-Specific Overrides
   18. Tools & Interactive Components
   19. Utility Classes
   20. Responsive Breakpoints
   ═══════════════════════════════════════════════════════════════════ */


/* ─────────────────────────────────────────────────────────────────
   01. CSS VARIABLES & DESIGN TOKENS
   ───────────────────────────────────────────────────────────────── */
:root {
  /* Primary — Forest Green (Palia nature palette) */
  --clr-primary:        #6B8F71;
  --clr-primary-dark:   #4A7C59;
  --clr-primary-deeper: #3A6147;
  --clr-primary-light:  #8FAF95;
  --clr-primary-xlight: #E8F0EA;
  --clr-primary-xxlight:#F2F7F3;

  /* Secondary — Warm Gold */
  --clr-gold:           #C4A45A;
  --clr-gold-dark:      #A8833A;
  --clr-gold-light:     #D4B87A;
  --clr-gold-xlight:    #FAF3E6;
  --clr-gold-border:    #EAD7A8;

  /* Status Colors */
  --clr-success:        #5A9E57;
  --clr-success-bg:     #EDF7EC;
  --clr-danger:         #C0392B;
  --clr-danger-bg:      #FDECEA;
  --clr-warn:           #D97706;
  --clr-warn-bg:        #FEF3C7;
  --clr-info:           #2563EB;
  --clr-info-bg:        #EFF6FF;

  /* Backgrounds */
  --bg-page:            #F9F6F0;
  --bg-card:            #FFFFFF;
  --bg-secondary:       #F2EDE6;
  --bg-tertiary:        #EBE4DA;
  --bg-overlay:         rgba(44, 44, 44, 0.06);

  /* Dark surfaces (hero, nav dropdowns) */
  --bg-dark:            #2A3D2E;
  --bg-dark-mid:        #344A38;
  --bg-darker:          #1E2E21;
  --bg-nav:             #FFFFFF;

  /* Text */
  --txt-primary:        #2C2C2C;
  --txt-secondary:      #5C5C5C;
  --txt-muted:          #8C8C8C;
  --txt-link:           #4A7C59;
  --txt-inverse:        #F9F6F0;

  /* Borders */
  --border:             #E8E0D4;
  --border-light:       #F0EAE2;
  --border-dark:        #D4C9B8;
  --border-focus:       #6B8F71;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(44,44,44,.05);
  --shadow-sm:  0 1px 4px rgba(44,44,44,.08);
  --shadow-md:  0 2px 8px rgba(44,44,44,.10);
  --shadow-lg:  0 4px 16px rgba(44,44,44,.12);
  --shadow-xl:  0 8px 32px rgba(44,44,44,.14);
  --shadow-nav: 0 2px 8px rgba(44,44,44,.10);

  /* Border Radius */
  --r-xs:   2px;
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  24px;
  --r-full: 9999px;

  /* Spacing */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* Typography */
  --font-sans:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                  'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --font-display: Georgia, 'Times New Roman', serif;

  /* Navigation */
  --topbar-h:  36px;
  --nav-h:     64px;
  --nav-total: calc(var(--topbar-h) + var(--nav-h));

  /* Max widths */
  --max-w:        1200px;
  --max-w-narrow: 780px;
  --max-w-tool:   960px;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 300ms;
}


/* ─────────────────────────────────────────────────────────────────
   02. RESET & BASE
   ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-total) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--txt-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* account for fixed dual-layer nav */
  padding-top: var(--nav-total);
}

main { flex: 1; }

img, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--txt-link);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--clr-primary-dark); }

ul, ol { padding-left: var(--sp-5); }

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem);  line-height: 1.2; font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem);   line-height: 1.25; font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem);line-height: 1.3;  font-weight: 700; }
h4 { font-size: 1.1rem;  line-height: 1.35; font-weight: 600; }
h5 { font-size: .95rem;  line-height: 1.4;  font-weight: 600; }
h6 { font-size: .875rem; line-height: 1.4;  font-weight: 600; }

p { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--sp-8) 0;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-secondary);
  color: var(--clr-primary-dark);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}


/* ─────────────────────────────────────────────────────────────────
   03. LAYOUT & CONTAINERS
   ───────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
.container-narrow {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.page-body   { padding: var(--sp-10) 0; }
.section     { padding: var(--sp-12) 0; }
.section-sm  { padding: var(--sp-8) 0; }
.section-alt { background: var(--bg-secondary); }

/* Two-column content + sidebar */
.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--sp-8);
  align-items: start;
}
.content-main { min-width: 0; }

/* Grid shorthands */
.grid-2    { display: grid; grid-template-columns: repeat(2, 1fr);                      gap: var(--sp-5); }
.grid-3    { display: grid; grid-template-columns: repeat(3, 1fr);                      gap: var(--sp-5); }
.grid-4    { display: grid; grid-template-columns: repeat(4, 1fr);                      gap: var(--sp-5); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: var(--sp-5); }

/* Section header with "see all" link */
.section-header {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.section-header-text { flex: 1; }
.section-header h2   { margin-bottom: var(--sp-1); }
.section-header p    { color: var(--txt-muted); margin: 0; font-size: .95rem; }
.section-header > a  { color: var(--clr-primary); font-size: .875rem; font-weight: 600;
                        white-space: nowrap; }
.section-header > a:hover { color: var(--clr-primary-dark); }


/* ─────────────────────────────────────────────────────────────────
   04a. TOP UTILITY BAR
   ───────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  height: var(--topbar-h);
  background: var(--bg-dark);
  border-bottom: 1px solid var(--bg-dark-mid);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.topbar-tagline {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.topbar-links a {
  font-size: .75rem;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  transition: color var(--t-fast);
  white-space: nowrap;
}
.topbar-links a:hover { color: #fff; }
.topbar-links a.topbar-cta {
  background: var(--clr-gold);
  color: var(--bg-dark) !important;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-weight: 700;
}
.topbar-links a.topbar-cta:hover { background: var(--clr-gold-light); }


/* ─────────────────────────────────────────────────────────────────
   04b. MAIN SITE NAV  (white, fixed)
   ───────────────────────────────────────────────────────────────── */
.sitenav {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--bg-nav);
  box-shadow: var(--shadow-nav);
  border-bottom: 2px solid var(--clr-primary-xlight);
}
.sitenav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Logo */
.sitenav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--clr-primary);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.sitenav-logo:hover .logo-mark { background: var(--clr-primary-dark); }
.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--txt-primary);
  letter-spacing: -.02em;
}

/* Nav links list */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 2px;
  flex: 1;
}
.nav-links > li { position: relative; }

/* Top-level link */
.nav-links > li > a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--txt-secondary);
  border-radius: var(--r-md);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}
.nav-links > li > a:hover {
  background: var(--clr-primary-xlight);
  color: var(--clr-primary-dark);
}
.nav-links > li > a.active {
  color: var(--clr-primary-dark);
  background: var(--clr-primary-xlight);
}

/* Chevron icon on dropdown parents */
.nav-chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: .55;
  transition: transform var(--t-base) var(--ease);
  flex-shrink: 0;
}
.has-dropdown:hover .nav-chevron { transform: rotate(225deg) translateY(-2px); }

/* Codes CTA in nav */
.nav-codes-cta > a {
  background: var(--clr-gold) !important;
  color: var(--bg-dark) !important;
  font-weight: 700 !important;
  padding: 7px 14px !important;
}
.nav-codes-cta > a:hover {
  background: var(--clr-gold-dark) !important;
  color: #fff !important;
}

/* Nav right-side actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex-shrink: 0;
}

/* Mobile hamburger button */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.nav-toggle:hover { background: var(--clr-primary-xlight); }
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--txt-secondary);
  border-radius: 2px;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ─────────────────────────────────────────────────────────────────
   04c. DROPDOWN MENUS
   ───────────────────────────────────────────────────────────────── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--t-base) var(--ease),
              visibility var(--t-base),
              transform var(--t-base) var(--ease);
  pointer-events: none;
  z-index: 200;
}
.has-dropdown:hover .nav-dropdown,
.has-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Wide two-column dropdown */
.nav-dropdown.wide {
  min-width: 460px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--sp-3);
}

/* Dropdown section label */
.dd-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--txt-muted);
  padding: 6px 10px 4px;
  display: block;
}

/* Dropdown links */
.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 500;
  color: var(--txt-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-dropdown a:hover {
  background: var(--clr-primary-xlight);
  color: var(--clr-primary-dark);
}
.nav-dropdown a .dd-icon {
  width: 22px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Dropdown divider */
.dd-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--sp-2) 0;
}


/* ─────────────────────────────────────────────────────────────────
   04d. MOBILE SIDEBAR NAV
   ───────────────────────────────────────────────────────────────── */
/* Sidebar is revealed via .open class on #nav-links */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    /* Slide in from left as a full-height sidebar */
    position: fixed;
    top: var(--nav-total);
    left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-4);
    overflow-y: auto;
    gap: var(--sp-1);
    transform: translateX(-100%);
    transition: transform var(--t-slow) var(--ease);
    z-index: 999;
  }
  .nav-links.open { transform: translateX(0); }

  /* Backdrop */
  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--nav-total);
    background: rgba(44,44,44,.35);
    z-index: 998;
  }
  .nav-backdrop.open { display: block; }

  .nav-links > li > a {
    padding: 11px 14px;
    font-size: .95rem;
    border-radius: var(--r-md);
  }

  /* Mobile dropdowns: accordion style */
  .nav-dropdown {
    position: static;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--r-md);
    display: none;
    padding: var(--sp-2);
    margin: var(--sp-1) 0;
  }
  .nav-dropdown.wide { grid-template-columns: 1fr; min-width: unset; }
  .nav-dropdown a { color: var(--txt-secondary); font-size: .875rem; }
  .has-dropdown.open-mobile .nav-dropdown { display: block; }
  .has-dropdown.open-mobile > a { background: var(--clr-primary-xlight); color: var(--clr-primary-dark); }

  .nav-codes-cta { order: -1; margin-bottom: var(--sp-2); }
  .nav-codes-cta > a { display: block; text-align: center; border-radius: var(--r-md) !important; }

  .nav-actions { display: none; }

  .topbar-links { display: none; }
}


/* ─────────────────────────────────────────────────────────────────
   05. HERO SECTIONS
   ───────────────────────────────────────────────────────────────── */

/* ── Homepage hero ── */
.hero-home {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-mid) 55%, #2D4A35 100%);
  padding: var(--sp-20) 0 var(--sp-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Subtle dot pattern overlay */
.hero-home::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.hero-home .container { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(196,164,90,.15);
  color: var(--clr-gold-light);
  border: 1px solid rgba(196,164,90,.35);
  padding: 4px 14px;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: var(--sp-5);
}
.hero-home h1 {
  color: #fff;
  max-width: 680px;
  margin: 0 auto var(--sp-4);
}
.hero-home > .container > p {
  color: rgba(255,255,255,.68);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto var(--sp-8);
}

/* Search bar in hero */
.hero-search {
  display: flex;
  max-width: 500px;
  margin: 0 auto var(--sp-8);
  background: rgba(255,255,255,.97);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  padding: 13px 20px;
  font-size: .95rem;
  background: transparent;
  color: var(--txt-primary);
  font-family: var(--font-sans);
}
.hero-search input::placeholder { color: var(--txt-muted); }
.hero-search button {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  padding: 13px 22px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.hero-search button:hover { background: var(--clr-primary-dark); }

/* Hero quick badges */
.hero-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.hero-badge {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.15);
  padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: .8rem;
  font-weight: 500;
}

/* ── Page hero (sub-pages) ── */
.hero-page {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-mid) 100%);
  padding: var(--sp-10) 0 var(--sp-8);
}
.hero-page .container { display: flex; align-items: center; gap: var(--sp-5); }
.hero-page-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--r-xl);
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.1);
}
.hero-page-text h1 { color: #fff; margin-bottom: var(--sp-2); }
.hero-page-text > p { color: rgba(255,255,255,.65); margin: 0; font-size: 1rem; }
.npc-quote {
  font-style: italic;
  color: #888;
  text-align: center;
  margin: var(--sp-3) 0 var(--sp-2) !important;
  font-size: .95rem;
  letter-spacing: .01em;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
}
.hero-meta span {
  color: rgba(255,255,255,.45);
  font-size: .78rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Compact mini hero (tools) ── */
.hero-mini {
  background: var(--bg-dark);
  padding: var(--sp-8) 0;
}
.hero-mini h1 { color: #fff; font-size: clamp(1.35rem, 3vw, 1.7rem); margin-bottom: var(--sp-2); }
.hero-mini p  { color: rgba(255,255,255,.6); margin: 0; }

/* ── Announcement bar (top of page, below nav) ── */
.announce-bar {
  background: var(--clr-primary);
  color: #fff;
  text-align: center;
  padding: 9px var(--sp-4);
  font-size: .875rem;
  font-weight: 500;
}
.announce-bar a { color: var(--clr-gold-light); font-weight: 700; text-decoration: underline; }
.announce-bar a:hover { color: #fff; }


/* ─────────────────────────────────────────────────────────────────
   06. BREADCRUMBS
   ───────────────────────────────────────────────────────────────── */
.breadcrumbs {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}
.breadcrumbs nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 0;
  font-size: .82rem;
}
.breadcrumbs a { color: var(--txt-muted); }
.breadcrumbs a:hover { color: var(--clr-primary); }
.breadcrumbs .sep  { color: var(--border-dark); user-select: none; }
.breadcrumbs .current { color: var(--txt-secondary); font-weight: 500; }


/* ─────────────────────────────────────────────────────────────────
   07. CARDS & ROUTE GRIDS
   ───────────────────────────────────────────────────────────────── */

/* Base card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-body   { padding: var(--sp-5); }
.card-footer {
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  font-size: .8rem;
  color: var(--txt-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Route Card (icon + title + description, fully clickable) ── */
.route-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  text-decoration: none;
  color: var(--txt-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
  transition: box-shadow var(--t-base) var(--ease),
              transform var(--t-base) var(--ease),
              border-color var(--t-base);
}
.route-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--clr-primary-light);
  color: var(--txt-primary);
}
.route-card:active { transform: translateY(-1px); }

.route-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.route-card h3 { font-size: 1rem;   margin: 0; line-height: 1.2; }
.route-card p  { font-size: .825rem; color: var(--txt-muted); margin: 0; }

/* Route icon color variants */
.ic-green    { background: #E6F4E8; color: var(--clr-primary-dark); }
.ic-gold     { background: var(--clr-gold-xlight); color: var(--clr-gold-dark); }
.ic-blue     { background: #E8F2FC; color: #1E5FA8; }
.ic-purple   { background: #F0E8F8; color: #6B21A8; }
.ic-red      { background: #FDE8E8; color: #9B1C1C; }
.ic-teal     { background: #E0F4F4; color: #0F766E; }
.ic-rose     { background: #FDE8F0; color: #9D174D; }
.ic-amber    { background: #FEF3C7; color: #92400E; }
.ic-stone    { background: #F0ECE8; color: #57534E; }

/* ── Skill card ── */
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  text-decoration: none;
  color: var(--txt-primary);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.skill-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); color: var(--txt-primary); }
.skill-card-header { display: flex; align-items: center; gap: var(--sp-3); }
.skill-icon { width: 44px; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.skill-card h3 { font-size: 1.05rem; margin: 0; }
.skill-card > p { font-size: .825rem; color: var(--txt-muted); margin: 0; }
.skill-level-bar { height: 5px; background: var(--bg-secondary); border-radius: var(--r-full); overflow: hidden; }
.skill-level-fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--clr-primary) 0%, var(--clr-gold) 100%); }
.skill-max-level { font-size: .72rem; color: var(--txt-muted); text-align: right; }

/* ── Guide card (with thumbnail band) ── */
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  text-decoration: none;
  color: var(--txt-primary);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.guide-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); color: var(--txt-primary); }
.guide-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
}
.guide-card-body { padding: var(--sp-4) var(--sp-5); flex: 1; }
.guide-card-body h3 { font-size: .975rem; margin-bottom: var(--sp-2); }
.guide-card-body p  { font-size: .825rem; color: var(--txt-muted); margin: 0; }

/* ── Tool card (horizontal, icon left) ── */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  text-decoration: none;
  color: var(--txt-primary);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  transition: box-shadow var(--t-base), transform var(--t-base), border-color var(--t-base);
}
.tool-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--clr-primary-light); color: var(--txt-primary); }
.tool-icon { width: 48px; height: 48px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.tool-card h3 { font-size: 1rem; margin-bottom: var(--sp-1); }
.tool-card p  { font-size: .825rem; color: var(--txt-muted); margin: 0; }

/* ── Villager card ── */
.villager-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: var(--sp-4); }
.villager-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  text-decoration: none;
  color: var(--txt-primary);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.villager-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); color: var(--txt-primary); }
.villager-thumb { height: 110px; background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-mid) 100%); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.villager-info { padding: var(--sp-3) var(--sp-4); }
.villager-info h3 { font-size: .9rem; margin-bottom: 3px; }
.villager-info p  { font-size: .75rem; color: var(--txt-muted); margin: 0; }
.heart-bar { display: flex; gap: 3px; margin-top: var(--sp-2); }
.heart { font-size: .8rem; color: var(--border-dark); }
.heart.filled { color: #E91E63; }


/* ─────────────────────────────────────────────────────────────────
   08. STATS DISPLAY BLOCKS
   ───────────────────────────────────────────────────────────────── */
/* Row of stats */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.stats-row .stat-block { flex: 1; min-width: 120px; }

/* Individual stat block */
.stat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6);
  text-align: center;
}
.stat-num {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--clr-primary);
  line-height: 1;
  display: block;
  margin-bottom: var(--sp-2);
}
.stat-num.gold   { color: var(--clr-gold-dark); }
.stat-num.dark   { color: var(--txt-primary); }
.stat-label {
  font-size: .8rem;
  color: var(--txt-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: block;
}
.stat-desc {
  font-size: .875rem;
  color: var(--txt-secondary);
  margin-top: var(--sp-1);
}

/* Dark stat block (for hero areas) */
.stat-block-dark {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  text-align: center;
}
.stat-block-dark .stat-num   { color: #fff; }
.stat-block-dark .stat-label { color: rgba(255,255,255,.55); }


/* ─────────────────────────────────────────────────────────────────
   09. TABLES (responsive, zebra stripes)
   ───────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

/* Head */
thead th {
  background: var(--bg-dark);
  color: rgba(255,255,255,.8);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  transition: background var(--t-fast);
}
thead th[data-sort] { cursor: pointer; }
thead th[data-sort]:hover { background: var(--bg-dark-mid); }
thead th.sort-asc::after  { content: ' ↑'; color: var(--clr-gold-light); }
thead th.sort-desc::after { content: ' ↓'; color: var(--clr-gold-light); }

/* Body — zebra stripes */
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(odd)  { background: var(--bg-card); }
tbody tr:nth-child(even) { background: var(--bg-page); }
tbody tr:hover           { background: var(--clr-primary-xxlight); }

tbody td { padding: 10px 16px; vertical-align: middle; }

/* Filter / search bar above table */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-4);
}
.table-search {
  flex: 1;
  min-width: 200px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: .875rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--txt-primary);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.table-search:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(107,143,113,.15);
}
.table-filter {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: .875rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  cursor: pointer;
  outline: none;
  transition: border-color var(--t-fast);
}
.table-filter:focus { border-color: var(--clr-primary); }
.table-count { font-size: .8rem; color: var(--txt-muted); margin-left: auto; white-space: nowrap; }


/* ─────────────────────────────────────────────────────────────────
   10. CODE DISPLAY BLOCKS
   ───────────────────────────────────────────────────────────────── */
/* Inline game-code pill */
.code-box {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-secondary);
  border: 1.5px dashed var(--border-dark);
  border-radius: var(--r-md);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--clr-primary-dark);
  user-select: all;
}

/* Full code / pre-formatted block */
.code-block {
  position: relative;
  background: #1E2A1E;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin: var(--sp-5) 0;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.code-block-lang {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
}
.code-block pre {
  margin: 0;
  padding: var(--sp-5);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.65;
  color: #A8D8A8;
  background: transparent;
  border: none;
  border-radius: 0;
}
.code-block code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Copy button (used in both code blocks and code table cells) */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-md);
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-copy:hover { background: rgba(255,255,255,.18); color: #fff; }
.btn-copy.copied { background: rgba(90,158,87,.25); color: #7ED87B; border-color: rgba(90,158,87,.4); }

/* Light variant (in white areas) */
.btn-copy-light {
  background: var(--bg-secondary);
  color: var(--txt-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--t-fast);
}
.btn-copy-light:hover { background: var(--clr-primary-xlight); color: var(--clr-primary-dark); border-color: var(--clr-primary-light); }
.btn-copy-light.copied { background: var(--clr-success-bg); color: var(--clr-success); border-color: #A5D6A7; }

/* Pulsing live dot */
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clr-success);
  display: inline-block;
  flex-shrink: 0;
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .55; transform: scale(1.25); }
}


/* ─────────────────────────────────────────────────────────────────
   11. FAQ ACCORDION  (pure CSS — details/summary)
   ───────────────────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: box-shadow var(--t-base);
}
.faq-item:has(details[open]) { box-shadow: var(--shadow-md); border-color: var(--clr-primary-light); }

/* HTML <details> approach */
.faq-item details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  font-size: .95rem;
  font-weight: 600;
  color: var(--txt-primary);
  cursor: pointer;
  list-style: none;
  transition: background var(--t-fast), color var(--t-fast);
  -webkit-appearance: none;
}
.faq-item details summary::-webkit-details-marker { display: none; }
.faq-item details summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--clr-primary);
  flex-shrink: 0;
  transition: transform var(--t-base) var(--ease);
  line-height: 1;
}
.faq-item details[open] summary::after { transform: rotate(45deg); }
.faq-item details summary:hover { background: var(--clr-primary-xxlight); color: var(--clr-primary-dark); }

.faq-item details[open] summary { background: var(--clr-primary-xxlight); color: var(--clr-primary-dark); }

.faq-answer {
  padding: 0 var(--sp-5) var(--sp-4) var(--sp-5);
  font-size: .9rem;
  color: var(--txt-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border-light);
  animation: fadeDown .2s ease;
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* JS-based fallback (for browsers without :has) */
.faq-item.open .faq-question { background: var(--clr-primary-xxlight); color: var(--clr-primary-dark); }
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: .95rem;
  font-weight: 600;
  color: var(--txt-primary);
  font-family: var(--font-sans);
  transition: background var(--t-fast), color var(--t-fast);
}
.faq-question:hover { background: var(--clr-primary-xxlight); color: var(--clr-primary-dark); }
.faq-question .faq-icon { font-size: 1.2rem; color: var(--clr-primary); flex-shrink: 0; transition: transform var(--t-base) var(--ease); }
.faq-item.open .faq-question .faq-icon { transform: rotate(45deg); }
.faq-body { display: none; padding: 0 var(--sp-5) var(--sp-4); font-size: .9rem; color: var(--txt-secondary); border-top: 1px solid var(--border-light); }
.faq-item.open .faq-body { display: block; }


/* ─────────────────────────────────────────────────────────────────
   12. CALLOUTS & NOTICES
   ───────────────────────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-xl);
  border-left: 4px solid;
  margin: var(--sp-6) 0;
}
.callout-tip    { background: #EDF7EC; border-color: var(--clr-success); }
.callout-info   { background: var(--clr-primary-xlight); border-color: var(--clr-primary); }
.callout-warn   { background: var(--clr-warn-bg); border-color: var(--clr-warn); }
.callout-danger { background: var(--clr-danger-bg); border-color: var(--clr-danger); }
.callout-gold   { background: var(--clr-gold-xlight); border-color: var(--clr-gold); }

.callout-icon { font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
.callout-body > p { font-size: .9rem; margin: 0; }
.callout-body a { color: var(--txt-link); font-weight: 600; }

/* Status / code-active bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--clr-success-bg);
  border: 1px solid #A5D6A7;
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-5);
  font-size: .875rem;
  margin-bottom: var(--sp-6);
}
.status-bar strong { color: var(--clr-success); }

/* Info / warn sidebar boxes */
.info-box {
  background: var(--clr-primary-xlight);
  border: 1px solid var(--clr-primary-light);
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  font-size: .875rem;
  margin-bottom: var(--sp-4);
}
.info-box h4 { color: var(--clr-primary-dark); font-size: .875rem; margin-bottom: var(--sp-2); }
.info-box p  { color: var(--txt-secondary); margin: 0; font-size: .85rem; }

.warn-box {
  background: var(--clr-warn-bg);
  border: 1px solid #FCD34D;
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  font-size: .875rem;
  margin-bottom: var(--sp-4);
}
.warn-box h4 { color: var(--clr-warn); font-size: .875rem; margin-bottom: var(--sp-2); }
.warn-box p  { color: var(--txt-secondary); margin: 0; font-size: .85rem; }

/* Redeem steps */
.how-to-redeem {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-8);
}
.how-to-redeem h3 { margin-bottom: var(--sp-5); }
.redeem-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-5); }
.redeem-step { text-align: center; padding: var(--sp-5); background: var(--bg-page); border-radius: var(--r-xl); }
.redeem-step .step-num {
  width: 36px; height: 36px;
  background: var(--clr-primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
  margin: 0 auto var(--sp-3);
}
.redeem-step h4 { font-size: .875rem; margin-bottom: var(--sp-2); }
.redeem-step p  { font-size: .8rem; color: var(--txt-muted); margin: 0; }


/* ─────────────────────────────────────────────────────────────────
   13. BADGES & TAGS
   ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-active  { background: var(--clr-success-bg); color: #166534; border: 1px solid #A5D6A7; }
.badge-expired { background: var(--clr-danger-bg);  color: #9B1C1C; border: 1px solid #FECACA; }
.badge-new     { background: var(--clr-info-bg);    color: #1E40AF; border: 1px solid #BFDBFE; }
.badge-limited { background: var(--clr-gold-xlight);color: var(--clr-gold-dark); border: 1px solid var(--clr-gold-border); }
.badge-primary { background: var(--clr-primary-xlight); color: var(--clr-primary-dark); border: 1px solid var(--clr-primary-light); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: .8rem;
  color: var(--txt-secondary);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.tag:hover, .tag.active {
  background: var(--clr-primary-xlight);
  border-color: var(--clr-primary-light);
  color: var(--clr-primary-dark);
}

/* Currency display */
.currency        { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.currency.gold   { color: var(--clr-gold-dark); }
.currency.renown { color: var(--clr-primary-dark); }


/* ─────────────────────────────────────────────────────────────────
   14. BUTTONS & FORMS
   ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--r-md);
  font-size: .9rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast),
              box-shadow var(--t-fast);
}
.btn:active { transform: scale(.98); }

.btn-primary   { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-dark); color: #fff; box-shadow: var(--shadow-md); }

.btn-secondary { background: transparent; border-color: var(--clr-primary); color: var(--clr-primary); }
.btn-secondary:hover { background: var(--clr-primary); color: #fff; }

.btn-gold      { background: var(--clr-gold); color: var(--bg-dark); }
.btn-gold:hover{ background: var(--clr-gold-dark); color: #fff; }

.btn-ghost     { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; }

.btn-danger    { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #9B1C1C; color: #fff; }

.btn-sm  { padding: 7px 16px; font-size: .8rem; }
.btn-lg  { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

/* Form elements */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: .875rem;
  font-weight: 600;
  color: var(--txt-secondary);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: .9rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--txt-primary);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(107,143,113,.18);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.input-group { display: flex; gap: var(--sp-3); align-items: flex-end; }
.input-group .form-group { flex: 1; margin-bottom: 0; }


/* ─────────────────────────────────────────────────────────────────
   15. SIDEBAR & TABLE OF CONTENTS
   ───────────────────────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--nav-total) + 16px); }

.toc-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.toc-header {
  background: var(--bg-dark);
  color: rgba(255,255,255,.8);
  padding: 10px 16px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { border-bottom: 1px solid var(--border-light); }
.toc-list li:last-child { border-bottom: none; }
.toc-list a {
  display: block;
  padding: 9px 16px;
  font-size: .85rem;
  color: var(--txt-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}
.toc-list a:hover { background: var(--clr-primary-xxlight); color: var(--clr-primary-dark); }
.toc-list a.active {
  background: var(--clr-primary-xlight);
  color: var(--clr-primary-dark);
  font-weight: 600;
  border-right: 3px solid var(--clr-primary);
}
.toc-list.nested a { padding-left: 28px; font-size: .8rem; }

/* Related links box */
.related-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: var(--sp-6);
  margin-top: var(--sp-10);
}
.related-box h3 { margin-bottom: var(--sp-4); font-size: 1.05rem; }
.related-links  { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.related-links a {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 7px 16px;
  font-size: .85rem;
  color: var(--txt-secondary);
  transition: all var(--t-fast);
}
.related-links a:hover {
  background: var(--clr-primary-xlight);
  border-color: var(--clr-primary-light);
  color: var(--clr-primary-dark);
}

/* Article content — headings with dividers */
.article-content h2 {
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--border-light);
  scroll-margin-top: calc(var(--nav-total) + 20px);
}
.article-content h2:first-child { margin-top: 0; }
.article-content h3 {
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
  scroll-margin-top: calc(var(--nav-total) + 20px);
}
.article-content h4 { margin-top: var(--sp-5); margin-bottom: var(--sp-2); }
.article-content ul,
.article-content ol { margin-bottom: var(--sp-4); }
.article-content li { margin-bottom: var(--sp-2); }

/* XP progression table head */
.xp-table thead th { background: var(--clr-primary-dark); }
.xp-table .level-col { font-weight: 700; color: var(--clr-primary-dark); }

/* Progress bar */
.progress-bar { height: 10px; background: var(--bg-secondary); border-radius: var(--r-full); overflow: hidden; }
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--clr-primary) 0%, var(--clr-gold) 100%);
  transition: width .5s var(--ease);
}


/* ─────────────────────────────────────────────────────────────────
   16. FOOTER (3-column)
   ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-darker);
  color: rgba(255,255,255,.55);
  margin-top: auto;
}

.footer-main {
  padding: var(--sp-16) 0 var(--sp-10);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-10);
}

/* Brand column */
.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
  margin-bottom: var(--sp-4);
}
.footer-brand .footer-logo:hover { color: var(--clr-gold-light); }
.footer-brand .f-logo-mark {
  width: 32px; height: 32px;
  background: var(--clr-primary);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.footer-brand p {
  font-size: .875rem;
  line-height: 1.7;
  max-width: 280px;
  margin-bottom: var(--sp-5);
}
.footer-social { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.footer-social a {
  width: 34px; height: 34px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  color: rgba(255,255,255,.5);
  transition: background var(--t-fast), color var(--t-fast);
}
.footer-social a:hover { background: var(--clr-primary); color: #fff; }

/* Footer columns */
.footer-col h4 {
  color: rgba(255,255,255,.8);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: var(--sp-4);
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: var(--sp-2); }
.footer-col a {
  color: rgba(255,255,255,.5);
  font-size: .875rem;
  transition: color var(--t-fast);
}
.footer-col a:hover { color: rgba(255,255,255,.9); }

/* Footer bottom bar */
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: var(--sp-5) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.footer-bottom p { font-size: .78rem; margin: 0; }
.footer-legal { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.footer-legal a { font-size: .78rem; color: rgba(255,255,255,.38); }
.footer-legal a:hover { color: rgba(255,255,255,.75); }

/* Footer disclaimer */
.footer-disclaimer {
  background: rgba(255,255,255,.03);
  border-top: 1px solid rgba(255,255,255,.05);
  padding: var(--sp-4) 0;
  text-align: center;
  font-size: .75rem;
  line-height: 1.7;
  color: rgba(255,255,255,.25);
}


/* ─────────────────────────────────────────────────────────────────
   17. PAGE-SPECIFIC OVERRIDES
   ───────────────────────────────────────────────────────────────── */

/* Homepage quick grid */
.homepage-quick { padding: var(--sp-12) 0; }

/* Events */
.event-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-2xl); overflow: hidden; margin-bottom: var(--sp-5); }
.event-header {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-mid) 100%);
  padding: var(--sp-6);
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}
.event-header .event-icon { font-size: 1.8rem; flex-shrink: 0; margin-top: 2px; }
.event-header h3 { color: #fff; margin-bottom: 5px; }
.event-header p  { color: rgba(255,255,255,.65); font-size: .875rem; margin: 0; }
.event-body  { padding: var(--sp-5) var(--sp-6); }
.event-rewards { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.event-reward {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 11px;
  font-size: .8rem;
  display: flex; align-items: center; gap: 5px;
}

/* Map page */
.map-layout { display: grid; grid-template-columns: 270px 1fr; height: calc(100vh - var(--nav-total) - 60px); }
.map-sidebar { background: #1a2535; border-right: 1px solid rgba(255,255,255,.08); overflow-y: auto; padding: var(--sp-4); }
.map-area { background: linear-gradient(135deg, #1a3a2a 0%, #1a2a3a 100%); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--sp-4); }

/* Timer display */
.timer-display {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 800;
  font-family: var(--font-mono);
  text-align: center;
  padding: var(--sp-8) var(--sp-6);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: var(--sp-5);
  letter-spacing: .04em;
  color: var(--txt-primary);
}
.timer-display.warning { color: var(--clr-warn);   border-color: var(--clr-warn); }
.timer-display.urgent  { color: var(--clr-danger);  border-color: var(--clr-danger); animation: urgentPulse 1s ease infinite; }
@keyframes urgentPulse { 0%,100%{opacity:1} 50%{opacity:.65} }

/* Checklist items */
.checklist-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: background var(--t-fast);
}
.checklist-item:hover { background: var(--clr-primary-xxlight); }
.checklist-item input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--clr-primary); cursor: pointer; flex-shrink: 0; }
.checklist-item.done { opacity: .5; }
.checklist-item.done span { text-decoration: line-through; }

/* Result boxes in tools */
.result-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--sp-5); margin-top: var(--sp-5); }
.result-box h3 { margin-bottom: var(--sp-4); font-size: 1rem; }
.result-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .875rem;
}
.result-stat:last-child { border-bottom: none; }
.result-stat .label { color: var(--txt-secondary); }
.result-stat .value { font-weight: 700; }
.result-stat .value.positive { color: var(--clr-primary-dark); }
.result-stat .value.negative { color: var(--clr-danger); }

/* Friendship tracker hearts */
.heart-btn {
  width: 30px; height: 30px;
  border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-page);
  cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  color: var(--border-dark);
}
.heart-btn.filled { background: #FCE4EC; border-color: #E91E63; color: #E91E63; }
.heart-btn:hover  { border-color: #E91E63; transform: scale(1.1); }


/* ─────────────────────────────────────────────────────────────────
   18. HOMEPAGE SPECIFIC SECTIONS
   ───────────────────────────────────────────────────────────────── */

/* Announce / update bar below nav */
.update-bar {
  background: var(--clr-gold);
  color: var(--bg-dark);
  padding: 9px 0;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--clr-gold-dark);
}
.update-bar a { color: var(--bg-dark); font-weight: 800; text-decoration: underline; }

/* Updates list widget */
.updates-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.update-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
}
.update-date {
  background: var(--bg-dark);
  color: rgba(255,255,255,.7);
  border-radius: var(--r-md);
  padding: 6px 10px;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 48px;
}
.update-date .day { font-size: 1.15rem; font-weight: 800; color: #fff; display: block; }
.update-body h4 { font-size: .9rem; margin-bottom: 3px; }
.update-body p  { font-size: .825rem; color: var(--txt-muted); margin: 0; }


/* ─────────────────────────────────────────────────────────────────
   19. UTILITY CLASSES
   ───────────────────────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--txt-muted); }
.text-primary-c { color: var(--clr-primary); }
.text-gold    { color: var(--clr-gold-dark); }
.text-sm      { font-size: .875rem; }
.text-xs      { font-size: .775rem; }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 700; }
.font-800     { font-weight: 800; }

.d-flex       { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); } .mb-8 { margin-bottom: var(--sp-8); }

.hidden  { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.divider { border: none; border-top: 1px solid var(--border-light); margin: var(--sp-6) 0; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Tooltip */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  color: #fff;
  padding: 5px 10px;
  border-radius: var(--r-md);
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }


/* ─────────────────────────────────────────────────────────────────
   20. RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────────── */

/* ── Large — ≤ 1024px ── */
@media (max-width: 1024px) {
  .content-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nav-dropdown.wide { min-width: 360px; }
}

/* ── Medium — ≤ 768px ── */
@media (max-width: 768px) {
  :root {
    --topbar-h: 0px;   /* hide topbar on mobile (overflow) */
    --nav-h: 58px;
  }
  .topbar { display: none; }

  body { padding-top: var(--nav-h); }

  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); }

  .footer-main { grid-template-columns: 1fr; gap: var(--sp-6); }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-brand p { max-width: none; }

  .redeem-steps { grid-template-columns: 1fr; }

  .hero-page .container { flex-direction: column; align-items: flex-start; }
  .hero-search { flex-direction: column; border-radius: var(--r-xl); }
  .hero-search button { border-radius: 0 0 var(--r-xl) var(--r-xl); }

  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-sidebar { height: auto; max-height: 260px; }

  .table-controls { flex-direction: column; align-items: stretch; }
  .table-search, .table-filter { width: 100%; min-width: unset; }
  .table-count { margin-left: 0; }

  .section  { padding: var(--sp-8) 0; }
  .page-body{ padding: var(--sp-8) 0; }

  .homepage-quick .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .villager-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Small — ≤ 480px ── */
@media (max-width: 480px) {
  .container { padding: 0 var(--sp-4); }
  .grid-4, .homepage-quick .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .villager-grid { grid-template-columns: repeat(2, 1fr); }
  .timer-display { padding: var(--sp-5); font-size: 2rem; }
  .stat-num { font-size: 1.8rem; }
  .stats-row { flex-direction: column; }
  .hero-page-icon { width: 48px; height: 48px; font-size: 1.4rem; }
  .how-to-redeem { padding: var(--sp-4); }
}
