/* =========================================================================
   ARMOURY
   ========================================================================= */
:root {
    --bg: #0d0e10;
    --surface: #15171a;
    --surface-2: #1c1f23;
    --surface-3: #252930;
    --line: #2a2e35;
    --line-strong: #3a3f48;
    --text: #e9e7e3;
    --muted: #959aa3;
    --faint: #6b7079;
    --accent: #e9a23b;
    --accent-ink: #1a1206;
    --up: #5cc78a;
    --down: #e0645c;
    --radius: 10px;
    --radius-sm: 6px;
    --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
    --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --wrap: none;                            /* full width: content spans the whole window */
    --gutter: clamp(16px, 3vw, 48px);        /* side margins grow with the screen */
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { color-scheme: dark; }
/* Switching pages: the browser keeps the old page on screen until the new one is drawn, then
   cross-fades, with the header staying put (Chrome, Edge, Safari 18.2+; other browsers just switch). */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
}
body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
kbd {
    font: 600 11px/1 var(--body);
    padding: 3px 6px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    color: var(--muted);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .02em; line-height: 1.1; }
h2 { font-size: 18px; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
h3 { font-size: 15px; text-transform: uppercase; color: var(--faint); margin: 22px 0 10px; }

.btn {
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #f2b452; }

.tag {
    display: inline-block;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--muted);
}

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

.empty-state { color: var(--faint); padding: 24px 0; }
.empty-state.error { color: var(--down); }

/* Weapon icon with tier underline and season watermark */
.wicon {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    flex: none;
    width: var(--size);
    height: var(--size);
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: inset 0 -3px 0 var(--tier);
}
.wicon img { width: 100%; height: 100%; }
.wicon .wm, .wicon .overlay { position: absolute; inset: 0; }
/* Tier 5 diamonds on tiered gear, down the left edge below the watermark */
.tier-pips {
    position: absolute;
    left: 8%; top: 34%; bottom: 8%;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center;
    pointer-events: none;
}
/* Craftable badge, bottom-left: salmon-red square with a darker cross, as in game */
.craft-badge {
    position: absolute; right: 0; bottom: 0;
    width: 26%; height: 22%;
    background:
        linear-gradient(#8e3f33, #8e3f33) center 42% / 100% 12% no-repeat,
        linear-gradient(#8e3f33, #8e3f33) 46% center / 11% 100% no-repeat,
        #d6866f;
    box-shadow: inset 0 0 0 1px rgba(255, 228, 205, .35);
    pointer-events: none;
}
/* Bungie draws the crafted badge in the bottom-left, where the tier diamonds are, so it is
   slid across to the bottom-right corner. The icon clips the rest of the (transparent) image. */
.wicon .craft-ovl { transform: translateX(72%); }
.tier-pips i {
    display: block;
    width: max(3px, calc(var(--size) * .07));
    height: max(3px, calc(var(--size) * .07));
    background: #f3d58a;
    transform: rotate(45deg);
    box-shadow: 0 0 0 1px rgba(60, 40, 10, .45), 0 0 3px rgba(0, 0, 0, .6);
}

/* =========================================================================
   Header
   ========================================================================= */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 14, 16, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    view-transition-name: site-nav;
}
/* The header is filled in by ui.js: keep its height meanwhile, so the page doesn't jump down. */
.site-nav:empty { min-height: 61px; }
.nav-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 60px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font: 700 22px/1 var(--display);
    letter-spacing: .08em;
}
.brand img { border-radius: 6px; border: 1px solid var(--line-strong); }

.nav-search { position: relative; flex: 1; max-width: 460px; }
.nav-search.is-hidden { visibility: hidden; }

/* Query search bar (header = compact, Vault/Guide = full with pills) */
.qbar {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 6px 0 34px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: text;
}
.qbar:focus-within { border-color: var(--accent); background: var(--surface); }
.qbar-field { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 0; }
.qbar-pills { display: contents; }
.qbar-input {
    flex: 1;
    min-width: 140px;
    height: 28px;
    padding: 0 2px;
    background: none;
    border: 0;
    outline: none;
    font-size: 14px;
}
.qbar-input::-webkit-search-cancel-button { display: none; }
.qbar-clear { flex: none; background: none; border: 0; padding: 0 8px; font-size: 20px; line-height: 1; color: var(--faint); cursor: pointer; }
.qbar-clear:hover { color: var(--text); }
.qbar.compact .qbar-input { padding-right: 24px; }
.qbar.compact:focus-within .search-kbd, .qbar.compact .qbar-clear:not([hidden]) ~ .search-kbd { display: none; }
.qbar.full { min-height: 50px; padding-left: 40px; border-radius: var(--radius); background: var(--surface); }
.qbar.full .search-glyph { left: 15px; }
.qbar.full .qbar-input { font-size: 15px; }
.qpill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font: 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qpill-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 4px 6px 8px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.qpill-x { padding: 6px 8px 6px 4px; background: none; border: 0; font: 14px/1 var(--body); color: var(--faint); cursor: pointer; }
.qpill-x:hover { color: var(--down); }
.qpill.neg { border-color: rgba(224, 100, 92, .55); }
.qpill.neg .qpill-text { color: #f2a7a1; }
.search-glyph {
    position: absolute; left: 12px; top: 50%;
    width: 13px; height: 13px; margin-top: -8px;
    border: 2px solid var(--faint); border-radius: 50%;
    pointer-events: none;
}
.search-glyph::after {
    content: ""; position: absolute; right: -5px; bottom: -5px;
    width: 6px; height: 2px; background: var(--faint); transform: rotate(45deg);
}
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.nav-search input:focus ~ .search-kbd { display: none; }

.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
    padding: 6px;
    max-height: 70vh;
    overflow-y: auto;
}
.suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
}
.suggestion[aria-selected="true"] { background: var(--surface-3); }
.suggestion .s-text { display: flex; flex-direction: column; min-width: 0; }
.suggestion strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion small { color: var(--muted); font-size: 12px; }
.suggestion.filter { cursor: pointer; gap: 12px; min-height: 34px; }
.s-code { font: 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-desc { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-count { margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.suggestion.weapon { cursor: pointer; }
.suggestion.all { color: var(--accent); font-size: 13px; justify-content: center; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 10px; }

.nav-links { display: flex; gap: 20px; margin-left: auto; }
.nav-links a {
    text-decoration: none;
    color: var(--muted);
    font: 600 16px/60px var(--display);
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.api-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); cursor: help; }
.api-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.api-status[data-state="up"] .dot { background: var(--up); box-shadow: 0 0 0 3px rgba(92, 199, 138, .18); }
.api-status[data-state="down"] .dot { background: var(--down); box-shadow: 0 0 0 3px rgba(224, 100, 92, .2); }

.load-banner {
    position: fixed;
    left: 50%; bottom: 20px;
    transform: translateX(-50%);
    z-index: 200;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    font-size: 13px;
}

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 48px;
    padding: 28px var(--gutter);
    text-align: center;
    color: var(--faint);
    font-size: 12px;
}

/* =========================================================================
   Shared weapon cards (home + database)
   ========================================================================= */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
}
.wcard {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color .15s, background-color .15s;
    min-width: 0;
}
.wcard:hover { border-color: var(--tier); background: var(--surface-2); }
.wcard-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wcard-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-tags { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.wcard-tags img { opacity: .9; }

/* =========================================================================
   Home
   ========================================================================= */
.home { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); width: 100%; }
.home-hero { padding: 72px 0 48px; max-width: 760px; }
.eyebrow { color: var(--accent); font: 600 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 14px; }
.home-hero h1 { font-size: clamp(34px, 6vw, 60px); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
.lede { color: var(--muted); margin-top: 16px; font-size: 16px; }
.home-section { margin-top: 36px; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.type-tile {
    display: flex; flex-direction: column; gap: 2px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color .15s, transform .15s;
}
.type-tile:hover { border-color: var(--accent); }
.type-tile strong { font: 600 19px/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.type-tile small { color: var(--muted); font-size: 12px; }

/* =========================================================================
   Database
   ========================================================================= */
.db-layout {
    max-width: var(--wrap);
    width: 100%;
    margin: 0 auto;
    padding: 24px var(--gutter) 0;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 24px;
    align-items: start;
}
.filters {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
}
.filter-group { border: 0; margin-bottom: 20px; }
.filter-group legend {
    font: 600 14px/1 var(--display);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips.scroll { max-height: 220px; overflow-y: auto; scrollbar-width: thin; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: background-color .12s, border-color .12s;
}
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip[aria-pressed="true"] img { filter: brightness(0); opacity: .8; }
.chip .count { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .count { color: var(--accent-ink); opacity: .7; }
.chip.empty:not([aria-pressed="true"]) { opacity: .35; }
.swatch { width: 8px; height: 8px; border-radius: 2px; }

.db-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; min-height: 34px; }
.result-count { font: 600 18px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.active-filters { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    font-size: 12px;
    cursor: pointer;
}
.pill:hover { border-color: var(--down); }
.pill.clear { border-style: dashed; color: var(--muted); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-left: auto; }
.sort select {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 13px;
}
.vault-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.vault-title { font: 700 34px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.vault-guide, .hints-guide { color: var(--accent); text-decoration: none; font-size: 13px; }
.vault-guide:hover, .hints-guide:hover { text-decoration: underline; }
.vault-bar { position: relative; }
.query-errors { margin-top: 8px; color: var(--down); font-size: 13px; }
.query-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 18px; min-height: 28px; }
.hints-label { margin-right: 4px; font: 600 13px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.hint-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 9px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.hint-chip code { font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.hint-chip .count { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.hint-chip:hover { border-color: var(--accent); }
.hints-tip { color: var(--faint); font-size: 12px; margin-left: 4px; }
.hints-tip kbd, .filters-hint kbd { font-size: 10px; padding: 2px 4px; }
.filters-hint { color: var(--faint); font-size: 12px; margin-bottom: 16px; }
.chip.excluded, .chip.excluded:hover { border-color: rgba(224, 100, 92, .7); background: rgba(224, 100, 92, .12); color: #f2a7a1; }
.chip.excluded > :not(.count) { opacity: .8; }
.chip.excluded { text-decoration: line-through; }
.filters-toggle { display: none; }
.filters-done { display: none; }
.sentinel { height: 1px; }

/* =========================================================================
   Weapon page: laid out like the in-game inspect screen
   ========================================================================= */
.inspect {
    --tier: #7d55c7;
    --ink: rgba(255, 255, 255, .94);
    --ink-2: rgba(255, 255, 255, .66);
    --ink-3: rgba(255, 255, 255, .45);
    --rule: rgba(255, 255, 255, .26);
    --sel: #4a87bd;
    --gold: #f0cc6a;
    --inset-l: clamp(76px, 8vw, 140px);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    /* Desktop: exactly one screen tall. weapon.js wraps/shrinks the perks so everything fits. */
    height: calc(100vh - var(--nav-h, 61px));
    height: calc(100dvh - var(--nav-h, 61px));
    min-height: 480px;
    background: linear-gradient(120deg, #241d2f, #4a2f63 55%, #2c2238);
    color: var(--ink);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.inspect-bg {
    position: absolute; inset: 0; z-index: -2;
    background: 72% center / cover no-repeat;
}
/* Readability scrim: dark on the left where the menu sits, fading out over the weapon */
.inspect::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
        linear-gradient(90deg, rgba(8, 8, 12, .8) 0%, rgba(8, 8, 12, .58) 34%, rgba(8, 8, 12, .12) 58%, transparent 72%),
        linear-gradient(0deg, rgba(8, 8, 12, .72) 0%, rgba(8, 8, 12, .2) 30%, transparent 46%),
        linear-gradient(90deg, color-mix(in srgb, var(--tier) 20%, transparent), transparent 45%);
    transition: opacity .3s;
}

/* Foundry stripe down the left edge */
.inspect-foundry {
    position: absolute; left: 0; top: 0; bottom: 0; z-index: -1;
    width: calc(var(--inset-l) - 28px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 40px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--tier) 38%, transparent), color-mix(in srgb, var(--tier) 10%, transparent));
    pointer-events: none;
    transition: opacity .3s;
}
.inspect-foundry span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font: 800 clamp(44px, 5.4vw, 92px)/1 var(--body);
    letter-spacing: -.02em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(255, 255, 255, .16);
    text-shadow: none;
}

.inspect-ui {
    position: relative;
    max-width: var(--wrap);
    height: 100%;
    margin: 0 auto;
    padding: 30px 48px 78px var(--inset-l);
    display: grid;
    grid-template-columns: minmax(0, 860px) minmax(24px, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "left . right";
    transition: opacity .3s, visibility .3s;
}
.inspect-left { grid-area: left; min-width: 0; align-self: start; transform-origin: top left; }
.inspect-right { grid-area: right; align-self: end; display: flex; align-items: flex-start; transform-origin: bottom right; }
/* In-game style dark band behind power + stats: clear on the left, fading to dark towards the right edge */
@media (min-width: 1181px) {
    .inspect-right { position: relative; isolation: isolate; }
    .inspect-right::before {
        content: ""; position: absolute; z-index: -1; pointer-events: none;
        top: -24px; bottom: -24px; left: -160px; right: -200vw;      /* straight top and bottom edges; the page clips the right */
        background: linear-gradient(to right, rgba(6, 7, 10, 0) 0, rgba(6, 7, 10, .5) 160px, rgba(6, 7, 10, .68) 420px, rgba(6, 7, 10, .74) 100%);
    }
}

/* Hide menu: show just the weapon, like the in-game "Hide Menu" */
.inspect.menu-hidden .inspect-ui { opacity: 0; visibility: hidden; }
.inspect.menu-hidden::before, .inspect.menu-hidden .inspect-foundry { opacity: 0; }

/* Header */
.inspect-head { display: flex; align-items: flex-start; gap: 22px; }
.inspect-icon { flex: none; }
.inspect-icon .wicon {
    display: block;
    border-radius: 0;
    box-shadow: none;
    outline: 2px solid rgba(255, 255, 255, .9);
    background: color-mix(in srgb, var(--tier) 55%, #111);
}
.inspect-title { flex: 1; min-width: 0; padding-top: 2px; }
.inspect-head h1 {
    font: 700 clamp(36px, 4.4vw, 68px)/.95 var(--body);
    letter-spacing: -.005em;
    text-transform: uppercase;
    color: #fff;
    overflow-wrap: normal;   /* wrap between words only; weapon.js shrinks long single words to fit */
    word-break: normal;
}
.inspect-type {
    margin-top: 8px;
    font: 400 clamp(17px, 1.6vw, 25px)/1.1 var(--body);
    text-transform: uppercase;
    color: var(--ink-2);
}
.inspect-type .tier-label { color: color-mix(in srgb, var(--tier) 65%, #fff); font-weight: 500; }
.inspect-flavor {
    margin-top: 16px;
    max-width: 620px;
    font-size: 16px;
    font-style: italic;
    color: rgba(255, 255, 255, .8);
}
.inspect-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.d2-tag {
    font-size: 11px;
    line-height: 1;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(0, 0, 0, .28);
    color: var(--ink-2);
    text-shadow: none;
}
a.d2-tag:hover { border-color: rgba(255, 255, 255, .6); color: #fff; }
.d2-tag.craft { border-color: rgba(214, 72, 60, .7); color: #f2a59c; }
.d2-tag.warn { border-style: dashed; }

/* Section labels: thin uppercase heading over a rule, as in game */
.d2-section { margin-top: 24px; min-width: 0; }
.d2-label {
    font: 400 17px/1 var(--body);
    letter-spacing: .01em;
    text-transform: uppercase;
    color: var(--ink-2);
    padding-bottom: 8px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--rule);
}

/* Perk grid: one column per socket, separated by thin rules */
.perk-grid {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    padding: 8px 2px 6px 8px;
    scrollbar-width: thin;
}
.perk-col {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-left: 1px solid var(--rule);
}
.perk-col:first-child { border-left: 0; padding-left: 0; }
.perk-col-label {
    font: 500 10px/1 var(--body);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
    margin-bottom: 2px;
}
/* Perks fill top-to-bottom; when weapon.js limits the rows, extra perks start a new sub-column */
.perk-stack {
    display: grid;
    grid-auto-flow: column;
    gap: calc(var(--perk, 62px) * .19) 12px;
    justify-items: center;
}
.perk {
    position: relative;
    flex: none;
    width: var(--perk, 62px); height: var(--perk, 62px);
    display: grid; place-items: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5);
    background: rgba(18, 20, 26, .55);
    cursor: pointer;
    transition: background-color .12s, border-color .12s, box-shadow .12s, opacity .12s;
}
.perk img { width: calc(var(--perk, 62px) - 14px); height: calc(var(--perk, 62px) - 14px); }
.perk:hover { border-color: #fff; background: rgba(255, 255, 255, .14); }
.perk.on {
    background: var(--sel);
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(74, 135, 189, .35), 0 0 22px rgba(74, 135, 189, .55);
}
/* Enhanced, as in game: a normal perk with a gold glow rising from the bottom edge */
.perk.enhanced {
    background:
        radial-gradient(ellipse 85% 75% at 50% 105%, #f2d47c 0%, #d6b65a 28%, rgba(170, 140, 72, .75) 52%, rgba(120, 104, 80, .35) 72%, transparent 88%),
        rgba(18, 20, 26, .55);
    border-color: #efd28a;
    box-shadow: inset 0 0 0 2px rgba(140, 96, 24, .5);
}
.perk.enhanced:hover { border-color: #fff; filter: brightness(1.1); }
.perk.enhanced.on {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .3), 0 0 22px rgba(240, 204, 106, .55);
    background: var(--sel);
}
.perk.on img { filter: drop-shadow(0 0 1px rgba(0, 0, 0, .7)); }
.perk.enhanced img { filter: drop-shadow(0 1px 1px rgba(90, 60, 10, .55)); }
.perk.retired { opacity: .35; }
.perk.retired.on { opacity: 1; }
/* Gold "enhanced available" arrow, top-left like the game */
.enh-badge {
    position: absolute; left: -7px; top: -5px;
    width: 12px; height: 16px;
    opacity: .55;
    transition: opacity .12s;
}
.enh-badge::before {
    content: ""; position: absolute; left: 0; top: 0;
    border: 6px solid transparent; border-top: 0;
    border-bottom: 7px solid var(--gold);
}
.enh-badge::after { content: ""; position: absolute; left: 4px; top: 7px; width: 4px; height: 9px; background: var(--gold); }
.perk.enhanced .enh-badge { opacity: 1; }
.inspect-hint { margin-top: 12px; font-size: 12px; color: var(--ink-3); }

/* Weapon mods and intrinsic trait share a row so the screen fits */
.inspect-lower { display: flex; align-items: flex-start; gap: 36px; }
#mods-section { flex: none; }
#intrinsic-section { flex: 1; min-width: 0; }
.inspect-lower .d2-label { white-space: nowrap; }

.mod-row { display: flex; gap: 8px; }
.tier-pick { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.tier-pick-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .6); margin-right: 6px; }
.tier-pip { width: 30px; height: 30px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .3);
    color: rgba(255, 255, 255, .7); font: 600 13px Inter, sans-serif; cursor: pointer; }
.tier-pip.on { background: #e8c25a; border-color: #e8c25a; color: #1b1b1b; }
.tier-pip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 700px) { .tier-pip { width: 38px; height: 38px; } }
.mod {
    position: relative;
    width: 66px; height: 66px;
    display: grid; place-items: center;
    background: rgba(0, 0, 0, .32);
    border: 1px solid rgba(255, 255, 255, .45);
    cursor: pointer;
    transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.mod img { width: 56px; height: 56px; }
.mod:hover, .mod[aria-expanded="true"] { border-color: #fff; background: rgba(255, 255, 255, .12); }
.mod.mw.set { border: 2px solid var(--gold); box-shadow: 0 0 14px rgba(240, 204, 106, .35); }
.mod.set:not(.mw) { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.mod-more {
    position: absolute; right: 3px; bottom: 3px;
    border: 4px solid transparent; border-right-color: rgba(255, 255, 255, .7); border-bottom-color: rgba(255, 255, 255, .7);
}

.mod-picker {
    position: absolute;
    z-index: 290;
    max-width: min(420px, calc(100vw - 16px));
    background: rgba(14, 15, 19, .97);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .65);
    padding: 10px 12px 12px;
}
.mod-picker-head {
    font: 400 13px/1 var(--body);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .65);
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .2);
}
.mod-picker-grid { display: grid; grid-template-columns: repeat(6, 54px); gap: 6px; max-height: 50vh; overflow-y: auto; scrollbar-width: none; }
.mod-picker-grid::-webkit-scrollbar { display: none; }
.mod-opt {
    width: 54px; height: 54px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .25);
    cursor: pointer;
}
.mod-opt img { width: 44px; height: 44px; }
.mod-opt:hover, .mod-opt:focus-visible { border-color: #fff; background: rgba(255, 255, 255, .16); }
.mod-opt.on { border: 2px solid var(--gold); background: rgba(240, 204, 106, .14); }

/* Intrinsic trait */
.intrinsic { display: flex; gap: 18px; align-items: flex-start; }
.intrinsic-icon {
    flex: none;
    width: 66px; height: 66px;
    display: grid; place-items: center;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(0, 0, 0, .3);
}
.intrinsic small { display: block; color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.intrinsic strong { display: block; font: 700 18px/1.2 var(--body); text-transform: uppercase; color: #fff; }
.intrinsic p { margin-top: 3px; max-width: 560px; font-size: 14px; color: rgba(255, 255, 255, .82); white-space: pre-line; }

/* Right side: damage/ammo block, then the stat sheet */
.power-block { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; padding: 4px 24px 0 0; text-align: right; }
.pw small { display: block; font: 400 15px/1 var(--body); text-transform: uppercase; color: var(--ink-2); }
.pw strong {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    margin-top: 4px;
    font: 700 34px/1.05 var(--body);
    text-transform: uppercase;
    color: #fff;
}
.pw-ammo strong { font-size: 22px; font-weight: 600; }
.stat-sheet { width: 480px; padding-left: 24px; border-left: 2px solid var(--rule); }
.d2-stats { display: flex; flex-direction: column; gap: 5px; }
.d2-nums { margin-top: 18px; }
.d2-stat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px 40px;
    gap: 14px;
    align-items: center;
    font-size: 15px;
    line-height: 1.35;
}
.d2-stat-name { text-align: right; color: rgba(255, 255, 255, .9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d2-stat-name[title] { cursor: help; }
.d2-stat-val { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.d2-stat.num { grid-template-columns: minmax(0, 1fr) 254px; }
.d2-num-val { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.d2-num-val strong { font-weight: 500; }
.stat-bar { position: relative; height: 16px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.stat-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #f2f2f2; transition: width .2s; }
.stat-bar .delta { position: absolute; top: 0; bottom: 0; transition: left .2s, width .2s; }
.stat-bar .delta.up { background: var(--up); }
.stat-bar .delta.down { background: var(--down); opacity: .9; }
.up { color: var(--up); }
.down { color: var(--down); }
.recoil-wrap { display: block; height: 18px; }
.recoil { width: 36px; height: 18px; overflow: visible; }
.recoil .arc { fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 4; }
.recoil .cone { fill: #fff; }

/* Bottom bar of key hints, like the game's footer */
.inspect-keys {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 28px;
    padding: 12px 48px 12px var(--inset-l);
    background: linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .35));
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.keys-spacer { flex: 1; }
.key-btn {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 4px 0;
    background: none; border: 0;
    font-size: 15px;
    color: rgba(255, 255, 255, .88);
    cursor: pointer;
}
.key-btn kbd {
    min-width: 24px;
    text-align: center;
    color: #fff;
    border-color: rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .08);
}
.key-btn:hover:not(:disabled) { color: #fff; }
.key-btn:hover:not(:disabled) kbd { background: rgba(255, 255, 255, .2); }
.key-btn[aria-pressed="true"] { color: var(--gold); }
.key-btn[aria-pressed="true"] kbd { background: var(--gold); border-color: var(--gold); color: #1a1206; }
.key-btn:disabled { opacity: .4; cursor: default; }

/* Perk tooltip */
.perk-tip {
    position: absolute;
    z-index: 300;
    width: 340px;
    max-width: calc(100vw - 16px);
    background: rgba(14, 15, 19, .96);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .65);
    overflow: hidden;
    pointer-events: none;
}
.tip-head { padding: 12px 16px; background: #3d4b5c; }
.tip-head.enh { background: linear-gradient(90deg, #8a6420, #5b4316); }
.tip-head.is-mod { background: #4b4f58; }
.tip-head strong { display: block; font: 700 21px/1.1 var(--body); text-transform: uppercase; color: #fff; }
.tip-head small { color: rgba(255, 255, 255, .7); font-size: 13px; }
.tip-body { padding: 12px 16px 14px; font-size: 14px; color: #dcd9d3; }
.tip-body p + p { margin-top: 6px; }
.tip-stats { list-style: none; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.tip-stats li { font-size: 13px; }
.tip-stats span { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-stats .up span { color: var(--up); }
.tip-stats .down span { color: var(--down); }
.tip-note { margin-top: 8px; font-size: 12px; color: var(--accent); }
.tip-note.warn { color: var(--faint); }

/* Below the inspect screen: details, lore, other versions */
.inspect-extra {
    max-width: var(--wrap);
    width: 100%;
    margin: 0 auto;
    padding: 12px 48px 0 var(--inset-l, clamp(76px, 8vw, 140px));
    display: grid;
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}
/* Left column: details, other versions, lore. Right: insights, community rolls, similar weapons. */
.extra-side, .extra-main { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
.extra-side .d2-section, .extra-main .d2-section { margin: 0; }
.extra-main .similar .card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.extra-side .lore { max-width: 70ch; }
@media (max-width: 1180px) {
    /* One column: the two halves merge, and the long lore goes to the end. */
    .inspect-extra { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 8px var(--gutter) 0; }
    .extra-side, .extra-main { display: contents; }
    .extra-side > :first-child { order: 1; }
    #versions { order: 2; }
    #insights { order: 3; }
    #community { order: 4; }
    #similar { order: 5; }
    #lore-panel { order: 6; }
}
.inspect-extra .d2-label { color: var(--muted); border-bottom-color: var(--line-strong); }

.details { list-style: none; display: flex; flex-direction: column; font-size: 13px; }
.details li { padding: 7px 0 7px 26px; position: relative; border-top: 1px solid var(--line); }
.details li:first-child { border-top: 0; padding-top: 0; }
.details li > img { position: absolute; left: 0; top: 7px; }
.details li:first-child > img { top: 0; }
.details li:not(:has(> img))::before {
    content: ""; position: absolute; left: 6px; top: 14px;
    width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong);
}
.details li:first-child:not(:has(> img))::before { top: 7px; }
.details b { font-weight: 600; letter-spacing: .02em; }
.details small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.details a { color: var(--accent); text-decoration: none; }
.details a:hover { text-decoration: underline; }
.details code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); user-select: all; }

.version-list { display: flex; flex-direction: column; gap: 6px; }
.version { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); text-decoration: none; }
.version:hover { background: var(--surface-2); }
.version span { display: flex; flex-direction: column; font-size: 13px; }
.version small { color: var(--muted); font-size: 12px; }

.lore { color: #c9c6c0; max-width: 68ch; font-size: 15px; }
.lore p + p { margin-top: 12px; }

/* =========================================================================
   Responsive
   ========================================================================= */
/* Laptop widths: stack damage/ammo above the stats so the name and perks get more room */
@media (min-width: 1181px) and (max-width: 1500px) {
    .inspect-ui { grid-template-columns: minmax(0, 860px) minmax(24px, 1fr) auto; }
    .inspect-right { flex-direction: column; align-items: flex-end; gap: 18px; }
    .power-block { flex-direction: row; align-items: flex-end; gap: 32px; padding: 0; }
    .stat-sheet { width: 480px; }
}

@media (max-width: 1180px) {
    .inspect { height: auto; min-height: 0; background: var(--bg); text-shadow: none; }
    .inspect::before, .inspect-foundry { display: none; }
    .inspect-bg {
        position: relative; inset: auto; z-index: 0;
        width: 100%; aspect-ratio: 16 / 9; max-height: 64vh;
        background-position: center;
    }
    .inspect-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, var(--bg)); }
    .inspect-ui {
        height: auto;
        grid-template-rows: auto;
        margin-top: -56px;
        padding: 0 var(--gutter) 28px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "left" "right";
        gap: 32px;
    }
    .inspect-right { align-self: start; flex-direction: column; gap: 22px; }
    .inspect-lower { flex-direction: column; gap: 0; }
    .power-block { flex-direction: row; align-items: flex-end; gap: 32px; padding: 0; text-align: left; }
    .pw strong { justify-content: flex-start; }
    .stat-sheet { width: 100%; max-width: 560px; padding-left: 0; border-left: 0; }
    .inspect-keys { position: static; padding: 10px var(--gutter); background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    #key-menu { display: none; }
}

@media (max-width: 1000px) {
    .db-layout { grid-template-columns: 1fr; }
    .filters { display: none; position: static; max-height: none; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
    .filters-open .filters {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 150;
        max-height: none;
        border: 0;
        border-radius: 0;
        padding: 20px var(--gutter) 90px;
    }
    .filters-open { overflow: hidden; }
    .filters-done { display: block; position: fixed; left: var(--gutter); right: var(--gutter); bottom: 16px; padding: 12px; font-size: 15px; }
    .filters-toggle { display: inline-block; }
}

@media (max-width: 760px) {
    .nav-inner { height: auto; flex-wrap: wrap; gap: 10px 16px; padding-top: 10px; padding-bottom: 10px; }
    .nav-search { order: 3; flex-basis: 100%; max-width: none; }
    .nav-search.is-hidden { display: none; }
    .qbar-input { font-size: 16px !important; }
    .search-kbd { display: none; }
    .brand { font-size: 19px; }
    .nav-links { gap: 14px; }
    .nav-links a { line-height: 32px; font-size: 14px; }
    .api-status .api-label { display: none; }

    .home-hero { padding: 40px 0 24px; }
    .card-grid { grid-template-columns: 1fr; }
    .sort { margin-left: 0; }
    .active-filters { flex-basis: 100%; order: 3; }

    .inspect-ui { margin-top: -36px; }
    .inspect-head { gap: 14px; }
    .inspect-icon .wicon { --size: 68px !important; }
    .inspect-flavor { font-size: 15px; }
    .perk-col { gap: 10px; padding: 0 7px; }
    .perk-col-label { letter-spacing: .03em; font-size: 9px; }
    .perk { width: 52px; height: 52px; }
    .perk img { width: 40px; height: 40px; }
    .intrinsic-icon { width: 60px; height: 60px; }
    .intrinsic-icon img { width: 48px; height: 48px; }
    .pw strong { font-size: 26px; }
    .pw-ammo strong { font-size: 19px; }
    .d2-stat { grid-template-columns: 148px minmax(0, 1fr) 30px; gap: 10px; font-size: 13px; }
    .d2-stat.num { grid-template-columns: 148px minmax(0, 1fr); }
    .inspect-keys { gap: 4px 18px; }
    .key-btn { font-size: 14px; }
}

@media (hover: none) {
    .perk:hover { background: rgba(18, 20, 26, .55); border-color: rgba(255, 255, 255, .5); }
    .perk.on:hover { background: var(--sel); border-color: #fff; }
    .key-btn kbd { display: none; }
}

/* =========================================================================
   Query guide
   ========================================================================= */
.guide-layout {
    max-width: var(--wrap);
    width: 100%;
    margin: 0 auto;
    padding: 32px var(--gutter) 0;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}
.guide-toc { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.toc-title { font: 600 13px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.guide-toc a { color: var(--muted); text-decoration: none; padding: 4px 0 4px 10px; border-left: 2px solid var(--line); }
.guide-toc a:hover { color: var(--text); border-left-color: var(--accent); }
.guide { max-width: 820px; min-width: 0; }
.guide-intro h1 { font: 700 clamp(36px, 5vw, 56px)/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.guide-intro p { color: var(--muted); margin-top: 12px; font-size: 15px; max-width: 68ch; }
.guide-intro .lede { color: var(--text); font-size: 17px; }
.guide-section { margin-top: 44px; scroll-margin-top: 80px; }
.guide-section h2 { font-size: 26px; color: var(--text); margin-bottom: 14px; }
.guide-section h2 a { color: var(--faint); text-decoration: none; margin-right: 4px; }
.guide-section h2 a:hover { color: var(--accent); }
.guide-section h3 { margin: 26px 0 10px; color: var(--muted); }
.guide-section p, .guide-section li { font-size: 15px; color: #cfccc6; max-width: 70ch; }
.guide-section p + p { margin-top: 10px; }
.guide-section ul { margin: 10px 0 14px 20px; display: flex; flex-direction: column; gap: 6px; }
.guide code, .callout code { font: 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.guide a { color: var(--accent); }
.guide a.wcard { color: inherit; }
.guide .note { color: var(--faint); font-size: 13px; }

.ex-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.ex {
    display: inline-flex; align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 100%;
}
.ex-code { min-width: 0; background: none; border: 0; padding: 7px 10px; text-align: left; cursor: pointer; }
.ex-code code { background: none; padding: 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.ex-code:hover code { color: var(--accent); }
.ex-count { display: flex; align-items: center; padding: 0 8px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); }
.ex-count:empty { display: none; }
.ex-count.zero { color: var(--down); }
.guide .ex-try { display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; border-left: 1px solid var(--line); background: var(--surface-2); }
.guide .ex-try:hover { background: var(--surface-3); }
.ref-table td .ex { margin: 0; }

.ref-table, .keys-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.ref-table th { text-align: left; font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.ref-table td, .keys-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: #cfccc6; vertical-align: middle; }
.keys-table td:first-child { white-space: nowrap; width: 1%; }
.callout { margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); }

.playground { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.playground .qbar.full { background: var(--bg); }
.pg-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 12px; }
.pg-open { font-size: 13px; text-decoration: none; }
.pg-results { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

@media (max-width: 900px) {
    .guide-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
    .guide-toc { display: none; }
}
@media (max-width: 760px) {
    .playground { padding: 14px; }
    .ref-table { font-size: 13px; }
    .ref-table td, .ref-table th { padding: 7px 6px; }
    .vault-title { font-size: 28px; }
}

/* =========================================================================
   Shared page bits (accounts, saved rolls, compare, perks, changes, admin)
   ========================================================================= */
.page { max-width: var(--wrap); width: 100%; margin: 0 auto; padding: 32px var(--gutter) 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font: 700 clamp(34px, 5vw, 52px)/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.page-head .lede { margin-top: 10px; font-size: 15px; max-width: 70ch; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-plain { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.panel-plain h2 { color: var(--text); margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.section-title { color: var(--text); font-size: 24px; margin: 32px 0 14px; }
.text-input, .field input, .field textarea, .field select, .panel-plain textarea {
    width: 100%; padding: 9px 12px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 14px; outline: none; resize: vertical;
}
.text-input:focus, .field input:focus, .field textarea:focus, .field select:focus, .panel-plain textarea:focus { border-color: var(--accent); }
/* Security questions (sign-up, My Armoury, forgot password) */
.sq-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.sq-box > .sq-title { margin: 0; color: var(--text); font-weight: 600; font-size: 14px; }
.sq-modes { align-self: flex-start; margin-right: 0; flex-wrap: wrap; }
.lost-box { border-top: 1px solid var(--line); padding-top: 14px; }
.btn.danger { border-color: rgba(224, 100, 92, .55); color: #f2a7a1; }
.btn.danger:hover:not(:disabled) { background: rgba(224, 100, 92, .15); }
.btn.small { padding: 4px 8px; font-size: 12px; }
a.btn { display: inline-block; text-decoration: none; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }
.file-btn { cursor: pointer; }
.empty-big { text-align: center; padding: 48px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-big h2 { color: var(--text); font-size: 24px; }
.empty-big p { margin: 8px auto 18px; max-width: 46ch; }

/* Header: compare count, account button + menu */
.nav-compare { position: relative; }
.nav-count {
    display: inline-block; min-width: 16px; margin-left: 4px; padding: 0 4px;
    border-radius: 8px; background: var(--accent); color: var(--accent-ink);
    font: 700 11px/16px var(--body); text-align: center; vertical-align: 2px;
}
.nav-count[hidden] { display: none; }
.nav-account { position: relative; }
.nav-login, .nav-user { white-space: nowrap; }
.nav-user { display: inline-flex; align-items: center; gap: 6px; max-width: 160px; }
.nav-user-name { overflow: hidden; text-overflow: ellipsis; }
.caret { border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.account-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 150; min-width: 170px;
    display: flex; flex-direction: column; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.account-menu[hidden] { display: none; }
.account-menu a, .account-menu button { text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); background: none; border: 0; text-decoration: none; font-size: 14px; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover { background: var(--surface-3); }

.announcement {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 9px var(--gutter); background: #3b2a12; border-bottom: 1px solid #6b4b1d; color: #f3d9a8; font-size: 14px; text-align: center;
}
.announcement .modal-x { color: #f3d9a8; }
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 400;
    max-width: calc(100vw - 32px); padding: 10px 16px;
    background: var(--surface-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 14px;
}
.toast[hidden] { display: none; }
.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: var(--text); }

/* Dialogs and forms */
.modal {
    width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 32px); margin: auto; padding: 0;
    background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
}
.modal.wide { width: min(720px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.modal-head h2 { margin: 0; color: var(--text); font-size: 22px; }
.modal-body { padding: 16px 18px 18px; }
.modal-x { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-actions .link { margin-right: auto; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field > span { color: var(--muted); font-weight: 500; }
.field small { color: var(--faint); font-size: 12px; }
.form-error { color: var(--down); font-size: 13px; }
.form-error[hidden] { display: none; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; color: var(--muted); cursor: pointer; font-size: 14px; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.recovery-code {
    font: 600 20px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-align: center;
    padding: 14px; background: var(--bg); border: 1px dashed var(--accent); border-radius: var(--radius-sm); user-select: all; word-break: break-all;
}
.tag-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 12px; cursor: pointer; }
.tag-pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag-input { margin-top: 6px; }
.roll-summary { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.roll-summary-perks { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }

/* My Armoury */
.export-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 28px; }
.export-grid p { margin-bottom: 12px; font-size: 14px; }
.export-grid a { color: var(--accent); }
.rolls-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.rolls-toolbar .text-input { flex: 1; min-width: 220px; }
.rolls-toolbar .sort { margin-left: 0; }
.roll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; margin-top: 10px; }
.roll-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.roll-weapon { display: flex; gap: 12px; align-items: center; text-decoration: none; min-width: 0; }
.roll-weapon span { display: flex; flex-direction: column; min-width: 0; }
.roll-weapon strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-weapon small { color: var(--muted); }
.roll-perks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.roll-perk { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sel, #4a87bd); border: 2px solid rgba(255, 255, 255, .7); }
.roll-perk.enh { background: radial-gradient(ellipse 85% 75% at 50% 105%, #f2d47c 0%, #d6b65a 28%, rgba(170, 140, 72, .75) 52%, rgba(120, 104, 80, .35) 72%, transparent 88%), #4a87bd; }
.roll-mod { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface-2); }
.roll-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.roll-notes { font-size: 13px; color: #cfccc6; white-space: pre-line; }
.roll-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }

/* Compare */
.cmp-add { position: relative; max-width: 560px; margin-bottom: 20px; }
.cmp-results { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; }
.cmp-results .suggestion { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.cmp-results .suggestion:hover, .cmp-results .suggestion[aria-selected="true"] { background: var(--surface-3); }
.cmp-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 10px 0; margin: 0 -10px; table-layout: fixed; min-width: calc(190px + var(--cols, 4) * 230px); font-size: 14px; }
.cmp-col-label { width: 190px; }
.cmp-table th, .cmp-table td { padding: 10px 14px; text-align: left; vertical-align: middle; }
.cmp-table tbody td { background: var(--surface); border-bottom: 1px solid var(--line); }
.cmp-table tbody tr:hover td { background: var(--surface-2); }
.cmp-label { color: var(--muted); font-weight: 500; font-size: 13px; }
.cmp-table thead th { padding: 0 0 10px; vertical-align: bottom; }
.cmp-table tbody td.cmp-blank, .cmp-table tbody tr:hover td.cmp-blank { background: transparent; border-bottom-color: transparent; }

/* Header cards */
.cmp-card {
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; align-items: flex-end; gap: 14px; min-height: 150px; padding: 16px;
    border: 1px solid var(--line); border-top: 3px solid var(--tier, var(--line)); border-radius: var(--radius);
    background: var(--surface);
}
.cmp-card-bg { position: absolute; inset: 0; z-index: -2; background: 70% 40% / cover no-repeat; opacity: .5; }
.cmp-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(13, 14, 16, .92) 0%, rgba(13, 14, 16, .55) 60%, rgba(13, 14, 16, .25) 100%); }
.cmp-card-icon { flex: none; }
.cmp-card-icon .wicon { outline: 1px solid rgba(255, 255, 255, .6); }
.cmp-card-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cmp-name { font: 700 26px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-name:hover { color: var(--accent); }
.cmp-type { font-size: 13px; color: var(--muted); }
.cmp-type b { color: color-mix(in srgb, var(--tier) 70%, #fff); font-weight: 600; }
.cmp-icons { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; margin-top: 2px; }
.cmp-remove { position: absolute; top: 8px; right: 10px; z-index: 1; }
.cmp-empty {
    width: 100%; justify-content: center; align-items: center; flex-direction: column; gap: 6px;
    border: 1px dashed var(--line-strong); background: transparent; color: var(--faint); cursor: pointer; font-size: 14px;
}
.cmp-empty:hover { border-color: var(--accent); color: var(--accent); }
.cmp-plus { font: 300 36px/1 var(--body); }

/* Sections */
.cmp-section th { padding: 26px 0 8px; }
.cmp-section span { font: 600 15px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); border-left: 3px solid var(--accent); padding-left: 10px; }
.cmp-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.cmp-link:hover { color: var(--accent); }
.cmp-yes { color: var(--up); font-weight: 600; }
.cmp-source { font-size: 12px; color: var(--muted); }

/* Stats */
.cmp-stat-row td { padding-top: 8px; padding-bottom: 8px; }
.cmp-stat { display: flex; align-items: center; gap: 12px; }
.cmp-stat .stat-bar { flex: 1; height: 10px; background: var(--surface-3); position: relative; overflow: hidden; border-radius: 2px; }
.cmp-stat .stat-bar .fill { position: absolute; inset: 0 auto 0 0; background: #d9d6d0; }
.cmp-val { display: inline-flex; align-items: baseline; gap: 6px; min-width: 64px; font-variant-numeric: tabular-nums; }
.cmp-val b { font-size: 15px; }
.cmp-val small { font-size: 12px; font-weight: 600; }
.cmp-stat.best .cmp-val b, .cmp-legend.best { color: var(--up); }
.cmp-stat.best .stat-bar .fill { background: var(--up); }
.cmp-legend.gap { color: var(--down); }

/* Perks */
.cmp-perks { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-perk {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
    text-decoration: none; font-size: 13px; white-space: nowrap;
}
.cmp-perk img { background: #2b3038; border-radius: 50%; }
.cmp-perk:hover { border-color: var(--line-strong); background: var(--surface-3); }
.cmp-perk.shared { border-color: rgba(233, 162, 59, .55); color: #f3c27a; }
.cmp-perk.retired { opacity: .45; }
.cmp-legend-row { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; }
.cmp-legend.shared { color: #f3c27a; }

/* Perk page + directory */
.perk-hero { display: flex; gap: 22px; align-items: flex-start; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.perk-hero-icon { flex: none; width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%; background: #2b3038; border: 2px solid rgba(255, 255, 255, .5); }
.perk-hero h1 { font: 700 clamp(30px, 4vw, 44px)/1 var(--body); text-transform: uppercase; }
.perk-desc { margin: 12px 0 16px; max-width: 70ch; color: #d3d0ca; font-size: 15px; display: flex; flex-direction: column; gap: 6px; }
.perk-stats { margin: 0 0 16px; }
.perk-group { margin-top: 18px; }
.perk-group h3 { color: var(--muted); }
.perk-kinds { margin-bottom: 14px; }
.perk-dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.perk-tile { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.perk-tile:hover { border-color: var(--accent); }
.perk-tile img { flex: none; border-radius: 50%; background: #2b3038; }
.perk-tile > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perk-tile small { color: var(--muted); font-size: 12px; }
.perk-tile-desc { color: var(--faint); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* What changed */
.chg { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.chg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chg-head h2 { color: var(--text); margin: 0; }
.chg-head .d2-tag { margin-left: 8px; }
.chg-section { margin-top: 16px; }
.chg-section h3 { margin: 0 0 10px; }
.chg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.chg-weapon { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: var(--radius-sm); text-decoration: none; }
.chg-weapon:hover { background: var(--surface-2); }
.chg-weapon span { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.chg-weapon small { color: var(--muted); }
.chg-plain { font-size: 13px; color: var(--muted); }
.chg-row { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; }
.chg-row a { color: var(--text); font-weight: 600; text-decoration: none; }
.chg-vals { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }

/* Admin */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-tile { display: flex; flex-direction: column; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-tile strong { font: 700 32px/1 var(--display); }
.stat-tile span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-popular { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.admin-popular a { color: var(--accent); text-decoration: none; }
.admin-users { overflow-x: auto; margin-top: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--faint); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.data-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table td .d2-tag { margin-left: 6px; }
.data-table tr.banned td { opacity: .6; }
.admin-pending { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 14px 0; }
.admin-pending .field { flex: 1; min-width: 220px; }
.admin-pending .chg { flex-basis: 100%; background: var(--bg); }
.admin-published { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.admin-published li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }

@media (max-width: 760px) {
    .page { padding-top: 20px; }
    .export-grid, .admin-grid { grid-template-columns: 1fr; gap: 20px; }
    .roll-list { grid-template-columns: 1fr; }
    .perk-hero { flex-direction: column; padding: 16px; }
    .cmp-table { min-width: calc(96px + var(--cols, 1) * 230px); font-size: 13px; }
    .cmp-col-label { width: 96px; }
    .cmp-table th, .cmp-table td { padding: 8px 10px; }
    .cmp-card { flex-direction: column; align-items: flex-start; min-height: 0; padding: 12px; gap: 10px; }
    .cmp-name { font-size: 22px; max-width: 100%; }
    .nav-refresh, .api-status, .nav-account { order: 1; }
    .nav-refresh { margin-left: auto; }
    .nav-links { order: 2; flex-basis: 100%; margin-left: 0; gap: 12px; justify-content: space-between; }
    .nav-links a { font-size: 13px; }
    .nav-user { max-width: 110px; }
}

/* =========================================================================
   Home (full-width layout)
   ========================================================================= */
.home { max-width: none; padding: 0; }
.home-hero {
    position: relative; isolation: isolate; overflow: hidden;
    max-width: none; padding: 0;
    border-bottom: 1px solid var(--line);
    background: radial-gradient(ellipse at 80% 20%, #1d2230, var(--bg) 70%);
}
.home-hero-bg {
    position: absolute; inset: 0; z-index: -1;
    background: 75% 35% / cover no-repeat;
    opacity: 0; transition: opacity .6s;
}
.home-hero.has-art .home-hero-bg { opacity: .55; }
.home-hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(90deg, var(--bg) 0%, rgba(13, 14, 16, .85) 35%, rgba(13, 14, 16, .2) 75%, rgba(13, 14, 16, .4) 100%),
                linear-gradient(0deg, var(--bg) 0%, transparent 40%);
}
.home-hero-inner { max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(32px, 5vw, 64px); }
.home-hero-inner h1 { font-size: clamp(36px, 5vw, 68px); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; max-width: 14em; }
.home-search { position: relative; max-width: 720px; margin-top: 28px; }
.home-search .qbar { min-height: 54px; border-radius: var(--radius); background: rgba(21, 23, 26, .92); border-color: var(--line-strong); }
.home-search .qbar-input { font-size: 16px; }
.home-search .search-glyph { left: 15px; }
.home-search .qbar.compact { padding-left: 42px; }
.home-search-hint { margin-top: 10px; color: var(--muted); font-size: 13px; }
.home-search-hint a { color: var(--accent); text-decoration: none; }
.home-search-hint a:hover { text-decoration: underline; }
.home-stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 32px; }
.home-stats div { display: flex; flex-direction: column; }
.home-stats dt { font: 700 32px/1 var(--display); letter-spacing: .02em; }
.home-stats dd { color: var(--muted); font-size: 13px; margin-top: 4px; }
.home-hero-credit {
    position: absolute; right: var(--gutter); bottom: 18px;
    display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; text-align: right;
    font: 600 18px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.home-hero-credit small { font: 500 11px/1 var(--body); letter-spacing: .1em; color: var(--accent); margin-bottom: 4px; }
.home-hero-credit[hidden] { display: none; }

.home-cols {
    max-width: var(--wrap); margin: 0 auto; padding: 8px var(--gutter) 0;
    display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start;
}
.home-section { margin-top: 32px; }
.home-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.home-section-head h2 { margin: 0; }
.home-section-head a { color: var(--accent); font-size: 13px; text-decoration: none; }
.home-section-head a:hover { text-decoration: underline; }

/* Types grouped by ammo */
.ammo-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ammo-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ammo-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; text-decoration: none;
    border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.ammo-head strong { font: 600 20px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.ammo-head span { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ammo-head:hover strong { color: var(--accent); }
.ammo-primary .ammo-head { box-shadow: inset 3px 0 0 #e9e7e3; }
.ammo-special .ammo-head { box-shadow: inset 3px 0 0 #5cc78a; }
.ammo-heavy .ammo-head { box-shadow: inset 3px 0 0 #9a6cd8; }
.type-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.type-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 11px 16px; text-decoration: none; border-bottom: 1px solid var(--line);
    font: 600 17px/1.15 var(--display); letter-spacing: .03em; text-transform: uppercase;
    transition: background-color .12s, color .12s;
}
.type-row small { font: 400 12px/1 var(--body); color: var(--faint); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.type-row:hover { background: var(--surface-2); color: var(--accent); }

.home-newest { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* Side column */
.home-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 14px; margin-top: 32px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.side-card h2 { margin-bottom: 12px; }
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-row { display: flex; align-items: center; gap: 12px; padding: 6px; margin: 0 -6px; border-radius: var(--radius-sm); text-decoration: none; }
.side-row:hover { background: var(--surface-2); }
.side-row > span { display: flex; flex-direction: column; min-width: 0; }
.side-row strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-row small { color: var(--muted); font-size: 12px; }
.update-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.update-list b { color: var(--text); font-variant-numeric: tabular-nums; }
.side-more { display: inline-block; margin-top: 12px; color: var(--accent); font-size: 13px; text-decoration: none; }
.side-links { display: flex; flex-direction: column; gap: 4px; }
.side-link { display: flex; flex-direction: column; padding: 8px 10px; margin: 0 -10px; border-radius: var(--radius-sm); text-decoration: none; }
.side-link:hover { background: var(--surface-2); }
.side-link strong { font-size: 14px; }
.side-link small { color: var(--muted); font-size: 12px; }
.side-login { margin-top: 8px; }

@media (max-width: 1300px) {
    .ammo-groups { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
    .home-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .home-side { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
    .ammo-groups { grid-template-columns: 1fr; }
    .home-hero-credit { display: none; }
    .home-stats { gap: 10px 24px; }
    .home-stats dt { font-size: 26px; }
    .home-side { grid-template-columns: 1fr; }
}

/* ================= community: shared rolls, upvotes, popular ================= */
.community #community-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.community #community-body > :only-child { grid-column: 1 / -1; }
.community-sub { font-family: var(--display); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

.combo-list { display: flex; flex-direction: column; gap: 6px; }
.combo-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: inherit; text-decoration: none; min-width: 0; }
.combo-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.combo-perks { display: flex; flex-wrap: wrap; gap: 3px; }
.combo-perk { display: inline-flex; }
.combo-names { font-size: 12px; color: var(--muted); line-height: 1.4; }
.combo-perk img { flex: none; border-radius: 50%; background: var(--sel, #4a87bd); border: 1px solid rgba(255, 255, 255, .5); }
.combo-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.combo-weapon { font-size: 13px; font-weight: 600; }
.combo-count { display: flex; flex-direction: column; align-items: center; flex: none; min-width: 44px; line-height: 1.1; }
.combo-count b { font-family: var(--display); font-size: 20px; color: var(--accent); }
.combo-count small { font-size: 11px; color: var(--muted); }

.croll-list { display: flex; flex-direction: column; gap: 8px; }
.croll { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.croll-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.croll-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.croll-head > div { display: flex; flex-direction: column; min-width: 0; }
.croll-name { font-weight: 600; color: var(--text); text-decoration: none; }
.croll-name:hover { color: var(--accent); }
.croll-head small b { color: var(--text); font-weight: 600; }
.croll-perks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.croll-perks .roll-perk { width: 34px; height: 34px; }
.croll-perks .roll-mod { width: 32px; height: 32px; }
.croll-perk-names { font-size: 12px; color: var(--muted); flex-basis: 100%; }
.croll-try { align-self: center; }
.croll-list.compact .croll { padding: 10px; gap: 10px; }
.croll-list.compact .roll-notes { display: none; }
.croll-list.compact .croll-perk-names { display: none; }

.vote-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; padding: 6px 4px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); cursor: pointer; font: inherit; }
.vote-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.vote-btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(233, 162, 59, .14); color: var(--accent); }
.vote-btn:disabled { cursor: default; opacity: .7; }
.vote-arrow { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 9px solid currentColor; }
.vote-n { font-family: var(--display); font-size: 17px; font-weight: 600; line-height: 1; }

.shared-badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 99px; border: 1px solid rgba(233, 162, 59, .5); color: var(--accent); font-size: 11px; }

/* home: popular */
.popular-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.popular-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.popular-col h3 { display: flex; align-items: baseline; gap: 8px; font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: .02em; margin-bottom: 10px; }
.popular-col h3 small { font-family: var(--body); font-size: 12px; font-weight: 400; }
.popular-col .combo-row, .popular-col .croll { background: var(--surface-2); }
.pop-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pop-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pop-rank { width: 18px; text-align: right; font-family: var(--display); color: var(--faint); font-size: 16px; flex: none; }
.pop-weapon { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.pop-weapon > span { display: flex; flex-direction: column; min-width: 0; }
.pop-weapon strong { font-size: 14px; font-weight: 600; }
.pop-weapon small { color: var(--muted); font-size: 12px; }
.pop-weapon:hover strong { color: var(--accent); }

@media (max-width: 900px) {
    .community #community-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .croll { grid-template-columns: auto minmax(0, 1fr); }
    .croll-try { grid-column: 2; justify-self: start; }
}
.popular-col h3 { flex-wrap: wrap; row-gap: 0; }
.croll-list.compact .croll { grid-template-columns: auto minmax(0, 1fr); }
.croll-list.compact .croll-try { display: none; }
.croll-list.compact .croll-perks .roll-perk { width: 28px; height: 28px; }
.croll-list.compact .croll-perks .roll-mod { display: none; }
.combo-row { align-items: flex-start; }
.combo-row > .wicon, .combo-row > .combo-count { align-self: center; }

/* ================= trending tabs, profiles, reports, weapon of the day ================= */
.seg-tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 99px; padding: 2px; gap: 2px; margin-right: auto; }
.seg-tabs button { background: none; border: 0; color: var(--muted); font: 500 13px var(--body); padding: 4px 12px; border-radius: 99px; cursor: pointer; }
.seg-tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.seg-tabs button:hover { color: var(--text); }
#popular-section .home-section-head { align-items: center; flex-wrap: wrap; justify-content: flex-start; }
#popular-section .home-section-head h2 { margin-right: 8px; }

.croll-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: center; }
.croll-actions .croll-try { align-self: stretch; text-align: center; }
.croll-copy, .croll-report { font-size: 12px; }
.croll-report { color: var(--muted); }
.croll-report:hover { color: var(--down); }
.croll-author { color: var(--text); font-weight: 600; text-decoration: none; }
.croll-author:hover { color: var(--accent); text-decoration: underline; }
.croll-list.compact .croll-actions { display: none; }
@media (max-width: 560px) {
    .croll-actions { grid-column: 2; flex-direction: row; align-items: center; gap: 14px; }
    .croll-actions .croll-try { align-self: auto; }
}

.daily-card { position: relative; display: block; overflow: hidden; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: inherit; text-decoration: none; min-height: 96px; }
.daily-card:hover { border-color: var(--tier); }
.daily-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .45; }
.daily-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13, 14, 16, .9), rgba(13, 14, 16, .35)); }
.daily-top { position: relative; z-index: 1; display: flex; gap: 12px; align-items: center; padding: 18px 14px; }
.daily-top > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.daily-top strong { font: 700 22px/1.1 var(--display); letter-spacing: .02em; }
.daily-top small { font-size: 12.5px; color: var(--text); }
.daily-top small.muted { color: var(--muted); }
.daily-label { margin: 12px 0 6px; }

.profile-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
.profile-hero h1 { font: 700 40px/1 var(--display); letter-spacing: .02em; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font: 700 36px var(--display); color: var(--accent-ink); background: var(--accent); flex: none; }
.profile-stats { margin-left: auto; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.profile-head .section-title { margin: 0; }

.report-list { display: flex; flex-direction: column; gap: 8px; }
.report-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid rgba(224, 100, 92, .45); background: rgba(224, 100, 92, .06); border-radius: var(--radius); }
.report-card > div:first-child { min-width: 0; flex: 1; }
.report-why { font-size: 13px; margin-top: 4px; }
.stat-tile { color: inherit; text-decoration: none; }
.stat-tile.alert { border-color: var(--down); }
.stat-tile.alert strong { color: var(--down); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.chart-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chart-head strong { font: 700 22px var(--display); color: var(--text); }
.spark { display: block; width: 100%; height: 64px; }
.spark rect { fill: var(--accent); }
.spark rect:hover { fill: var(--text); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }

/* vault quick filters */
.quick-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 4px; }
.quick-chip { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); border-radius: 99px; padding: 5px 12px; font: 500 13px var(--body); cursor: pointer; }
.quick-chip:hover { border-color: var(--accent); }
.quick-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* weapon page: similar weapons, stat breakdown, share image */
.similar .d2-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.similar-more { font: 500 13px var(--body); color: var(--accent); text-decoration: none; text-transform: none; letter-spacing: 0; }
.d2-stat-delta { font-size: .72em; margin-left: 4px; opacity: .9; }
.share-preview { width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* what changed: summary */
.chg-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.chg-sum { display: flex; flex-direction: column; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 120px; }
.chg-sum strong { font: 700 26px/1 var(--display); color: var(--accent); }
.chg-sum span { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.d2-stat { grid-template-columns: minmax(0, 1fr) 200px 66px; }
.d2-stat.num { grid-template-columns: minmax(0, 1fr) 280px; }
.d2-stat-val { white-space: nowrap; }
.d2-stat[title] { cursor: help; }
@media (max-width: 760px) {
    .d2-stat { grid-template-columns: 148px minmax(0, 1fr) 54px; }
    .d2-stat.num { grid-template-columns: 148px minmax(0, 1fr); }
}

/* shared roll upvote, on the "Legendary Combat Bow" line so the name keeps the full width */
.inspect-type-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.inspect-type-row .inspect-type { margin-top: 0; }
.w-vote { flex: none; display: flex; align-items: center; gap: 10px; }
.w-vote-label { font-size: 13px; color: rgba(255, 255, 255, .75); }
.w-vote-label b { color: #fff; font-weight: 600; }
.w-vote-label a { color: #fff; }
.w-vote:empty { display: none; }
.vote-btn.weapon-vote { flex-direction: row; gap: 7px; padding: 4px 10px; min-width: 0; background: rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .35); color: #fff; }
.vote-btn.weapon-vote .vote-n { font-size: 18px; }
.vote-btn.weapon-vote:hover:not(:disabled) { border-color: var(--accent); }
.vote-btn.weapon-vote[aria-pressed="true"] { background: rgba(233, 162, 59, .22); border-color: var(--accent); color: var(--accent); }

/* Roll builder buttons on phones: proper tap targets in a grid, no keyboard hints */
@media (max-width: 760px) {
    .inspect-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px var(--gutter); }
    .keys-spacer { display: none; }
    .key-btn {
        justify-content: center; gap: 8px;
        min-height: 46px; padding: 10px 12px;
        border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
        background: var(--surface-2);
        font-size: 14px; font-weight: 500; color: var(--text);
        -webkit-tap-highlight-color: transparent;
    }
    .key-btn kbd { display: none; }
    .key-btn:active:not(:disabled) { background: var(--surface-3); }
    .key-btn[aria-pressed="true"] { border-color: var(--gold); background: rgba(240, 204, 106, .12); color: var(--gold); }
    .key-btn[hidden] { display: none; }
    #key-save { order: -1; grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
    #key-save:active { filter: brightness(.92); }
}

/* refresh button (top bar) */
.nav-refresh { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; padding: 0; flex: none; }
.nav-refresh:hover { color: var(--text); border-color: var(--line-strong); }
.nav-refresh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.is-refreshing .nav-refresh svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) { .nav-refresh { width: 40px; height: 40px; } }

/* pull to refresh (home-screen app only) */
.standalone-app, .standalone-app body { overscroll-behavior-y: contain; }
.ptr { position: fixed; top: env(safe-area-inset-top, 0px); left: 50%; z-index: 300; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--muted);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45); transform: translate(-50%, -56px); opacity: 0; pointer-events: none; }
.ptr.ptr-back { transition: transform .2s ease, opacity .2s ease; }
.ptr.ready { color: var(--accent); border-color: var(--accent); }
.ptr-icon { display: grid; place-items: center; }
.ptr.spinning .ptr-icon svg { animation: spin .8s linear infinite; }

/* ================= weapon page: community insights (All / PvE / PvP) ================= */
.ins-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.ins-head .d2-label { margin: 0; }
.ins-tabs button { font-weight: 600; padding: 5px 16px; }
.ins-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 1199px) { .ins-both-tab { display: none; } }
.ins-note { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.ins-note b { color: var(--text); }
.ins-dot { flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: #2f9e5b; color: #fff; font: 700 11px/16px var(--body); text-align: center; }
.ins-empty { font-size: 14px; }
.ins-h { font: 600 13px var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.ins-sub { font: 400 12px var(--body); letter-spacing: 0; text-transform: none; color: var(--faint); }
.ins-perks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.ins-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; min-width: 0; }
.ins-col h4, .ins-best h4 { font: 600 11px var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.ins-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; min-width: 0; }
.ins-item.top { background: rgba(233, 162, 59, .08); }
.ins-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #4a87bd; border: 1px solid rgba(255, 255, 255, .6); display: grid; place-items: center; }
.ins-icon img { width: 100%; height: 100%; }
.ins-icon.mod { border-radius: 4px; background: #2a2d33; border-color: rgba(201, 165, 74, .7); }
.ins-txt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; min-width: 0; flex: 1; }
.ins-txt b { font-weight: 500; font-size: 13px; grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-item.top .ins-txt b { color: var(--accent); font-weight: 600; }
.ins-bar { height: 5px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.ins-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ins-txt small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.ins-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }     /* masterwork and mod popularity: a line each */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.ins-best { display: inline-block; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; color: inherit; text-decoration: none; }
.ins-best:hover { border-color: var(--accent); }
.ins-best-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ins-best-pct { display: flex; flex-direction: column; margin-left: 12px; line-height: 1.1; }
.ins-best-pct b { font: 700 24px var(--display); color: var(--accent); }
.ins-best-pct small { font-size: 11px; color: var(--muted); }
.ins-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.ins-split .ins-two { grid-template-columns: minmax(0, 1fr); }
.ins-mode { font: 700 24px var(--display); letter-spacing: .04em; margin-bottom: 6px; }
@media (max-width: 560px) {
    .ins-perks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
    .ins-col { padding: 8px; }
    .ins-col .ins-item { gap: 7px; padding: 5px 4px; }
    .ins-col .ins-icon { width: 30px; height: 30px; }
    .ins-col .ins-txt small { min-width: 38px; font-size: 11px; }
    .ins-best-pct { margin-left: 4px; }
}
.croll-more { margin-top: 10px; width: 100%; justify-content: center; }
.croll-more[hidden] { display: none; }
.croll-copies { color: var(--faint); }

/* ================= admin: tabs and metrics ================= */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    padding: 10px 16px; color: var(--muted); font: 600 15px var(--body); cursor: pointer; white-space: nowrap; }
.admin-tab:hover { color: var(--text); }
.admin-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.admin-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.admin-tab-badge { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--down); color: #fff; font-size: 12px; text-align: center; }
.admin-tab-badge[hidden] { display: none; }
.admin-panel { display: flex; flex-direction: column; gap: 24px; }
.admin-panel[hidden] { display: none; }

.admin-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metric-card h3 { display: flex; align-items: baseline; gap: 10px; font: 700 20px var(--display); letter-spacing: .02em; margin: 0 0 8px; }
.metric-card h3 small { font: 400 12px var(--body); color: var(--muted); letter-spacing: 0; }
.metric-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 120px; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.metric-label { color: var(--muted); }
.metric-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.metric-pct { display: flex; align-items: center; gap: 8px; }
.metric-pct small { color: var(--faint); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.metric-bar i { display: block; height: 100%; background: var(--accent); }
.admin-tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; align-items: start; }
.admin-top { margin: 0; }
.admin-facts { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
@media (max-width: 560px) {
    .metric-row { grid-template-columns: minmax(0, 1fr) 52px 90px; }
}
@media (max-width: 560px) {
    .admin-tabs { gap: 0; }
    .admin-tab { padding: 10px 7px; font-size: 13.5px; }
}

/* intrinsic frame's own stat bonuses, under its description */
.intrinsic-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; font-weight: 500; }
.intrinsic-stats .up { color: #6fd39a; }
.intrinsic-stats .down { color: #e57a72; }

/* "When active" perk stats: striped part of the bar, blue numbers */
.stat-bar .cond { position: absolute; top: 0; bottom: 0; transition: left .2s, width .2s;
    background: repeating-linear-gradient(135deg, rgba(110, 170, 240, .85) 0 4px, rgba(110, 170, 240, .35) 4px 8px); }
.stat-bar .cond.down { background: repeating-linear-gradient(135deg, rgba(224, 100, 92, .8) 0 4px, rgba(224, 100, 92, .3) 4px 8px); }
.d2-stat-cond { font-size: .72em; margin-left: 4px; color: #7fb4f0; }
.d2-stat { grid-template-columns: minmax(0, 1fr) 200px 84px; }
.d2-stat.num { grid-template-columns: minmax(0, 1fr) 298px; }
@media (max-width: 760px) {
    .d2-stat { grid-template-columns: 148px minmax(0, 1fr) 70px; }
    .d2-stat.num { grid-template-columns: 148px minmax(0, 1fr); }
}
.tip-cond-head { margin-top: 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7fb4f0; }
.tip-stats.cond .up, .tip-stats.cond .up span { color: #7fb4f0; }

/* ================= Clarity community research ================= */
.cl-box { margin-top: 12px; padding: 10px 12px 8px; border-left: 3px solid #5b8fd6; background: rgba(91, 143, 214, .08); border-radius: 0 6px 6px 0; max-width: 620px; }
.cl-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font: 600 11px var(--body); letter-spacing: .1em; text-transform: uppercase; color: #8db6ee; }
.cl-head small { font-size: 10px; letter-spacing: .06em; color: var(--muted); }
.cl-body { font-size: 13.5px; line-height: 1.45; color: rgba(255, 255, 255, .86); }
.cl-line { margin: 0 0 2px; }
.cl-spacer { height: 7px; }
.cl-bold { font-weight: 700; color: #fff; }
.cl-def { border-bottom: 1px dotted currentColor; cursor: help; }
.cl-body a { color: #8db6ee; }
.cl-pve::before, .cl-pvp::before { display: inline-block; margin-right: 3px; padding: 0 4px; border-radius: 3px; font: 700 9px/14px var(--body); letter-spacing: .04em; vertical-align: 1px; }
.cl-pve::before { content: "PvE"; background: #2f6b45; color: #d7f5e2; }
.cl-pvp::before { content: "PvP"; background: #7a2f2f; color: #fbdcdc; }
.cl-tag { display: inline-block; margin-right: 3px; padding: 0 5px; border-radius: 3px; background: rgba(255, 255, 255, .12); font: 600 10px/15px var(--body); color: #fff; vertical-align: 1px; }
.cl-tag-Primary { background: rgba(255, 255, 255, .18); } .cl-tag-Special { background: #2c6e4a; } .cl-tag-Heavy { background: #5b3a86; }
.cl-enh { display: inline-block; width: 0; height: 0; margin: 0 5px 1px 1px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid #e8c35a; }
.cl-solar { color: #f0a052; } .cl-arc { color: #7ad3f0; } .cl-void { color: #b98be8; } .cl-stasis { color: #6e93e8; }
.cl-strand { color: #4fd18b; } .cl-kinetic { color: #e6e6e6; } .cl-yellow { color: #f2d26b; } .cl-blue { color: #7fb4f0; }
.cl-green { color: #6fd39a; } .cl-purple { color: #c49af0; }
.cl-credit { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.cl-credit a { color: #8db6ee; }
.cl-box.compact { margin-top: 10px; max-width: none; }
.cl-box.compact .cl-body { font-size: 12.5px; }
.footer-credit { font-size: 12px; color: var(--muted); margin-top: 6px; }
.footer-credit a { color: inherit; text-decoration: underline; }

/* ================= weapon page: Stats / PvP switch ================= */
.stat-tabs { display: inline-flex; gap: 2px; margin-bottom: 10px; padding: 2px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 99px; }
.stat-tabs[hidden] { display: none; }
.stat-tabs button { background: none; border: 0; padding: 3px 14px; border-radius: 99px; font: 600 12px var(--body); color: rgba(255, 255, 255, .65); cursor: pointer; letter-spacing: .04em; }
.stat-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.pvp-panel { width: 100%; max-width: 420px; }
.pvp-ttk { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px 14px; margin-bottom: 8px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; }
.pvp-ttk small { display: block; font: 600 11px var(--body); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.pvp-ttk b { font: 700 36px/1 var(--display); color: #6fd39a; }
.pvp-ttk-alt { text-align: right; font-size: 12px; line-height: 1.55; color: rgba(255, 255, 255, .6); }
.pvp-ttk-alt strong { color: #fff; font-weight: 600; }
.pvp-res { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 6px 2px 10px; font-size: 13px; color: rgba(255, 255, 255, .75); }
.pvp-res b { color: #fff; }
.pvp-res input { accent-color: var(--accent); width: 100%; }
.pvp-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 6px 2px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.pvp-row span { color: rgba(255, 255, 255, .75); }
.pvp-row small { color: rgba(255, 255, 255, .4); font-size: 11px; }
.pvp-row b { font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.pvp-row b i { font-style: normal; font-weight: 400; color: rgba(255, 255, 255, .45); }
.pvp-row.boosted b { color: #7fd99a; }
.pvp-outdated { margin-top: 8px; padding: 8px 10px; border-radius: 4px; background: rgba(240, 110, 79, .15); color: #f3a58f; font-size: 13px; }
.pvp-effects { margin-top: 8px; padding: 8px 10px; border-left: 3px solid #4f9cf0; background: rgba(79, 156, 240, .08); border-radius: 4px; }
.pvp-effects small { display: block; margin-bottom: 4px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #8db6ee; }
.pvp-effects ul { margin: 0; padding-left: 16px; font-size: 13px; line-height: 1.5; color: rgba(255, 255, 255, .8); }
.pvp-note { margin-top: 10px; font-size: 11px; line-height: 1.5; color: rgba(255, 255, 255, .45); }
.pvp-note a { color: #8db6ee; }
/* stack count on a picked perk (click again for more) */
.perk { position: relative; }
.stack-badge { position: absolute; right: -4px; bottom: -4px; min-width: 24px; padding: 1px 4px; border-radius: 99px; background: #5b8fd6; border: 1px solid rgba(255, 255, 255, .8); color: #fff; font: 700 10px/14px var(--body); text-align: center; pointer-events: none; }
