* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: system-ui, sans-serif;
  min-height: 100vh;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.site-header a.brand { text-decoration: none; display: inline-flex; align-items: center; }
/* Brand lockup: the sigil-R medallion leads into "eveal". Two stacked layers —
   desecrated green in flow (sizes the box), revealed gold overlaid — so the gold
   can wipe in over the green on load (see the reveal animation below). */
.brand-lock { position: relative; display: inline-block; }
.brand-layer { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.brand-sigil { width: 30px; height: 30px; flex: 0 0 auto; }
.brand-word {
  font-family: var(--font-display);
  font-size: 20px; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.brand-desecrated { position: relative; color: #9fe86a; filter: drop-shadow(0 0 6px rgba(159, 232, 106, 0.5)); }
.brand-revealed { position: absolute; inset: 0; color: #e6c989; filter: drop-shadow(0 0 5px rgba(230, 201, 137, 0.35)); }

/* On load the gold layer wipes in left-to-right and the green fades — the mark
   performs the Well-of-Souls reveal on every page load. Honors reduced-motion. */
@keyframes brand-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes brand-fade { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
.brand-revealed { clip-path: inset(0 0 0 0); animation: brand-wipe 1.5s cubic-bezier(0.72, 0, 0.22, 1) both; }
.brand-desecrated { animation: brand-fade 1.5s ease-in both; }
@media (prefers-reduced-motion: reduce) {
  .brand-revealed { animation: none; clip-path: inset(0 0 0 0); }
  .brand-desecrated { animation: none; opacity: 0; }
}
.search-box { flex: 1; max-width: 480px; position: relative; }

/* Card size control (S/M/L) — scales the gem-detail unit, persisted in localStorage */
.card-size { display: flex; gap: 2px; margin-left: auto; }
.card-size button {
  width: 26px;
  height: 26px;
  padding: 0;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--color-normal);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.card-size button:hover { border-color: var(--color-prop); }
.card-size button.active {
  border-color: var(--color-prop);
  color: var(--color-prop);
}
.search-box input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
/* The htmx target: an overlay anchored to the search box so results float over
   the page (drop-down) instead of pushing the header taller. */
#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
}
.search-results {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.search-results a {
  display: block;
  padding: 6px 12px;
  color: var(--color-normal);
  text-decoration: none;
}
.search-results a:hover { background: var(--bg-base); }
/* Escalation row — pinned to the bottom, set off from the named hits above. */
.search-result-all {
  border-top: 1px solid var(--border);
  color: var(--color-prop);
}
.search-result-all .search-result-name { color: var(--color-prop); }
.search-result-all kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 0 4px;
  margin-right: 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-base);
}
.search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.search-result-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-caret {
  flex-shrink: 0;
  color: var(--color-default);
  font-size: 15px;
  line-height: 1;
}
.search-result-cat {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-default);
  white-space: nowrap;
  flex-shrink: 0;
}
.search-result-cat--gem,
.search-result-cat--skill,
.search-result-cat--support,
.search-result-cat--spirit { background: rgba(27, 162, 155, 0.2); color: var(--color-gem); }
.search-result-cat--unique { background: rgba(175, 96, 37, 0.2); color: var(--color-unique); }
.search-result-cat--keystone { background: rgba(200, 180, 100, 0.2); color: #c8b464; }
.search-result-cat--notable { background: rgba(200, 180, 100, 0.15); color: #b8a454; }
.search-result-cat--affix { background: rgba(136, 136, 255, 0.15); color: var(--magic-color); }
/* --- Site nav --- */
.site-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0;
}
.site-nav__item {
  position: relative;
}
.site-nav__top {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--color-normal);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: color 0.1s;
}
.site-nav__top:hover,
.site-nav__item:focus-within .site-nav__top {
  color: var(--color-unique);
}
.site-nav__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.site-nav__item:hover .site-nav__dropdown,
.site-nav__item:focus-within .site-nav__dropdown {
  display: block;
}
.site-nav__dropdown li a {
  display: block;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--color-normal);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.site-nav__dropdown li a:hover {
  background: var(--bg-base);
  color: var(--color-unique);
}

/* --- Gem browse grid --- */
.gem-list-section {
  width: 100%;
  max-width: 960px;
  margin-bottom: 32px;
}
.gem-list-heading {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--color-normal);
}
.gem-list-heading--active { color: var(--color-normal); }
.gem-list-heading--spirit { color: var(--color-gem); }
.gem-list-heading--support { color: var(--color-prop); }
.gem-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
  /* Cards size to their own content rather than stretching to the row. */
  align-items: start;
}
/* Condensed gem card: a gem header banner on top, then icon + a body of
   type/tags, requirements and the skill description. Full tooltip on hover. */
.gem-browse-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-normal);
  font-family: var(--font-smallcaps);
  transition: border-color 0.12s;
  overflow: hidden;
  position: relative;
}
.gem-browse-card:hover { border-color: var(--card-hover-border); }
/* Gem-color spine down the left edge (single color, or a hybrid gradient). */
.gem-browse-card--r { border-left: 2px solid var(--color-gem-r); }
.gem-browse-card--g { border-left: 2px solid var(--color-gem-g); }
.gem-browse-card--b { border-left: 2px solid var(--color-gem-b); }
.gem-browse-card--w { border-left: 2px solid var(--color-gem-w); }
.gem-browse-card--rg::before,
.gem-browse-card--rb::before,
.gem-browse-card--gb::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 2;
}
.gem-browse-card--rg::before { background: linear-gradient(to bottom, var(--color-gem-r), var(--color-gem-g)); }
.gem-browse-card--rb::before { background: linear-gradient(to bottom, var(--color-gem-r), var(--color-gem-b)); }
.gem-browse-card--gb::before { background: linear-gradient(to bottom, var(--color-gem-g), var(--color-gem-b)); }

/* In-game gem header banner (GemHoverTitle texture, left-anchored ornate
   corner over a dark fill) with the name in white. */
.gem-browse-header {
  background: #0c0d0d url(/static/img/Art/Textures/Interface/2D/2DArt/UIImages/InGame/SmartHover/GemHoverTitle.webp) left center / auto 100% no-repeat;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.6);
}
.gem-browse-name {
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gem-browse-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 11px;
}
.gem-browse-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.gem-browse-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
/* Type + tags line. Keywords keep the standard teal glossary color (base .kw)
   for contrast — dotted underline marks them. */
.gem-browse-tags {
  font-size: 11.5px;
  color: var(--color-default);
  line-height: 1.3;
}
.gem-browse-req {
  font-size: 11px;
  color: var(--color-default);
}
/* Skill effect lines — reuse the tooltip .explicitMod (magic blue, white
   values) but left-align and tighten for the dense card. */
.gem-browse-effect { display: flex; flex-direction: column; gap: 2px; }
.gem-browse-card .explicitMod {
  padding: 0;
  font-size: 11.5px;
  line-height: 1.35;
}

.page { padding: 24px; display: flex; justify-content: center; }
/* Column layout variant — templates add this in place of inline
   flex-direction/align-items on column pages. */
.page--column { flex-direction: column; align-items: center; }
/* Prose pages (credits, etc.): readable text column, left-aligned. */
.page--prose { align-items: stretch; }
.page--prose > * { max-width: 760px; margin-inline: auto; width: 100%; }
.page--prose h1 { font-family: var(--font-display); margin-bottom: 8px; }
.page--prose h2 { font-family: var(--font-display); margin: 24px 0 8px; color: var(--color-unique); }
.page--prose section { margin-bottom: 8px; }
.page--prose a { color: var(--color-magic); }
.page--prose li { margin-bottom: 8px; line-height: 1.5; }

/* Passive tree page: full-viewport canvas with an in-canvas overlay panel. */
.page--passives { flex-direction: column; padding: 0; width: 100%; }
.passive-tree-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 88px); /* viewport minus header + nav */
  /* dvh tracks the *visible* viewport as mobile browser URL bars collapse/expand,
     so the canvas doesn't get clipped or leave a gap under a retracting toolbar.
     Kept after the vh line as a progressive-enhancement fallback. */
  height: calc(100dvh - 88px);
}
.passive-tree-wrap:fullscreen { height: 100%; background: var(--bg-base); }

/* In-canvas control panel — GGG-style overlay, wiki-native dark styling. */
.tree-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 248px;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  font-size: 13px;
}
.tree-panel-toggle {
  position: absolute;
  top: 6px;
  left: -1px;
  transform: translateX(-100%);
  width: 22px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  color: var(--color-unique, #c9aa71);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.tree-panel-toggle:hover { color: var(--text, #e8dcc0); }
.tree-panel.collapsed { width: auto; background: transparent; border: none; box-shadow: none; backdrop-filter: none; }
.tree-panel.collapsed .tree-panel-body { display: none; }
.tree-panel.collapsed .tree-panel-toggle {
  position: static;
  transform: none;
  border-right: 1px solid var(--border);
  border-radius: 6px;
}
.tree-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.tree-panel-points {
  font-family: var(--font-display);
  color: var(--color-unique, #c9aa71);
  font-size: 14px;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.tree-panel-points.points-full { color: var(--color-danger, #d9534f); }
.tree-panel-field { display: flex; flex-direction: column; gap: 3px; }
.tree-panel-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted, #9a8f7a);
}
.passive-tree-select,
.passive-tree-input {
  width: 100%;
  background: var(--bg, #181410);
  color: var(--text, #e8dcc0);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 13px;
  font-family: inherit;
}
.passive-tree-select { cursor: pointer; }
.passive-tree-select:disabled { opacity: 0.5; cursor: default; }
.passive-tree-input::placeholder { color: var(--text-muted, #9a8f7a); opacity: 0.7; }

/* Weapon-set row (inert placeholder for the follow-up). */
.tree-panel-ws { display: flex; align-items: center; gap: 8px; }
.tree-panel-ws .tree-panel-label { flex: 1; }
.tree-ws-sets { display: flex; align-items: center; gap: 5px; }
.tree-ws-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}
/* Count text matches its set's tree accent — Set I red, Set II green — and
   brightens + bolds when the set's 25 points are fully spent. */
.tree-ws-count[data-ws-count="1"] { color: #e0584e; }
.tree-ws-count[data-ws-count="2"] { color: #5bbf6a; }
.tree-ws-count[data-ws-count="1"].is-full { color: #ff8a80; font-weight: 600; }
.tree-ws-count[data-ws-count="2"].is-full { color: #9be8a6; font-weight: 600; }
.tree-ws-btn {
  width: 26px;
  height: 22px;
  background: var(--bg, #181410);
  color: var(--text-muted, #9a8f7a);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font-display);
  cursor: pointer;
}
.tree-ws-btn:hover { border-color: var(--text-muted, #9a8f7a); }
/* Active set glows in its accent — Set I red, Set II green (matches the tree). */
.tree-ws-btn[data-ws-set="1"].is-active { color: #ff8a80; border-color: #e0584e; box-shadow: inset 0 0 0 1px #e0584e; }
.tree-ws-btn[data-ws-set="2"].is-active { color: #9be8a6; border-color: #5bbf6a; box-shadow: inset 0 0 0 1px #5bbf6a; }
.tree-panel-soon {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #9a8f7a);
}

.tree-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.passive-tree-btn {
  flex: 1 1 auto;
  background: var(--bg, #181410);
  color: var(--color-unique, #c9aa71);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
  cursor: pointer;
  white-space: nowrap;
}
.passive-tree-btn:hover { color: var(--text, #e8dcc0); border-color: var(--color-unique, #c9aa71); }

/* Left-docked stat aggregation panel — same chrome as #tree-panel, mirrored to
   the left edge with its collapse tab on the inner (right) side. Totals are
   rebuilt client-side on every alloc/dealloc. */
.tree-stats-panel { left: 12px; right: auto; width: 268px; }
.tree-stats-panel .tree-panel-toggle {
  left: auto;
  right: -1px;
  transform: translateX(100%);
  border-radius: 0 6px 6px 0;
  border-left: 1px solid var(--border);
  border-right: none;
}
.tree-stats-panel.collapsed .tree-panel-toggle {
  border-right: 1px solid var(--border);
  border-radius: 6px;
}
.tree-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
  /* room for the scrollbar so text doesn't sit under it */
  margin-right: -4px;
  padding-right: 4px;
}
.tree-stats-empty { margin: 0; color: var(--text-muted, #9a8f7a); font-style: italic; }
.tree-stats-cat { display: flex; flex-direction: column; gap: 2px; }
.tree-stats-cat-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted, #9a8f7a);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  margin-bottom: 2px;
}
/* Muted prose, white numbers — at-a-glance scanning (contrast-for-scanning). */
.tree-stats-line {
  color: var(--color-default, #a89e88);
  line-height: 1.35;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px;
  margin: 0 -4px;
  transition: background-color 0.12s ease;
}
.tree-stats-line:hover { background: color-mix(in srgb, var(--color-unique, #c9aa71) 14%, transparent); }
/* Pinned stat (its highlight lives in the search bar). Persistent, with a gold
   rail so it reads as selected, not merely hovered. */
.tree-stats-line.selected {
  background: color-mix(in srgb, var(--color-unique, #c9aa71) 22%, transparent);
  box-shadow: inset 2px 0 0 var(--color-unique, #c9aa71);
}
.tree-stats-line.selected .num { color: #fff; }
.tree-stats-line .num { color: #fff; font-weight: 600; }
.tree-stats-uniq .tree-stats-line { color: var(--color-unique, #c9aa71); }
.tree-stats-uniq .tree-stats-line .xn { color: var(--text-muted, #9a8f7a); font-weight: 600; }

/* Narrow viewports: both panels collapse by default (JS adds .collapsed on load).
   When expanded they must not exceed the screen or overlap each other, and their
   bodies scroll rather than running off-screen. */
@media (max-width: 640px) {
  .tree-panel,
  .tree-stats-panel {
    width: min(280px, calc(100vw - 48px));
    max-height: calc(100% - 24px);
  }
  .tree-panel .tree-panel-body,
  .tree-stats-panel .tree-panel-body {
    max-height: calc(100dvh - 88px - 24px);
    overflow-y: auto;
  }
}

/* Touch devices (no hover, coarse pointer): grow tap targets to ~44px and drop
   controls that don't work on touch. */
@media (hover: none) and (pointer: coarse) {
  .tree-panel-toggle,
  .tree-stats-panel .tree-panel-toggle { width: 32px; height: 44px; }
  .tree-ws-btn { min-width: 38px; min-height: 38px; }
  .passive-tree-btn,
  .passive-tree-select,
  .passive-tree-input { min-height: 40px; }
  /* iOS Safari only allows the Fullscreen API on <video>, so the button no-ops on
     iPhone — hide it on touch rather than present a dead control. */
  #tree-fullscreen { display: none; }
}
.passive-tree-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* The renderer owns all gestures (custom pan + pinch-zoom via pointer events).
     Without this the browser claims touches for page scroll / double-tap-zoom and
     the tree can't be panned or pinched on mobile. */
  touch-action: none;
}
.passive-tree-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  max-width: 260px;
  z-index: 10;
}

/* Site footer: legally-required GGG disclaimer + credits link, on every page. */
.site-footer {
  margin-top: 48px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--color-default);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
/* Passive tree fills the viewport with a black canvas; the footer's top margin
   reads as a stray black band with no nodes in it, so drop it on that page. */
main:has(.page--passives) + .site-footer { margin-top: 0; }
.site-footer__disclaimer { max-width: 820px; margin: 0 auto 6px; }
.site-footer__links { margin: 0; }
.site-footer a { color: var(--color-magic); }
/* Page titles use the display face; per-page color stays inline on the element. */
.page-title { font-family: var(--font-display); }
/* Full page width (up to a cap) so the recommended-supports grid can wrap into
   many columns; align-items:center keeps the gem card itself centered. */
.gem-detail { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 1400px; }

/* Recommended Supports / Recommended For: collapsible accent bands modeled on
   the /bases mod-table sections (.affix-origin). A left rule and faint wash of
   the per-section accent (--rec-accent, set inline) make each read as a distinct
   band; the smallcaps title carries a count badge and a rotating caret. The
   card grid inside renders the same browse cards as /gems. */
.rec-group {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px 14px 11px;
  border-left: 3px solid var(--rec-accent);
  background: color-mix(in srgb, var(--rec-accent) 6%, transparent);
  border-radius: 0 4px 4px 0;
}
.rec-group-title {
  font-family: var(--font-smallcaps);
  font-size: 18px;
  margin: 0;
  color: var(--rec-accent);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.rec-group-title::-webkit-details-marker { display: none; }
.rec-group-title::before {
  content: "\25B8"; /* ▸ */
  font-size: 12px;
  transition: transform 0.15s;
}
.rec-group[open] > .rec-group-title::before { transform: rotate(90deg); }
.rec-group-count {
  font-family: var(--font-smallcaps);
  font-size: 13px;
  font-weight: normal;
  color: var(--color-default);
}
.rec-group-hint {
  color: var(--color-default);
  font-size: 12.5px;
  margin: 4px 0 12px;
}
/* One tier row: a Roman-numeral label gutter + that tier's card grid. */
.rec-tier {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 12px;
  align-items: start;
}
.rec-tier + .rec-tier {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--rec-accent) 22%, transparent);
}
.rec-tier-label {
  font-family: var(--font-smallcaps);
  font-size: 22px;
  line-height: 1;
  color: var(--rec-accent);
  text-align: center;
  padding-top: 4px;
  user-select: none;
}
/* Center each tier's cards rather than pinning them left when a row isn't full.
   Fixed-width columns (not 1fr) keep cards from stretching so centering reads. */
.rec-tier .gem-browse-grid {
  grid-template-columns: repeat(auto-fit, 250px);
  justify-content: center;
}

/* Progressive disclosure for long "Recommended For" lists (some supports are
   recommended by ~100 skills). First N cards show inline; the rest collapse. */
.support-more { width: 100%; text-align: center; margin-top: 8px; }
.support-more__toggle {
  display: inline-block;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  color: var(--color-prop);
  list-style: none;
}
.support-more__toggle::-webkit-details-marker { display: none; }
/* Once expanded, drop the toggle entirely — it's a one-way "show all". */
.support-more[open] .support-more__toggle { display: none; }
.support-more__list { margin-top: 8px; }

/* Keyword tooltips — styling matched to poe2db's live tooltip (term #e7b478,
   body #b7ab83, opaque black popup; Tippy box neutralized so the popup paints). */
.kw {
  color: var(--kw-color);
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  cursor: help;
}
.kw:hover { color: var(--kw-hover-color); }

.tippy-box[data-theme~='poe2'] {
  background: #000;
  border: 0;
  border-radius: 4px;
  color: #b7ab83;
  font-size: 13px;
  line-height: 1.4;
  /* Tall tooltips can't fit any placement and spill off-screen; cap to the
     viewport and let the body scroll so the title is never clipped at the top. */
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}
.tippy-box[data-theme~='poe2'] .tippy-content { padding: 0; }
.tippy-box[data-theme~='poe2'] .tippy-arrow { color: #000; }
/* Cards carry a page-layout margin (e.g. .PassivePopup { margin: 16px auto 0 })
   that collapses into the zero-padding tooltip and shows the black box top. Zero
   it inside tooltips so the card sits flush. */
.tippy-box[data-theme~='poe2'] .newItemPopup { margin: 0; }

/* Passive-tree tooltips are translucent so the tree shows through (in-game feel).
   A backdrop blur keeps the stat text legible over the busy tree behind it.
   The per-rarity colored border/glow is dropped here — over the tree it's just
   noise — for a neutral faint edge + soft drop shadow that only reads as depth. */
.tippy-box[data-theme~='passive-tree'] { background: transparent; }
.tippy-box[data-theme~='passive-tree'] .newItemPopup {
  background-color: rgba(8, 9, 12, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}
/* No subtitle (Keystone / Notable Passive / Passive) in the tree tooltips —
   just the name in the banner. */
.tippy-box[data-theme~='passive-tree'] .itemName.typeLine { display: none; }

/* Generic-attribute node: the "+5 to any Attribute" choice. Each row is a
   clickable Str/Int/Dex option; the picked one is highlighted (in-game pick). */
.attr-choice .attr-opt {
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 8px;
  transition: background 0.1s ease;
}
.attr-choice .attr-opt:hover { background: rgba(200, 170, 110, 0.14); }
.attr-choice .attr-opt.chosen { background: rgba(200, 170, 110, 0.26); }
/* Once selected the card collapses to the single chosen stat — show it as a
   plain stat line (the node itself carries the colour; respec via node click). */
.attr-choice.locked .attr-opt { cursor: default; background: none; padding: 0; }

/* Affix base-target flyout — the list of bases that can roll a mod. */
.affix-bases { padding: 8px 10px; min-width: 160px; }
.affix-bases-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-default);
  margin-bottom: 6px;
}
.affix-bases-list { list-style: none; margin: 0; padding: 0; }
.affix-bases-link {
  display: block;
  padding: 3px 6px;
  border-radius: 3px;
  color: var(--color-normal);
  text-decoration: none;
  white-space: nowrap;
}
.affix-bases-link:hover { background: var(--bg-base); color: var(--color-prop); }

/* Match the tooltip to the card size. Tooltips are appended to <body> (outside
   the zoomed .gem-detail), so without this they always render at base/M scale.
   Zoom the .tippy-box, NOT the Popper-positioned [data-tippy-root] wrapper, so
   the content scales while the anchor math stays in an unzoomed frame. */
html[data-card-size="s"] .tippy-box[data-theme~='poe2'] { zoom: 0.85; }
html[data-card-size="l"] .tippy-box[data-theme~='poe2'] { zoom: 1.25; }
html[data-card-size="xl"] .tippy-box[data-theme~='poe2'] { zoom: 1.5; }

.kw-tip {
  text-align: center;             /* poe2db centres the popup text */
  /* same Fontin faces as the gem card (poe2db: FontinSmallCaps popup, FontinRegular body) */
  font-family: var(--font-smallcaps);
}
.kw-tip > strong {            /* term — poe2db's .card-header */
  display: block;
  margin: 0;
  color: #f0e6d2;
  font-weight: 500;
  font-size: 15px;
  /* No text-transform: FontinSmallCaps renders caps itself (capitals full-size,
     lowercase as small caps). Forcing uppercase removes that size variation. */
  padding: 8px 16px 0;
}
.kw-tip__body {               /* definition — poe2db's .card-body / .keyword-body */
  color: #b7ab83;
  font-family: var(--font-regular);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 4px 16px 8px;
}
.kw-tip__body::before {       /* yellowish divider — poe2db's .ItemRareSeparator */
  content: "";
  display: block;
  height: 2px;
  margin: 2px 0 7px;
  background: linear-gradient(90deg, transparent, #c9a227, transparent);
}
.kw-tip__body .kw { color: inherit; }   /* nested keywords match body text, like poe2db */

/* --- Filter bar --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  width: 100%;
  max-width: 960px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

/* Centered variant: center the bar on the page and center its buttons. */
.filter-bar--center {
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}
.filter-bar--center .filter-group { justify-content: center; }

.filter-label {
  font-size: 11px;
  color: var(--color-default);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

.filter-btn {
  padding: 3px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--color-normal);
  font-family: var(--font-smallcaps);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.filter-btn:hover { border-color: var(--color-normal); }

/* Icon buttons: label stacked above a generic class glyph, so each option is
   readable at a glance without waiting for the tooltip. If the icon fails to
   load the label remains and the button collapses to a plain text chip. */
.filter-btn--icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  line-height: normal;
}
.filter-btn-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: block;
}
.filter-btn--icon .filter-btn-label { display: block; }
.filter-btn--icon.filter-btn--noicon { padding: 3px 10px; }

.filter-btn--r.is-active { border-color: var(--color-gem-r); color: var(--color-gem-r); background: rgba(196,64,64,0.12); }
.filter-btn--g.is-active { border-color: var(--color-gem-g); color: var(--color-gem-g); background: rgba(74,173,74,0.12); }
.filter-btn--b.is-active { border-color: var(--color-gem-b); color: var(--color-gem-b); background: rgba(102,102,170,0.12); }
.filter-btn--w.is-active { border-color: var(--color-gem-w); color: var(--color-gem-w); background: rgba(170,170,170,0.12); }
.filter-btn.is-active    { border-color: var(--color-normal); color: var(--color-normal); background: rgba(200,200,200,0.1); }

.home-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.home-links a {
  text-decoration: none;
  font-family: var(--font-smallcaps);
}
.home-links a:hover { text-decoration: underline; }

/* Theory Crafting search */
.tc-search { margin-bottom: 18px; }
.tc-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  background: var(--surface-2, #1a1a1a);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  color: inherit;
}
.tc-input:focus { outline: none; border-color: var(--accent, #c8a13a); }
.tc-hint { margin: 8px 2px 0; font-size: 12.5px; color: var(--color-default, #888); }
.tc-hint code, .tc-examples code, .tc-summary code {
  background: var(--surface-2, #1a1a1a); padding: 1px 5px; border-radius: 3px;
}
.tc-empty { padding: 24px 4px; color: var(--color-default, #888); }
.tc-examples { margin-top: 8px; }
.tc-summary { margin: 4px 2px 14px; color: var(--color-default, #888); font-size: 13px; }
.tc-group { margin-bottom: 22px; }
.tc-group-heading { font-size: 15px; margin: 0 0 10px; }
.tc-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.tc-result-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; text-decoration: none; color: inherit;
  background: var(--surface-2, #1a1a1a);
  border: 1px solid var(--border, #333);
  border-left-width: 3px;
  border-radius: 5px;
}
.tc-result-card:hover { border-color: var(--accent, #c8a13a); }
.tc-result-icon { width: 28px; height: 28px; object-fit: contain; flex: 0 0 auto; }
.tc-result-name { font-weight: 600; }
.tc-result-sub { color: var(--color-default, #888); font-size: 12px; margin-left: auto; }
.tc-more { margin: 8px 2px 0; font-size: 12px; color: var(--color-default, #888); }

/* Theory Crafting — search help panel */
.tc-lead { margin: 8px 2px 6px; font-size: 13px; color: var(--color-default, #888); }
.tc-help { margin: 4px 2px 0; font-size: 13px; }
.tc-help > summary {
  cursor: pointer; color: var(--color-default, #888);
  padding: 4px 0; user-select: none;
}
.tc-help > summary:hover { color: var(--accent, #c8a13a); }
.tc-help[open] > summary { color: var(--accent, #c8a13a); margin-bottom: 10px; }
.tc-help-terms {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 18px;
  align-items: baseline;
}
.tc-help-terms dt { font-weight: 600; white-space: nowrap; }
.tc-help-terms dt code { background: none; padding: 0; }
.tc-help-terms dd { margin: 0; color: var(--color-default, #999); }
.tc-examples-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tc-example {
  font-family: inherit; font-size: 12px;
  background: var(--surface-2, #1a1a1a); color: inherit;
  border: 1px solid var(--border, #333); border-radius: 3px;
  padding: 2px 7px; cursor: pointer;
}
.tc-example:hover { border-color: var(--accent, #c8a13a); color: var(--accent, #c8a13a); }

/* ── "Search on PoE Trade" action (Todo 4 part 1) ─────────────────────────────
   `.card-actions` is the action slot; it holds the trade balance-scale icon today
   and is sized to take a second button (Add to Theory Craft) later. Two contexts:
   inside a full tooltip popup (.newItemPopup), and overlaid on a condensed card. */
.card-actions {
  position: absolute;
  /* Vertically centered within the header band (56px, border-box) — the header's
     right side is empty on unique/base popups. */
  top: 17px;
  right: 30px;
  z-index: 4;
  display: flex;
  gap: 4px;
}
/* Popups get a bit more right inset than the condensed cards. The gem popup pins a
   gem icon (.trailGemIcon, 45px wide, ending at right:50px) in its header, so the
   shared right:50px lands the trade icon just left of it — same header-band spot as
   uniques, no overlap. */
.newItemPopup .card-actions { right: 50px; }
/* Gem popup: nudge 10px further left so it clears the pinned gem icon a bit more. */
.GemPopup .card-actions { right: 60px; }
/* Condensed browse/list cards are <a>; the trade affordance is a <span> overlay
   (no nested anchor) handled by trade-link.js. The card must be a positioning
   context for it — .gem-browse-card is already relative; .bases-list-card isn't. */
.bases-list-card { position: relative; }
/* On the narrow condensed cards, pin the overlay to the top corner instead of the
   popups' vertical centering (which would float it over the card's stat text).
   Keeps the shared right: 30px inset. */
.card-actions--overlay { top: 6px; transform: none; }

.trade-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: var(--text, #c8b888);
  background: color-mix(in srgb, var(--bg-base, #0d0d0d) 70%, transparent);
  opacity: 0.5;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.trade-link:hover,
.trade-link:focus-visible {
  opacity: 1;
  color: var(--accent, #c8a13a);
  background: color-mix(in srgb, var(--bg-base, #0d0d0d) 85%, transparent);
  outline: none;
}
.trade-scale {
  width: 15px;
  height: 15px;
  display: block;
}
