/* Loot Pool Calculator: layout, rarity colors, the library, the table editor, the odds and the Verse view. Type, colors,
   buttons and fields come from the FileFortress kit (ff-kit/), so the tool follows the visitor's site theme.
   Rules of the look: the brand color only for what's selected and the main buttons; rarity colors only on items;
   one quiet card per area, no boxes in boxes; controls show up on hover. */
[hidden] { display: none !important; }
:root { --line-soft: color-mix(in srgb, var(--ff-line) 60%, transparent); --tint: color-mix(in srgb, var(--ff-text) 4%, transparent);
  --tint-2: color-mix(in srgb, var(--ff-text) 7%, transparent); --muted: color-mix(in srgb, var(--ff-text) 55%, transparent); }
.app { padding: 10px 12px 16px; max-width: 1760px; margin: 0 auto; }
.app-top { display: flex; align-items: center; gap: 12px; padding: 2px 4px 10px; flex-wrap: wrap; }
.app-logo { width: 22px; height: 22px; color: var(--ff-brand); flex: none; }
.app-title { min-width: 0; flex: 1 1 300px; }
.app-title h1 { margin: 0; font-size: 17px; }
.app-title p { margin: 0; font-size: 12.5px; }
.app-foot { padding: 12px 4px 0; font-size: 11px; }

/* library | table | odds. Narrower: the library becomes a drawer; phones: one column */
.app-grid { display: grid; gap: 10px; align-items: start; grid-template-columns: 320px minmax(0, 1fr) var(--side-w, 370px);
  grid-template-areas: "lib edit side"; }
.app-lib { grid-area: lib; } .app-edit { grid-area: edit; } .app-side { grid-area: side; }
.app-lib, .app-side { position: sticky; top: 10px; max-height: calc(100vh - 20px); }
.edit-lib-btn { display: none; }
@media (max-width: 1320px) {
  .app-grid { grid-template-columns: minmax(0, 1fr) var(--side-w, 350px); grid-template-areas: "edit side"; }
  .app-lib { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(360px, 92vw); max-height: none; border-radius: 0 var(--ff-radius) var(--ff-radius) 0;
    transform: translateX(-104%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
  .lib-open .app-lib { transform: none; }
  .app-lib-shade { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .35); }
  .edit-lib-btn { display: inline-flex; }
  .is-dragging-guns .app-lib-shade { display: none !important; }
}
@media (min-width: 1321px) { .lib-close { display: none; } .app-lib-shade { display: none !important; } }
@media (max-width: 900px) {
  .app-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "edit" "side"; }
  .app-side { position: static; max-height: none; }
}

/* rarity colors (Fortnite-style) */
[data-rarity] { --rar: #9aa0a6; }
[data-rarity="uncommon"] { --rar: #5fbf3a; }
[data-rarity="rare"] { --rar: #3fa4f0; }
[data-rarity="epic"] { --rar: #b45cf0; }
[data-rarity="legendary"] { --rar: #f08a3a; }
[data-rarity="mythic"] { --rar: #f2c230; }
[data-rarity="exotic"] { --rar: #4fd8e8; }
[data-rarity="pool"] { --rar: #8d8698; }
[data-rarity="fort"] { --rar: #8b8fff; }
[data-rarity="ammo"] { --rar: #c9b27a; }
.app-col-title { margin: 10px 0 2px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.app-two { grid-template-columns: 1fr 1fr; }

/* small shared pieces */
.icon-btn { all: unset; cursor: pointer; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.icon-btn:hover, details[open] > .icon-btn { color: var(--ff-text); background: var(--tint-2); }
.icon-btn:focus-visible { outline: 2px solid var(--ff-brand); outline-offset: 1px; }
.icon-btn .ff-icon { width: 16px; height: 16px; }
.app-gun-img { display: inline-block; flex: none; background-repeat: no-repeat; vertical-align: middle; }
.app-gun-icon { display: inline-block; flex: none; color: var(--rar); width: 44px; height: 17px; }

/* ================= header: the view switch ================= */
.view-switch { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--tint-2); }
.view-switch button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.view-switch button:hover { color: var(--ff-text); }
.view-switch button.is-on { color: #fff; background: var(--ff-brand); }
.view-switch button:focus-visible { outline: 2px solid var(--ff-brand); outline-offset: 2px; }
.view-verse .app-grid { display: none; }

/* ================= the library ================= */
.app-lib { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.lib-head { padding: 10px 10px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.lib-title { gap: 6px; }
.lib-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--tint-2); flex: 1; }
.lib-tab { all: unset; cursor: pointer; flex: 1; text-align: center; padding: 5px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.lib-tab span { font-weight: 500; opacity: .7; font-size: 11px; margin-left: 2px; }
.lib-tab:hover { color: var(--ff-text); }
.lib-tab.is-on { color: var(--ff-text); background: var(--ff-card-bg, var(--ff-surface, #1d1922)); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.lib-tab:focus-visible { outline: 2px solid var(--ff-brand); outline-offset: 2px; }
.lib-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 11px; border-radius: 9px; background: var(--tint); border: 1px solid var(--line-soft); }
.lib-search:focus-within { border-color: var(--ff-brand); background: transparent; }
.lib-search > .ff-icon { color: var(--muted); flex: none; width: 15px; height: 15px; }
.lib-search input { all: unset; flex: 1; min-width: 0; font-size: 13.5px; color: inherit; }
.lib-search input::placeholder { color: var(--muted); }
.lib-search input::-webkit-search-cancel-button { display: none; }
.lib-count { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lib-clear { all: unset; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--muted); }
.lib-clear:hover { color: var(--ff-text); background: var(--tint-2); }
/* type chips: one row that scrolls sideways */
.lib-types { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 0 10px; mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 18px), transparent); }
.lib-types::-webkit-scrollbar { display: none; }
.lib-tchip { flex: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--tint); color: var(--muted); border: 1px solid transparent; }
.lib-tchip:hover { color: var(--ff-text); }
.lib-tchip.is-on { color: var(--ff-text); border-color: var(--ff-brand); background: color-mix(in srgb, var(--ff-brand) 14%, transparent); }
.lib-tchip-icon { width: 20px; height: 8px; color: currentColor; }
/* rarity filter: colored dots */
.lib-row { display: flex; align-items: center; gap: 8px; }
.lib-rars { display: flex; gap: 5px; }
.lib-rdot { cursor: pointer; width: 18px; height: 18px; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--rar) 30%, transparent); border: 2px solid transparent; transition: transform .1s; }
.lib-rdot:hover { transform: scale(1.15); background: var(--rar); }
.lib-rdot.is-on { background: var(--rar); border-color: var(--ff-text); }
.lib-rars:has(.is-on) .lib-rdot:not(.is-on) { opacity: .45; }
.lib-sort { font: inherit; font-size: 12px; color: var(--muted); background: transparent; border: 0; cursor: pointer; padding: 2px; }
.lib-sort:hover { color: var(--ff-text); }
.lib-list { flex: 1; overflow-y: auto; padding: 6px; display: grid; gap: 2px; align-content: start; }
.lib-gun { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border-radius: 9px; cursor: grab; user-select: none; }
.lib-gun:hover { background: var(--tint-2); }
.lib-gun:active { cursor: grabbing; }
.lib-gun.is-added { animation: lib-added .5s ease-out; }
@keyframes lib-added { 30% { background: color-mix(in srgb, var(--ff-brand) 25%, transparent); } }
.lib-pic { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 9px;
  background: color-mix(in srgb, var(--rar) 12%, transparent); border: 1px solid color-mix(in srgb, var(--rar) 26%, transparent); }
.lib-img.app-gun-img { width: 44px; height: 44px; }
.lib-img.app-gun-icon { width: 40px; height: 16px; }
.lib-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lib-name { font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-ammo { display: inline-flex; align-items: center; gap: 3px; }
.lib-ammo-img.app-gun-img { width: 14px; height: 14px; }
.lib-pills { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.lib-pill { cursor: pointer; width: 20px; height: 18px; padding: 0; border-radius: 5px; font-size: 10px; font-weight: 800;
  color: var(--rar); background: color-mix(in srgb, var(--rar) 12%, transparent); border: 0; }
.lib-pill:hover { background: var(--rar); color: #111; }
.lib-pill.is-added { animation: lib-added .5s ease-out; }
.lib-add { cursor: pointer; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; padding: 0;
  color: var(--muted); background: transparent; border: 0; opacity: 0; }
.lib-gun:hover .lib-add, .lib-add:focus-visible { opacity: 1; }
.lib-add:hover { background: var(--ff-brand); color: #fff; }
.lib-none { text-align: center; padding: 30px 10px; display: grid; gap: 8px; justify-items: center; }
.lib-target { flex: none; padding: 8px 12px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.lib-target b { color: var(--ff-text); }
@media (hover: none) { .lib-add { opacity: 1; } }

/* ================= the table editor ================= */
.app-edit { padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.edit-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.edit-name { all: unset; font-size: 19px; font-weight: 700; min-width: 120px; flex: 1 1 160px; padding: 2px 6px; margin-left: -6px; border-radius: 7px; border: 1px solid transparent; }
.edit-name:hover { border-color: var(--line-soft); }
.edit-name:focus { border-color: var(--ff-brand); }
.edit-preset, .edit-adv { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.edit-preset select { font: inherit; color: inherit; background: var(--tint); border: 1px solid var(--line-soft); border-radius: 8px; padding: 5px 8px; cursor: pointer; }
.edit-help { margin-top: -4px; }
.edit-help summary { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; list-style: none; }
.edit-help summary::-webkit-details-marker { display: none; }
.edit-help summary .ff-icon { width: 14px; height: 14px; }
.edit-help p { margin: 6px 0 2px; max-width: 80ch; }
.app-sources { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.app-notes:empty { display: none; }
.app-notes .ff-alert { display: flex; gap: 8px; align-items: flex-start; }

/* a source pool: one quiet card */
.pool.is-source { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--tint); transition: border-color .15s, box-shadow .15s; }
.pool.is-source.is-target { border-color: color-mix(in srgb, var(--ff-brand) 55%, var(--line-soft)); }
.pool.is-drop { border-color: var(--ff-brand) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-brand) 22%, transparent); background: color-mix(in srgb, var(--ff-brand) 7%, transparent); }
.is-dragging-guns .pool.is-source { border-style: dashed; }
.pool-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 6px 12px; }
.pool-name { all: unset; font-weight: 700; font-size: 15px; min-width: 40px; field-sizing: content; max-width: 260px; padding: 2px 6px; margin-left: -6px; border-radius: 6px; border: 1px solid transparent; }
.pool-name:hover { border-color: var(--line-soft); }
.pool-name:focus { border-color: var(--ff-brand); }
.pool-bar { display: flex; height: 4px; margin: 0 12px 6px; border-radius: 99px; overflow: hidden; gap: 2px; }
.pool-bar > span { background: var(--rar); min-width: 3px; border-radius: 99px; opacity: .85; }
.pool-bar:empty { display: none; }
.pool-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.pool-foot { padding: 4px 8px 8px; }
.pool.is-nested .pool-foot { padding: 2px 0 4px; }
.pool-empty { display: flex; align-items: center; gap: 10px; margin: 2px 10px 4px; padding: 14px; border-radius: 9px; font-size: 13px; color: var(--muted);
  border: 1.5px dashed var(--line-soft); }
.pool.is-nested .pool-empty { margin: 4px 0; padding: 10px 12px; }
.pool-new { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; border: 1.5px dashed var(--line-soft); }
.pool-new.is-drop { border-color: var(--ff-brand); background: color-mix(in srgb, var(--ff-brand) 8%, transparent); }

/* picks: "Picks [ − 1 + ]". Everything is a fixed-size box centered on one line; − and + are drawn icons. */
.stepper { --h: 26px; display: inline-flex; align-items: center; gap: 8px; height: var(--h); line-height: 1; }
.stepper-label { font-size: 12px; color: var(--muted); line-height: 1; }
.stepper-box { display: inline-flex; align-items: center; height: var(--h); padding: 2px; border-radius: 8px; background: var(--tint-2); box-sizing: border-box; }
.stepper button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: calc(var(--h) - 4px); height: calc(var(--h) - 4px); border-radius: 6px; color: var(--muted); }
.stepper button svg { width: 12px; height: 12px; display: block; }
.stepper button:hover { color: var(--ff-text); background: var(--tint-2); }
.stepper button:focus-visible { outline: 2px solid var(--ff-brand); outline-offset: -2px; }
.stepper input { box-sizing: border-box; width: 26px; height: calc(var(--h) - 4px); padding: 0; margin: 0; text-align: center; line-height: calc(var(--h) - 4px);
  font: inherit; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: inherit; background: transparent; border: 0; -moz-appearance: textfield; }
.stepper input:focus { outline: none; background: color-mix(in srgb, var(--ff-brand) 15%, transparent); border-radius: 5px; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* "+ Add" */
.add-btn { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.add-btn::-webkit-details-marker { display: none; }
.add-btn:hover, .add-menu[open] > .add-btn { color: var(--ff-text); background: var(--tint-2); }
.add-btn .ff-icon { width: 14px; height: 14px; }

/* entry rows: picture | name and tags | chance / pick | (weight) | per drop | ⋯ × */
.row { display: grid; align-items: center; gap: 10px; grid-template-columns: 40px minmax(0, 1fr) 76px 0 58px 52px; padding: 6px 8px 6px 12px; border-top: 1px solid var(--line-soft); position: relative; }
.pool.is-source > .pool-list > .row-wrap:first-child > .row { border-top: 0; }
.app-sources.show-weights .row { grid-template-columns: 40px minmax(0, 1fr) 76px 64px 58px 52px; }
.col-w { visibility: hidden; overflow: hidden; }
.app-sources.show-weights .col-w { visibility: visible; }
.row:hover { background: var(--tint); }
.row::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rar); }
.row.is-new { animation: row-new 1.2s ease-out; }
@keyframes row-new { 0% { background: color-mix(in srgb, var(--ff-brand) 22%, transparent); } }
.row-pic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px;
  background: color-mix(in srgb, var(--rar) 10%, transparent); border: 1px solid color-mix(in srgb, var(--rar) 22%, transparent); }
.row-img.app-gun-img { width: 36px; height: 36px; }
.row-img.app-gun-icon { width: 34px; height: 13px; }
.row-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rar); }
.row-kind { color: color-mix(in srgb, var(--rar) 70%, var(--ff-text)); }
.row-kind .ff-icon { width: 17px; height: 17px; }
.row-main { min-width: 0; display: grid; gap: 4px; }
.row-name { all: unset; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 5px; margin-left: -5px; border-radius: 6px; border: 1px solid transparent; }
select.row-name { cursor: pointer; }
.row-name:hover { border-color: var(--line-soft); }
.row-name:focus { border-color: var(--ff-brand); }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap;
  color: var(--muted); background: var(--tint-2); border: 0; font-family: inherit; }
.tag input { width: 26px; font: inherit; color: var(--ff-text); background: transparent; border: 0; padding: 0; -moz-appearance: textfield; text-align: right; }
.tag input::-webkit-inner-spin-button { display: none; }
.tag-rar { color: var(--rar); background: color-mix(in srgb, var(--rar) 13%, transparent); }
select.tag-rar { cursor: pointer; appearance: none; }
.tag-amount input { width: 30px; text-align: left; }
.tag-ammo { color: #d9c89a; background: rgba(201, 178, 122, .12); }
.tag-ammo button { all: unset; cursor: pointer; padding: 0 1px 0 2px; opacity: .6; font-size: 13px; line-height: 1; }
.tag-ammo button:hover { opacity: 1; }
.tag-img.app-gun-img { width: 14px; height: 14px; }
.tag-ammo-off { cursor: pointer; background: transparent; border: 1px dashed rgba(201, 178, 122, .45); color: #d9c89a; opacity: .75; }
.tag-ammo-off:hover { opacity: 1; }
.tag-always { color: var(--ff-text); background: color-mix(in srgb, var(--ff-brand) 18%, transparent); }
.row-tags .stepper { --h: 22px; gap: 6px; }
.row-tags .stepper-label { font-size: 11px; }
.row-tags .stepper button svg { width: 10px; height: 10px; }
.row-tags .stepper input { width: 22px; font-size: 12px; }
/* the numbers: value on top, a small caption under it */
.row-num { display: grid; justify-items: end; gap: 0; min-width: 0; }
.num-cap { font-size: 10px; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
.row-chance { display: flex; align-items: baseline; justify-content: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-chance input { width: 52px; text-align: right; font: inherit; font-size: 15px; color: inherit; padding: 1px 2px; border-radius: 6px; background: transparent; border: 1px solid transparent; }
.row-chance input:hover { border-color: var(--line-soft); background: var(--tint); }
.row-chance input:focus { outline: none; border-color: var(--ff-brand); background: transparent; }
.row-chance > span { color: var(--muted); font-size: 12px; margin-left: 1px; }
.row-chance.is-fixed { font-size: 13px; color: var(--ff-text); }
.row-weight { width: 58px; font: inherit; font-size: 13px; color: inherit; padding: 1px 4px; border-radius: 6px; background: transparent; border: 1px solid var(--line-soft); text-align: right; }
.row-weight-inf { font-size: 13px; color: var(--muted); }
.row-drop { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 20px; }
.row-drop:empty + .num-cap { visibility: hidden; }
.row-acts { display: flex; justify-content: flex-end; gap: 0; opacity: 0; transition: opacity .1s; }
.row:hover .row-acts, .row:focus-within .row-acts, .row-acts:has(details[open]) { opacity: 1; }
@media (hover: none) { .row-acts { opacity: 1; } }

/* a nested pool: its entries indented under its row, with a guide line */
.row-nest { margin-left: 32px; padding-left: 12px; border-left: 2px solid var(--line-soft); }
.row-nest > .pool > .pool-list > .row-wrap > .row { padding-left: 10px; }
.row-nest > .pool > .pool-list > .row-wrap:first-child > .row { border-top: 0; }
.row-wrap:has(> .row-nest) > .row { border-bottom: 0; }

/* the ⋯ menus */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-box { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 230px; padding: 5px; display: grid; gap: 1px; border-radius: 10px;
  background: var(--ff-card-bg, var(--ff-surface, #1d1922)); border: 1px solid var(--ff-line); box-shadow: 0 14px 36px rgba(0, 0, 0, .45); }
.menu-box.menu-left { right: auto; left: 0; }
.menu-box > button { all: unset; cursor: pointer; display: grid; grid-template-columns: 18px 1fr; align-items: center; column-gap: 9px; padding: 7px 9px; border-radius: 7px; font-size: 13px; }
.menu-box > button .ff-icon { width: 15px; height: 15px; color: var(--muted); }
.menu-box > button small { grid-column: 2; font-size: 11px; color: var(--muted); }
.menu-box > button:hover { background: var(--tint-2); }
.menu-box > button.is-danger, .menu-box > button.is-danger .ff-icon { color: var(--ff-danger, #e5484d); }
.menu-box hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 2px; }
.menu-up { transform: rotate(-90deg); }
.menu-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 9px; font-size: 13px; }
.menu-field input { width: 76px; font: inherit; color: inherit; padding: 4px 7px; border-radius: 6px; background: var(--tint); border: 1px solid var(--line-soft); }
.menu-field input:focus { outline: none; border-color: var(--ff-brand); }
.menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 9px; font-size: 13px; cursor: pointer; }

@media (max-width: 640px) {
  .app-edit { padding: 8px 6px; }
  .pool-head { padding-left: 8px; }
  .row, .app-sources.show-weights .row { grid-template-columns: 34px minmax(0, 1fr) 64px 26px; grid-template-areas: "pic main chance acts" "pic main drop acts"; gap: 2px 8px; padding: 6px 4px 6px 8px; }
  .row-pic { grid-area: pic; width: 34px; height: 34px; }
  .row-img.app-gun-img { width: 30px; height: 30px; }
  .row-main { grid-area: main; overflow: hidden; }
  .row > .num-chance { grid-area: chance; }
  .row > .col-w { display: none; }
  .row > .num-drop { grid-area: drop; }
  .row-acts { grid-area: acts; flex-direction: column; align-items: flex-end; }
  .row-chance input { width: 44px; font-size: 14px; }
  .num-cap { display: none; }
  .row-drop { font-size: 11.5px; color: var(--muted); }
  .row-drop:not(:empty)::after { content: ' drop'; font-weight: 400; }
  .row-nest { margin-left: 14px; padding-left: 6px; }
}

/* ================= the odds side ================= */
.app-side { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; position: relative; }
.side-tabs { flex: none; }
.side-pane { min-height: 0; overflow-y: auto; }
.side-pane > * { flex-shrink: 0; }
.app-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px 0 2px; }
.stat { display: grid; gap: 1px; padding: 2px 10px; border-left: 1px solid var(--line-soft); }
.stat:first-child { border-left: 0; padding-left: 2px; }
.stat b { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { font-size: 11px; color: var(--muted); }
.app-bad b, .app-bad-text { color: var(--ff-danger, #e5484d); }
.app-rarities { display: grid; gap: 5px; }
.app-rarities:empty { display: none; }
.rar-row { display: grid; grid-template-columns: 76px 1fr 50px 62px; align-items: center; gap: 10px; font-size: 12.5px; }
.rar-odds { font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rar-name { color: var(--rar); font-weight: 600; }
.rar-bar { height: 6px; border-radius: 99px; background: var(--tint-2); overflow: hidden; }
.rar-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--rar); }
.rar-row b { text-align: right; font-variant-numeric: tabular-nums; }
/* no scroll box of its own: the side panel is the one thing that scrolls */
.app-table-wrap { margin: 0 -4px; }
.app-table { table-layout: fixed; }
.app-table th:nth-child(2), .app-table td:nth-child(2) { width: 62px; }
.app-table th:nth-child(3), .app-table td:nth-child(3) { width: 64px; }
.app-table th:nth-child(4), .app-table td:nth-child(4) { width: 48px; }
.app-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.app-table th { text-align: right; font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px; position: sticky; top: 0; background: var(--ff-card-bg, var(--ff-surface)); }
.app-table th:first-child, .app-table td:first-child { text-align: left; }
.app-table td { text-align: right; padding: 4px; border-top: 1px solid var(--line-soft); }
.app-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-table .app-path td { font-size: 10.5px; color: var(--muted); padding-top: 10px; border-top: 0; text-transform: uppercase; letter-spacing: .04em; }
.app-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rar); margin: 0 8px 0 3px; }
.app-gun-row.app-gun-img { width: 22px; height: 22px; margin-right: 6px; vertical-align: -6px; }
.app-gun-row.app-gun-icon { width: 26px; height: 10px; margin-right: 6px; }
.app-bar-row { display: grid; grid-template-columns: 22px 1fr 54px; align-items: center; gap: 10px; font-size: 12.5px; }
.app-bar-row > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.app-meter { height: 6px; border-radius: 99px; background: var(--tint-2); overflow: hidden; }
.app-meter > span { display: block; height: 100%; background: var(--ff-text); opacity: .55; border-radius: 99px; }
.app-sizes { display: grid; gap: 4px; }
.sim-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.sim-foot select { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
.app-log { display: grid; gap: 2px; }
.app-drop { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.app-drop:first-child { border-top: 0; animation: app-pop .25s ease-out; }
@keyframes app-pop { from { opacity: 0; transform: translateY(-4px); } }
.app-chip { display: inline-flex; align-items: center; padding: 2px 8px 2px 4px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--rar) 13%, transparent); color: var(--ff-text); }
.app-chip::before { content: ''; width: 3px; align-self: stretch; margin-right: 5px; border-radius: 2px; background: var(--rar); }
.app-gun-chip.app-gun-img { width: 20px; height: 20px; margin-right: 4px; }
.app-gun-chip.app-gun-icon { width: 22px; height: 9px; margin-right: 4px; }
.app-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ================= the Verse view (full width) ================= */
.app-verse { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.verse-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 2px; }
.verse-sep { width: 1px; height: 18px; background: var(--line-soft); margin: 0 4px; }
.verse-wrap { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.verse-code { margin: 0; height: calc(100vh - 170px); min-height: 360px; overflow: auto; padding: 12px 0; border-radius: 10px; tab-size: 4; counter-reset: vl;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, "Cascadia Mono", Menlo, monospace; white-space: pre; color: #d6d3dc;
  background: #121016; border: 1px solid var(--line-soft); }
.verse-code:focus { outline: none; border-color: var(--ff-brand); }
.verse-code .vl { display: block; padding: 0 18px 0 0; counter-increment: vl; }
.verse-code .vl::before { content: counter(vl); display: inline-block; width: 3.2em; margin-right: 16px; padding-right: 12px; text-align: right;
  color: #4f4a59; user-select: none; position: sticky; left: 0; background: #121016; }
.verse-code .vl:hover { background: rgba(255, 255, 255, .025); }
.verse-code.is-wrap { white-space: pre-wrap; }
.verse-code.is-wrap .vl { padding-left: calc(3.2em + 28px); text-indent: calc(-3.2em - 28px); }
.verse-code.is-wrap .vl::before { position: static; text-indent: 0; }
.verse-code .v-com { color: #6f7d63; font-style: italic; }
.verse-code .v-kw { color: #ff79c6; }
.verse-code .v-type { color: #8be9fd; }
.verse-code .v-field { color: #f1fa8c; }
.verse-code .v-fn { color: #50fa7b; font-weight: 600; }
.verse-code .v-num { color: #bd93f9; }
.verse-code .v-fx { color: #ffb86c; }
.verse-code .v-path { color: #ffb86c; }
.verse-copy { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.verse-note { margin: 0 4px; }
@media (max-width: 640px) { .verse-code { font-size: 12px; height: calc(100vh - 230px); } .verse-code .vl::before { width: 2.4em; margin-right: 8px; padding-right: 6px; } }

/* the message at the bottom */
.app-toast { position: fixed; left: 50%; bottom: 18px; z-index: 60; transform: translate(-50%, 10px); opacity: 0; transition: opacity .2s, transform .2s;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #fff; background: rgba(24, 20, 30, .95); border: 1px solid var(--ff-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: calc(100vw - 32px); }
.app-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* the side panel's resize handle (its left edge) */
.side-resize { position: absolute; z-index: 5; left: 0; top: 0; bottom: 0; width: 10px; cursor: col-resize; touch-action: none; }
.side-resize::after { content: ''; position: absolute; left: 3px; top: 50%; width: 4px; height: 44px; margin-top: -22px; border-radius: 4px; background: var(--ff-line); opacity: 0; transition: opacity .15s, background .15s; }
.app-side:hover .side-resize::after, .side-resize:focus-visible::after { opacity: 1; }
.side-resize:hover::after, .is-resizing .side-resize::after { background: var(--ff-brand); opacity: 1; }
.side-resize:focus-visible { outline: none; }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 900px) { .side-resize { display: none; } }
/* odds: "1 : 67" */
.odds-cell { color: var(--muted); white-space: nowrap; }
/* the Verse code inside the side panel */
/* in the side panel the code box is what scrolls, not the tab around it */
.side-pane.side-verse { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow: hidden; }
.side-verse > .verse-code.verse-side { flex: 1 1 auto; flex-shrink: 1; height: auto; min-height: 200px; max-height: none; font-size: 12px; }
.app-side:has(.side-verse:not([hidden])) { height: calc(100vh - 20px); }

/* scrollbars: thin and quiet everywhere, no arrows */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ff-text) 18%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ff-text) 16%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ff-text) 30%, transparent); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
/* A line shows where the row will land. */
.row-wrap.is-moving > .row { opacity: .35; }
.row-wrap.is-moving > .row-nest { opacity: .35; }
.row.drop-before { box-shadow: inset 0 2px 0 var(--ff-brand); }
.row-wrap.drop-after { box-shadow: 0 2px 0 var(--ff-brand); }
.pool.is-nested.is-drop { background: color-mix(in srgb, var(--ff-brand) 6%, transparent); border-radius: 8px; }
/* odds table: one line per header, fixed columns that add up */
.app-table th { white-space: nowrap; }
.app-table th:nth-child(2), .app-table td:nth-child(2) { width: 58px; }
.app-table th:nth-child(3), .app-table td:nth-child(3) { width: 62px; }
.app-table th:nth-child(4), .app-table td:nth-child(4) { width: 38px; }

/* grabbing rows and pools: a ⋮⋮ grip on hover, a hand cursor on the free space */
.row { cursor: grab; }
.row input, .row label { cursor: auto; }
.row button, .row summary, .row select { cursor: pointer; }
.row-grip { position: absolute; left: 4px; top: 50%; width: 8px; height: 14px; margin-top: -7px; color: var(--muted); opacity: 0; transition: opacity .12s; pointer-events: none; }
.row-grip svg { display: block; width: 8px; height: 14px; }
.row:hover .row-grip { opacity: .8; }
.row:hover::before { opacity: 0; }
.row:active { cursor: grabbing; }
.pool-head { cursor: grab; position: relative; }
.pool-head:active { cursor: grabbing; }
.pool-grip { width: 8px; height: 14px; color: var(--muted); opacity: 0; margin: 0 -2px 0 -6px; transition: opacity .12s; }
.pool-grip svg { display: block; width: 8px; height: 14px; }
.pool-head:hover .pool-grip { opacity: .8; }
.pool.is-source.is-moving { opacity: .4; }
.pool.is-source.pool-before { box-shadow: 0 -3px 0 var(--ff-brand); }
.pool.is-source.pool-after { box-shadow: 0 3px 0 var(--ff-brand); }
.pool.is-source.is-moved { animation: pool-moved 1.2s ease-out; }
@keyframes pool-moved { 0%, 30% { border-color: var(--ff-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-brand) 25%, transparent); } }
.menu-svg { width: 15px; height: 15px; color: var(--muted); }

/* "drops in 100%": how often a source pool drops at all */
.pool-chance { display: inline-flex; align-items: center; gap: 8px; height: 26px; line-height: 1; cursor: auto; }
.pool-chance-box { display: inline-flex; align-items: center; height: 26px; padding: 0 8px 0 2px; border-radius: 8px; background: var(--tint-2); font-size: 12px; color: var(--muted); box-sizing: border-box; }
.pool-chance-box input { box-sizing: border-box; width: 38px; height: 22px; padding: 0 2px; margin: 0; text-align: right; font: inherit; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ff-text); background: transparent; border: 0; border-radius: 5px; }
.pool-chance-box input:focus { outline: none; background: color-mix(in srgb, var(--ff-brand) 15%, transparent); }
.pool-chance.is-set .pool-chance-box { background: color-mix(in srgb, var(--ff-brand) 16%, transparent); color: var(--ff-text); }
.pool-chance:not(.is-set) { opacity: .7; }
.pool-chance:hover, .pool-chance:focus-within { opacity: 1; }
@media (max-width: 640px) { .pool-head { flex-wrap: wrap; row-gap: 6px; } }

/* the preview that follows the pointer while dragging */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: flex; align-items: center; gap: 8px; max-width: 280px;
  padding: 5px 12px 5px 5px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ff-text);
  background: var(--ff-card-bg, #1d1922); border: 1px solid var(--ff-brand); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.drag-ghost > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-ghost .row-pic, .drag-ghost .lib-pic { width: 34px; height: 34px; flex: none; }
.drag-ghost .app-gun-img { width: 30px !important; height: 30px !important; }
.drag-ghost.is-nowhere { border-color: var(--ff-line); opacity: .8; }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none !important; }
.row-wrap.is-moving > .row, .row-wrap.is-moving > .row-nest { opacity: .35; }
.lib-gun { touch-action: pan-y; }
.row, .pool-head { touch-action: pan-y; }
.row-pic, .pool-grip { touch-action: none; }
@media (pointer: coarse) {
  .row-grip { opacity: .8; pointer-events: auto; touch-action: none; }
  .pool-grip { display: grid; place-items: center; flex: 0 0 24px; height: 24px; opacity: .8; }
}
/* names are only as wide as their text, so the free space of a row or pool header grabs it */
.row-name { justify-self: start; max-width: 100%; field-sizing: content; min-width: 3ch; }
select.row-name { field-sizing: content; }
.pool-name { flex: 0 1 auto; }

/* "Mine": your own items from UEFN */
.app-own-img { object-fit: contain; border-radius: 4px; }
.app-own-none { display: grid; place-items: center; color: var(--muted); }
.lib-img.app-own-none { width: 44px; height: 44px; }
.row-img.app-own-none { width: 36px; height: 36px; }
.app-gun-row.app-own-img { width: 22px; height: 22px; margin-right: 6px; vertical-align: -6px; }
.app-gun-row.app-own-none, .app-gun-chip.app-own-none { display: none; }
.app-gun-chip.app-own-img { width: 20px; height: 20px; margin-right: 4px; }
.drag-ghost .app-own-img { width: 30px !important; height: 30px !important; }
[data-rarity="mine"] { --rar: #8d8698; }
.mine-bar { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.mine-empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 26px 18px; }
.mine-empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--tint-2); color: var(--ff-brand); }
.mine-empty-icon .ff-icon { width: 22px; height: 22px; }
.mine-empty ol { margin: 0; padding-left: 18px; text-align: left; display: grid; gap: 5px; color: var(--muted); }
.mine-empty ol a { color: var(--ff-text); font-weight: 600; }
.mine-empty code { font-size: 11px; padding: 1px 4px; border-radius: 4px; background: var(--tint-2); word-break: break-all; }

/* rarity buttons on a gun's row: lit = in this pool; click to add or take out */
.row-rars { display: inline-flex; gap: 3px; margin-left: 2px; }
.rar-pill { cursor: pointer; width: 20px; height: 20px; padding: 0; border-radius: 6px; font: inherit; font-size: 10.5px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: color-mix(in srgb, var(--rar) 75%, var(--ff-text)); background: transparent; border: 1px dashed color-mix(in srgb, var(--rar) 45%, transparent); opacity: .7; }
.rar-pill:hover { opacity: 1; border-style: solid; background: color-mix(in srgb, var(--rar) 18%, transparent); }
.rar-pill.is-on { opacity: 1; color: #111; background: var(--rar); border: 1px solid var(--rar); }
.rar-pill.is-self { box-shadow: 0 0 0 2px var(--ff-card-bg, #1d1922), 0 0 0 3px var(--rar); cursor: default; }
.rar-pill:focus-visible { outline: 2px solid var(--ff-brand); outline-offset: 1px; }

/* a hover explanation (Weights) */
.has-tip { position: relative; display: inline-flex; }
.tip-q { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-weight: 800; color: var(--muted); border: 1px solid var(--ff-line); margin-left: 2px; }
.tip-box { position: absolute; z-index: 40; right: 0; top: calc(100% + 8px); width: 300px; padding: 12px 14px; border-radius: 12px; display: grid; gap: 7px;
  font-size: 12.5px; line-height: 1.45; color: var(--ff-text); background: var(--ff-card-bg, #1d1922); border: 1px solid var(--ff-line); box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s; pointer-events: none; }
.has-tip:hover .tip-box, .has-tip:focus-within .tip-box { opacity: 1; visibility: visible; transform: none; }
.tip-box b:first-child { font-size: 13px; }
.tip-ex { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 7px; background: var(--tint-2); font-variant-numeric: tabular-nums; font-size: 12px; }
.tip-ex > span:last-child { color: var(--muted); white-space: nowrap; }
.tip-foot { color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line-soft); padding-top: 7px; }
@media (max-width: 640px) { .tip-box { right: auto; left: -120px; width: min(300px, 86vw); } }
.tip-box { display: block; }
.tip-box > b:first-child { display: block; margin-bottom: 5px; }
.tip-ex { margin: 6px 0; }
.tip-foot { display: block; margin-top: 8px; }

/* pressing a row or a pool header drags it: no text selection there (boxes inside still select) */
.row, .pool-head, .lib-gun { -webkit-user-select: none; user-select: none; }
.row input, .pool-head input { -webkit-user-select: text; user-select: text; }

/* gun type filters: all visible, wrapping onto lines (no hidden sideways scroll) */
.lib-types { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; mask-image: none; -webkit-mask-image: none; gap: 4px; }
.lib-tchip { height: 24px; padding: 0 8px; font-size: 11.5px; }
.lib-tchip-icon { width: 18px; height: 7px; }

/* rarity buttons (library cards and table rows): always in their rarity's color, a hand on hover,
   the rarity's name in a quick tooltip */
.lib-pill, .rar-pill { position: relative; cursor: pointer !important; width: 21px; height: 20px; border-radius: 6px; font-size: 10.5px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  color: var(--rar); background: color-mix(in srgb, var(--rar) 16%, transparent); border: 1px solid color-mix(in srgb, var(--rar) 45%, transparent); opacity: 1; }
.lib-pill:hover, .rar-pill:hover { color: #111; background: var(--rar); border-color: var(--rar); border-style: solid; }
.rar-pill.is-on { color: #111; background: var(--rar); border-color: var(--rar); }
.rar-pill:not(.is-on) { border-style: dashed; }
.rar-pill.is-self { cursor: default !important; box-shadow: 0 0 0 2px var(--ff-card-bg, #1d1922), 0 0 0 3.5px var(--rar); }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); z-index: 50; pointer-events: none;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; font-size: 11.5px; font-weight: 600; letter-spacing: 0;
  color: #fff; background: rgba(18, 15, 22, .96); border: 1px solid var(--rar, var(--ff-line)); box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }

/* a gun's rarities grouped into one row; "N rarities ▾" unfolds them */
.row-name-static { font-weight: 600; font-size: 14px; padding: 1px 0; }
.tag-count { cursor: pointer !important; color: var(--ff-text); background: var(--tint-2); border: 0; font-family: inherit; }
.tag-count:hover { background: color-mix(in srgb, var(--ff-brand) 18%, transparent); }
.chev { display: inline-block; transition: transform .15s; }
.chev.is-open { transform: rotate(180deg); }
.group-members { margin-left: 32px; padding-left: 12px; border-left: 2px solid var(--line-soft); }
.group-members .row { padding-top: 4px; padding-bottom: 4px; }

/* the Mine tab: the script download link, and "not an item" on a prefab without an item_component */
.mine-link { all: unset; cursor: pointer; color: var(--ff-text); text-decoration: underline; text-underline-offset: 2px; }
.mine-link:hover { color: var(--ff-brand); }
.mine-empty .ff-faint a { color: inherit; }
.lib-warn { color: #e5c07b; font-weight: 600; }
