/* ── SM2 Wiki Reference Pages ─────────────────────────────────────────────── */

:root {
  --bg:          #0b0b12;
  --surface:     #13131f;
  --surface2:    #1c1c2e;
  --surface3:    #252538;
  --border:      #2e2e48;
  --gold:        #c8a84b;
  --gold-dim:    #8a7030;
  --gold-glow:   rgba(200, 168, 75, 0.18);
  --red:         #c0392b;
  --green:       #27ae60;
  --blue:        #4a90d9;
  --radius:      6px;
  --radius-lg:   10px;
}

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

html { font-size: 16px; overscroll-behavior: none; }

body {
  background: var(--bg);
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ── Header ───────────────────────────────────────────────────────────────── */
.wiki-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.wiki-back-btn {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.wiki-back-btn:hover { color: var(--gold); text-decoration: none; }
.wiki-header-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 16px;
}
.wiki-calc-link {
  font-size: 1.15rem;
  padding: 10px 22px;
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  color: #0b0b12;
  font-weight: 700;
  white-space: nowrap;
  justify-self: end;
}
.wiki-calc-link:hover { background: #d4b86e; text-decoration: none; }

/* ── Bottom CTA banner ────────────────────────────────────────────────────── */
.wiki-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  margin-top: 56px;
}
.wiki-cta-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wiki-cta-text strong {
  font-size: 1.4rem;
  color: var(--gold);
}
.wiki-cta-text span {
  font-size: 1.1rem;
  color: #fff;
}
.wiki-cta-btn {
  font-size: 1.2rem;
  padding: 14px 36px;
  background: var(--gold);
  border-radius: var(--radius);
  color: #0b0b12;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.wiki-cta-btn:hover { background: #d4b86e; text-decoration: none; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.wiki-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 64px;
  position: relative;
}

.wiki-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.wiki-page-subtitle {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 28px;
}

/* ── Sections — scroll offset for sticky header + search bar ─────────────── */
/* --wiki-scroll-offset is set from JS (wiki-search.js) so it matches the
   actual measured height of the header + sticky search bar. Fallback covers
   first paint before JS runs. */
.wiki-content section, .wiki-main section {
  scroll-margin-top: var(--wiki-scroll-offset, 140px);
}

/* ── Section headings ─────────────────────────────────────────────────────── */
.wiki-section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: block;
  width: 100%;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.wiki-table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
}
.wiki-table th {
  background: var(--surface2);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: right;
  border-bottom: none;
  box-shadow: inset 0 -2px 0 var(--border);
  white-space: nowrap;
}
.wiki-table th:first-child { text-align: left; }
.wiki-table td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #fff;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.wiki-table td:first-child { text-align: left; }
.wiki-table tr:hover td { background: var(--surface2); }

/* ── Generic content styles (TipTap output in wiki sections) ──────────────── */
.wiki-content table, .wiki-main section table {
  width: 100%; border-collapse: collapse; margin: 10px 0;
}
.wiki-content th, .wiki-main section th {
  background: #1a1a2e; color: #c8a84b; padding: 6px 10px;
  border: 1px solid var(--border); text-align: left; font-weight: 600;
}
.wiki-content th.nowrap, .wiki-main section th.nowrap { white-space: nowrap; }
.wiki-content td, .wiki-main section td {
  padding: 6px 10px; border: 1px solid var(--border); color: #fff;
}
.wiki-content ul, .wiki-main section ul { padding-left: 24px; margin: 8px 0; list-style: disc; }
.wiki-content ol, .wiki-main section ol { padding-left: 24px; margin: 8px 0; list-style: decimal; }
.wiki-content li, .wiki-main section li { margin: 4px 0; }
.wiki-content blockquote, .wiki-main section blockquote {
  border-left: 3px solid #8a7030; padding-left: 12px; margin: 8px 0;
}
.wiki-content a, .wiki-main section a { color: #4a90d9; text-decoration: underline; }
.wiki-content hr, .wiki-main section hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.wiki-content pre, .wiki-main section pre {
  background: #0b0b12; padding: 12px; border-radius: 4px; overflow-x: auto; margin: 8px 0;
}
.wiki-content code, .wiki-main section code {
  background: #1a1a2e; padding: 2px 6px; border-radius: 3px; font-size: 0.9rem;
  word-break: break-all; overflow-wrap: break-word;
}
.wiki-content pre code, .wiki-main section pre code {
  background: none; padding: 0;
}
.wiki-content p:empty, .wiki-main section p:empty { min-height: 1em; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-tyranid { background: #2a1a3a; color: #c084fc; }
.badge-chaos   { background: #3a1a1a; color: #f87171; }
.badge-minoris  { background: var(--surface2); color: #fff; }
.badge-majoris  { background: #1a2a1a; color: #86efac; }
.badge-extremis { background: #2a2a1a; color: #fde047; }
.badge-terminus { background: #3a1a1a; color: #f87171; }

/* ── Sensitivity colours ──────────────────────────────────────────────────── */
.sens-bonus    { color: var(--green); }  /* > 1 = takes more damage */
.sens-neutral  { color: #fff; }
.sens-resist   { color: var(--red); }    /* < 1 = resists */
.sens-immune   { color: #666; }          /* 0 = immune */

/* ── Table subheaders (enemy page sensitivity sections) ───────────────────── */
.wiki-table-subheader {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 10px;
  background: rgba(255,255,255,0.03);
}
.wiki-subheader-note {
  font-weight: 400;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
}

/* ── Cards (hub page, stat blocks) ────────────────────────────────────────── */
.wiki-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.wiki-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.wiki-card:hover { border-color: var(--gold-dim); }
.wiki-card h3 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 6px;
}
.wiki-card p {
  font-size: 1rem;
  color: #fff;
}

/* ── Modifier list ────────────────────────────────────────────────────────── */
.wiki-mod-list {
  list-style: none;
  display: grid;
  gap: 8px;
}
.wiki-mod-item {
  list-style: none;
}
.wiki-mod-item a.wiki-mod-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}
.wiki-mod-item a.wiki-mod-link:hover {
  border-color: var(--gold);
  background: var(--surface2);
}
.wiki-mod-item a.wiki-mod-link:hover .wiki-mod-name {
  color: var(--gold);
}
.wiki-mod-name {
  font-weight: 600;
  color: #fff;
  font-size: 1.05rem;
}
.wiki-mod-desc {
  color: #fff;
  font-size: 1rem;
  margin-top: 2px;
}

/* ── Per-modifier page ────────────────────────────────────────────────────── */
.wiki-modifier-classification {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  margin: 0 0 16px 0;
  border: 1px solid var(--border);
  background: var(--surface);
}
.wiki-modifier-classification.negative {
  border-color: #a24a4a;
  background: #3a1f1f;
}
.wiki-modifier-classification.positive {
  border-color: #4a7a4a;
  background: #1f2f1f;
}
.wiki-mod-description,
.wiki-mod-note {
  color: #fff;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 14px 0;
}

/* ── Stat row (used on individual enemy pages) ────────────────────────────── */
.wiki-stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.wiki-stat-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 140px;
}
.wiki-stat-label {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  margin-bottom: 4px;
}
.wiki-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

/* ── Placeholder / coming soon ────────────────────────────────────────────── */
.wiki-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: #fff;
}
.wiki-placeholder h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.wiki-footer {
  text-align: center;
  padding: 24px 28px;
  border-top: 1px solid var(--border);
  color: #fff;
  font-size: 0.95rem;
}

/* ── Enemy link list on overview ──────────────────────────────────────────── */
.wiki-table td a {
  color: var(--gold);
}
.wiki-table td a:hover {
  text-decoration: underline;
}

/* ── Wiki Tooltip ────────────────────────────────────────────────────────── */
#wiki-tip {
  position: fixed;
  z-index: 9999;
  background: #1a1a2e;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 320px;
  padding: 10px 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
#wiki-tip.visible { opacity: 1; }
tr[data-tip] { cursor: default; }

/* ── Narrow table: cap width for 2-column tables (enemy detail pages) ─────── */
.wiki-table-narrow { width: auto; max-width: 420px; }

/* ── Wide table: breaks out of the 1100px main constraint ─────────────────── */
.wiki-table-wide {
  min-width: 100%;
}
.wiki-table-wrap:has(.wiki-table-wide) {
  margin-left: calc(-1 * max(0px, (100vw - 1400px) / 2));
  margin-right: calc(-1 * max(0px, (100vw - 1400px) / 2));
}
.wiki-main:has(.wiki-table-wide) {
  max-width: 1400px;
}

/* ── Column group header (Health / Damage Sensitivity) ────────────────────── */
.wiki-table .col-group-header {
  text-align: center;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: #fff;
  padding: 5px 10px;
}
/* Separate the two groups visually */
.wiki-table th[colspan="3"].col-group-header,
.wiki-table .sens-col-first {
  border-left: 2px solid var(--border);
}

/* ── Wiki Search ────────────────────────────────────────────────────────── */

/* Search bar below header on sub-pages */
.ws-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  box-shadow: 0 -4px 0 var(--surface);
}
.ws-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}
.ws-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  font-size: 1rem;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}
.ws-input:focus {
  border-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23c8a84b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
}
.ws-input::placeholder {
  color: #555;
}

/* Hero search — main attraction on home page */
.ws-hero {
  margin: 8px 0 32px;
}
.ws-hero-input {
  width: 100%;
  padding: 20px 28px 20px 56px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 1.3rem;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 20px center;
}
.ws-hero-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23c8a84b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
}
.ws-hero-input::placeholder {
  color: #666;
}

/* Search results — dropdown on sub-pages */
.ws-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
/* On home page, results are inline not dropdown */
.wiki-main > .ws-results {
  position: static;
  border: none;
  background: transparent;
  box-shadow: none;
  max-height: none;
  overflow: visible;
  margin-top: 4px;
}
.ws-result {
  display: block;
  padding: 14px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.ws-result:last-child {
  border-bottom: none;
}
.ws-result:hover {
  background: rgba(200, 168, 75, 0.1);
}
.ws-result-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.ws-result-meta {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.ws-result-cat {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(200, 168, 75, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}
.ws-result-desc {
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.4;
}
.ws-result-snippet {
  color: #9a9ab0;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 4px;
  font-style: italic;
}
.ws-result mark {
  background: rgba(200, 168, 75, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.ws-no-results {
  padding: 24px 20px;
  color: #fff;
  text-align: center;
  font-size: 1rem;
}
/* Home page result cards — full width styled cards */
.wiki-main > .ws-results .ws-result {
  padding: 20px 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.wiki-main > .ws-results .ws-result:hover {
  border-color: var(--gold);
}
.wiki-main > .ws-results .ws-result-title {
  font-size: 1.15rem;
}

/* ── Mobile responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Hide fixed TOC — it overlaps content on narrow screens */
  .wiki-toc { display: none !important; }

  /* Header: back+CTA on row 1, title on row 2 */
  .wiki-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 8px;
    padding: 10px 16px;
  }
  .wiki-back-btn {
    font-size: 1rem;
    grid-row: 1; grid-column: 1;
    overflow: hidden; text-overflow: ellipsis;
  }
  .wiki-calc-link {
    font-size: 0.85rem;
    padding: 6px 14px;
    grid-row: 1; grid-column: 2;
  }
  .wiki-header-title {
    font-size: 1rem;
    padding: 0;
    grid-row: 2; grid-column: 1 / -1;
    text-align: center;
    white-space: normal;
  }

  /* Main content: tighter padding */
  .wiki-main { padding: 20px 16px 48px; }
  .wiki-page-title { font-size: 1.5rem; }
  .wiki-section-title { font-size: 1.4rem; }

  /* Tables: horizontal scroll instead of breaking layout */
  .wiki-content table, .wiki-main section table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .wiki-content thead, .wiki-main section thead,
  .wiki-content tbody, .wiki-main section tbody {
    display: table;
    width: 100%;
  }

  /* Stat row: wrap on small screens */
  .wiki-stat-row { flex-wrap: wrap; gap: 8px; }
  .wiki-stat-block { min-width: 100px; flex: 1; }

  /* Search bar: tighter padding */
  .ws-bar { padding: 8px 16px; }

  /* Bottom CTA: stack vertically */
  .wiki-cta-banner {
    flex-direction: column;
    text-align: center;
    padding: 20px;
    gap: 16px;
  }
  .wiki-cta-text strong { font-size: 1.15rem; }
  .wiki-cta-text span { font-size: 1rem; }
  .wiki-cta-btn { padding: 12px 28px; font-size: 1.05rem; }

  /* Hero search: smaller on mobile */
  .ws-hero-input { font-size: 1rem; padding: 14px 20px 14px 44px; }

}

@media (max-width: 480px) {
  /* Extra small: even tighter */
  .wiki-header { padding: 10px 12px; }
  .wiki-back-btn { font-size: 1rem; }
  .wiki-header-title { font-size: 0.95rem; }
  .wiki-main { padding: 16px 12px 40px; }
  .wiki-page-title { font-size: 1.3rem; }
  .wiki-section-title { font-size: 1.2rem; }
  .wiki-card { padding: 14px; }
  .wiki-card h3 { font-size: 1.05rem; }
}

/* ── Banner / Toast Notifications (mirrored from style.css for wiki pages) ── */
#banner-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  pointer-events: none;
}

.banner-toast {
  position: relative;
  width: 400px; /* default medium, overridden by JS */
  max-width: calc(100vw - 48px);
  background: var(--surface2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 16px 40px 16px 16px;
  color: #fff;
  font-size: 13px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.banner-toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.banner-toast.banner-toast-center {
  transform: scale(0.95);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.banner-toast.banner-toast-center.banner-toast-visible {
  transform: scale(1);
}
.banner-toast.banner-toast-center.banner-toast-hiding {
  transform: scale(0.95);
}

.banner-toast-hiding {
  opacity: 0;
  transform: translateX(100%);
}

.banner-toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.6;
}
.banner-toast-close:hover { opacity: 1; }

.banner-toast-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}

.banner-toast-message {
  color: #fff;
  line-height: 1.5;
  margin-bottom: 10px;
}

.banner-toast-cta {
  display: inline-block;
  padding: 6px 14px;
  background: var(--gold);
  color: #0b0b12;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.banner-toast-cta:hover { background: #d4b65a; }

.banner-bar {
  width: 100%;
  background: var(--surface2);
  border-bottom: 1px solid var(--gold-dim);
  padding: 10px 48px 10px 16px;
  color: #fff;
  font-size: 13px;
  position: relative;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease;
}
.banner-bar-visible {
  opacity: 1;
  max-height: 80px;
  padding: 10px 48px 10px 16px;
}
.banner-bar-hiding {
  opacity: 0;
  max-height: 0;
  padding: 0 48px 0 16px;
}
.banner-bar-text { color: #fff; }
.banner-bar-text strong { color: var(--gold); }
.banner-bar-cta {
  display: inline-block;
  margin-left: 12px;
  padding: 3px 10px;
  background: var(--gold);
  color: #0b0b12;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
}
.banner-bar-cta:hover { background: #d4b65a; }
.banner-bar-close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
}
.banner-bar-close:hover { opacity: 1; }

@media (max-width: 768px) {
  #banner-toast-container {
    top: 12px !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    transform: none !important;
    width: auto;
  }
  .banner-toast {
    width: 100% !important;
    max-width: 100%;
    border-radius: var(--radius);
    padding: 12px 36px 12px 12px;
    font-size: 12px;
    transform: translateY(-120%);
  }
  .banner-toast-visible {
    transform: translateY(0);
  }
  .banner-toast-hiding {
    transform: translateY(-120%);
  }
  .banner-toast-title { font-size: 24px !important; margin-bottom: 10px; }
  .banner-toast-message { font-size: 20px !important; margin-bottom: 8px; line-height: 1.5; }
  .banner-toast-cta { font-size: 16px; padding: 6px 14px; }
  .banner-toast-close { font-size: 28px; top: 8px; right: 10px; padding: 8px; }
}

/* ── Ranged weapons pages: wider layout + collapsible per-family rows ─────── */
body.ranged-weapons-page .wiki-main {
  /* Use nearly the full viewport (with a small breathing margin) so the
     17-column table can actually fit. */
  max-width: calc(100vw - 32px);
  padding-left: 16px;
  padding-right: 16px;
}

/* Sticky thead requires every ancestor up to the viewport to have
   overflow:visible on BOTH axes (per CSS overflow spec, setting one axis to
   non-visible coerces the other to auto, creating a scroll container that
   captures the sticky element). The wrap therefore can't clip in any
   direction — if the table is wider than the viewport, the page itself
   scrolls horizontally instead. */
body.ranged-weapons-page .rw-table-wrap {
  margin-bottom: 24px;
  overflow: visible;
}
.rw-table {
  font-size: 0.85rem;
  table-layout: auto;
  /* Browser will distribute width — keep a fixed width so it definitely
     consumes the available room and doesn't render at intrinsic width. */
  width: 100%;
}
/* Compact cells — the table has 17 columns; standard wiki-table padding is
   too loose for this many. */
.rw-table th,
.rw-table td {
  padding: 6px 6px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
/* Damage Falloff is the longest free-form column. The source data uses <br>
   to break each zone onto its own line; reserve enough width that "20-23m:
   100% → 75%"-style segments don't wrap mid-zone, but cap the column so it
   can't dominate the table. */
.rw-table th:last-child,
.rw-table td.falloff-cell {
  min-width: 160px;
  max-width: 240px;
  white-space: normal;
  line-height: 1.35;
}
/* Numeric / short stat columns can be narrow and centered for compactness. */
.rw-table tbody td:nth-child(n+4):not(:last-child) { white-space: nowrap; }

/* Generic tooltip-bearing stat cell — shared by the RPM formula cells and
   the per-stance spread cells. Shows it's hover-interactive via dotted
   underline + cursor:help + a small ⓘ glyph. */
.rw-table td.tip-cell {
  cursor: help;
  text-decoration: underline dotted rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}
.rw-table td.tip-cell .tip-info {
  margin-left: 4px;
  color: #c8a84b;
  font-size: 0.85em;
}

/* Inline tooltip annotation — applied via the polished/wiki editor's Tooltip mark.
   Matches .rpm-cell visual treatment: dotted underline + gold info icon. The hover
   popup is driven by /js/wiki-tooltips.js (shared with rpm-cell's .rw-tip styling). */
.info-tooltip {
  cursor: help;
  text-decoration: underline dotted rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}
.info-tooltip::after {
  content: 'ⓘ';
  margin-left: 4px;
  color: #c8a84b;
  font-size: 0.85em;
}

/* Custom hover tooltip for the burst-RPM formula. Positioned by JS, kept
   out of the OS-level title delay. */
.rw-tip {
  position: fixed;
  z-index: 200;
  background: var(--surface2);
  color: #fff;
  border: 1px solid #c8a84b;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 540px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
  /* pre-line so embedded "\n" line-breaks in the tooltip text (e.g. the
     spread-cell "Min: 1.04°\nMax: 2.10°") render as actual breaks while
     long lines still wrap. */
  white-space: pre-line;
}
.rw-tip.visible { opacity: 1; }

/* Vertical column dividers (subtle). */
.rw-table th,
.rw-table td {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.rw-table th:last-child,
.rw-table td:last-child {
  border-right: none;
}

/* Sticky column headers — top offset is set per-page from JS via --sticky-top
   (header height + search bar height). Falls back to 60px if the script hasn't
   measured yet. */
.rw-table thead th {
  position: sticky;
  top: var(--sticky-top, 60px);
  z-index: 5;
  background: var(--surface2);
  /* Sticky cells lose their normal border-bottom in some browsers; re-add via
     box-shadow so the line stays visible while scrolling. */
  box-shadow: inset 0 -2px 0 var(--border);
}

/* Summary row = the visible "collapsed" representation of a weapon family. */
.rw-table tr.fam-summary {
  cursor: pointer;
  background: var(--surface2);
  border-top: 2px solid var(--border);
}
.rw-table tr.fam-summary:hover td { background: rgba(200, 168, 75, 0.10); }
.rw-table tr.fam-summary:focus-visible {
  outline: 2px solid #c8a84b;
  outline-offset: -2px;
}
.rw-table tr.fam-summary td {
  padding-top: 10px;
  padding-bottom: 10px;
  font-weight: 600;
}
.rw-table tr.fam-summary td.fam-name-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}
.fam-toggle {
  color: #c8a84b;
  font-size: 0.9rem;
  display: inline-block;
  width: 12px;
  /* Nudge the arrow down a hair so it sits on the family-name baseline
     rather than the very top of the stack. */
  margin-top: 4px;
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.fam-summary.expanded .fam-toggle { transform: rotate(90deg); }
.fam-name-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;          /* allow flex child to shrink + wrap */
  flex: 1 1 auto;
}
.fam-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #c8a84b;
}
.fam-best-variant {
  font-size: 0.9rem;
  color: #fff;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

/* Variant rows = expanded children. Visually inset so they read as a sub-group. */
.rw-table tr.fam-variant td.variant-cell {
  padding-left: 28px;
  color: #fff;
  font-weight: 400;
}

/* Constrain the long-text columns so they don't dominate the table.
   First column (Variant Name / family summary) wraps onto 2 lines if needed
   instead of stretching the row. Specialty likewise wraps. */
.rw-table th:first-child,
.rw-table td:first-child {
  min-width: 150px;
  max-width: 220px;
  white-space: normal;
}
/* Heavy weapons page has one fewer column (no Reload) — let the variant
   name column claim the freed width so the long Heroic skin names fit on
   a single line. */
body.weapons-page-heavy .rw-table th:first-child,
body.weapons-page-heavy .rw-table td:first-child {
  min-width: 220px;
  max-width: 320px;
}
.rw-table td.fam-name-cell,
.rw-table td.variant-cell {
  word-break: break-word;
}
/* Specialty (3rd column) — narrow enough to fit "Grenade Launcher" on one
   line, allow longer strings to wrap. */
.rw-table th:nth-child(3),
.rw-table td:nth-child(3) {
  max-width: 110px;
  white-space: normal;
}
.rw-table tr.fam-variant.alt-fire td {
  background: rgba(200, 168, 75, 0.05);
}
.rw-table tr.fam-variant.alt-fire td.alt-fire-name {
  padding-left: 48px;
  color: #c8a84b;
}

/* Hub page: weapon-category cards reusing wiki-card grid styling */
.weapon-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
