/* Weapon grid, tiles and the page chrome the four routes share.
   Shell chrome lives in layout.css; filter controls in filters.css. */

.page {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}

.page-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- grid --- */

.weapon-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Table-style row: label+chevron on the left, count right-aligned, a thin
   divider standing in for the old left guide line. */
.weapon-group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 4px 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
    font: inherit;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.weapon-group-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.weapon-group-count {
    flex: none;
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.weapon-group-chevron {
    display: inline-block;
    width: 0.9em;
    text-align: center;
    color: var(--text-dim);
}

/* Nested grouping. Three levels are styled; anything deeper reuses depth 2,
   which is already past the point the headings stay readable. Rows touch —
   each one's own border-bottom is the only separator, table-style. */
.weapon-group-children {
    display: flex;
    flex-direction: column;
}

.weapon-group.is-depth-1,
.weapon-group.is-depth-2 {
    padding-left: 16px;
}

.weapon-group.is-depth-1 > .weapon-group-heading {
    font-size: 12px;
    color: var(--text-dim);
}

.weapon-group.is-depth-2 > .weapon-group-heading {
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

/* Off-screen groups skip layout and paint entirely. `auto` on the intrinsic
   size makes the browser remember each group's last rendered height, so
   scrolling back does not jump. */
.weapon-group-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--tile-size));
    gap: var(--tile-gap);
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

/* Shared masking mechanics for every vendored/live monochrome glyph — filter
   pills (filters.css), the tile corner badge and the popup icon (popup.css)
   each add their own size on top of this. */
.mask-glyph {
    background-color: currentColor;
    -webkit-mask-image: var(--mask-glyph);
    mask-image: var(--mask-glyph);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* --- tile --- */

.weapon-tile {
    position: relative;
    width: var(--tile-size);
    height: calc(var(--tile-size) + var(--tile-footer-h) * 2);
    padding: 0;
    /* Outline, not border: with box-sizing:border-box a border eats into this
       element's padding box, which .tile-icon and .tile-footers both size
       themselves against (100%/left:0;right:0) — that shrank the icon a
       couple of px narrower than tall instead of the settings-chosen square.
       Outline paints the same 1px ring without taking space out of the box.
       base.css's global `button` rule sets its own 1px border, so it has to
       be explicitly zeroed here or it re-adds the same shrinkage. */
    border: none;
    outline: 1px solid transparent;
    outline-offset: -1px;
    border-radius: 2px;
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
}

/* Collections / Wishlist render definitions, not owned instances — no
   lock/tag/wishlist row, so no second footer bar's worth of height either. */
.weapon-tile.is-definition {
    height: calc(var(--tile-size) + var(--tile-footer-h));
}

.weapon-tile:hover,
.weapon-tile:focus-visible {
    outline-color: var(--accent);
}

.tile-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--tile-size);
    height: var(--tile-size);
    aspect-ratio: 1 / 1;
}

/* Custom chevron-pip tier glyph, top-right over the icon (see WeaponTile.js's
   TierChevrons) — one polyline per tier level, gold to read as a rank/quality
   mark against any icon art. */
.tile-tier {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(var(--tile-size) * 0.14);
    height: auto;
    filter: drop-shadow(0 0 2px #000);
}

.tile-tier polygon {
    fill: var(--tier-diamond);
}

/* --- footer bars: icon (var(--tile-size) square, unaffected by these) sits
   above two stacked fixed-height bars — tile-footer-1 (damage/champion/power)
   then tile-footer-2 (lock/tag). Bars are a fixed --tile-footer-h regardless
   of --tile-size; icons inside fill that height exactly, no padding. The
   border lives on this wrapper, not .weapon-tile — it only wraps the two
   black bars, not the icon above them. --tile-rarity (WeaponTile.js) is the
   same colour Bungie bakes into the icon art's own background pixels. */

.tile-footers {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tile-rarity, var(--border));
    border-bottom-left-radius: 2px;
    border-bottom-right-radius: 2px;
    overflow: hidden;
}

.tile-footer-1,
.tile-footer-2 {
    height: var(--tile-footer-h);
    display: flex;
    align-items: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.72);
}

.tile-footer-1 {
    gap: 0;
}

.tile-footer-2 {
    justify-content: space-between;
}

/* Two independent groups, opposite ends of row 2 via the parent's
   space-between — left is thumbs-up + wishlist match count, right is
   Keep/Trash tag then lock, flush against each other (no gap). */
.tile-footer-2-left,
.tile-footer-2-right {
    display: flex;
    align-items: center;
}

.tile-footer-2-left {
    gap: 2px;
}

.tile-footer-2-right {
    gap: 0;
}

/* Shrunk below --tile-footer-h (unlike .tile-lock, which fills it) so damage
   + champion together still leave the power number enough width to render at
   the icon-size slider's minimum — see docs/dim-vs-grm-tile-comparison.md. */
.tile-footer-icon {
    flex: none;
    height: 12px;
    width: auto;
}

/* Spec: the wishlist thumb reads smaller than the damage/champion glyphs it
   shares .tile-footer-icon with, so it gets its own height rather than
   shrinking that shared rule. */
.tile-footer-thumb {
    height: 10px;
}

/* Flush against each other (no gap) when both render; each still separates
   itself from whatever comes next (champion, or power directly if there's no
   champion) by its own 2px margin. */
.tile-footer-damage {
    margin-right: 2px;
}

.tile-footer-damage:has(+ .tile-footer-champion) {
    margin-right: 0;
}

.tile-footer-champion {
    margin-right: 2px;
}

/* Definition tiles (Collections) never carry .tile-footer-power to push
   against — Craftable and Heat are the only right-aligned elements in row 1
   there. Shared by both so the auto margin lands on whichever renders first;
   a second one right after gets a small gap instead of sitting flush. */
.tile-footer-badge-right {
    margin-left: auto;
}

.tile-footer-badge-right + .tile-footer-badge-right {
    margin-left: 2px;
}

.tile-footer-power {
    margin-left: auto;
    font-size: calc(var(--tile-footer-h) * 0.8);
    font-weight: normal;
    line-height: 1;
    color: #fff;
}

.tile-footer-count {
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    color: #fff;
}

/* 12px, matching .tile-footer-icon above — same reasoning: smaller than the
   15px bar so lock/keep/trash don't crowd each other at the icon-size
   slider's minimum. */
.tile-lock {
    flex: none;
    height: 12px;
    width: auto;
    color: #fff;
}

.tile-tag {
    flex: none;
    height: 12px;
    width: auto;
    fill: currentColor;
}

.tile-tag.is-keep {
    color: var(--tag-keep);
}

.tile-tag.is-trash {
    color: var(--tag-trash);
}

/* Masterwork badge, far right of row 2 (WeaponTile.js renders it last in
   .tile-footer-2-right, after the tag and lock). */
.tile-star {
    flex: none;
    height: 12px;
    width: 12px;
}

/* --- loading and empty states --- */

.tile-skeleton {
    width: var(--tile-size);
    height: calc(var(--tile-size) + var(--tile-footer-h) * 2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    animation: tile-skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes tile-skeleton-pulse {
    0%, 100% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.8;
    }
}

.grid-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    text-align: center;
}

/* --- triage page --- */

/* Three equal columns (plan_triage 00 D7). minmax(0, 1fr) rather than 1fr so a
   long weapon name ellipsises instead of widening its column. */
.triage-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

/* separate, not collapse: sticky header cells lose their borders under
   border-collapse in Chromium. */
.triage-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
}

/* Pinned under the filter bar (plan_triage 00 D11). --triage-filter-bar-h is
   measured by Triage.js; below the filter bar's z-index 9. */
.triage-table thead {
    position: sticky;
    top: calc(var(--tab-bar-height) + var(--triage-filter-bar-h, 0px));
    z-index: 2;
}

.triage-table th,
.triage-table td {
    padding: 3px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.triage-table th {
    background: var(--surface);
    font-weight: 700;
}

.triage-table tbody tr:last-child td {
    border-bottom: none;
}

col.triage-col-icon {
    width: 44px;
}

col.triage-col-tier {
    width: 36px;
}

col.triage-col-total {
    width: 52px;
}

col.triage-col-priority {
    width: 32px;
}

.triage-heading {
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.triage-heading-counts {
    color: var(--text-dim);
    font-weight: 400;
}

th.triage-col-name {
    text-align: left;
}

th.triage-col-tier,
th.triage-col-total,
.triage-count {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.triage-count.is-zero {
    color: var(--text-dim);
}

.triage-total {
    font-weight: 700;
}

/* Priority column (user request 14-SEP-2026): per-column quartile bucket
   (domain/triage.js's classifyPriority), inline SVG stroke icons, not text —
   the cell's own 3px 6px padding (.triage-table th/td, above) already gives
   the requested 3px top/bottom, so the icon itself is fixed at exactly 24px
   tall; width follows the 24x24 viewBox. Up = solar orange, Down = green
   (--tag-keep, reused from the Tags pill's "keep" colour — the closest
   existing green token). Arrows are the two extremes, thickest stroke. */
th.triage-col-priority,
.triage-priority {
    text-align: center;
}

.triage-priority-icon {
    display: inline-block;
    height: 24px;
    width: 24px;
    vertical-align: middle;
    stroke-width: 2;
}

/* stroke-width is set here, not on the <path> elements (TriageTable.js), so
   it inherits down and these per-bucket overrides can win. */
.triage-priority-up-arrow {
    color: var(--damage-solar);
    stroke-width: 3;
}

.triage-priority-up-chevron {
    color: var(--damage-solar);
    stroke-width: 2.5;
}

.triage-priority-down-chevron {
    color: var(--tag-keep);
    stroke-width: 2.5;
}

.triage-priority-down-arrow {
    color: var(--tag-keep);
    stroke-width: 3;
}

/* Click-through to Collections (user request 14-SEP-2026, same handoff as
   WeaponPopup.js's "Open in Collections" button) — a bare button so the icon
   stays exactly as it was, just made interactive. */
.triage-icon-button {
    display: block;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.triage-icon {
    display: block;
    width: 32px;
    height: 32px;
}

.triage-name,
.triage-count {
    font-size: 14px;
}

.triage-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.triage-empty {
    padding: 16px 6px;
    text-align: center;
    color: var(--text-dim);
}

/* --- settings page --- */

.settings-page {
    max-width: 1200px;
    gap: 20px;
}

/* Filters + Grouping & Sorting on the left, Size/Display/Wishlist/Fireteam in
   the middle, Dismantle/Version Info on the right — each column its own flex
   stack, all three top-aligned so a shorter column doesn't stretch to match
   the tallest one's height. */
.settings-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Thin rule separating the 3-column layout above from the extendable
   toggle-table row below (Boot Animation, and future flashy-animation
   switches). */
.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

.settings-boot-animation-row {
    max-width: 320px;
}

/* One row per switch — new rows (Boot Animation today) can be appended
   without touching this table's structure. */
.settings-toggle-table {
    border-collapse: collapse;
}

.settings-toggle-table td {
    padding: 4px 0;
    vertical-align: middle;
}

.settings-toggle-table td:first-child {
    padding-right: 10px;
}

/* Blue/white on-off switch — left (white track) is Off, right (blue track) is On. */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-switch.is-on {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.toggle-switch.is-on .toggle-switch-thumb {
    transform: translateX(14px);
}

.settings-section {
    padding: 10px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
}

.settings-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-section-heading h2 {
    margin: 0;
}

.settings-nuke-info ul {
    margin: 2px 0 8px;
    padding-left: 18px;
}

.settings-nuke-info ul:last-child {
    margin-bottom: 10px;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.settings-control input[type="range"] {
    width: 200px;
}

.settings-version-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-version-table th,
.settings-version-table td {
    text-align: left;
    padding: 4px 12px 4px 0;
    color: var(--text-dim);
    font-weight: normal;
}

.settings-version-table thead th {
    color: inherit;
    font-weight: 600;
}

.settings-version-table tbody th {
    color: inherit;
}

.settings-version-table td.version-status {
    font-weight: 600;
}

.settings-version-table td.version-status.is-success {
    color: var(--status-success);
}

.settings-version-table td.version-status.is-error {
    color: var(--status-error);
}

.settings-transfer-table {
    border-collapse: collapse;
    border: 1px solid var(--border);
    margin-bottom: 6px;
}

.settings-transfer-table th,
.settings-transfer-table td {
    text-align: left;
    padding: 4px 10px;
    border-top: 1px solid var(--border);
}

.settings-transfer-table th {
    font-weight: 700;
    padding-right: 24px;
}

.settings-nuke-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--status-error);
    border-color: var(--status-error);
}

.settings-nuke-icon {
    width: 16px;
    height: 16px;
    flex: none;
    fill: currentColor;
}

/* Settings → Fireteam Sharing granted list (plan_fireteam 06). The ✕ reuses
   popup.css's .wishlist-perk-remove. */
.fireteam-grants {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.fireteam-grant-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fireteam-grant-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Static Keep/Trash/lock glyph legend, laid over the right side of the
   preview tile's own row 2 (same rect as .tile-footer-2-right). Row 2's left
   side (thumbs-up + count) is real — WeaponTile renders that itself — only
   the right side needs an overlay, since real tags are one-or-none and this
   legend wants both Keep and Trash at once. The tile's own real lock is
   switched off (Settings.js sets locked: false) so this overlay draws all
   three itself, right-aligned to land in the same spot .tile-footer-2-right
   would. Reference only, not an interactive control. */
.settings-tile-preview {
    position: relative;
    display: inline-flex;
}

.settings-tile-preview-tags {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--tile-footer-h);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    padding: 0;
}

/* Showing both Keep and Trash plus the lock (34px combined at the real
   .tile-tag/.tile-lock size) doesn't fit next to the tile's real thumb+count
   group (~18px at the thumb's 10px height, fixed regardless of --tile-size)
   at the icon-size slider's lower end — 48-56px tiles have only ~26px free there, so at the real size
   the legend overlapped the count. Scoped shrink (not a change to .tile-tag/
   .tile-lock themselves, which every real tile app-wide still uses at 12px)
   fits the worst case (48px) with a few px to spare. */
.settings-tile-preview-tags .tile-tag,
.settings-tile-preview-tags .tile-lock {
    height: 8px;
}

/* Outbreak Perfected (with tag/lock legend) plus the two Tier-chevron
   examples, side by side under the icon size slider. */
.settings-icon-preview-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Size & Display's three columns — Icon Size, Filter, Refresh Interval. */
.settings-split {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-top: 5px;
}

.settings-split-col h3 {
    margin: 0 0 8px;
    font-size: 14px;
}

.settings-control-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* Refresh Interval as an aligned 2-column grid; Never spans both columns on
   its own row underneath. max-content + justify-items:start keeps each pill
   its natural size instead of stretching to fill the (fairly wide) column —
   grid's default stretch made every pill balloon to full column width. */
.settings-refresh-grid {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-items: start;
    gap: 4px 8px;
}

.settings-refresh-grid .settings-refresh-never {
    grid-column: 1 / -1;
}

/* Same --tile-size rule the grid tiles use, so the preview is honest. The
   placeholder keeps the box so an unsynced weapons store costs no layout jump. */
.settings-icon-preview {
    flex: none;
    width: var(--tile-size);
    height: var(--tile-size);
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface-raised);
}

.settings-icon-preview.is-placeholder {
    border-style: dashed;
}

/* --- sorting & grouping buckets --- */

.bucket-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 10px 0;
    overflow-x: auto;
}

/* Filters section (08): Hidden/Row 1/Row 2/Row 3, one more column than the
   Grouping & Sorting buckets above. Same chip type as Grouping & Sorting
   (no scoped font/padding override). Falls back to .bucket-columns' own
   horizontal scroll if the 180px floor is still tight for the longest
   label ("Anti Champion") plus its Single/Multi button at a given viewport
   width. */
.bucket-columns-4 {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

/* Page-tab switcher (Inventory/Collections/Wishlist) next to the Filters
   section's Reset button — same row as the h2, like every other section
   heading's Reset. */
.filter-page-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bucket-title {
    margin: 0 0 2px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bucket-hint {
    margin: 0 0 6px;
    font-size: 11px;
}

.bucket-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 90px;
    margin: 0;
    /* Extra bottom padding gives a drop target below the last row — without
       it, a drop near the bottom edge lands on that row (insert-before) and
       there's no way to drag something into the last position. */
    padding: 6px 6px 26px;
    list-style: none;
    background: var(--surface-raised);
    border: 1px dashed var(--border);
    border-radius: 3px;
}

.bucket-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 4px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: grab;
}

/* Truncates rather than wrapping under its own direction/mode button — the
   4-column Filters buckets (08) are narrower than Grouping & Sorting's 3, so
   a label like "Anti Champion" needs to give way to stay on one line. */
.bucket-row-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bucket-row button {
    flex: 0 0 auto;
    padding: 1px 6px;
    font-size: 11px;
}

/* A fixed field's direction (Slot in either bucket, Rarity/Ammo Type in
   Grouping — sort_field_config's *_user_orderable flags) — same metrics as
   the button it replaces, dimmed and non-interactive so the order stays
   visible without implying it can be dragged into changing. */
.bucket-row-fixed {
    flex: 0 0 auto;
    padding: 1px 6px;
    font-size: 11px;
    color: var(--text-dim);
    cursor: default;
}

.bucket-empty {
    padding: 4px 6px;
    font-size: 11px;
    color: var(--text-dim);
}
