[hidden] { display: none !important; }

:root {
  --wi-bg-light: #f3f5f8;
  --wi-surface-light: #ffffff;
  --wi-surface-alt-light: color-mix(in oklab, var(--wi-surface-light) 92%, var(--wi-brand-light));
  --wi-ink-light: #131b26;
  --wi-muted-light: #475569;
  --wi-brand-light: #1d4ed8;
  --wi-brand-hover-light: color-mix(in oklab, var(--wi-brand-light) 82%, var(--wi-ink-light));
  --wi-brand-ink-light: #ffffff;
  --wi-gold-light: #925200;
  --wi-border-light: color-mix(in oklab, var(--wi-muted-light) 35%, var(--wi-surface-light));
  --wi-border-soft-light: color-mix(in oklab, var(--wi-muted-light) 20%, var(--wi-surface-light));
  --wi-table-head-light: color-mix(in oklab, var(--wi-surface-light) 88%, var(--wi-brand-light));
  --wi-portal-head-light: color-mix(in oklab, var(--wi-surface-light) 84%, var(--wi-brand-light));
  --wi-scroll-thumb-light: color-mix(in oklab, var(--wi-muted-light) 75%, var(--wi-bg-light));
  --wi-scroll-track-light: var(--wi-border-soft-light);

  --wi-bg-dark: #0f141d;
  --wi-surface-dark: #161e2c;
  --wi-surface-alt-dark: color-mix(in oklab, var(--wi-surface-dark) 88%, var(--wi-brand-dark));
  --wi-ink-dark: #eef2f7;
  --wi-muted-dark: #a0b0c6;
  --wi-brand-dark: #60a5fa;
  --wi-brand-hover-dark: color-mix(in oklab, var(--wi-brand-dark) 78%, var(--wi-ink-dark));
  --wi-brand-ink-dark: #0b1220;
  --wi-gold-dark: #fbbf24;
  --wi-border-dark: color-mix(in oklab, var(--wi-muted-dark) 35%, var(--wi-surface-dark));
  --wi-border-soft-dark: color-mix(in oklab, var(--wi-muted-dark) 20%, var(--wi-surface-dark));
  --wi-table-head-dark: color-mix(in oklab, var(--wi-surface-dark) 84%, var(--wi-brand-dark));
  --wi-portal-head-dark: color-mix(in oklab, var(--wi-surface-dark) 80%, var(--wi-brand-dark));
  --wi-scroll-thumb-dark: color-mix(in oklab, var(--wi-muted-dark) 65%, var(--wi-bg-dark));
  --wi-scroll-track-dark: var(--wi-surface-dark);

  --wi-bg: var(--wi-bg-light);
  --wi-surface: var(--wi-surface-light);
  --wi-surface-alt: var(--wi-surface-alt-light);
  --wi-ink: var(--wi-ink-light);
  --wi-muted: var(--wi-muted-light);
  --wi-brand: var(--wi-brand-light);
  --wi-brand-hover: var(--wi-brand-hover-light);
  --wi-brand-ink: var(--wi-brand-ink-light);
  --wi-gold: var(--wi-gold-light);
  --wi-border: var(--wi-border-light);
  --wi-border-soft: var(--wi-border-soft-light);
  --wi-table-head: var(--wi-table-head-light);
  --wi-portal-head: var(--wi-portal-head-light);
  --wi-scroll-thumb: var(--wi-scroll-thumb-light);
  --wi-scroll-track: var(--wi-scroll-track-light);

  --wi-font-display: 'Cinzel', Georgia, serif;
  --wi-font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --wi-radius: 4px;
  --wi-shadow-sm: 0 1px 2px rgba(15, 20, 29, 0.06);
  --wi-shadow-md: 0 8px 24px rgba(15, 20, 29, 0.08);
  --target-size: 24px;

  color-scheme: light dark;
  accent-color: var(--wi-brand);
  scrollbar-color: var(--wi-scroll-thumb) var(--wi-scroll-track);
  scrollbar-gutter: stable;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wi-bg: var(--wi-bg-dark);
    --wi-surface: var(--wi-surface-dark);
    --wi-surface-alt: var(--wi-surface-alt-dark);
    --wi-ink: var(--wi-ink-dark);
    --wi-muted: var(--wi-muted-dark);
    --wi-brand: var(--wi-brand-dark);
    --wi-brand-hover: var(--wi-brand-hover-dark);
    --wi-brand-ink: var(--wi-brand-ink-dark);
    --wi-gold: var(--wi-gold-dark);
    --wi-border: var(--wi-border-dark);
    --wi-border-soft: var(--wi-border-soft-dark);
    --wi-table-head: var(--wi-table-head-dark);
    --wi-portal-head: var(--wi-portal-head-dark);
    --wi-scroll-thumb: var(--wi-scroll-thumb-dark);
    --wi-scroll-track: var(--wi-scroll-track-dark);
  }
}

@supports (color: light-dark(white, black)) {
  :root {
    --wi-bg: light-dark(var(--wi-bg-light), var(--wi-bg-dark));
    --wi-surface: light-dark(var(--wi-surface-light), var(--wi-surface-dark));
    --wi-surface-alt: light-dark(var(--wi-surface-alt-light), var(--wi-surface-alt-dark));
    --wi-ink: light-dark(var(--wi-ink-light), var(--wi-ink-dark));
    --wi-muted: light-dark(var(--wi-muted-light), var(--wi-muted-dark));
    --wi-brand: light-dark(var(--wi-brand-light), var(--wi-brand-dark));
    --wi-brand-hover: light-dark(var(--wi-brand-hover-light), var(--wi-brand-hover-dark));
    --wi-brand-ink: light-dark(var(--wi-brand-ink-light), var(--wi-brand-ink-dark));
    --wi-gold: light-dark(var(--wi-gold-light), var(--wi-gold-dark));
    --wi-border: light-dark(var(--wi-border-light), var(--wi-border-dark));
    --wi-border-soft: light-dark(var(--wi-border-soft-light), var(--wi-border-soft-dark));
    --wi-table-head: light-dark(var(--wi-table-head-light), var(--wi-table-head-dark));
    --wi-portal-head: light-dark(var(--wi-portal-head-light), var(--wi-portal-head-dark));
    --wi-scroll-thumb: light-dark(var(--wi-scroll-thumb-light), var(--wi-scroll-thumb-dark));
    --wi-scroll-track: light-dark(var(--wi-scroll-track-light), var(--wi-scroll-track-dark));
  }
}

@supports not (scrollbar-color: auto) {
  .wi-table-wrap,
  .wi-drawer-sheet {
    scrollbar-width: auto;
  }
  .wi-table-wrap::-webkit-scrollbar,
  .wi-drawer-sheet::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  .wi-table-wrap::-webkit-scrollbar-thumb,
  .wi-drawer-sheet::-webkit-scrollbar-thumb {
    background: var(--wi-scroll-thumb);
  }
  .wi-table-wrap::-webkit-scrollbar-track,
  .wi-drawer-sheet::-webkit-scrollbar-track {
    background: var(--wi-scroll-track);
  }
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

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

html {
  font-size: 16px;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background-color: var(--wi-bg);
  color: var(--wi-ink);
  font-family: var(--wi-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

img, video, svg {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

a {
  color: var(--wi-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--wi-brand-hover);
}

:where(a, code) {
  overflow-wrap: anywhere;
}

:where(button, select, textarea, input:not([type="checkbox"], [type="radio"]), [role="button"], nav a) {
  min-block-size: var(--target-size);
  min-inline-size: var(--target-size);
}

:focus-visible {
  outline: 2px solid var(--wi-brand);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--wi-font-display);
  color: var(--wi-ink);
  line-height: 1.2;
  text-wrap: balance;
  margin-top: 0;
}

h1 {
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--wi-border);
  margin-bottom: 12px;
}

h2 {
  font-size: 1.4rem;
  margin-top: 28px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--wi-border-soft);
}

h3 {
  font-family: var(--wi-font-sans);
  font-weight: 700;
  font-size: 1.125rem;
  margin-top: 20px;
  margin-bottom: 8px;
}

p, li {
  text-wrap: pretty;
}

.wi-article-body p,
.wi-article-body li {
  max-inline-size: 70ch;
}

code, pre {
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--wi-surface-alt);
  padding: 2px 6px;
  border-radius: 3px;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.wi-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wi-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--wi-brand);
  color: var(--wi-brand-ink);
  padding: 8px 14px;
  z-index: 50;
}
.wi-skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Masthead */
.wi-masthead {
  background: var(--wi-surface);
  border-bottom: 1px solid var(--wi-border);
  box-shadow: var(--wi-shadow-sm);
}

.wi-masthead-inner {
  max-width: 1400px;
  margin-inline: auto;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.wi-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--wi-ink);
  font-family: var(--wi-font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
}

.wi-brand-sub {
  font-family: var(--wi-font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wi-muted);
  display: block;
}

.wi-search-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 380px;
  margin-inline-start: auto;
  min-inline-size: 0;
}

.wi-search-input {
  width: 100%;
  min-block-size: 38px;
  padding: 6px 12px;
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-bg);
  color: var(--wi-ink);
  font-family: var(--wi-font-sans);
  font-size: 0.875rem;
}

.wi-search-results {
  position: absolute;
  inset-block-start: calc(100% + 4px);
  inset-inline: 0;
  background: var(--wi-surface);
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  box-shadow: var(--wi-shadow-md);
  z-index: 40;
  max-block-size: 300px;
  overflow-y: auto;
}

.wi-search-results a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--wi-border-soft);
  font-size: 0.875rem;
}

.wi-search-results a:hover {
  background: var(--wi-surface-alt);
}

.wi-search-results strong {
  display: block;
  color: var(--wi-ink);
}

.wi-search-results span {
  display: block;
  font-size: 0.75rem;
  color: var(--wi-muted);
}

.wi-masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wi-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  min-block-size: 38px;
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-surface);
  color: var(--wi-ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.wi-btn-outline:hover {
  background: var(--wi-surface-alt);
}

.wi-drawer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  min-block-size: 40px;
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-surface-alt);
  color: var(--wi-ink);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

@media (min-width: 960px) {
  .wi-drawer-btn {
    display: none;
  }
}

/* Mobile Navigation Drawer (modern-web-guidance) */
.wi-drawer {
  --drawer-width: min(20em, 82dvw, 100dvw - 24px);
  --drawer-backdrop: 0;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.wi-drawer::backdrop {
  background: rgb(0 0 0);
  opacity: calc(var(--drawer-backdrop) / 2);
}

.wi-drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

@media (prefers-reduced-motion: no-preference) {
  .wi-drawer-scroller {
    scroll-behavior: smooth;
  }
}

.wi-drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.wi-drawer-sheet {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100svh;
  background: var(--wi-surface);
  color: var(--wi-ink);
  border-inline-end: 1px solid var(--wi-border);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-align: start;
  padding: 16px;
  gap: 16px;
}

.wi-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wi-border-soft);
  padding-bottom: 10px;
}

@supports (animation-timeline: scroll()) {
  .wi-drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }
  .wi-drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }
  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }
  @keyframes fade-drawer-backdrop {
    0% { --drawer-backdrop: 1; }
    100% { --drawer-backdrop: 0; }
  }
}

/* Encyclopedia Shell: main FIRST in DOM, sidebar SECOND in DOM */
.wi-shell {
  max-width: 1400px;
  margin-inline: auto;
  padding: 10px 8px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.wi-sheet {
  min-inline-size: 0;
  background: var(--wi-surface);
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  padding: 14px 12px 24px;
  box-shadow: var(--wi-shadow-sm);
}

.wi-sidebar {
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 960px) {
  .wi-shell {
    padding: 18px 24px 48px;
    grid-template-columns: 244px minmax(0, 1fr);
    grid-template-areas: "sidebar main";
    gap: 20px;
    align-items: start;
  }
  .wi-sheet {
    grid-area: main;
    padding: 20px 28px 36px;
  }
  .wi-sidebar {
    grid-area: sidebar;
  }
}

.wi-portlet {
  background: var(--wi-surface);
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  overflow: hidden;
}

.wi-portlet-title {
  margin: 0;
  padding: 8px 12px;
  background: var(--wi-table-head);
  border-bottom: 1px solid var(--wi-border);
  font-family: var(--wi-font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wi-ink);
}

.wi-portlet-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.wi-portlet-list a {
  display: block;
  padding: 5px 12px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--wi-ink);
}

.wi-portlet-list a:hover {
  background: var(--wi-surface-alt);
  color: var(--wi-brand);
}

/* Namespace Tabs Bar */
.wi-ns-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--wi-border);
  margin-bottom: 14px;
  padding-bottom: 6px;
}

.wi-ns-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wi-ns-tab {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--wi-muted);
  border: 1px solid transparent;
  border-radius: 3px;
}

.wi-ns-tab:hover {
  color: var(--wi-ink);
  background: var(--wi-surface-alt);
}

.wi-ns-tab--active {
  color: var(--wi-ink);
  background: var(--wi-surface-alt);
  border-color: var(--wi-border);
}

.wi-stamp {
  font-size: 0.75rem;
  color: var(--wi-muted);
  font-weight: 600;
}

.wi-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--wi-muted);
  margin-bottom: 10px;
}

/* Article Flow + Right-Floated Infobox */
.wi-article-flow::after {
  content: "";
  display: table;
  clear: both;
}

.wi-direct-answer {
  font-size: 1.02rem;
  background: var(--wi-surface-alt);
  border-inline-start: 4px solid var(--wi-brand);
  padding: 10px 14px;
  margin: 0 0 14px;
  border-radius: 0 var(--wi-radius) var(--wi-radius) 0;
}

.wi-infobox {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface);
  margin: 0 0 16px;
  font-size: 0.875rem;
}

@media (min-width: 960px) {
  .wi-infobox {
    float: right;
    clear: right;
    width: 344px;
    margin: 0 0 18px 24px;
  }
}

.wi-infobox th.wi-infobox-head {
  background: var(--wi-table-head);
  color: var(--wi-ink);
  font-family: var(--wi-font-display);
  font-size: 1rem;
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--wi-border);
}

.wi-infobox td.wi-infobox-stage-cell {
  padding: 10px;
  border-bottom: 1px solid var(--wi-border);
}

.wi-infobox-row th {
  width: 38%;
  text-align: left;
  padding: 6px 10px;
  background: var(--wi-surface-alt);
  border-top: 1px solid var(--wi-border-soft);
  font-weight: 600;
  color: var(--wi-ink);
  vertical-align: top;
}

.wi-infobox-row td {
  padding: 6px 10px;
  border-top: 1px solid var(--wi-border-soft);
  color: var(--wi-ink);
  vertical-align: top;
}

/* Stage & Play CTA inside Infobox */
.wi-stage {
  position: relative;
  width: 100%;
  background: var(--wi-surface-alt);
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  overflow: hidden;
}

.wi-cover {
  display: flex;
  flex-direction: column;
}

.wi-cover-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.wi-cover-bar {
  padding: 8px;
  background: var(--wi-surface);
  border-top: 1px solid var(--wi-border-soft);
}

.wi-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-block-size: 44px;
  padding: 10px 14px;
  background: var(--wi-brand);
  color: var(--wi-brand-ink);
  border: 1px solid transparent;
  border-radius: var(--wi-radius);
  font-family: var(--wi-font-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.wi-play-btn:hover {
  background: var(--wi-brand-hover);
  color: var(--wi-brand-ink);
}

.wi-loader {
  display: none;
  padding: 18px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--wi-ink);
}

[data-gf-state="loading"] .wi-loader {
  display: block;
}

.wi-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.wi-action-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-block-size: 36px;
  padding: 4px 8px;
  background: var(--wi-surface-alt);
  color: var(--wi-ink);
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.wi-action-btn[aria-pressed="true"],
.wi-action-btn[data-gf-liked] {
  background: var(--wi-brand);
  color: var(--wi-brand-ink);
  border-color: var(--wi-brand);
}

.wi-share-msg {
  font-size: 0.75rem;
  color: var(--wi-gold);
  font-weight: 600;
  margin-top: 4px;
}

/* Numbered Contents TOC */
.wi-toc {
  display: inline-block;
  min-width: min(100%, 260px);
  max-width: 100%;
  background: var(--wi-surface-alt);
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  padding: 10px 16px;
  margin: 6px 0 18px;
  font-size: 0.875rem;
}

.wi-toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.wi-toc ol,
.wi-toc ul {
  margin: 0;
  padding-inline-start: 20px;
  list-style: decimal;
}

.wi-toc li {
  margin: 3px 0;
}

/* Interactive Tier Matrix Filter Controls */
.wi-top-interactive {
  clear: both;
}

.wi-lookup-panel {
  clear: both;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface);
  border-radius: var(--wi-radius);
  padding: 12px;
  margin: 12px 0 18px;
}

.wi-empty-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--wi-brand);
  border-radius: 3px;
  background: var(--wi-surface-alt);
  font-size: 0.9rem;
  font-weight: 600;
}

.wi-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.wi-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  min-block-size: 36px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface-alt);
  color: var(--wi-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.wi-filter-btn[aria-pressed="true"] {
  background: var(--wi-brand);
  color: var(--wi-brand-ink);
  border-color: var(--wi-brand);
}

.wi-table-filter-input {
  flex: 1 1 200px;
  min-inline-size: 0;
  min-block-size: 36px;
  padding: 6px 10px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-bg);
  color: var(--wi-ink);
  font-size: 0.875rem;
}

/* Border-collapsed MediaWiki Wikitables (Container query stacked cards on < 580px, NO display:grid on td) */
.wi-table-wrap {
  container-type: inline-size;
  overflow-x: auto;
  max-inline-size: 100%;
  margin: 10px 0 18px;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface);
  scrollbar-gutter: stable;
}

table.wikitable {
  width: 100%;
  min-inline-size: 540px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

@container (inline-size < 580px) {
  .wi-table-wrap {
    border: 0;
    overflow-x: visible;
    background: transparent;
  }
  .wi-table-wrap table.wikitable {
    min-inline-size: 0;
  }
  .wi-table-wrap table.wikitable,
  .wi-table-wrap table.wikitable caption,
  .wi-table-wrap table.wikitable thead,
  .wi-table-wrap table.wikitable tbody,
  .wi-table-wrap table.wikitable tr,
  .wi-table-wrap table.wikitable th,
  .wi-table-wrap table.wikitable td {
    display: block;
    width: 100%;
    text-align: left;
  }
  .wi-table-wrap table.wikitable thead {
    display: none;
  }
  .wi-table-wrap table.wikitable caption {
    border: 1px solid var(--wi-border);
    border-radius: var(--wi-radius);
    margin-bottom: 10px;
  }
  .wi-table-wrap table.wikitable tbody tr {
    margin-bottom: 10px;
    border: 1px solid var(--wi-border);
    border-radius: var(--wi-radius);
    background: var(--wi-surface);
    padding: 8px 12px;
  }
  .wi-table-wrap table.wikitable tbody tr:nth-child(even) {
    background: var(--wi-surface-alt);
  }
  .wi-table-wrap table.wikitable td {
    border: 0;
    border-top: 1px solid var(--wi-border-soft);
    padding: 6px 0;
  }
  .wi-table-wrap table.wikitable td:first-child {
    border-top: 0;
    padding-top: 2px;
  }
  .wi-table-wrap table.wikitable td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wi-muted);
    margin-bottom: 2px;
  }
}

table.wikitable caption {
  text-align: left;
  font-weight: 700;
  padding: 8px 10px;
  background: var(--wi-surface-alt);
  border-bottom: 1px solid var(--wi-border);
  color: var(--wi-ink);
}

table.wikitable th,
table.wikitable td {
  border: 1px solid var(--wi-border-soft);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

table.wikitable thead th {
  background: var(--wi-table-head);
  border-bottom: 1px solid var(--wi-border);
  font-weight: 700;
}

table.wikitable thead th:has(> button) {
  padding: 0;
}

.wi-sort-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-block-size: 38px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  color: var(--wi-ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.wi-sort-btn:hover {
  background: var(--wi-surface-alt);
}

.wi-sort-ind::after {
  content: "↕";
  font-size: 0.75rem;
  opacity: 0.65;
}

th[aria-sort="ascending"] .wi-sort-ind::after {
  content: "▲";
  opacity: 1;
}

th[aria-sort="descending"] .wi-sort-ind::after {
  content: "▼";
  opacity: 1;
}

table.wikitable tbody tr:nth-child(even) {
  background: var(--wi-surface-alt);
}

/* 2x2 Bordered Encyclopedia Portal Matrix (OSRS / Factorio style) */
.wi-portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 18px 0 24px;
}

@media (min-width: 720px) {
  .wi-portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.wi-portal-box {
  min-inline-size: 0;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
}

.wi-portal-head {
  background: var(--wi-portal-head);
  border-bottom: 1px solid var(--wi-border);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wi-portal-body {
  padding: 10px 12px;
  font-size: 0.9rem;
}

.wi-portal-body p {
  margin: 0 0 8px;
}

.wi-portal-links {
  margin: 0;
  padding-inline-start: 18px;
}

.wi-portal-links li {
  margin: 4px 0;
}

/* Figures, Official Shots & Verified Diagrams */
figure {
  margin: 16px 0 20px;
  padding: 8px;
  background: var(--wi-surface-alt);
  border: 1px solid var(--wi-border);
  border-radius: 3px;
}

figure img {
  width: 100%;
  height: auto;
  border-radius: 2px;
}

figcaption {
  padding-top: 8px;
  font-size: 0.875rem;
  color: var(--wi-muted);
}

/* Interactive Step Checklist & WakeLock */
.wi-steps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

ol[data-gf-steps] {
  padding-inline-start: 22px;
}

ol[data-gf-steps] li {
  margin-bottom: 10px;
}

/* FAQ & Sources & Bottom Navbox */
.wi-faq-item {
  border: 1px solid var(--wi-border-soft);
  border-radius: 3px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--wi-surface);
}

.wi-faq-item summary {
  font-weight: 700;
  cursor: pointer;
  min-block-size: 32px;
  display: flex;
  align-items: center;
}

.wi-sources-box {
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface-alt);
  border-radius: 3px;
}

.wi-sources-box h2 {
  margin-top: 0;
  font-size: 1.125rem;
  border-bottom: 0;
  padding-bottom: 0;
}

table.wi-navbox {
  width: 100%;
  border-collapse: collapse;
  margin-top: 22px;
  border: 1px solid var(--wi-border);
  font-size: 0.875rem;
}

table.wi-navbox th.wi-navbox-title {
  background: var(--wi-portal-head);
  padding: 7px 12px;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid var(--wi-border);
}

table.wi-navbox th.wi-navbox-group {
  width: 160px;
  background: var(--wi-table-head);
  padding: 7px 10px;
  text-align: right;
  border-top: 1px solid var(--wi-border-soft);
  border-right: 1px solid var(--wi-border-soft);
}

table.wi-navbox td.wi-navbox-list {
  padding: 7px 10px;
  border-top: 1px solid var(--wi-border-soft);
}

@media (max-width: 640px) {
  table.wi-navbox th.wi-navbox-group,
  table.wi-navbox td.wi-navbox-list {
    display: block;
    width: 100%;
    text-align: left;
    border-right: 0;
  }
}

/* Adsterra Lossless Containers */
.wi-ad {
  margin: 18px auto;
  padding: 8px 4px;
  border: 1px solid var(--wi-border-soft);
  background: var(--wi-surface-alt);
  border-radius: 3px;
  text-align: center;
  max-inline-size: 100%;
  overflow-x: auto;
}

.wi-ad-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wi-muted);
  margin-bottom: 4px;
}

.wi-ad--top {
  margin-top: 16px;
}

.wi-ad--rect {
  margin-top: 22px;
}

/* Native Comments */
.wi-comments {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--wi-border);
}

.wi-comment-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--wi-surface-alt);
  border: 1px solid var(--wi-border-soft);
  border-radius: 3px;
}

.wi-comment-form input,
.wi-comment-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
  color: var(--wi-ink);
  font-family: var(--wi-font-sans);
  font-size: 0.9375rem;
}

.wi-comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wi-comment-item {
  border: 1px solid var(--wi-border-soft);
  border-radius: 3px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--wi-surface);
}

.wi-comment-item[data-gf-owner] {
  border-inline-start: 4px solid var(--wi-gold);
}

.wi-comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 0.8125rem;
  margin-bottom: 4px;
}

.wi-owner-badge {
  background: var(--wi-gold);
  color: var(--wi-brand-ink);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 2px;
}

.wi-comment-replies {
  margin-top: 8px;
  padding-inline-start: 16px;
  border-inline-start: 2px solid var(--wi-border);
}

[data-gf-comments][data-gf-empty]::before {
  content: "No player notes yet. Share your Wicked Island 1.0 route, weapon find, or tip above.";
  display: block;
  color: var(--wi-muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

/* Interactive 1.0 Combat, Bleed & Scaling Calculator */
.wi-calc {
  border: 1px solid var(--wi-border);
  background: var(--wi-surface-alt);
  border-radius: var(--wi-radius);
  padding: 16px;
  margin: 14px 0 22px;
  min-inline-size: 0;
}

.wi-calc h2 {
  margin-top: 0;
}

.wi-calc-intro {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--wi-muted);
}

.wi-calc-form {
  display: grid;
  gap: 14px;
  min-inline-size: 0;
}

.wi-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  min-inline-size: 0;
}

.wi-calc-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-inline-size: 0;
}

.wi-calc-field label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--wi-ink);
}

.wi-calc-field select,
.wi-calc-field input[type="number"] {
  font: inherit;
  font-size: max(1rem, 1em);
  min-block-size: 44px;
  padding: 8px 10px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
  color: var(--wi-ink);
  width: 100%;
  box-sizing: border-box;
}

.wi-field-hint {
  font-size: 0.78rem;
  color: var(--wi-muted);
}

.wi-calc-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  min-inline-size: 0;
}

.wi-calc-fieldset {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--wi-border-soft);
  border-radius: 3px;
  background: var(--wi-surface);
  min-inline-size: 0;
}

.wi-calc-fieldset legend {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0 6px;
  color: var(--wi-ink);
}

.wi-radio-row,
.wi-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-block-size: 40px;
  padding: 3px 0;
}

.wi-radio-row input,
.wi-check-row input {
  inline-size: 18px;
  block-size: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--wi-brand);
}

.wi-radio-row label,
.wi-check-row label {
  font-size: 0.875rem;
  color: var(--wi-ink);
  cursor: pointer;
  line-height: 1.35;
}

.wi-calc-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--wi-border);
  min-inline-size: 0;
}

.wi-calc-stat {
  background: var(--wi-surface);
  border: 1px solid var(--wi-border-soft);
  border-inline-start: 3px solid var(--wi-brand);
  border-radius: 3px;
  padding: 8px 12px;
  min-inline-size: 0;
}

.wi-calc-stat--wide {
  grid-column: 1 / -1;
  border-inline-start-color: var(--wi-gold);
}

.wi-calc-stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wi-muted);
  margin-bottom: 2px;
}

.wi-calc-stat output {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--wi-ink);
}

/* Rich Feature Cards (modern-web-guidance card) */
.wi-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin: 14px 0 24px;
}

#core-systems-cards .wi-card-grid {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
  #core-systems-cards .wi-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.wi-card {
  container-type: inline-size;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-surface);
  min-inline-size: 0;
}

.wi-card > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 2px;
}

.wi-card > h3 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.wi-card > p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--wi-muted);
}

.wi-card > footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--wi-border-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.wi-card a.wi-card-link {
  color: var(--wi-ink);
  text-decoration: none;
}

.wi-card a.wi-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.wi-card a.wi-card-link:focus-visible {
  outline: none;
}

.wi-card:has(a.wi-card-link:focus-visible) {
  outline: 2px solid var(--wi-brand);
  outline-offset: 2px;
}

.wi-card:has(a.wi-card-link:hover) {
  border-color: var(--wi-brand);
  background: var(--wi-surface-alt);
}

.wi-card footer a,
.wi-card button,
.wi-card input {
  position: relative;
  z-index: 1;
}

@container (min-width: 34rem) {
  .wi-card:has(> img) {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    column-gap: 14px;
  }
  .wi-card:has(> img) > img {
    grid-column: 1;
    grid-row: 1 / 4;
    height: 100%;
  }
  .wi-card:has(> img) > h3,
  .wi-card:has(> img) > p,
  .wi-card:has(> img) > footer {
    grid-column: 2;
  }
}

/* Guides Hub, Interactive Island Atlas & Changelog */
.wi-hub-group {
  margin: 20px 0 26px;
}

.wi-atlas-panel {
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-surface-alt);
  padding: 14px;
  margin: 14px 0 22px;
}

.wi-atlas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 10px;
  margin: 12px 0;
}

.wi-atlas-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
  color: var(--wi-ink);
  cursor: pointer;
  min-inline-size: 0;
}

.wi-atlas-node[aria-pressed="true"] {
  border-color: var(--wi-brand);
  box-shadow: inset 3px 0 0 var(--wi-brand);
  background: var(--wi-surface-alt);
}

.wi-atlas-node-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wi-gold);
}

.wi-atlas-detail {
  padding: 12px 14px;
  border: 1px solid var(--wi-border);
  border-inline-start: 4px solid var(--wi-brand);
  background: var(--wi-surface);
  border-radius: 3px;
}

.wi-changelog-entry {
  border: 1px solid var(--wi-border);
  border-inline-start: 4px solid var(--wi-brand);
  background: var(--wi-surface);
  border-radius: 3px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.wi-changelog-meta {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--wi-gold);
  margin-bottom: 4px;
}

details.spoiler {
  border: 1px solid var(--wi-border);
  background: var(--wi-surface-alt);
  border-radius: 3px;
  padding: 8px 12px;
  margin: 12px 0;
}

details.spoiler summary {
  font-weight: 700;
  cursor: pointer;
}

/* Page Feedback Tally Bar */
.wi-feedback {
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface-alt);
  border-radius: var(--wi-radius);
}

.wi-fb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wi-fb-heading {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--wi-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
}

.wi-fb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wi-fb-btn {
  min-block-size: 38px;
  padding: 6px 12px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
  color: var(--wi-ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.wi-fb-btn:hover {
  background: var(--wi-table-head);
}

.wi-fb-btn[aria-pressed="true"] {
  background: var(--wi-brand);
  color: var(--wi-brand-ink);
  border-color: var(--wi-brand);
}

.wi-fb-status {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--wi-muted);
  min-block-size: 1.2em;
}

/* Footer */
.wi-footer {
  border-top: 1px solid var(--wi-border);
  background: var(--wi-surface);
  padding: 18px 24px;
  margin-top: 24px;
}

.wi-footer-inner {
  max-width: 1400px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--wi-muted);
}

.wi-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

@media (hover: hover) and (pointer: fine) {
  [data-gf-wakelock] {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .wi-masthead-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .wi-brand-sub {
    display: none;
  }
  .wi-brand-link {
    font-size: 0.98rem;
    gap: 7px;
  }
  .wi-brand-link img {
    width: 24px;
    height: 24px;
  }
  .wi-search-wrap {
    flex: 1 0 100%;
    max-width: none;
    margin-inline-start: 0;
  }
  .wi-search-input {
    min-block-size: 38px;
    padding: 6px 10px;
    font-size: 0.875rem;
  }
  .wi-masthead-actions {
    flex: 1 0 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  .wi-btn-outline,
  .wi-drawer-btn {
    min-block-size: 36px;
    padding: 5px 10px;
    font-size: 0.8125rem;
  }
  .wi-shell {
    padding: 6px 6px 24px;
  }
  .wi-sheet {
    padding: 10px 10px 22px;
  }
  .wi-ns-bar {
    gap: 4px 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .wi-ns-tabs {
    display: flex;
    flex-wrap: wrap;
    overflow-x: auto;
    max-inline-size: 100%;
    gap: 4px;
  }
  .wi-ns-tab {
    flex: 0 0 auto;
    padding: 4px 8px;
    font-size: 0.78rem;
  }
  .wi-sheet h1 {
    font-size: 1.45rem;
    padding-bottom: 4px;
    margin-bottom: 8px;
  }
  .wi-direct-answer {
    font-size: 0.9rem;
    line-height: 1.44;
    padding: 7px 10px;
    margin-bottom: 10px;
  }
  .wi-cover-img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }
  .wi-cover-bar {
    padding: 6px;
  }
}

/* Click-to-load YouTube cards */
.wi-video-card {
  margin: 12px 0 18px;
  padding: 10px;
  border: 1px solid var(--wi-border);
  background: var(--wi-surface-alt);
  border-radius: 4px;
  max-inline-size: 500px;
}
.wi-video-card button[data-youtube] {
  display: block;
  position: relative;
  inline-size: 100%;
  max-inline-size: 480px;
  padding: 0;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.wi-video-card button[data-youtube] img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.wi-video-card button[data-youtube]::after {
  content: "▶ Play Video";
  position: absolute;
  inset-inline-start: 10px;
  inset-block-end: 10px;
  padding: 4px 10px;
  border-radius: 3px;
  background: rgba(15, 20, 29, 0.86);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
}
.wi-video-card iframe[data-youtube],
.wi-video-card iframe {
  display: block;
  inline-size: 100%;
  max-inline-size: 480px;
  aspect-ratio: 16 / 9;
  block-size: auto;
  border: 0;
}
.wi-video-meta {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--wi-muted);
}

/* Interactive Collection Progress Checklist */
.wi-checklist-panel {
  border: 1px solid var(--wi-border);
  border-radius: var(--wi-radius);
  background: var(--wi-surface-alt);
  padding: 14px;
  margin: 14px 0 20px;
}
.wi-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.wi-progress-bar {
  flex: 1 1 200px;
  height: 12px;
  accent-color: var(--wi-brand);
}
.wi-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
  gap: 8px;
}
.wi-check-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-block-size: 44px;
  border: 1px solid var(--wi-border);
  border-radius: 3px;
  background: var(--wi-surface);
  color: var(--wi-ink);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.wi-check-card input[type="checkbox"] {
  inline-size: 18px;
  block-size: 18px;
  flex: 0 0 auto;
}
.wi-check-card:has(input:checked) {
  border-color: var(--wi-brand);
  background: var(--wi-table-head);
}
