:root {
  --bg: #14140f;
  --bg2: #1b1b15;
  --panel: #21221b;
  --panel2: #292a21;
  --line: #38392e;
  --line2: #4a4c3c;
  --text: #e7e4d6;
  --muted: #9c9a86;
  --dim: #74725f;
  --gold: #d3b05c;
  --olive: #a6b45a;
  --rust: #c07a4a;
  --blue: #7fa6b8;
  --radius: 9px;
  --maxw: 1100px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-y: scroll;
}
a { color: var(--gold); }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px calc(12px);
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1c1c15, var(--bg));
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { border-radius: 8px; border: 1px solid var(--line2); flex: none; }
.brand-txt { min-width: 0; }
.brand h1 {
  margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; color: var(--text); white-space: nowrap;
}
.tagline { margin: 1px 0 0; font-size: 11.5px; color: var(--dim); letter-spacing: .2px; }
.install {
  flex: none; background: var(--gold); color: #1a1a12; border: 0; font-weight: 700;
  padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font-size: 13px;
  text-transform: uppercase; letter-spacing: .4px;
}
.install:hover { filter: brightness(1.08); }

/* ---- search ---- */
.searchwrap { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 12px 16px 0; }
#search {
  width: 100%; background: var(--panel); border: 1px solid var(--line2); color: var(--text);
  border-radius: var(--radius); padding: 11px 38px 11px 13px; font-size: 15px; outline: none;
}
#search:focus { border-color: var(--gold); }
#search::placeholder { color: var(--dim); }
.searchclear {
  position: absolute; right: 24px; top: 12px; height: 40px; width: 30px;
  background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer;
}

/* ---- tabs ---- */
.tabs {
  display: flex; gap: 6px; max-width: var(--maxw); margin: 12px auto 0; padding: 0 16px;
  position: sticky; top: 0;
}
.tab {
  flex: 1; background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-bottom: 0; padding: 10px 4px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0; text-transform: uppercase; letter-spacing: .2px;
  white-space: nowrap;
}
.tab.active { background: var(--panel2); color: var(--gold); border-color: var(--line2); }

.view { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 40px;
  border-top: 1px solid var(--line2); }

/* ---- list layouts: three selectable modes (List / Grid / Split) ---- */
.panes { display: grid; grid-template-columns: 1fr; gap: 14px; padding-top: 8px; }
.list { min-width: 0; }
.detail { min-width: 0; }
.backbtn { display: none; align-items: center; gap: 6px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line2); color: var(--gold);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }

/* browse toolbar: count + the layout gear menu */
.viewbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 0; }
.viewbar-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 700; }
.layoutpick { position: relative; }
.gear { background: var(--panel); border: 1px solid var(--line2); color: var(--muted); border-radius: 8px;
  width: 34px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
.gear:hover { color: var(--gold); border-color: var(--gold); }
.layoutmenu { position: absolute; right: 0; top: 36px; z-index: 30; min-width: 158px; display: none;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0,0,0,.55); padding: 5px; }
.layoutpick.open .layoutmenu { display: block; }
.layoutmenu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-family: inherit; }
.layoutmenu button:hover { background: var(--panel); }
.layoutmenu button.active { color: var(--gold); }
.layoutmenu button.active::after { content: "\2713"; margin-left: auto; }
.layoutmenu .ico { width: 16px; text-align: center; color: var(--muted); font-size: 14px; }
.layoutmenu button.active .ico { color: var(--gold); }

/* desktop layout modes (mobile forces grid+toggle in the mobile block below) */
@media (min-width: 721px) {
  /* List — original: narrow single-column list beside a persistent detail */
  body.wl-list .panes { grid-template-columns: minmax(240px, 320px) 1fr; }
  body.wl-list .list { display: block; }
  body.wl-list .row { margin-bottom: 6px; }

  /* Grid — full-width compact grid; picking one shows its detail full-width */
  body.wl-grid .panes { grid-template-columns: 1fr; }
  body.wl-grid .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px; align-content: start; }
  body.wl-grid .view:not(.detail-open) .detail { display: none; }
  body.wl-grid .view.detail-open .list { display: none; }
  body.wl-grid .view.detail-open .backbtn { display: inline-flex; }

  /* Split — tight grid on ~40%, detail on ~60%, both on one page */
  body.wl-split .panes { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); }
  body.wl-split .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 5px; align-content: start; }
  body.wl-split .row { padding: 6px 9px; font-size: 12.5px; }

  /* attachments carry longer names (e.g. "Sup. Muzzle Device A") -> wider cells so nothing clips */
  body.wl-grid .list-att { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  body.wl-split .list-att { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  body.wl-split .list-att .row { padding: 7px 10px; font-size: 13px; }
  /* attachment cells are wide; give split's list pane more room so it's a real 2-col grid,
     not a lone column (otherwise Split looks identical to List for attachments) */
  body.wl-split .panes:has(.list-att) { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); }
}

/* group headers in lists */
.grp { grid-column: 1 / -1; margin: 14px 0 6px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--dim); font-weight: 700; }
.grp:first-child { margin-top: 2px; }

/* row buttons */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  cursor: pointer; font-size: 14px;
}
.row:hover { border-color: var(--line2); background: var(--panel2); }
.row.sel { border-color: var(--gold); background: #2a2a1e; }
.row .rname { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rmeta { flex: none; font-size: 11.5px; color: var(--dim); display: flex; gap: 6px; align-items: center; }
.count { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px;
  padding: 1px 8px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* detail card */
.card { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 16px; }
.dhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.dhead h2 { margin: 0; font-size: 21px; letter-spacing: .3px; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 2px 8px;
  border-radius: 20px; border: 1px solid var(--line2); color: var(--muted); background: var(--bg2); }
.badge.gold { color: var(--gold); border-color: #6a5a2c; }
.badge.olive { color: var(--olive); border-color: #545c2c; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.callout { margin: 14px 0; padding: 11px 13px; border-left: 3px solid var(--gold);
  background: var(--bg2); border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--text); }
.callout b { color: var(--gold); }

.section { margin-top: 16px; }
.section h3 { margin: 0 0 8px; font-size: 12.5px; letter-spacing: .8px; text-transform: uppercase;
  color: var(--olive); display: flex; align-items: center; gap: 8px; }
.section h3 .c { color: var(--dim); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--bg2); border: 1px solid var(--line2); color: var(--text);
  border-radius: 7px; padding: 6px 10px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.static { cursor: default; }
.chip.static:hover { border-color: var(--line2); color: var(--text); }
.chip small { color: var(--dim); margin-left: 5px; }
.chip.part { cursor: default; display: inline-flex; align-items: center; gap: 6px; position: relative; }
.chip.part:hover { border-color: var(--line2); color: var(--text); }
.chip .lvl { font-size: 10px; color: var(--dim); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 5px; }
.chip .cap { font-size: 10.5px; color: var(--gold); font-variant-numeric: tabular-nums; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); }
.stat .v { font-size: 15px; font-weight: 600; margin-top: 2px; }
.stat.key { border-color: #6a5a2c; }
.stat.key .v { color: var(--gold); }

/* asterisk note on derived stats (accuracy / stability / recoil) */
.statnote { position: relative; color: var(--gold); font-weight: 700; cursor: help; }
.statnote > .tip, .chip.part > .tip {
  position: absolute; left: 0; top: 150%; z-index: 40;
  width: max-content; max-width: min(260px, 74vw);
  background: var(--panel2); color: var(--text); font-weight: 400;
  text-transform: none; letter-spacing: 0; text-align: left;
  border: 1px solid var(--line2); border-radius: 8px; padding: 8px 11px;
  font-size: 12px; line-height: 1.5; box-shadow: 0 10px 26px rgba(0,0,0,.55);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease; pointer-events: none;
}
.statnote:hover > .tip, .statnote:focus > .tip, .statnote:focus-within > .tip,
.chip.part:hover > .tip, .chip.part:focus > .tip, .chip.part:focus-within > .tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.req { color: var(--gold); font-weight: 700; margin-left: 1px; }
.legend { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.legend .req { margin-right: 4px; }
.empty { color: var(--dim); font-size: 14px; padding: 30px 4px; text-align: center; }
.placeholder { color: var(--dim); font-size: 14px; padding: 40px 10px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); }

/* muzzle guide cards */
.mz-intro { margin: 16px 0 4px; }
.mzgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding-bottom: 8px; }
.mzcard { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 14px; }
.mzcard h3 { margin: 0 0 2px; font-size: 16px; color: var(--gold); }
.mzcard .fam { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.mzcard .lab { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); margin: 10px 0 5px; }

/* ---- stats guide ---- */
.guide { padding-top: 4px; }
.guide .card { margin-top: 14px; }
.guide p { font-size: 14px; color: var(--text); line-height: 1.6; margin: 6px 0; }
.guide .gnote { font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.guide code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--olive); white-space: nowrap; }
.gdef { display: grid; grid-template-columns: 165px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.gdef:first-of-type { border-top: 0; }
.gdef .term { color: var(--gold); font-weight: 600; }
.gdef em { color: var(--muted); font-style: italic; }
.gtable-wrap { overflow-x: auto; margin: 4px 0; }
.gtable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 460px; }
.gtable th, .gtable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gtable th { color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; font-size: 10.5px; }
.gtable td:first-child { font-weight: 600; white-space: nowrap; }
.gtable td.ok { color: var(--olive); font-weight: 700; }
.gtable td.bad { color: var(--rust); font-weight: 700; }
.gtable .esub { font-size: 10.5px; color: var(--dim); font-weight: 400; margin-top: 1px; }

/* detection: noise bars */
.noise-list { display: flex; flex-direction: column; gap: 5px; margin: 4px 0; }
.noise-row { display: grid; grid-template-columns: 130px 1fr 132px; gap: 10px; align-items: center; font-size: 13px; }
.noise-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.noise-bar { height: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.noise-bar > span { display: block; height: 100%; background: var(--rust); }
.noise-val { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .noise-row { grid-template-columns: 92px 1fr 78px; gap: 7px; font-size: 12px; } }

/* ---- economy / loot tab ---- */
.eco-strip { display: flex; flex-direction: column; gap: 5px; margin: 4px 0; }
.eco-tierbar { display: grid; grid-template-columns: 150px 1fr 104px; gap: 10px; align-items: center;
  background: none; border: 0; padding: 4px 5px; border-radius: 6px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text); }
.eco-tierbar:hover { background: var(--panel); }
.eco-tname { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eco-tname small { color: var(--dim); font-size: 11px; margin-left: 3px; }
.eco-tbarwrap { height: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.eco-tbar { display: block; height: 100%; border-radius: 4px; }
.eco-tmeta { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eco-tmeta small { color: var(--dim); }

.eco-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap; }
.eco-modes { display: inline-flex; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 3px; gap: 3px; }
.eco-modes button { background: none; border: 0; color: var(--muted); padding: 7px 13px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; font-family: inherit; }
.eco-modes button:hover { color: var(--text); }
.eco-modes button.on { background: var(--panel2); color: var(--gold); }

.eco-cats { margin: 4px 0 12px; }
.eco-cats .chip { padding: 5px 9px; font-size: 12px; }
.chip.on { border-color: var(--gold); color: var(--gold); background: #2a2a1e; }

.eco-sec h3 { align-items: center; }
.eco-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* collapsible tier sections */
.eco-det { border-top: 1px solid var(--line); }
.eco-det:last-of-type { border-bottom: 1px solid var(--line); }
.eco-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; cursor: pointer;
  padding: 12px 4px; font-size: 12.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--olive); font-weight: 700; }
.eco-sum::-webkit-details-marker { display: none; }
.eco-sum::before { content: "\25B8"; color: var(--dim); font-size: 12px; transition: transform .15s ease; }
.eco-det[open] > .eco-sum::before { transform: rotate(90deg); }
.eco-sum:hover { color: var(--gold); }
.eco-sum:hover::before { color: var(--gold); }
.eco-sum .c { color: var(--dim); font-weight: 500; text-transform: none; letter-spacing: normal; font-size: 11.5px; }
.eco-table { min-width: 0; }
.eco-table td:first-child { white-space: normal; }
.eco-table td.num, .eco-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eco-table td.gold { color: var(--gold); font-weight: 600; }
.eco-table .dim { color: var(--dim); }
.eco-cat { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px; text-align: left; }
.eco-cat:hover { color: var(--gold); text-decoration: underline; }
.eco-tier { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  padding: 1px 7px; border-radius: 20px; border: 1px solid var(--line2); color: var(--tc, var(--muted)); }
.eco-q { color: var(--gold); font-size: 11px; }
.eco-loc { display: inline-block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px;
  padding: 0 6px; border-radius: 20px; border: 1px solid var(--line2); color: var(--blue);
  margin-left: 6px; vertical-align: middle; white-space: nowrap; }

@media (max-width: 560px) {
  .eco-tierbar { grid-template-columns: 104px 1fr 78px; gap: 7px; }
  .eco-tname small { display: none; }
}

/* ---- drops / loot-source tab ---- */
.loot-kinds { margin: 4px 0 10px; }
.loot-kindhead { margin-top: 18px; }
.loot-src { border-top: 1px solid var(--line); }
.loot-src:last-of-type { border-bottom: 1px solid var(--line); }
.loot-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; cursor: pointer;
  padding: 10px 2px; font-weight: 600; }
.loot-sum::-webkit-details-marker { display: none; }
.loot-sum::before { content: "\25B8"; color: var(--dim); font-size: 12px; transition: transform .15s ease; }
.loot-src[open] > .loot-sum::before { transform: rotate(90deg); }
.loot-sum:hover, .loot-sum:hover::before { color: var(--gold); }
.loot-src-name { color: var(--text); }
.loot-sum .c { color: var(--dim); font-weight: 500; font-size: 11.5px; margin-left: auto; text-transform: none; letter-spacing: normal; }
.loot-table td:first-child { white-space: normal; }
.loot-table td.num, .loot-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loot-item { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.loot-item:hover { color: var(--gold); text-decoration: underline; }
.loot-rar { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rc, var(--muted)); white-space: nowrap; }
.loot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rc, var(--muted)); flex: none; }
.loot-table td .gold { color: var(--gold); font-weight: 600; }
.loot-table .dim { color: var(--dim); }
/* per-tier crate view: a rarity dot per tier column */
.loot-tiered th.tc, .loot-tiered td.tc { text-align: center; width: 34px; padding-left: 2px; padding-right: 2px; }
.loot-tiered th.tc { color: var(--dim); font-variant-numeric: tabular-nums; font-weight: 500; }
.loot-tdot { display: inline-block; box-sizing: border-box; width: 11px; height: 11px; border-radius: 50%;
  background: var(--rc, var(--muted)); vertical-align: middle; }
.loot-tdot.gap { background: transparent; border: 1px dashed var(--line2); }
.loot-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; margin: 2px 0 12px; font-size: 11.5px; color: var(--muted); }
.loot-legend .c { color: var(--dim); text-transform: uppercase; letter-spacing: .5px; font-size: 10px; }
.loot-key { display: inline-flex; align-items: center; gap: 5px; }

/* ---- Drops: "How drops work" model panel ---- */
.dropmodel { margin-top: 14px; scroll-margin-top: 88px; }
.dm-head { margin-top: 0; }
.dm-tldr { font-size: 14.5px; color: var(--text); line-height: 1.55; margin: 10px 0 0 !important;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 11px 14px; }
.dm-tldr b { color: var(--gold); }
.dm-layers { display: grid; gap: 10px; margin: 12px 0 14px; }
.dm-layer { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start;
  background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0; padding: 12px 14px; }
.dm-num { font-size: 26px; font-weight: 800; color: var(--gold); opacity: .45; line-height: 1;
  font-variant-numeric: tabular-nums; }
.dm-layer-body h4 { margin: 0 0 4px; font-size: 14.5px; color: var(--text); letter-spacing: .2px; }
.dropmodel .dm-lead { font-size: 14px; color: var(--text); line-height: 1.55; margin: 0 0 6px; }
.dropmodel .dm-detail { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0; }
.dm-budget { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 16px;
  padding: 10px 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; scroll-margin-top: 88px; }
.dm-budget-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); font-weight: 700; }
.dm-budget-scale { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dm-b { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dm-b b { color: var(--gold); margin-right: 3px; }
.dm-arrow { color: var(--dim); }
.dm-det { scroll-margin-top: 88px; }
.dm-type { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; text-align: left; }
.dm-type:hover { text-decoration: underline; }
.dm-gear { font: inherit; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--dim);
  background: none; border: 1px solid var(--line2); border-radius: 4px; padding: 1px 6px; margin-left: 5px;
  white-space: nowrap; cursor: pointer; }
.dm-gear:hover { color: var(--gold); border-color: var(--gold); }
.dm-type-table td:first-child { white-space: normal; font-weight: 400; }
.dm-inside { color: var(--muted); font-size: 12.5px; line-height: 1.5; font-weight: 400 !important; white-space: normal; }
.dm-pct { font-variant-numeric: tabular-nums; }
.dm-special { display: grid; gap: 10px; padding: 6px 2px 2px; }
.dm-sp { font-size: 13px; color: var(--muted); line-height: 1.55; }
.dm-sp b { color: var(--text); font-weight: 600; }
.dm-sources-head { margin-top: 24px !important; padding-top: 16px; border-top: 1px solid var(--line2); scroll-margin-top: 88px; }
.loot-budgetnote { margin: 4px 0 8px !important; padding: 7px 11px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; }
.loot-budgetnote b { color: var(--gold); }

/* ---- enemies tab ---- */
.guide .card.boss { margin-top: 14px; }
.badge.boss-threat { cursor: pointer; font-family: inherit; color: var(--muted); }
.badge.boss-threat small { text-transform: none; letter-spacing: 0; color: var(--dim); font-size: 9px; }
.badge.boss-threat:hover { color: var(--gold); border-color: var(--gold); }
.boss-blurb { color: var(--muted); font-style: italic; font-size: 14.5px; margin: 10px 0 2px; }
.boss-desc { font-size: 14px; color: var(--text); line-height: 1.6; margin: 4px 0 2px; }
.boss-jump { margin: 12px 0 4px; }
.boss-jump .chip { padding: 5px 10px; font-size: 12.5px; }
.boss-jump .chip small { color: var(--rust); font-weight: 700; margin-left: 5px; }
.boss-zone { cursor: default; display: inline-flex; align-items: baseline; gap: 5px; }
.boss-zone b { font-variant-numeric: tabular-nums; }
.boss-zone small { color: var(--dim); }
.boss-zone.crit { border-color: #6a3f28; color: var(--rust); }
.boss-zone.crit b { color: var(--rust); }
.boss-weak { margin: 6px 0 0; padding-left: 20px; }
.boss-weak li { margin: 5px 0; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.boss-codex { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--dim); }
.boss-codex b { color: var(--gold); }
/* category filter + sections */
.enemy-cats { margin: 12px 0 2px; }
.enemy-cat-sec { scroll-margin-top: 88px; }
.enemy-cat-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin: 26px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line2); }
.enemy-cat-head h2 { margin: 0; font-size: 16px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--olive); }
.enemy-cat-head h2 .c { color: var(--dim); font-weight: 500; letter-spacing: 0; font-size: 13px; }
.enemy-cat-blurb { font-size: 12.5px; color: var(--dim); }
/* compact (non-boss) unit cards sit a touch lighter than the boss cards */
.guide .card.boss.unit { margin-top: 10px; padding: 13px 14px; }
.card.boss.unit .dhead h2 { font-size: 18px; }
.unit-meta { font-size: 12.5px; color: var(--muted); margin: 6px 0 2px; }
.unit-meta b { color: var(--dim); font-weight: 600; }
.unit-senses { font-size: 13.5px; color: var(--text); line-height: 1.8; }
.unit-senses b { color: var(--olive); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; margin-right: 3px; }
.stat .v .help { cursor: help; }
.stat .v .help small { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.section h3 .linklike { font-size: 12px; font-weight: 500; margin-left: 8px; }

/* ---- factions / tug-of-war tab ---- */
.fac-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 2px 6px; }
.fac-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.fac-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.fac-map { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; margin: 7px 0; }
.fac-map-name { font-size: 13px; color: var(--text); }
.fac-bar { display: flex; height: 20px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.fac-seg { display: flex; align-items: center; justify-content: center; font-size: 10.5px; color: #14140f;
  font-weight: 700; min-width: 0; font-variant-numeric: tabular-nums; }
.fac-action { border-top: 1px solid var(--line); padding: 11px 0; }
.fac-action:first-of-type { border-top: 0; }
.fac-action-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fac-action-name { font-weight: 600; color: var(--gold); font-size: 14px; }
.fac-action-desc { color: var(--muted); font-style: italic; font-size: 13px; margin: 5px 0 6px; }
.fac-effects { display: flex; flex-wrap: wrap; gap: 6px; }
.fac-eff { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; border: 1px solid var(--line2);
  border-radius: 7px; padding: 4px 8px; color: var(--text); }
.fac-eff small { color: var(--dim); }
.fac-eff.up { border-color: #4a5c2c; }
.fac-eff.down { border-color: #6a3f28; }
@media (max-width: 560px) { .fac-map { grid-template-columns: 104px 1fr; gap: 8px; } }

/* ---- per-caliber headshot multipliers (weapon card + stats) ---- */
.hs-high { color: var(--olive); }
.hs-low { color: var(--rust); }
.hs-base { color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; margin: 0; color: var(--gold); cursor: pointer;
  font: inherit; text-decoration: underline; }
.linklike:hover { color: var(--text); }

/* ---- ammo tab ---- */
.ammo-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; margin-top: 10px; }
.ammo-card:first-of-type { margin-top: 6px; }
.ammo-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ammo-name { font-size: 15px; font-weight: 700; }
.ammo-stats { margin-top: 10px; }
.ammo-desc { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.55; }
.ammo-usedby { margin-top: 11px; }
.ammo-usedby .lab { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.ammo-usedby .chip { padding: 5px 9px; font-size: 12px; }

.foot { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  color: var(--dim); font-size: 11.5px; display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

/* ---- mobile: always grid-browse + toggle-detail, regardless of chosen mode ---- */
@media (max-width: 720px) {
  .panes { grid-template-columns: 1fr; }
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; align-content: start; }
  .list-att { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .view.detail-open .list { display: none; }
  .view:not(.detail-open) .detail { display: none; }
  .backbtn { display: inline-flex; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; }
  .gdef { grid-template-columns: 1fr; gap: 1px; }
  .gdef .term { margin-top: 2px; }
  .brand h1 { font-size: 14px; white-space: normal; }
}

/* ---- per-section copy-link icons + toast ---- */
.anchor-link {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  margin-left: 7px; width: 22px; height: 22px; padding: 0; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: var(--dim);
  cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.anchor-link svg { display: block; }
.anchor-link:hover { color: var(--gold); background: rgba(211, 176, 92, .13); }
.anchor-link:active { transform: translateY(1px); }
.anchor-link:focus-visible { opacity: 1; outline: 2px solid var(--gold); outline-offset: 1px; }
/* reveal only on hover of the section the icon belongs to (keeps the UI clean) */
.card:hover > .dhead > .anchor-link,
.card:hover > .section > h3 > .anchor-link,
.mzcard:hover > h3 > .anchor-link,
.ammo-card:hover > .ammo-head > .anchor-link,
.fac-map:hover > .fac-map-name > .anchor-link,
.fac-action:hover > .fac-action-head > .anchor-link,
.loot-kindhead:hover > h3 > .anchor-link,
.eco-sec:hover > h3 > .anchor-link,
details:hover > summary > .anchor-link,
.anchor-link:focus-visible { opacity: 1; }
/* touch screens can't hover — keep the icons faintly visible so they're discoverable */
@media (hover: none) { .anchor-link { opacity: .5; } }

#fw-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px); z-index: 9999; max-width: 88vw; text-align: center;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line2);
  padding: 10px 16px; border-radius: 9px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45); opacity: 0; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
#fw-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- dataset toggle (Vanilla | mod) + change/new badges ---- */
.badge.rust { color: var(--rust); border-color: #7a4a2c; }
.ds-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 0 4px;
  padding: 8px 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; }
.ds-bar.on { border-color: #7a4a2c; background: linear-gradient(0deg, rgba(192,122,74,.07), rgba(192,122,74,.07)), var(--bg2); }
.ds-modes { display: inline-flex; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 3px; gap: 3px; flex: none; }
.ds-modes button { background: none; border: 0; color: var(--muted); padding: 6px 13px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; font-family: inherit; }
.ds-modes button:hover { color: var(--text); }
.ds-modes button.on { background: var(--panel2); color: var(--gold); }
.ds-bar.on .ds-modes button.on { color: var(--rust); }
.ds-note { font-size: 12.5px; color: var(--text); }
.ds-note.ds-dim { color: var(--dim); }
.ds-note a { color: var(--rust); }
/* release-state caveat for an overlay, e.g. rebuilt-but-not-yet-published */
.ds-note .ds-status { color: var(--dim); font-style: italic; }
.ds-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rust);
  margin-left: 7px; vertical-align: middle; }
.ds-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--rust);
  border: 1px solid #7a4a2c; border-radius: 20px; padding: 1px 7px; vertical-align: middle; font-weight: 700; }
.ds-new { font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--rust);
  background: rgba(192,122,74,.14); border-radius: 4px; padding: 1px 4px; margin-left: 6px; font-weight: 700; }
.chip.part.mod { border-color: #7a4a2c; }

/* ---- crafting / manufacturing tab ---- */
.craft .grp.craft-cat { font-size: 12px; color: var(--gold); margin-top: 22px; }
.craft-group { margin: 6px 0 14px; }
.craft-group h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.craft-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 8px; }
.recipe { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 4px; }
.recipe-out { font-weight: 600; color: var(--gold); font-size: 14px; }
.recipe-in { font-size: 12.5px; color: var(--text); }
.recipe-in .rlab { color: var(--dim); text-transform: uppercase; font-size: 10px; letter-spacing: .6px; margin-right: 4px; }
.recipe .rq { color: var(--olive); font-variant-numeric: tabular-nums; font-weight: 600; }
.recipe .rplus { color: var(--dim); margin: 0 5px; }
.recipe-meta { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.craft-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.craft-req { font-size: 11px; color: var(--rust); }
