/* Infinity Stone Core Wiki. The Pugmeowla palette (warm peach→mauve background, cream and white surfaces, #C9A89B
   borders, purple accent) with a restrained system: hairline borders, a small set of radii, near-flat shadows,
   type built from size, weight and tracking, and quick color-only transitions instead of lifts and loops. */
:root {
  --bg-start: #eecd95;
  --bg-end: #b59395;
  --panel: rgb(251, 223, 181);
  --panel-soft: #fdf0dc;
  --card: #ffffff;
  --border: #C9A89B;
  --surface: #ffffff;
  --text-strong: #4a3b34;
  --tint: rgba(255, 255, 255, 0.45);
  --tint-strong: rgba(255, 255, 255, 0.75);
  --button-bg: #8e1fa6;
  --button-bg-hover: #6b1580;
  --callout-bg: #fff7e8; --callout-border: #f2d9a8;
  --callout-tip-bg: #eefbf2; --callout-tip-border: #b5e6c4;
  --callout-warn-bg: #fff0ea; --callout-warn-border: #f6c3ad;
  --callout-compat-bg: #f6ecfb; --lilac-border: #dcbde8; --notice-bg: rgba(246, 236, 251, 0.9);
  --tag-gold-bg: #fdebd0; --tag-gold-text: #8a5a12; --tag-purple-bg: #f1defa; --tag-warn-text: #b4441a;
  --mark-bg: #ffe39a; --code-bg: #f6ece0; --code-text: #6b4a3a; --row-hover: #fffaf3; --challenge-border: #d9b8f0;
  --hairline: rgba(90, 74, 66, 0.14);
  --hairline-strong: rgba(90, 74, 66, 0.24);
  --divider: #E8DCC8;
  --text: #5A4A42;
  --text-soft: #7A6A62;
  --text-faint: #9A8A82;
  --text-on-bg: #66564e;
  --accent: #8e1fa6;
  --accent-strong: #6b1580;
  --gold: #e3a43a;
  --curseforge: #eb622b;
  --modrinth: #00af5c;
  --shadow-panel: 0 1px 2px rgba(60, 40, 30, 0.05), 0 12px 32px -16px rgba(60, 40, 30, 0.22);
  --shadow-card: 0 1px 2px rgba(60, 40, 30, 0.06);
  --shadow-card-hover: 0 1px 2px rgba(60, 40, 30, 0.06), 0 10px 28px -12px rgba(60, 40, 30, 0.24);
  --radius-panel: 18px;
  --radius-card: 14px;
  --radius-small: 10px;
  --radius-tag: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --topbar-h: 60px;
  --sidebar-w: 272px;
  --toc-w: 220px;
  --ease: 0.18s cubic-bezier(0.25, 0.1, 0.25, 1);
}
/* Dark theme: the same warm palette at night. Set by the toggle in the top bar (data-theme on <html>). */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-start: #241c18;
  --bg-end: #35272c;
  --panel: #30261f;
  --panel-soft: #3a2e26;
  --card: #2a221d;
  --surface: #2a221d;
  --border: #6b5649;
  --divider: rgba(255, 236, 218, 0.12);
  --hairline: rgba(255, 236, 218, 0.12);
  --hairline-strong: rgba(255, 236, 218, 0.22);
  --text: #eadccf;
  --text-strong: #f7ece1;
  --text-soft: #c4b2a3;
  --text-faint: #9a887b;
  --text-on-bg: #d8c6b6;
  --accent: #d08ae6;
  --accent-strong: #e4adf2;
  --button-bg: #9a3db6;
  --button-bg-hover: #b04fcc;
  --tint: rgba(255, 255, 255, 0.06);
  --tint-strong: rgba(255, 255, 255, 0.1);
  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -12px rgba(0, 0, 0, 0.6);
  --callout-bg: #3a301f; --callout-border: #6a5530;
  --callout-tip-bg: #1f3328; --callout-tip-border: #2f5a40;
  --callout-warn-bg: #3d2721; --callout-warn-border: #6e3c2b;
  --callout-compat-bg: #33253a; --lilac-border: #5d4069; --notice-bg: #33253a;
  --tag-gold-bg: #45361d; --tag-gold-text: #f0c878; --tag-purple-bg: #3f2b49; --tag-warn-text: #ff9e7d;
  --mark-bg: #6b5420; --code-bg: #3a2f28; --code-text: #f1cfb6; --row-hover: rgba(255, 255, 255, 0.03); --challenge-border: #6d4a80;
}


* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 16px); -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 1rem; background-color: var(--bg-start); color: var(--text); line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
/* The page gradient sits on a fixed layer so it spans the viewport on long pages and on iOS. */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%); }
img { max-width: 100%; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--card); padding: 10px 16px; border-radius: var(--radius-small); box-shadow: var(--shadow-card); }
.skip-link:focus { top: 12px; }

/* ───── Top bar ───── */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--hairline); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; flex-shrink: 0; }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; font-size: 0.98rem; letter-spacing: -0.01em; }
.brand small { font-weight: 500; color: var(--text-soft); font-size: 0.72rem; letter-spacing: 0.02em; }
.home-link {
  margin-left: 0; flex-shrink: 0; text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.9rem;
  padding: 8px 16px; border: 1px solid var(--hairline-strong); border-radius: 10px; background: var(--tint); transition: all var(--ease);
}
.home-link:hover { background: var(--tint-strong); color: var(--text); }
.menu-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--hairline-strong); border-radius: 10px; background: var(--tint-strong); cursor: pointer; position: relative; flex-shrink: 0; }
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after { position: absolute; left: 10px; width: 18px; height: 2px; background: var(--text); border-radius: 2px; content: ''; }
.menu-toggle span { top: 18px; }
.menu-toggle span::before { left: 0; top: -6px; }
.menu-toggle span::after { left: 0; top: 6px; }
.menu-toggle[aria-expanded="true"] span { background: transparent; }
.menu-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* ───── Preferences: link platform and theme ───── */
.prefs { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.prefs-drawer { display: none; }
.platform-switch { display: flex; padding: 2px; border-radius: 10px; background: var(--tint); border: 1px solid var(--hairline); }
.platform-switch button { font: 600 0.8rem var(--font); padding: 6px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); cursor: pointer; }
.platform-switch button:hover { color: var(--text); }
.platform-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-card); }
.theme-toggle { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--hairline-strong); background: var(--tint-strong); color: var(--text); cursor: pointer; }
.theme-toggle:hover { background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun, html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ───── Search ───── */
.search { position: relative; flex: 1; max-width: 520px; margin-left: 12px; }
.search input {
  width: 100%; height: 44px; padding: 0 44px 0 42px; border: 1px solid var(--hairline-strong); border-radius: 12px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%237A6A62' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M13 13l4 4'/%3E%3C/svg%3E") no-repeat 15px center;
  font: inherit; font-size: 0.95rem; color: var(--text); transition: border-color var(--ease), box-shadow var(--ease);
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142, 31, 166, 0.14); }
.search-key { position: absolute; right: 14px; top: 11px; font: 600 0.75rem var(--mono); color: var(--text-faint); border: 1px solid var(--hairline); border-radius: 6px; padding: 1px 7px; pointer-events: none; }
.search input:focus ~ .search-key { display: none; }
.search-results { position: absolute; top: 50px; left: 0; right: 0; max-height: min(70vh, 520px); overflow-y: auto; background: var(--card); border: 1px solid var(--hairline-strong); border-radius: 14px; box-shadow: 0 18px 48px -18px rgba(40, 25, 20, 0.35); padding: 6px; }
.search-result { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.search-result[aria-selected="true"], .search-result:hover { background: var(--panel-soft); color: var(--text); }
.search-result .kind { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: var(--radius-tag); background: var(--divider); color: var(--text-soft); margin-top: 2px; min-width: 62px; text-align: center; }
.search-result .kind-ability { background: var(--tag-purple-bg); color: var(--accent-strong); }
.search-result .kind-item { background: var(--tag-gold-bg); color: var(--tag-gold-text); }
.search-result strong { display: block; font-size: 0.95rem; }
.search-result small { display: block; color: var(--text-soft); font-size: 0.8rem; line-height: 1.4; }
.search-result mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 14px; color: var(--text-soft); font-size: 0.9rem; }

/* ───── Shell ───── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 28px; max-width: 1480px; margin: 0 auto; padding: 24px 20px 40px; }
.shell.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }

.sidebar { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); }
.sidebar-inner { max-height: inherit; overflow-y: auto; padding: 2px 4px 12px; scrollbar-width: thin; }
.version-switch { margin: 0 6px 12px; }
.version-switch summary { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 12px; border-radius: 10px; background: var(--tint);
  font-size: 0.78rem; font-weight: 700; color: var(--text-soft); cursor: pointer; list-style: none; text-align: center; transition: background var(--ease); }
.version-switch summary::-webkit-details-marker { display: none; }
.version-switch summary::after { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--ease); flex-shrink: 0; }
.version-switch[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.version-label { display: flex; justify-content: center; padding: 7px 12px; border-radius: 10px; background: var(--tint); font-size: 0.78rem; font-weight: 700; color: var(--text-soft); text-align: center; }
.version-switch summary:hover { background: var(--tint-strong); color: var(--text); }
.version-switch-title { margin: 10px 6px 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.version-switch ul { list-style: none; display: grid; gap: 4px; }
.version-switch a { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; text-decoration: none; color: var(--text); background: var(--tint); }
.version-switch a:hover { background: var(--surface); color: var(--text); }
.version-switch a.active { background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
.version-switch small { color: var(--text-soft); font-size: 0.75rem; font-weight: 600; }
.version-notice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--notice-bg); border: 1px solid var(--lilac-border); font-size: 0.88rem; }
.version-notice a { font-weight: 700; white-space: nowrap; }
.version-notice p { margin: 0; flex: 1; }
.version-notice-close { flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.version-notice-close:hover, .version-notice-close:focus-visible { background: var(--lilac-border); }
.nav-group summary { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; list-style: none; user-select: none; transition: background var(--ease); }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--text-soft); border-bottom: 2px solid var(--text-soft); transform: rotate(-45deg); transition: transform var(--ease); }
.nav-group[open] summary::after { transform: rotate(45deg); }
.nav-group summary:hover { background: var(--tint); }
.nav-top { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text); text-decoration: none; transition: background var(--ease); }
.nav-top:hover { background: var(--tint); color: var(--text); }
.nav-top.active { background: var(--tint-strong); color: var(--accent-strong); }
.nav-icon { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
.nav-group ul { list-style: none; margin: 2px 0 8px 21px; border-left: 1px solid var(--hairline-strong); padding-left: 8px; }
.nav-group li a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-on-bg); text-decoration: none; font-size: 0.88rem; transition: background var(--ease), color var(--ease); }
.nav-group li a:hover { background: var(--tint); color: var(--text); }
.nav-group li a.active { background: var(--tint-strong); color: var(--accent-strong); font-weight: 600; }

.content { min-width: 0; }
.content:focus { outline: none; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; font-size: 0.85rem; color: var(--text-on-bg); margin-bottom: 12px; }
.breadcrumbs li + li::before { content: '›'; margin-right: 6px; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-on-bg); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 600; }

.page-head { display: flex; align-items: center; gap: 20px; padding: 6px 4px 26px; }
.page-icon { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 4px 8px rgba(60, 40, 30, 0.16)); }
.page-head h1 { font-family: var(--font-display); font-size: 2.4rem; line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; color: var(--text-strong); }
.lead { margin-top: 8px; font-size: 1.125rem; line-height: 1.5; color: var(--text-on-bg); max-width: 640px; letter-spacing: -0.005em; }

.toc { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; font-size: 0.86rem; padding: 6px 4px; }
.toc-title { font-weight: 600; font-size: 0.78rem; color: var(--text-on-bg); margin-bottom: 8px; }
.toc ol, .toc-inline ol { list-style: none; }
.toc a, .toc-inline a { display: block; padding: 4px 10px; border-left: 1px solid var(--hairline-strong); color: var(--text-on-bg); text-decoration: none; line-height: 1.35; }
.toc .toc-l3 a, .toc-inline .toc-l3 a { padding-left: 22px; font-size: 0.82rem; }
.toc a:hover { color: var(--text); border-left-color: var(--text-soft); }
.toc a.current { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }
.toc-inline { display: none; background: var(--tint); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.toc-inline summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.toc-inline ol { margin-top: 8px; }

/* ───── Prose ───── */
.prose { overflow-wrap: break-word; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: 40px 44px; }
body.home .prose { background: transparent; border: 0; box-shadow: none; padding: 0; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; margin-top: 2.2em; padding-top: 1.1em; border-top: 1px solid var(--hairline); line-height: 1.2; color: var(--text-strong); }
.prose > h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.012em; line-height: 1.3; margin-top: 1.7em; color: var(--text-strong); }
.prose h4 { font-size: 1rem; margin-top: 1.3em; }
.heading-anchor { margin-left: 8px; font-weight: 400; color: var(--text-faint); text-decoration: none; opacity: 0; transition: opacity var(--ease); }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.3em; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--code-bg); color: var(--code-text); padding: 1px 6px; border-radius: 6px; overflow-wrap: break-word; }
.prose strong { color: var(--text-strong); }
.prose kbd, kbd.key { font: 600 0.82em var(--mono); background: var(--card); border: 1px solid var(--hairline); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--divider); vertical-align: top; }
th { background: var(--panel-soft); font-weight: 600; font-size: 0.85rem; color: var(--text-soft); }
tbody tr:hover { background: var(--row-hover); }
tfoot td { font-weight: 700; background: var(--panel-soft); }
tr:last-child td { border-bottom: 0; }

.callout { border-radius: 12px; padding: 14px 18px 14px 48px; position: relative; background: var(--callout-bg); border: 1px solid var(--callout-border); }
.callout::before { content: ''; position: absolute; left: 16px; top: 15px; width: 20px; height: 20px; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='10' fill='%23e3a43a'/><path d='M10 9v5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/><circle cx='10' cy='6.2' r='1.2' fill='white'/></svg>") center / 20px 20px no-repeat; }
.callout > :first-child { margin-top: 0; }
.callout > * + * { margin-top: 0.6em; }
.callout.tip { background: var(--callout-tip-bg); border-color: var(--callout-tip-border); }
.callout.tip::before { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='10' fill='%2300af5c'/><path d='M6 10.4l2.6 2.6L14 7.6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.callout.warn { background: var(--callout-warn-bg); border-color: var(--callout-warn-border); }
.callout.warn::before { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='10' fill='%23eb622b'/><path d='M10 5.5v5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/><circle cx='10' cy='14.2' r='1.2' fill='white'/></svg>"); }
.callout.compat { background: var(--callout-compat-bg); border-color: var(--lilac-border); }
.callout.compat::before { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='10' cy='10' r='10' fill='%238e1fa6'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%280 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%2845 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%2890 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%28135 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%28180 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%28225 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%28270 10 10%29'/><rect x='9' y='3.6' width='2' height='3' rx='0.6' fill='white' transform='rotate%28315 10 10%29'/><circle cx='10' cy='10' r='3.6' fill='white'/><circle cx='10' cy='10' r='1.5' fill='%238e1fa6'/></svg>"); }
.callout-title { display: block; font-weight: 700; }

.status { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 9px; border-radius: var(--radius-tag); vertical-align: middle; }
.status.partial { background: var(--tag-gold-bg); color: var(--tag-gold-text); }
.status.legacy { background: var(--divider); color: var(--text-soft); }
.status.optional { background: var(--tag-purple-bg); color: var(--accent-strong); }

/* ───── Code ───── */
.code-block { border-radius: 12px; overflow: hidden; background: #2f2530; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 16px; background: #3d3040; color: #e8d6c8; font: 600 0.78rem var(--mono); }
.code-head span { min-width: 0; overflow-wrap: anywhere; }
.code-head .copy-button { flex-shrink: 0; margin-left: 10px; }
.copy-button { font: 600 0.75rem var(--font); color: #2f2530; background: var(--panel); border: 0; border-radius: 6px; padding: 5px 12px; cursor: pointer; transition: background var(--ease); }
.copy-button:hover { background: var(--surface); }
.copy-button.copied { background: #9ee6b5; }
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 0.84rem/1.6 var(--mono); color: #f3e7dc; tab-size: 2; }
.code-block code { background: none; color: inherit; padding: 0; font-size: inherit; }
.t-key { color: #f5b971; } .t-str { color: #a8dd8c; } .t-num { color: #f39ac1; } .t-bool { color: #8fc8ff; }
.t-comment { color: #a08f98; font-style: italic; } .t-cmd { color: #f0a0ff; font-weight: 700; } .t-arg { color: #ffd479; }
.t-opt { color: #9fd2ff; } .t-sel { color: #8fe0d0; } .t-lit { color: #f3e7dc; }

/* ───── Chips, tags & buttons ───── */
.chip { display: inline-flex; white-space: normal; max-width: 100%; line-height: 1.3; align-items: center; gap: 6px; vertical-align: middle; padding: 2px 10px 2px 4px; border-radius: 8px; background: var(--panel-soft); border: 1px solid var(--hairline); color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9em; line-height: 1.6; transition: all var(--ease); }
.prose td .chip { max-width: none; }
.prose td code { font-size: 0.8em; }
/* A short list of chips inside a table cell: one per line, two side by side when there's room. */
.prose .cell-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10.5rem, 100%), 1fr)); gap: 6px 10px; }
.prose .cell-list li { margin: 0; }
.prose li > .cell-list { margin-top: 8px; max-width: 26rem; }
.chip img, .chip .img-missing { width: 22px; height: 22px; max-width: none; flex-shrink: 0; object-fit: contain; }
.chip:hover { color: var(--text); border-color: var(--hairline-strong); background: var(--card); }
.stone-chip { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ability-link { font-weight: 600; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 !important; }
.tags li { margin: 0 !important; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 650; padding: 2px 10px; border-radius: var(--radius-tag); background: var(--panel-soft); color: var(--text-soft); border: 1px solid var(--divider); white-space: nowrap; }
.tag-activation { background: color-mix(in srgb, var(--accent, #8e1fa6) 14%, var(--surface)); color: var(--text-strong); border-color: color-mix(in srgb, var(--accent, #8e1fa6) 35%, var(--surface)); }
.tag-cost { background: var(--tag-gold-bg); color: var(--tag-gold-text); border-color: var(--callout-border); }
.tag-warn { background: var(--callout-warn-bg); color: var(--tag-warn-text); border-color: var(--callout-warn-border); }
.button-link { display: inline-flex; white-space: nowrap; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1px solid transparent; padding: 0 20px; border-radius: var(--radius-small); background: var(--button-bg); color: #fff; font-weight: 600; font-size: 0.95rem; letter-spacing: -0.005em; text-decoration: none; transition: background var(--ease), filter var(--ease), border-color var(--ease); }
.button-link:hover { background: var(--button-bg-hover); color: #fff; }
.button-link.ghost { background: var(--tint-strong); color: var(--text); border-color: var(--hairline-strong); }
.button-link.ghost:hover { background: var(--surface); color: var(--text); }
.button-link.curseforge:hover, .button-link.modrinth:hover { filter: brightness(0.92); }
.button-link.curseforge { background: var(--curseforge); }
.button-link.modrinth { background: var(--modrinth); }
.img-missing { display: inline-block; background: repeating-linear-gradient(45deg, var(--divider) 0 6px, var(--code-bg) 6px 12px); border-radius: 8px; }

/* ───── Ability cards ───── */
.ability-list { display: grid; gap: 16px; }
.ability-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 18px; padding: 20px 22px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--hairline); transition: box-shadow var(--ease); }
.ability-card:target { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #8e1fa6) 40%, transparent); }
.ability-icon { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent, #c9a89b) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent, #c9a89b) 22%, transparent); }
.ability-icon img, .ability-icon .img-missing { width: 36px; height: 36px; object-fit: contain; }
.ability-body > * + * { margin-top: 8px; }
.ability-name { font-size: 1.1rem !important; letter-spacing: -0.01em; margin: 0 !important; }
.ability-summary { font-weight: 500; }
.ability-req { font-size: 0.9rem; }
.ability-req > span:first-child { font-weight: 700; color: var(--text-soft); margin-right: 4px; }
.ability-id { font-size: 0.78rem; color: var(--text-faint); }
.ability-id code { font-size: 0.95em; }

/* ───── Filter panels (abilities / items) ───── */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-input, .filter-select { height: 44px; padding: 0 16px; border: 1px solid var(--hairline-strong); border-radius: 12px; font: inherit; color: var(--text); background: var(--card); }
.filter-input { flex: 1; min-width: min(220px, 100%); }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142, 31, 166, 0.14); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-chip { font: 600 0.82rem var(--font); padding: 6px 14px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--card); color: var(--text-soft); cursor: pointer; transition: all var(--ease); }
.filter-chip:hover { border-color: var(--border); color: var(--text); }
.filter-chip[aria-pressed="true"] { background: var(--accent, var(--text)); border-color: var(--accent, var(--text)); color: #fff; }
.filter-chip:not([style])[aria-pressed="true"] { background: var(--text); border-color: var(--text); }
.filter-count { font-size: 0.85rem; color: var(--text-soft); margin-top: 12px; }
.filter-empty { padding: 20px; text-align: center; color: var(--text-soft); }
.index-list { list-style: none; padding: 0 !important; display: grid; gap: 10px; margin-top: 12px; }
.index-row { margin: 0 !important; }
.index-row a { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--hairline); border-left: 3px solid var(--accent); background: var(--card); color: var(--text); text-decoration: none; transition: background var(--ease), border-color var(--ease); }
.index-row a:hover { background: var(--panel-soft); border-color: var(--hairline-strong); border-left-color: var(--accent); color: var(--text); }
.index-icon { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.index-main { flex: 1; min-width: 0; }
.index-main strong { display: block; }
.index-main small { display: block; color: var(--text-soft); font-size: 0.82rem; line-height: 1.4; }
.index-side { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 300px; }

.item-grid { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(118px, 100%), 1fr)); gap: 12px; margin-top: 12px; }
.item-tile { margin: 0 !important; }
.item-open { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--card); cursor: pointer; font: 600 0.8rem var(--font); color: var(--text); text-align: center; line-height: 1.3; transition: all var(--ease); }
.item-open:hover { border-color: var(--hairline-strong); background: var(--panel-soft); }
.item-tile:target .item-open { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142, 31, 166, 0.18); }
.item-img, .item-tile .img-missing { width: 56px; height: 56px; object-fit: contain; }
.item-dialog { border: 1px solid var(--hairline-strong); border-radius: var(--radius-panel); padding: 30px; max-width: min(520px, calc(100vw - 32px)); width: 100%; background: var(--panel); color: var(--text); box-shadow: 0 24px 60px -20px rgba(40, 25, 20, 0.45); margin: auto; }
.item-dialog::backdrop { background: rgba(60, 40, 35, 0.45); }
.dialog-close, .lightbox-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 1px solid var(--hairline-strong); border-radius: 50%; background: var(--card); font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--text); }
.item-detail { display: flex; flex-direction: column; flex: 1; }
.item-detail > * + * { margin-top: 12px; }
.item-card .item-detail > p:last-child:has(.button-link) { margin-top: auto; padding-top: 16px; }
.item-detail-head > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.item-detail-head { display: flex; gap: 16px; align-items: center; }
.item-detail-head code { overflow-wrap: anywhere; }
.item-id { align-self: flex-start; max-width: 100%; font-size: 0.8rem !important; overflow-wrap: break-word; }
.item-detail-img, .item-detail-head .img-missing { width: 72px; height: 72px; object-fit: contain; background: var(--card); border-radius: 12px; border: 1px solid var(--hairline); padding: 8px; flex-shrink: 0; }
.item-detail h3 { font-size: 1.2rem; margin: 0 !important; }
.item-detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 0.92rem; }
.item-detail dt { font-weight: 700; color: var(--text-soft); }
.item-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.item-card { display: flex; flex-direction: column; background: var(--panel-soft); border: 1px solid var(--hairline); border-radius: var(--radius-card); padding: 20px; }

/* ───── Stones ───── */
.stone-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stone-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 24px 14px 20px; border-radius: var(--radius-card); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--glint) 16%, var(--surface)) 0, var(--surface) 60%); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--hairline)); color: var(--text); text-decoration: none; transition: border-color var(--ease), box-shadow var(--ease); }
.stone-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--shadow-card-hover); color: var(--text); }
.stone-img { width: 64px; height: 64px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--glint) 60%, transparent)); }
.stone-card strong { font-size: 1rem; letter-spacing: -0.01em; }
.stone-card small { color: var(--text-soft); font-size: 0.82rem; line-height: 1.4; }

.stone-selector { background: var(--panel-soft); border: 1px solid var(--hairline); border-radius: var(--radius-panel); padding: 16px; }
.selector-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.selector-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; font: 600 0.9rem var(--font); color: var(--text-soft); cursor: pointer; transition: background var(--ease), color var(--ease), border-color var(--ease); }
.selector-tabs button img { width: 28px; height: 28px; }
.selector-tabs button:hover { background: var(--tint-strong); color: var(--text); }
.selector-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow-card); }
.selector-panel { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: center; margin-top: 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 28px; }
html:not(.js) .selector-panel[hidden] { display: grid !important; }
.selector-visual { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, var(--surface)) 0, color-mix(in srgb, var(--accent) 8%, var(--surface)) 55%, transparent 70%); }
.selector-stone { width: 112px; height: 112px; filter: drop-shadow(0 0 16px var(--accent)); }
.selector-info > * + * { margin-top: 10px; }
.selector-info h3 { margin: 0 !important; font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -0.02em; }
.selector-info dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 0.93rem; }
.selector-info dt { font-weight: 700; color: var(--text-soft); }
.selector-info .button-link { white-space: normal; text-align: center; }
.selector-info dd { min-width: 0; overflow-wrap: break-word; }

/* ───── Cards ───── */
.page-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.page-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius-card); background: var(--card); border: 1px solid var(--hairline); color: var(--text); text-decoration: none; transition: border-color var(--ease), background var(--ease); }
.page-card:hover { border-color: var(--hairline-strong); background: var(--panel-soft); color: var(--text); }
.page-card img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.page-card strong { display: block; }
.page-card small { display: block; color: var(--text-soft); font-size: 0.85rem; line-height: 1.45; margin-top: 2px; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 16px; }
.skin-card { background: var(--panel-soft); border: 1px solid var(--hairline); border-radius: var(--radius-card); padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color var(--ease); }
.skin-card:hover { border-color: var(--hairline-strong); }
.skin-card h3 { font-size: 1rem !important; margin: 0 !important; }
.skin-views { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.skin-zoom { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 6px 8px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); cursor: zoom-in; transition: border-color var(--ease); }
.skin-zoom:hover { border-color: var(--hairline-strong); }
.skin-zoom span { font: 600 0.7rem var(--font); color: var(--text-faint); }
.skin-img, .skin-model { width: 72px; height: 72px; object-fit: contain; }
.skin-unlock { font-size: 0.88rem; }
.skin-unlock > span:first-child { font-weight: 700; color: var(--text-soft); }
.skin-notes { font-size: 0.8rem; color: var(--text-soft); line-height: 1.4; }
.skin-card code { font-size: 0.75rem; margin-top: auto; max-width: 100%; overflow-wrap: anywhere; }
.spoiler { font: 600 0.78rem var(--font); padding: 2px 10px; border-radius: var(--radius-tag); border: 1.5px dashed var(--border); background: var(--card); color: var(--text-soft); cursor: pointer; }

/* Tabs (configuration examples) */
.tabs { border: 1px solid var(--hairline); border-radius: var(--radius-card); overflow: hidden; }
.tab-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--panel-soft); border-bottom: 1px solid var(--hairline); }
.tab-list button { font: 600 0.85rem var(--font); padding: 7px 14px; border-radius: 8px; border: 0; background: transparent; color: var(--text-soft); cursor: pointer; transition: background var(--ease), color var(--ease); }
.tab-list button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow-card); }
.tabs > section { padding: 16px; }
.tabs > section > * + * { margin-top: 1em; }
html.js .tabs > section > .tab-label { display: none; }

/* Figures & lightbox */
.figure { text-align: center; }
.figure .zoomable { border: 0; background: var(--panel-soft); border-radius: var(--radius-card); padding: 12px; cursor: zoom-in; display: inline-block; max-width: 100%; }
.figure img { display: block; max-width: 100%; height: auto; border-radius: 12px; }
.figure figcaption { font-size: 0.85rem; color: var(--text-soft); margin-top: 8px; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(40, 28, 26, 0.82); display: grid; place-items: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox figure { max-width: min(92vw, 900px); text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; min-width: min(60vw, 360px); image-rendering: pixelated; background: var(--panel); border-radius: var(--radius-card); padding: 20px; }
.lightbox figcaption { color: #fbe9d6; margin-top: 12px; font-weight: 600; }

/* Pager, footer, back-to-top */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.pager-link { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: var(--radius-card); background: var(--tint-strong); border: 1px solid var(--hairline); text-decoration: none; color: var(--text); transition: background var(--ease), border-color var(--ease); }
.pager-link:hover { background: var(--surface); border-color: var(--hairline-strong); color: var(--text); }
.pager-link small { color: var(--text-faint); font-weight: 500; font-size: 0.78rem; }
.pager-link span { font-weight: 600; color: var(--accent-strong); letter-spacing: -0.01em; }
.pager-link.next { text-align: right; }
.pager-link:only-child { grid-column: 1 / -1; }
.footer { margin-top: 32px; text-align: center; font-size: 0.82rem; color: var(--text-soft); }
.footer p + p { margin-top: 4px; }
.footer a { color: var(--text); font-weight: 600; }
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 30; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hairline-strong); background: var(--panel); color: var(--text); font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow-card-hover); transition: background var(--ease); }
.to-top:hover { background: var(--surface); }
.scrim { display: none; }

/* ───── Home ───── */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); align-items: center; gap: 32px;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: 52px 52px;
}
.hero-text > * + * { margin-top: 16px; }
.hero-badge { display: block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-soft); }
.hero h1 { font-family: var(--font-display); font-size: 3.2rem; line-height: 1.04; font-weight: 700; letter-spacing: -0.035em; color: var(--text-strong); }
.hero h1 span { display: block; font-size: 1.2rem; font-weight: 600; color: var(--text-soft); letter-spacing: -0.01em; margin-bottom: 6px; }
.hero p { font-size: 1.1rem; line-height: 1.6; color: var(--text-soft); max-width: 560px; }
.hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 400px; padding-top: 8px; }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 340px; }
.hero-gauntlet { position: relative; z-index: 2; width: min(100%, 200px); border-radius: 50%; border: 1px solid var(--hairline-strong); box-shadow: 0 18px 40px -18px rgba(60, 40, 30, 0.45); }
.hero-visual { --orbit: 290px; }
.hero-orbit { position: absolute; inset: 0; margin: auto; width: var(--orbit); height: var(--orbit); border-radius: 50%; border: 1px solid var(--hairline); animation: orbit 60s linear infinite; }
/* A ferris wheel: the ring turns, and each stone turns back by the same amount so it always stays upright. */
.orbit-stone { position: absolute; width: 44px; height: 44px; left: calc(50% - 22px); top: calc(50% - 22px); border-radius: 50%; transform: rotate(var(--a)) translateY(calc(var(--orbit) / -2)) rotate(calc(-1 * var(--a))); }
.orbit-stone img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--glow) 70%, transparent)); animation: orbit 60s linear infinite reverse; }
.orbit-stone:hover img, .orbit-stone:focus-visible img { filter: brightness(1.25) drop-shadow(0 0 6px color-mix(in srgb, var(--glow) 70%, transparent)); }
.hero-visual:hover .hero-orbit, .hero-visual:hover .orbit-stone img, .hero-visual:focus-within .hero-orbit, .hero-visual:focus-within .orbit-stone img { animation-play-state: paused; }
@keyframes orbit { to { transform: rotate(360deg); } }
.home-section { margin-top: 40px; }
.home-section > h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.025em; color: var(--text-strong); margin: 0 0 16px 4px; border: 0 !important; padding: 0 !important; }

/* ───── Responsive ───── */
@media (max-width: 1100px) {
  .selector-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; padding: 40px 36px; gap: 20px; }
  .hero-visual { min-height: 290px; order: -1; --orbit: 250px; }
  .hero-gauntlet { width: 170px; }
}
@media (max-width: 1240px) {
  .shell.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 920px) {
  .menu-toggle { display: block; }
  .shell, .shell.has-toc { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 32px; }
  /* Navigation becomes a full-height drawer that slides in from the left, under the top bar. */
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 35; width: min(340px, 88vw); max-height: none; padding: 0; align-self: stretch;
    display: none; }
  .sidebar-inner { height: 100%; max-height: none; background: var(--panel); border-right: 1px solid var(--hairline-strong); border-radius: 0;
    padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { display: block; box-shadow: 16px 0 40px -16px rgba(60, 40, 35, 0.35); }
  .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 min(340px, 88vw); z-index: 34; background: rgba(60, 40, 35, 0.4); opacity: 0; pointer-events: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .scrim[hidden] { display: block; }
  .version-switch { margin: 0 2px 14px; }
  .version-switch summary { padding: 10px 14px; font-size: 0.9rem; }
  .version-switch a { padding: 12px 14px; }
  .nav-group { margin-bottom: 2px; }
  .nav-group summary, .nav-top { padding: 11px 12px; font-size: 0.98rem; min-height: 46px; }
  .nav-group ul { margin: 2px 0 10px 24px; }
  .nav-group li a { padding: 10px 12px; font-size: 0.95rem; min-height: 44px; display: flex; align-items: center; }
  .home-link { display: none; }
  .prefs-top { display: none; }
  .prefs-drawer { display: flex; justify-content: space-between; margin: 0 2px 14px; }
  .prefs-drawer .platform-switch { flex: 1; }
  .prefs-drawer .platform-switch button { flex: 1; padding: 9px 10px; font-size: 0.88rem; }
  .prefs-drawer .theme-toggle { width: 42px; height: 42px; }
  .search { margin-left: 0; }
  .selector-panel { grid-template-columns: 1fr; }
  .selector-info h3 { text-align: center; }
  .selector-info > p:first-of-type { text-align: center; }
  .selector-visual { width: 160px; margin: 0 auto; }
  .selector-info dl { text-align: left; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand span { display: none; }
  .search-key { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; padding: 8px 4px 20px; gap: 12px; }
  .page-head h1 { font-size: 2rem; }
  .page-icon { width: 52px; height: 52px; }
  .prose { padding: 26px 20px; border-radius: var(--radius-card); }
  .prose h2 { font-size: 1.35rem; }
  .ability-card { grid-template-columns: 1fr; padding: 18px; }
  .index-row a { flex-wrap: wrap; row-gap: 8px; align-items: flex-start; }
  .index-icon { margin-top: 2px; }
  .index-main { flex: 1 1 calc(100% - 48px); }
  .index-side { flex: 1 1 100%; max-width: none; justify-content: flex-start; padding-left: 48px; }
  .selector-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .selector-panel { padding: 20px 16px; }
  .selector-tabs button { font-size: 0.88rem; padding: 8px 10px; }
  .selector-info .button-link { width: 100%; }
  .stone-selector { padding: 14px; }
  .pager { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.35rem; }
  .hero-actions { max-width: none; }
  .hero { padding: 28px 22px; }
  .to-top { right: 14px; bottom: 14px; }
  .footer { padding-bottom: 56px; }
  th, td { padding: 8px 10px; }
  /* Tables with three or more columns keep readable columns and scroll sideways instead of squeezing every word. */
  table:has(thead th:nth-child(3)) { min-width: 34rem; }
  table:has(thead th:nth-child(5)) { min-width: 44rem; }
  .skin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .skin-card { padding: 12px 10px; }
  .skin-img, .skin-model { width: 60px; height: 60px; }
  .item-detail dl, .selector-info dl { grid-template-columns: 1fr; }
  .item-detail-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .item-detail-img, .item-detail-head .img-missing { width: 64px; height: 64px; }
  .item-detail-head code { font-size: 0.78rem; }
  .item-card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  html:not([data-theme="dark"]) { --hairline: rgba(90, 74, 66, 0.4); --hairline-strong: rgba(90, 74, 66, 0.6); --text-soft: #5A4A42; --text-faint: #6a5a52; }
}

/* Advancements */
.adv-list { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.prose .adv-list li + li { margin-top: 0; }
.adv { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: start; padding: 14px 18px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--hairline); }
.adv > img { width: 56px; height: 56px; object-fit: contain; padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--hairline); box-sizing: border-box; }
.adv-challenge > img { border-color: var(--challenge-border); }
.adv-goal > img { border-radius: 50%; }
.prose .adv p { margin: 0; }
.adv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.adv-head strong { font-size: 1rem; margin-right: 2px; overflow-wrap: break-word; }
.adv-desc { font-style: italic; color: var(--text-soft); font-size: 0.9rem; margin-top: 2px !important; }
.adv-how { font-size: 0.92rem; margin-top: 6px !important; }

/* Travel options (dimensions page) and mod logos */
.travel-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .travel-options { grid-template-columns: 1fr; } }
.travel-option { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius-card); background: var(--panel-soft); border: 1px solid var(--hairline); }
.travel-option > img { width: 56px; height: 56px; object-fit: contain; border-radius: 14px; flex-shrink: 0; background: var(--card); padding: 4px; }
.travel-option p { margin-top: 4px; font-size: 0.9rem; color: var(--text-soft); }
.travel-option .travel-option-title { margin: 0; font-size: 1.02rem; font-weight: 600; color: var(--text); }
/* A mention of another mod: its icon, then its name, linking to its Modrinth or CurseForge page. */
.mod-link-lead { white-space: nowrap; }
.mod-icon { display: inline-block; width: 1.1em; height: 1.1em; object-fit: contain; vertical-align: -0.2em; margin-right: 0.3em; border-radius: 3px; }
/* Mod icons sit to the left of the name, and longer names wrap beside them rather than under. */
.mod-logo { position: absolute; left: 12px; top: 8px; width: 28px; height: 28px; object-fit: contain; border-radius: 7px; }
.prose td:has(> .mod-logo) { position: relative; padding-left: 50px; min-width: 12rem; }
.credits-list { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.credits-list li { margin: 0 !important; padding: 10px 14px; border-radius: 14px; background: var(--panel-soft); border: 1px solid var(--hairline); }
.credits-list small { display: block; color: var(--text-soft); }
.figure-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; align-items: start; }
.figure-row .figure { margin: 0; }
.figure-row .figure .zoomable { display: block; width: 100%; }

@media (max-width: 360px) {
  .index-side { padding-left: 0; }
  .travel-option { flex-direction: column; gap: 10px; }
  .skin-grid { grid-template-columns: 1fr; }
  .tag { white-space: normal; }
  .hero-visual { --orbit: 210px; min-height: 250px; }
  .hero-gauntlet { width: 140px; }
  .orbit-stone { width: 36px; height: 36px; left: calc(50% - 18px); top: calc(50% - 18px); }
}

/* ───── Large and ultrawide screens ─────
   The columns widen and the type grows a little; lists of cards go two across, the six stones sit in one row, and
   running text keeps a readable line length while tables and grids use the full width. */
@media (min-width: 1680px) {
  :root { --sidebar-w: 300px; --toc-w: 250px; }
  html { font-size: 106.25%; }
  .shell { max-width: 1960px; gap: 40px; padding: 32px 32px 56px; }
  .prose > p, .prose > ul, .prose > ol, .prose > .callout, .lead { max-width: 52rem; }
  .ability-list, .adv-list, .index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stone-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hero { padding: 64px; }
  .search { max-width: 640px; }
}
@media (min-width: 2200px) {
  :root { --sidebar-w: 320px; --toc-w: 280px; }
  html { font-size: 112.5%; }
  .shell { max-width: 2400px; }
}
