.brand .back { margin-left: auto; color: var(--accent); text-decoration: none; }

.armory { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 720px) {
  .armory { grid-template-columns: minmax(0, 1fr); }
}

.loadout-list { display: flex; flex-direction: column; gap: 10px; }
.loadout-list .group h3 { margin: 0 0 4px; padding-left: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.loadout-item {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--text);
}
.loadout-item:hover { background: var(--accent-soft); }
.loadout-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.loadout-value { float: right; margin-left: 8px; color: var(--muted); font-weight: 400; font-size: 0.85em; font-variant-numeric: tabular-nums; line-height: 1.6; }
/* Below this the loadout list leaves too little room beside it for the wide tables (Upgrades > All skills), so it goes
   above them, as rows of buttons rather than a tall column. */
@media (max-width: 1280px) {
  .armory:has(> .loadout-list) { grid-template-columns: minmax(0, 1fr); }
  .loadout-list { flex-flow: row wrap; gap: 6px 18px; }
  .loadout-list .group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
  .loadout-list .group h3 { margin: 0 4px 0 0; padding-left: 0; }
  .loadout-list .loadout-item { width: auto; }
  .loadout-list .loadout-value { float: none; }
  .loadout-list > p { flex-basis: 100%; margin: 0; }
}

.loadout-detail h3 { margin-top: 18px; }
/* Gear on the left, abilities and food on the right once there's room for both. */
.loadout-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 0 28px; align-items: start; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-head h2 { margin: 0; }

.badge {
  display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border); vertical-align: 1px;
}
.note { margin: 12px 0 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.note.warn { border-color: var(--warn); color: var(--warn); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
td.small { white-space: normal; min-width: 6em; }

.sim .controls { margin-bottom: 10px; }
.sim label.check { flex-direction: row; align-items: center; gap: 6px; min-height: 34px; }
.sim input[type="number"] { width: 7em; }
.sim button.btn:disabled { opacity: 0.6; cursor: progress; }
.buffs { margin-bottom: 12px; }
.buffs summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.buffs[open] summary { margin-bottom: 8px; }
.sim-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 16px; }
.sim-tables h3 { margin-top: 8px; }
.progress {
  position: relative; flex: 1 1 200px; min-width: 160px; height: 34px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg);
}
.progress .bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width .2s; }
.progress span { position: relative; display: block; line-height: 32px; padding: 0 10px; }
.finder-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 8px; }
fieldset.groups { display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center; border: 0; padding: 0; margin: 0; }
fieldset.groups legend { float: left; margin-right: 4px; }
.lab input[type="number"] { width: 7em; }
.lab .controls { margin-bottom: 10px; }
.sim label.check, .finder label.check, .lab label.check { flex-direction: row; align-items: center; gap: 6px; min-height: 34px; color: var(--text); }
.controls.scrolls { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px; align-items: start; }
.scrolls label.scroll { display: grid; grid-template-columns: 1fr; gap: 2px; }
.scrolls input[type="number"] { width: 100%; }
.scrolls .check { display: flex; gap: 6px; align-items: center; color: var(--text); }
.task-table select, .task-table input { min-height: 30px; }
.task-table input[type="number"] { width: 7em; }
.finder-table tr.flat td { opacity: 0.55; }
.finder-table td:nth-child(2) { white-space: normal; min-width: 8em; }
.finder-table td:nth-child(3) .muted:last-child { display: block; }
/* Sortable headers (sortHead in main.js): the whole label is the button; the arrow shows the column and direction. */
th.sortable { padding: 0; }
th.sortable button {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 3px; width: 100%;
  padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
th.num.sortable button { justify-content: flex-end; }
th.sortable button:hover, th.sortable[aria-sort] button { color: var(--text); }
th.sortable button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.sort-arrow { display: inline-block; width: 0.9em; font-size: 0.7em; text-align: center; }
tr.best td { font-weight: 650; }
tr.best td:first-child::after { content: " ★"; color: var(--warn); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin-bottom: 12px; }
label.cores { display: inline-flex; align-items: center; gap: 6px; }
label.cores select { min-height: 28px; padding: 2px 6px; }
.pm { font-size: 0.75em; font-weight: 400; color: var(--muted); }
.detail-tabs { margin: 0 0 12px; overflow-x: auto; flex-wrap: nowrap; }
.detail-tabs button { white-space: nowrap; }
.detail-title { margin: 0 0 10px; }
.settings-bar { padding: 12px 16px 6px; }
.settings-bar .controls { margin-bottom: 6px; }
.settings-bar .buffs { margin-bottom: 6px; }
.settings-bar input[type="number"] { width: 6em; }
.settings-bar label.cores { flex-direction: column; align-items: stretch; gap: 4px; }
.settings-bar label.cores select { min-height: 34px; }
.all-skills { margin-bottom: 14px; }
.all-skills td.weight-cell { white-space: nowrap; }
.setup-table td.level-cell { white-space: nowrap; }
.all-skills td.weight-cell input { width: 4.5em; }
.finder h3.tea-head { margin: 22px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.budget { margin: 12px 0; padding-top: 10px; border-top: 1px solid var(--border); }
.budget input[type="text"] { width: 12em; }
ol.plan { margin: 6px 0 10px; padding-left: 1.4em; }
ol.plan li { margin-bottom: 3px; }
.labrun .inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.labrun input[type="number"] { width: 6em; }
.assumptions, .chances { margin: 8px 0 12px; }
.assumptions summary, .chances summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.chance-table td, .chance-table th { padding: 3px 6px; font-size: 0.8rem; }
#views { margin-top: 10px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
tr.detail-row td { white-space: normal; background: var(--panel); }
ul.plain { list-style: none; padding: 0; margin: 0; }
.action-detail { padding: 8px 4px; }
/* Profit page: what to show (skill, search, only what you can do), then how it's priced (tax, lower tiers, catalyst),
   every control inline and the same height. */
.profit-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.pf-row label { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; font-size: 0.85rem; color: var(--muted); max-width: 100%; }
.pf-row label.check { gap: 6px; color: var(--text); cursor: pointer; }
.pf-row select { width: auto; max-width: 100%; }
.pf-search { flex: 0 1 auto; }
.pf-search input { width: 16em; max-width: 100%; }
.pf-how { padding-top: 8px; border-top: 1px solid var(--border); }
/* Scrolls running: one chip per scroll, the ticked ones lit in the accent; the checkbox is hidden, the chip shows it. */
.pf-scrolls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 14px; align-items: start; }
.pf-scrolls > .small { line-height: 32px; }
.pf-scroll-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-row label.pf-scroll-chip { min-height: 30px; gap: 6px; padding: 2px 10px 2px 4px; border: 1px solid var(--border); border-radius: 999px; position: relative;
  background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap; user-select: none; transition: border-color .15s, background .15s; }
.pf-scroll-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pf-scroll-chip .item-icon, .pf-scroll-chip .item-fallback { width: 22px; height: 22px; flex: none; opacity: .55; filter: grayscale(1); transition: opacity .15s, filter .15s; }
.pf-scroll-boost { color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-scroll-have { font-size: 0.72rem; padding: 0 6px; border-radius: 999px; background: var(--row-alt); color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-row label.pf-scroll-chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.pf-scroll-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.pf-row label.pf-scroll-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pf-scroll-chip:has(input:checked) .item-icon, .pf-scroll-chip:has(input:checked) .item-fallback { opacity: 1; filter: none; }
.pf-scroll-chip:has(input:checked) .pf-scroll-boost { color: var(--accent); }
.pf-scroll-cost { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pf-tax { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.pf-tax input[type="number"] { width: 4.5em; }
.pf-tax input:disabled { opacity: 0.5; }
@media (max-width: 640px) {
  .pf-scrolls { grid-template-columns: 1fr; }
  .pf-row label { white-space: nowrap; }
  .pf-search, .pf-row label:has(select) { flex: 1 1 100%; }
  .pf-search input, .pf-row label:has(select) select { flex: 1; width: auto; min-width: 0; }
}
/* Profit page: one action opened up. */
.skill-wrap { container-type: inline-size; }
/* Stays in view while the wide table scrolls sideways. */
.pph {
  --pph-mat: light-dark(#c2410c, #f0884a); --pph-tea: light-dark(#8a56d6, #b38cf0); --pph-tax: light-dark(#9c9584, #6f6857);
  --pph-scroll: light-dark(#0f8a8a, #4cc9c9);
  --pph-profit: var(--ok);
  display: flex; flex-direction: column; gap: 14px; padding: 12px 6px 16px; position: sticky; left: 0;
  width: min(1000px, calc(100cqw - 24px)); box-sizing: border-box; container-type: inline-size;
}
.pph h3 { margin: 0 0 8px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pph .num { font-variant-numeric: tabular-nums; }

/* The action, and the loadout and teas behind its numbers. */
.pph-head { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.pph-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.pph-title strong { font-family: var(--display); font-size: 1.15rem; letter-spacing: 0.02em; }
.pph-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.pph-icon .item-icon, .pph-icon .item-fallback { width: 32px; height: 32px; }
.pph-icon .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.pph-using { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pph-teas { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pph-tea { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 4px; border-radius: 999px; background: var(--row-alt); border: 1px solid var(--border); white-space: nowrap; }
.pph-tea .item-icon, .pph-tea .item-fallback { width: 18px; height: 18px; }
.pph-tea .item-fallback { font-size: 8px; display: inline-flex; align-items: center; justify-content: center; }
.pph-tea.none { padding: 2px 9px; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: none; }

/* Headline numbers: one strip, its cells ruled apart (each cell's rule above and to its left, clipped at the strip's
   edge, so the lines stay right however the cells wrap). */
.pph-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
@container (max-width: 520px) { .pph-tile.main { grid-column: 1 / -1; } .pph-tile { padding: 8px 12px; } }
.pph-tile { padding: 9px 14px; min-width: 0; box-shadow: -1px -1px 0 var(--border); }
.pph-tile .k { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pph-tile .v { font-size: 1.2rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.pph-tile.main .v { font-size: 1.6rem; line-height: 1.15; }
.pph-tile.main.gain { background: color-mix(in srgb, var(--ok) 7%, var(--panel)); }
.pph-tile.main.loss { background: color-mix(in srgb, var(--err) 7%, var(--panel)); }
.pph-tile .s { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.pph-even { margin: -6px 0 0; }

/* Where an hour's sales go. */
.pph-flow { display: flex; flex-direction: column; gap: 6px; }
.pph-flow-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--muted); }
.pph-flow-head strong { color: var(--text); }
.pph-flow-bar { position: relative; display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: visible; background: var(--row-alt); }
.pph-flow-bar > span { height: 100%; min-width: 3px; }
.pph-flow-bar > span:first-child { border-radius: 7px 0 0 7px; }
.pph-flow-bar > span:last-of-type { border-radius: 0 7px 7px 0; }
.pph-flow-bar > span:only-of-type { border-radius: 7px; }
.pph-flow-rev { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.pph-flow-key { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.pph-flow-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pph .pf-mat { background: var(--pph-mat); }
.pph .pf-tea { background: var(--pph-tea); }
.pph .pf-scroll { background: var(--pph-scroll); }
.pph .pf-tax { background: var(--pph-tax); }
.pph .pf-profit { background: var(--pph-profit); }

.pph-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pph-notes li { padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; }
.pph-notes li.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* The tabs: ledger, bonuses, chain, buy instead, advice. They scroll sideways on a phone rather than wrap. */
.pph-tabbed { min-width: 0; }
.pph-tabs { margin: 4px 0 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.pph-tabs button { white-space: nowrap; flex: none; }
.pph-panel { padding-top: 12px; min-width: 0; }
.pph-panel > p:first-child { margin-top: 0; }
.pph-panel > .table-wrap { margin: 0 -6px; }
.pph-ledger { width: 100%; border-collapse: collapse; }
.pph-ledger td, .pph-ledger th { padding: 6px; vertical-align: middle; }
.pph-ledger th { font-size: 0.72rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tr.detail-row .pph-ledger td { background: none; }
.pph-ledger tbody tr:not(.pph-group):not(.pph-total) td { border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.pph-ledger .pph-group td { padding-top: 14px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.pph-ledger .pph-group td.num { font-size: 0.85rem; letter-spacing: 0; text-transform: none; }
.pph-ledger .pph-sub td { color: var(--muted); font-size: 0.85rem; }
.pph-ledger .pph-total td { border-top: 2px solid var(--border); padding-top: 10px; font-weight: 700; font-size: 1.1rem; }
.pph-ledger td.num div { line-height: 1.1; }
.pph-note { display: block; line-height: 1.2; font-size: 0.75rem; }
.pph-was { color: var(--muted); text-decoration: line-through; font-size: 0.85em; }
.pph-chip { display: inline-block; margin-top: 3px; padding: 0 6px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; color: var(--muted); background: var(--row-alt); }
.pph-chip.good { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pph-coins { min-width: 80px; }
/* Prices: a click to set your own, how far each is from its weekly median, and the Your prices panel. */
.price-edit { font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px dashed var(--border); padding: 0; cursor: pointer; }
.price-edit:hover, .price-edit:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
.price-input { width: 7em; text-align: right; }
.vs-med, .price-mine { display: block; margin-left: auto; width: fit-content; margin-top: 2px; padding: 0 6px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; color: var(--muted); background: var(--row-alt); }
.vs-med.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.vs-med.neg { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.price-mine { color: var(--accent); background: var(--accent-soft); }
.my-prices td { vertical-align: top; }
.my-prices .price-input { width: 9em; text-align: left; }
.pph-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--row-alt); overflow: hidden; }
.pph-bar span { display: block; height: 100%; margin-left: auto; border-radius: 2px; background: var(--ok); }
.pph-pay .pph-bar span { background: var(--pph-mat); }

/* Every bonus and where it comes from, in as many columns as fit. */
.pph-stats { columns: 260px; column-gap: 10px; }
.pph-stat { border-radius: 8px; padding: 7px 10px; background: var(--row-alt); break-inside: avoid; margin-bottom: 10px; }
.pph-stat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.pph-stat-top strong { font-variant-numeric: tabular-nums; color: var(--ok); }
.pph-stat.off .pph-stat-top strong { color: var(--muted); font-weight: 500; }
.pph-stat:first-child .pph-stat-top strong { color: var(--text); }
.pph-stat ul { list-style: none; margin: 5px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; }
.pph-stat li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.pph-stat p { margin: 4px 0 0; }
.pph-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pph-kind { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 4px; min-width: 42px; text-align: center; color: var(--muted); background: var(--panel); }
.pph-kind.tea { color: var(--pph-tea); background: color-mix(in srgb, var(--pph-tea) 14%, transparent); }
.pph-kind.gear { color: var(--accent); background: var(--accent-soft); }
.pph-kind.house { color: var(--p-house, #e0703a); background: color-mix(in srgb, var(--p-house, #e0703a) 14%, transparent); }
.pph-kind.buff { color: var(--p-equipped, #2f6fde); background: color-mix(in srgb, var(--p-equipped, #2f6fde) 14%, transparent); }
.pph-kind.scroll { color: var(--pph-scroll); background: color-mix(in srgb, var(--pph-scroll) 14%, transparent); }

.pph-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pph-chain li { display: inline-flex; gap: 6px; align-items: center; }
.pph-panel > .controls { margin: 0 0 8px; }
.setup-table select { min-height: 28px; padding: 2px 6px; }
/* The custom gear set (Profit page): a row per skill, like Milkonomy's, then the slots worn for every skill. */
.gearset { display: grid; gap: 10px; margin: 4px 0 14px; }
.gearset-table th[scope=row] { text-align: left; font-weight: 600; white-space: nowrap; }
.gearset-table td { vertical-align: middle; }
.gs-piece { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px; border: 1px solid transparent; border-radius: 6px; white-space: nowrap; }
.gs-piece.changed { border-color: var(--accent); background: var(--accent-soft); }
.gs-piece select { width: 8.5em; min-height: 30px; padding: 2px 4px; }
.gearset-shared .gs-piece select { width: 12em; }
.gs-icon { display: inline-flex; flex: none; width: 24px; height: 24px; }
.gs-icon:empty { border: 1px dashed var(--border); border-radius: 4px; }
.gs-icon .item-icon, .gs-icon .item-fallback { width: 24px; height: 24px; }
.gs-icon .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); background: var(--row-alt); border-radius: 4px; }
.gs-enh { display: inline-flex; align-items: center; color: var(--muted); }
.gs-enh input { width: 2.8em; min-height: 30px; padding: 2px 4px; }
.gs-flag { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 12px; font-weight: 700; cursor: help; }
.gs-teas { display: grid; grid-template-columns: repeat(4, 32px); gap: 3px; }
.gs-tea { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; opacity: .55; }
.gs-tea .item-icon, .gs-tea .item-fallback { width: 24px; height: 24px; }
.gearset-table td, .gearset-table th { padding-top: 4px; padding-bottom: 4px; }
.gs-tea.on { opacity: 1; border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.gs-tea:hover:not(:disabled) { opacity: 1; }
.gs-tea:disabled { cursor: not-allowed; opacity: .25; }
.gs-heading { margin: 4px 0 0; font-size: 1em; }
.gearset-shared { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5em, 1fr)); gap: 6px 14px; }
.gs-shared { display: grid; gap: 2px; min-width: 0; }

tr.mine td { outline: 1px dashed var(--accent); }

/* Inventory and crafting planner: full width, sidebar + main. */
body.wide main, body.wide .top { max-width: 1680px; }
body.wide .drop { max-width: calc(1680px - 32px); }
.inv { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 860px) { .inv { grid-template-columns: minmax(0, 1fr); } }
.inv-side { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto; }
@media (max-width: 860px) { .inv-side { position: static; max-height: none; } }
.cat-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-list.game { border-top: 1px solid var(--border); padding-top: 8px; }
.cat-btn {
  flex: 1; display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 5px 8px; border: 0; border-radius: 8px; background: none; color: var(--text);
}
.cat-btn .muted { font-size: 0.8rem; white-space: nowrap; }
.cat-btn:hover { background: var(--accent-soft); }
.cat-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font: inherit; }
.icon-btn:hover { color: var(--accent); background: var(--accent-soft); }
.icon-btn.goal-add { font-size: 0.85em; padding: 0 4px; white-space: nowrap; }
.icon-btn.goal-add:disabled { cursor: default; background: none; color: var(--muted); opacity: 0.7; }
.res-group { margin-bottom: 10px; }
.res-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.inv-tools { align-items: center; }
.inv-tools input[type="search"] { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-height: 34px; width: 16em; }
.bulk {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft);
}
.bulk label { display: inline-flex; gap: 6px; align-items: center; }
.inv-group { padding: 10px 12px; }
.group-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.group-head .check { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; color: var(--muted); }
button.link-plain { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.link-plain:hover { color: var(--accent); }
.inv-table td, .plan-table td, .todo-table td { padding: 4px 10px; }
.inv-table { table-layout: fixed; min-width: 980px; }
.inv-table col.c-sel { width: 36px; }
.inv-table col.c-cat { width: 170px; }
.inv-table col.c-n { width: 86px; }
.inv-table col.c-mark { width: 108px; }
.inv-table .tile-mark { margin: 0; }
.inv-table td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.inv-table tr.flat td, .plan-table tr.flat td { opacity: 0.55; }
.inv-detail { padding: 6px 2px; }
.res-list li { margin-bottom: 3px; }
.res-new { margin: 8px 0 0; }
.res-new input[type="text"] { width: 10em; }
/* Crafting planner: plans and the new-plan search across the top, so the recipe tree gets the full width. */
.plan-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.plan-new { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-new .item-search { flex: 1 1 260px; max-width: 520px; }
.plan-new .plan-qty { width: 7em; }
.plan-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-tab {
  display: inline-flex; gap: 6px; align-items: baseline; font: inherit; cursor: pointer; padding: 3px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.plan-tab:hover { border-color: var(--accent); }
.plan-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.plan-controls { align-items: center; }
.plan-table td { vertical-align: top; }
.plan-table td.item { white-space: normal; min-width: 12em; width: 40%; }
.plan-table .sub { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.plan-table tr.target .tree-name { font-weight: 650; }
.tree-name { font-weight: 500; display: flex; align-items: center; }
.plan-icon { width: 20px; height: 20px; flex: none; margin-right: 6px; vertical-align: -5px; }
.plan-table tr.target .plan-icon { width: 26px; height: 26px; }
.gain-name { display: flex; align-items: center; }
.tree-name .elbow { color: var(--muted); margin-right: 4px; }
.plan-table .gives { display: flex; flex-wrap: wrap; gap: 0 10px; margin-top: 2px; font-size: 0.78rem; color: var(--ok); }
.seg.auto button.on { background: transparent; box-shadow: inset 0 0 0 1px var(--accent); border-radius: 0; }
.seg.auto { border-style: dashed; }
.gains-head { margin-top: 18px; }
.gains { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-bottom: 14px; }
.gain-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.gain-group h4 { margin: 0 0 4px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.gain-group td { padding: 3px 6px; vertical-align: top; }
.gain-group td:first-child { white-space: normal; }
.gain-group tr:last-child td { border-bottom: 0; }
.gain-group .sub { font-size: 0.78rem; color: var(--muted); }
.gain-group tr.flat td { opacity: 0.55; }
.plan-help { margin: 4px 0 12px; color: var(--muted); }
.plan-help summary { cursor: pointer; }
.plan-help p { margin: 6px 0 0; }
.plan-actions { align-items: center; }
.item-search { position: relative; display: flex; flex-direction: column; gap: 4px; }
.item-search > label { font-size: 0.85rem; color: var(--muted); }
.item-search input[type="search"] { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-height: 34px; }
.item-results { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 4px; list-style: none;
  max-height: 22em; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.18); }
.item-results li[data-pick-item] { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.item-results li[data-pick-item]:hover, .item-results li.on { background: var(--accent-soft); }
.item-results li b { color: var(--accent); font-weight: 600; }
.item-results li.hint { padding: 4px 8px; }
.plan-table select.way-pick { min-height: 26px; padding: 1px 4px; margin-top: 3px; width: 100%; max-width: 30em; font-size: 0.8rem; color: var(--muted); }
.planner .controls label.check { flex-direction: row; align-items: center; gap: 6px; min-height: 34px; color: var(--text); }
.planner .controls input[type="text"] { width: 10em; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
label.inline input { width: 8em; }
input.qty { width: 7em; min-height: 28px; padding: 2px 6px; text-align: right; }
input.qty.neg { border-color: var(--err); }
.seg.small-seg button { min-height: 28px; padding: 2px 10px; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.mini-bar { width: 120px; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.mini-bar div { height: 100%; background: var(--accent); }
.todo-table td.task-text { white-space: normal; min-width: 12em; }
.todo-table tr.done td.task-text { text-decoration: line-through; color: var(--muted); }
.todo-table tr.done .mini-bar div { background: var(--ok); }

/* Inventory grid: game-style tiles with room for numbers under each picture. */
.inv-group > .inv-grid { margin-top: 10px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.inv-tile { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-tile.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.inv-tile.short { border-color: var(--err); }
.inv-tile.zero { opacity: 0.55; }
.tile-main { position: relative; display: block; width: 100%; aspect-ratio: 1.4; background: var(--row-alt); border: 0; border-radius: 6px; cursor: pointer; padding: 0; color: var(--text); }
.tile-main .item-icon { position: absolute; inset: 10% 20%; width: 60%; height: 80%; }
.tile-main .item-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--muted); }
.tile-main .count { position: absolute; right: 5px; bottom: 3px; font-size: 13px; font-weight: 700; text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel); }
/* Enhancement levels sit on an ink chip in the emblem's gold, so they read over any icon (gold ones too) in either theme. */
.tile-main .enh, .doll-enh, .doll-lv {
  position: absolute; z-index: 1; font-size: 11px; font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 4px;
  background: var(--ink); color: var(--gold); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent);
}
.tile-main .enh { left: 3px; top: 3px; }
.tile-name { font-size: 12px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-value { font-size: 12px; color: var(--muted); }
.tile-flags { display: flex; flex-wrap: wrap; gap: 3px; min-height: 0; }
.tile-flags span { font-size: 11px; padding: 0 4px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.tile-flags span.need-short { background: transparent; color: var(--err); border: 1px solid var(--err); }
.tile-mark { display: flex; gap: 4px; margin-top: 2px; }
.tile-mark button { flex: 1; min-height: 24px; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.tile-mark button.on.save { background: var(--ok); border-color: var(--ok); color: #fff; }
.tile-mark button.on.sell { background: var(--warn); border-color: var(--warn); color: #fff; }
.inv-grid .inv-detail-cell { grid-column: 1 / -1; border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
@media (max-width: 520px) { .inv-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }
.scroll-controls { margin: 0; align-items: center; }
.scroll-controls label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }

/* Selling: Sell / Keep marks, the For sale and Goals pages. */
.tile-mark button.on.sell { background: var(--warn); border-color: var(--warn); color: #fff; }
.tile-flags span.sell-flag { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.mark-all { margin-left: 6px; font-weight: 400; }
.bulk-marks { display: inline-flex; gap: 6px; align-items: center; }
.sell-box { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--row-alt); }
.sell-box .tile-mark { margin: 0; min-width: 120px; }
.sell-box .tile-mark button { min-height: 28px; font-size: 12px; }
.sell-box label { display: inline-flex; gap: 6px; align-items: center; }
.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 960px) { .sale-layout { grid-template-columns: minmax(0, 1fr); } }
.sale-table, .goal-table { width: 100%; }
.sale-table td, .goal-table td { padding: 4px 8px; vertical-align: middle; }
.sale-table th, .goal-table th { padding-left: 8px; padding-right: 8px; }
.sale-table td.strong { font-weight: 650; }
.sale-table tfoot td { border-top: 1px solid var(--border); padding-top: 6px; }
.sale-table tr.flat td { opacity: 0.55; }
.sale-item { display: inline-flex; gap: 8px; align-items: center; min-width: 0; }
.sale-item .item-icon, .sale-item .item-fallback { flex: none; width: 24px; height: 24px; }
.sale-item .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); background: var(--row-alt); border-radius: 4px; }
.sale-table .sub, .goal-table .sub { font-size: 0.78rem; color: var(--muted); }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); font-weight: 600; }
.goal-table input.qty, .sale-table input.qty { width: 6em; }
.goal-table input.qty.mine { border-color: var(--accent); }
.goal-table tr.ready td:nth-child(2) { font-weight: 600; }
.goal-actions { white-space: nowrap; text-align: right; }
.goal-actions .btn { min-height: 28px; padding: 2px 10px; }
.meter { width: 110px; height: 8px; border-radius: 4px; background: var(--row-alt); border: 1px solid var(--border); overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); }
.goal-table tr.ready .meter .fill { background: var(--ok); }
.goal-mini { margin: 0 0 10px; }
.goal-mini li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.idea-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.idea-list li:last-child { border-bottom: 0; }
.idea-list .tile-mark { flex: none; width: 104px; margin: 0; }
.goal-new { display: flex; flex-direction: column; gap: 8px; }
.goal-new label { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; color: var(--muted); }
.goal-new-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal-new input { min-width: 0; width: 100%; box-sizing: border-box; }
.goal-table .sell-for { margin-top: 2px; }
.goal-table td:nth-child(2), .sale-table td:first-child { white-space: normal; min-width: 10em; }
.goal-table .meter { width: 90px; }
.goal-table input.qty[data-goal-field="price"] { width: 5.5em; }

/* Guild > Profiles (profile.js): a member's profile like the game's, with their loadouts. */
.prof-members { position: sticky; top: 8px; max-height: calc(100vh - 16px); }
.prof-members .group { display: flex; flex-direction: column; min-height: 0; }
.prof-search { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; margin: 0 0 6px; width: 100%; }
.prof-member-list { overflow-y: auto; max-height: calc(100vh - 110px); }
a.prof-member { display: flex; flex-direction: column; text-decoration: none; }
a.prof-member[hidden] { display: none; }
/* A member known only from a gathered in-game profile (no upload). */
a.prof-member.gathered { opacity: 0.6; }
a.prof-member.gathered:hover, a.prof-member.gathered.on { opacity: 0.85; }
.prof-guests { margin: 12px 0 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.prof-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.prof-head h2 { margin: 0 0 2px; font-size: 1.4rem; }
.prof-name { flex: 1 1 200px; min-width: 0; }
.prof-avatar { flex: none; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; }
.prof-avatar svg { width: 100%; height: 100%; }
.prof-avatar span { font-size: 1.8rem; font-weight: 700; color: var(--muted); }
.prof-levels { display: flex; gap: 10px; }
.prof-levels > div { border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; text-align: center; min-width: 110px; }
.prof-levels .k, .prof-pick-row .k { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.prof-levels b { font-size: 1.35rem; }
.prof-tabs { margin: 14px 0 12px; overflow-x: auto; flex-wrap: nowrap; }
.prof-tabs button { white-space: nowrap; }
.prof-body h3 { margin-top: 14px; }
.prof-body h3:first-child { margin-top: 0; }

.prof-overview { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-start; }
.prof-eq { flex: 0 1 auto; min-width: 0; }
.prof-eq.list { flex: 2 1 520px; }
.prof-eq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.prof-eq-head h3 { margin: 0; }
.prof-stats { flex: 1 1 220px; display: flex; flex-direction: column; }
.prof-stat { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; border-bottom: 1px solid var(--border); }

/* The game's equipment panel: a 5-wide grid of slots, tools in two rows of their own. */
.doll { display: grid; grid-template-columns: repeat(5, 56px); grid-auto-rows: 56px; gap: 6px; }
.doll-tools { margin-top: 14px; }
.doll-slot { position: relative; border: 1px solid var(--border); border-radius: 8px; background: var(--row-alt); }
/* No padding: app.css's .empty (an empty list's message) pads 40px. */
.doll-slot.empty { padding: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--row-alt) 6px 12px); opacity: 0.7; }
.doll-slot .item-icon { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
.doll-slot .item-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
/* Top left, as on the Inventory's tiles: refined gear's star is in the bottom right. */
.doll-enh { left: 2px; top: 2px; }
/* Picture mode (Guild > Profiles): food, drinks and abilities beside the gear, below it when there's no room. */
.prof-picture { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-start; }
.prof-belt { display: flex; flex-direction: column; gap: 10px; }
.belt-row .k { display: block; margin-bottom: 4px; font-size: 0.8rem; color: var(--muted); }
.doll-slot svg.ability-icon { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); padding: 4px; box-sizing: border-box; border-radius: 6px; background: #263155; }
.doll-slot.special { border-color: color-mix(in srgb, var(--gold) 60%, var(--border)); }
.doll-lv { right: 2px; bottom: 2px; }

.prof-skill-head { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 4px; color: var(--muted); }
.prof-skill-head b { color: var(--text); }
.prof-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
/* A skill tile: the skill, then its ranks (Guild, Standard, Steam) in a strip below. */
.prof-skills .prof-skill, .prof-skill.prof-total { flex-direction: column; align-items: stretch; gap: 6px; }
.prof-skill-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.prof-ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-top: 1px solid var(--border); padding-top: 5px; text-align: center; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.prof-ranks i { display: block; font-style: normal; color: var(--muted); font-size: 0.72rem; }
.prof-ranks b { font-weight: 600; }
.prof-skill.prof-total { max-width: 420px; margin-bottom: 4px; }
.prof-total .prof-skill-head { margin: 0; }
.prof-rank-note { margin: 4px 0 0; max-width: 70ch; }
.prof-boards { table-layout: fixed; }
.prof-boards th:nth-child(1) { width: 5em; }
.prof-boards th:nth-child(2) { width: 32%; }
.prof-boards th:nth-child(4) { width: 7em; }
.prof-skill, .prof-room { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0; }
/* The game draws its skill and ability art for its dark navy panels (some of it is white), so give it that backdrop. */
.prof-icon { flex: none; width: 36px; height: 36px; padding: 3px; border-radius: 8px; background: #263155; }
.prof-gear svg.ability-icon { width: 22px; height: 22px; padding: 2px; border-radius: 5px; background: #263155; }
.prof-fallback { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--row-alt); color: var(--muted); font-weight: 700; font-size: 0.8rem; }
.prof-skill-text { flex: 1; min-width: 0; }
.prof-skill-text > div:first-child { display: flex; justify-content: space-between; gap: 6px; }
.prof-bar { height: 5px; border-radius: 3px; background: var(--row-alt); border: 1px solid var(--border); overflow: hidden; margin: 3px 0 1px; }
.prof-bar span { display: block; height: 100%; background: var(--accent); }

.prof-pick { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.prof-pick-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.prof-pick-row .k { min-width: 7.5em; }
.prof-pick-row button { font: inherit; font-size: 0.9rem; cursor: pointer; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.prof-pick-row button:hover { border-color: var(--accent); }
.prof-pick-row button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.prof-loadout-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.prof-loadout-head h3 { margin: 0; }
.prof-calc { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.prof-calc .prof-view { margin-right: 6px; }
.prof-build { margin-top: 12px; }
/* Combat > Meta builds' build view: the gear, then its lists in columns. */
.prof-loadout { display: grid; grid-template-columns: max-content repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 28px; align-items: start; margin-top: 12px; }
.prof-loadout > div > .doll:first-child { margin-top: 26px; }
.prof-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 28px; align-items: start; }
.prof-gear { list-style: none; margin: 0; padding: 0; }
.prof-gear li { display: grid; grid-template-columns: 6.5em 22px minmax(0, 1fr); gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.prof-gear li .muted { font-size: 0.8rem; }
.prof-gear .item-icon, .prof-gear .item-fallback { width: 22px; height: 22px; }
.prof-gear .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: var(--muted); background: var(--row-alt); border-radius: 4px; }
@media (max-width: 720px) {
  .prof-loadout { grid-template-columns: minmax(0, 1fr); }
  .doll { grid-template-columns: repeat(5, minmax(0, 52px)); grid-auto-rows: 52px; }
  .prof-members { position: static; max-height: none; }
  .prof-member-list { max-height: 240px; }
}

.prof-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.prof-room.unbuilt { opacity: 0.55; }
.prof-room.maxed { border-color: var(--accent); }
.prof-tier { margin-bottom: 8px; }
.prof-achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.prof-ach { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; opacity: 0.6; }
.prof-ach.done { opacity: 1; border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.prof-check { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--ok); font-weight: 700; }
.prof-ach.done .prof-check { border-color: var(--ok); }

/* A checkbox drawn as an on/off switch: <label class="switch"><input type="checkbox" role="switch"> Text</label>. */
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; cursor: pointer;
  width: 30px; height: 17px; border-radius: 999px; background: var(--border); transition: background 0.15s;
}
.switch input::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(13px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Collection pages (collectpoints.js, combatpoints.js): a two-line header, its filters folded away. */
.collect-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.collect-top h2 { margin: 0; }
.collect-top .collect-search { margin-left: auto; width: 16em; max-width: 100%; min-height: 30px; padding: 4px 8px; }
.collect-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.collect-bar label { display: inline-flex; align-items: center; gap: 6px; }
.collect-bar label.switch { color: var(--text); }
.collect-bar select { min-height: 30px; padding: 3px 6px; }
.collect-bar .progress { flex: 1 1 200px; }
.collect-filters { margin-top: 12px; font-size: 0.85rem; }
/* The Filters toggle looks like a button: icon, label, what's hidden, and a chevron that flips open. */
.collect-filters > summary {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; max-width: 100%; cursor: pointer; list-style: none; user-select: none;
  padding: 5px 12px 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); transition: border-color 0.15s, background 0.15s;
}
.collect-filters > summary::-webkit-details-marker { display: none; }
.collect-filters > summary:hover { border-color: var(--accent); background: var(--accent-soft); }
.collect-filters > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.collect-filters > summary::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s; }
.collect-filters[open] > summary { border-color: var(--accent); background: var(--accent-soft); }
.collect-filters[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.collect-filters .cf-icon { width: 14px; height: 14px; fill: var(--accent); flex: none; }
.collect-filters .cf-label { font-weight: 600; }
.collect-filters .cf-note { color: var(--muted); }
.collect-filters .cf-note b { color: var(--text); }
.type-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 20px; margin-top: 10px; }
.type-group h4 { margin: 0 0 4px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.type-group .switch { display: flex; padding: 2px 0; }
.type-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-top: 10px; }
details.how { margin-top: 12px; }
details.how > summary { cursor: pointer; color: var(--muted); }
details.how p { color: var(--muted); margin: 6px 0 0; }
/* Skilling > Collection's To-do buttons and its link to the list. */
button.btn.small { min-height: 26px; padding: 2px 10px; font-size: 0.8rem; white-space: nowrap; }
button.btn.on { border-color: var(--ok); color: var(--ok); }
/* A row's ▼ / ▲: the item it collects runs to an earlier or later mark. */
.bump-ctl { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: baseline; }
button.bump { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font: inherit; font-size: 0.75rem; line-height: 1.5;
  color: var(--accent); cursor: pointer; white-space: nowrap; }
button.bump:hover { border-color: var(--accent); background: var(--accent-soft); }
/* Under each item a row collects: your count against the mark its run takes it to. */
.cp-progress { display: flex; align-items: center; gap: 6px; margin: 1px 0 4px; }
.cp-progress .prof-bar { flex: 0 1 120px; min-width: 40px; margin: 0; }
.cp-progress .small { white-space: nowrap; }
/* A Collection row's "and N more": gives way to the rest of its list. */
.cp-more > summary { cursor: pointer; width: fit-content; list-style: none; }
.cp-more > summary::-webkit-details-marker { display: none; }
.cp-more > summary:hover { color: var(--accent); text-decoration: underline; }
.cp-more[open] > summary { display: none; }

/* Inventory > Collection to-do (collecttodo.js): the list, what to queue for each, and the shopping list. */
.todo-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; }
.collect-head .stats { margin-top: 12px; }
.todo-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .todo-layout { grid-template-columns: minmax(0, 1fr); } }
.todo-layout h3 { margin: 0; }
.todo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
.todo-bar label { display: inline-flex; align-items: center; gap: 6px; }
.todo-bar label.switch { color: var(--text); }
.todo-bar select { min-height: 30px; padding: 3px 6px; }
.todo-badge { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.todo-badge.ok { color: var(--ok); border-color: var(--ok); }
.todo-badge.warn { color: var(--warn); border-color: var(--warn); }
.todo-move { display: inline-flex; white-space: nowrap; }
.todo-move .icon-btn:disabled { opacity: 0.35; cursor: default; background: none; color: var(--muted); }
.todo-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.todo-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--panel); }
.todo-card.flat { opacity: 0.6; }
.todo-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.todo-card-head > span:nth-child(2) { flex: 1 1 14em; min-width: 0; }
.todo-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.8rem; }
.todo-steps { margin: 8px 0 2px; padding-left: 22px; display: grid; gap: 6px; font-size: 0.9rem; }
.todo-steps li { padding-left: 2px; }
.todo-steps li::marker { color: var(--muted); }
.todo-steps li > span { margin-right: 8px; }
.todo-steps li.short .todo-step-name { color: var(--muted); }
.todo-times, .todo-cost { font-variant-numeric: tabular-nums; }
.todo-cost { white-space: nowrap; }
.todo-steps .neg { display: block; }

/* Enhance > +20 decompose: the four steps, and the top row in words. */
.enhdec-steps { list-style: none; counter-reset: step; display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; padding: 0; }
.enhdec-steps li { counter-increment: step; flex: 1 1 140px; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 0.9rem; }
.enhdec-steps li::before { content: counter(step); flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.8rem; }
.enhdec-pick { padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; }
.enhdec-table tr.open td { background: var(--accent-soft); }
/* The breakdown stays the width of what's on screen, even when the table is wider and scrolls sideways. */
.enhdec-wrap { container-type: inline-size; }
.enhdec-detail { position: sticky; left: 8px; width: calc(100cqw - 32px); box-sizing: border-box;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; padding: 6px 0; }
.enhdec-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--panel); min-width: 0; }
.enhdec-card h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 0.85rem; }
.enhdec-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 700; }
.enhdec-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 0.85rem; }
.enhdec-card dt { color: var(--muted); }
.enhdec-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* A panel that folds up: its h2 is the toggle. */
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary h2 { margin: 0; }
details.fold[open] > summary { margin-bottom: 12px; }
.settings-bar .baseline input { width: 8em; }

/* Tasks (armory/js/taskadvice.js): cards side by side; Settings as rows of label and control, zones as chips. */
.ts-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 0 14px; align-items: start; }
.ts-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.ts-label { font-weight: 600; }
.ts-hint { display: block; margin-top: 2px; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.ts-row input[type=number] { width: 9em; text-align: right; }
.ts-row select { max-width: 17em; }
.ts-section { margin: 16px 0 2px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ts-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 4px; }
.ts-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--row-alt); font-size: 0.85rem; cursor: pointer; }
.ts-chip input { margin: 0; }
.ts-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ts-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ts-tile { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto auto; gap: 0 8px; align-items: center; padding: 8px 10px; text-align: left;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--muted); cursor: pointer; opacity: .75; }
.ts-tile:hover { opacity: 1; }
.ts-tile.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); opacity: 1; }
.ts-tile-icon { grid-row: 1 / 4; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.ts-tile-icon .item-icon { width: 32px; height: 32px; }
.ts-tile-name { font-weight: 600; }
.ts-tile-sub { font-size: 0.78rem; }
.ts-tile-state { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ts-tile.on .ts-tile-state { color: var(--accent); }
.tb-table .tb-group th { padding-top: 16px; text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tb-table td:first-child { padding-left: 14px; }
.q1-skill + .q1-skill { margin-top: 12px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.ts-minis { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-mini { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 0.85rem; cursor: pointer; }
.ts-mini .item-icon { width: 22px; height: 22px; }
.task-tabs { margin: 0; }
.q1-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.q1-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text); font-size: 0.8rem; cursor: pointer; }
.q1-icon .item-icon, .q1-icon .action-icon { width: 34px; height: 34px; }
.q1-icon.on { border-color: var(--accent); background: var(--accent-soft); }
.q1-icon:not(.on) { opacity: 0.35; filter: grayscale(1); }
.q1-icon:not(.on):hover { opacity: 0.7; }
.q1-icon.set { border-style: dashed; }

/* Labyrinth (armory/js/labpages.js): rush, automation and manual floors each have a colour. */
.labs { --lab-rush: light-dark(#2f7d8c, #5cb8c9); --lab-auto: var(--accent-fill); --lab-manual: light-dark(#7a4fa8, #b18ae0); }
.labs input[type="number"] { width: 6.5em; }
.labs label.check { flex-direction: row; align-items: center; gap: 6px; min-height: 34px; color: var(--text); }
.labs-phase { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 650; color: var(--on-accent); }
.labs-phase.rush, .labs-bar-fill.rush { background: var(--lab-rush); }
.labs-phase.auto, .labs-bar-fill.auto { background: var(--lab-auto); }
.labs-phase.manual, .labs-bar-fill.manual { background: var(--lab-manual); }
.labs-phase.rush, .labs-phase.manual { color: #fff; }
.labs-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 10px; align-items: start; }
.labs-depth { width: 100%; }
.labs-depth td { padding: 3px 6px; }
.labs-depth .bar-cell { width: 70%; }
.labs-bar-fill { display: block; height: 14px; min-width: 2px; border-radius: 4px; }
.labs-rules { margin: 6px 0 0; padding-left: 20px; }
.labs-rules li + li { margin-top: 2px; }
.labs tr.labs-sub td { font-weight: 600; }
.labs td.indent { padding-left: 22px; }
.labs input.labs-offset { width: 7em; }
/* Labyrinth: compact, so each page needs less scrolling. */
.labs .panel { padding: 10px 12px; margin-bottom: 10px; }
.labs h2 { margin-bottom: 8px; font-size: 1rem; }
.labs h3 { margin-bottom: 6px; font-size: 0.95rem; }
.labs h3[title], .labs h2[title] { cursor: help; }
.labs p.small, .labs .note { margin: 6px 0 0; }
.labs .controls { gap: 6px 12px; margin-bottom: 6px; }
.labs .controls label { gap: 2px; }
.labs th, .labs td { padding: 3px 8px; }
.labs th, .labs td.num { white-space: nowrap; }
.labs input[type="number"], .labs select { min-height: 28px; padding-top: 2px; padding-bottom: 2px; }
.labs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.labs-bar .labs-plan { flex: 1 1 420px; line-height: 1.6; }
.labs-run { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.labs-timed { display: inline-flex; align-items: center; gap: 6px; }
.labs-stats { gap: 8px; margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.labs-stats .stat { padding: 6px 10px; }
.labs td input.labs-offset { min-height: 0; height: 24px; padding: 0 6px; }
/* Labyrinth > Loadouts: what's holding you back, as a ranked list. */
.labs-limits { margin: 6px 0 0; padding-left: 22px; }
.labs-limits.plain { list-style: disc; }
.labs-limits > li + li { margin-top: 8px; }
.labs-limit-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.labs-limit-gain { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.labs-limits .labs-bar-fill { height: 6px; margin: 3px 0; }
.labs details.panel > summary { cursor: pointer; }

/* Skilling > Enhance > Calculator: a setting changed from the loadout's. */
label.changed { color: var(--accent); }

/* Skilling > XP vs Profit (horizonchart.js): the horizon chart, its key and the optimal mix above the table. */
.hz-wrap { overflow-x: auto; margin: 4px 0 6px; }
/* Short enough that the table starts on screen under it; side by side with the table once there's room. */
.hz-chart { display: block; width: 100%; min-width: 620px; height: auto; max-height: 46vh; font-size: 11px; }
.hz-layout { display: grid; gap: 8px 24px; }
.hz-table :is(th, td):not(:nth-child(2)) { white-space: nowrap; }
/* Side by side: the table at its own width, the chart in the rest. */
@media (min-width: 1600px) {
  .hz-layout { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .hz-plot { position: sticky; top: 12px; }
  .hz-data { max-width: 640px; }
  .hz-chart { min-width: 560px; max-height: 78vh; }
}
.hz-grid { stroke: var(--border); stroke-width: 1; }
.hz-grid.hz-zero { stroke: var(--muted); stroke-dasharray: 4 3; }
.hz-axis { stroke: var(--muted); stroke-width: 1; }
.hz-tick { fill: var(--muted); font-variant-numeric: tabular-nums; }
.hz-axis-title { fill: var(--muted); font-size: 12px; font-weight: 600; }
.hz-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.hz-pt circle { stroke: var(--panel); stroke-width: 1.5; }
.hz-pt.on circle { fill: var(--accent); }
.hz-pt.near circle { fill: var(--panel); stroke: var(--muted); }
.hz-pt:hover circle { stroke: var(--text); }
.hz-label { fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.hz-pt.near .hz-label { fill: var(--muted); }
.hz-label.hz-num { font-weight: 700; }
.hz-mix circle { fill: none; stroke: var(--ok); stroke-width: 2.5; }
.hz-mix path { fill: var(--ok); stroke: var(--ok); stroke-width: 1.5; stroke-linejoin: round; }
.hz-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; }
.hz-key span { display: inline-flex; align-items: center; gap: 6px; }
.hz-key i { display: inline-block; }
.hz-key-line { width: 18px; height: 3px; border-radius: 2px; background: var(--accent); }
.hz-key-dot { width: 9px; height: 9px; border-radius: 50%; }
.hz-key-dot.on { background: var(--accent); }
.hz-key-dot.near { border: 1.5px solid var(--muted); }
.hz-key-mix { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--ok); box-sizing: border-box; }
.hz-summary { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--ok); border-radius: 10px;
  background: color-mix(in srgb, var(--ok) 8%, transparent); }
.hz-summary div { display: flex; flex-direction: column; gap: 2px; }
.hz-summary strong { font-variant-numeric: tabular-nums; }
.hz-table tr.hz-mix-row td { background: color-mix(in srgb, var(--ok) 10%, transparent); font-weight: 600; }
.hz-badge { color: var(--ok); border-color: var(--ok); }
.hz-left { margin-top: 14px; }
.hz-left h3 { margin: 0 0 6px; font-size: 0.95rem; }
.hz-left ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
/* XP vs Profit > All skills: every skill's horizon on one chart, a colour each (the dataviz reference palette's eight,
   checked for colour-blind separation on both panels; alchemy, a ninth, is a dashed grey line), the band of all of
   them together behind, a key that hides or shows each, then a row per skill. */
.hz-combo {
  --hz-s1: light-dark(#2a78d6, #3987e5); --hz-s2: light-dark(#eb6834, #d95926); --hz-s3: light-dark(#1baf7a, #199e70);
  --hz-s4: light-dark(#eda100, #c98500); --hz-s5: light-dark(#e87ba4, #d55181); --hz-s6: light-dark(#008300, #008300);
  --hz-s7: light-dark(#6250d6, #9085e9); --hz-s8: light-dark(#e34948, #e66767);
}
.hz-combo-chart { max-height: 70vh; }
.hz-allline { fill: none; stroke: var(--text); stroke-opacity: 0.14; stroke-width: 14; stroke-linejoin: round; stroke-linecap: round; }
.hz-series { transition: opacity 0.15s; }
.hz-sline { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; }
.hz-series.dash-0 .hz-sline { stroke-dasharray: 6 4; }
.hz-series.dash-1 .hz-sline { stroke-dasharray: 0.5 4.5; stroke-linecap: round; stroke-width: 2.5; }
.hz-spt circle { fill: var(--c); stroke: var(--panel); stroke-width: 2; }
.hz-spt:hover circle { stroke: var(--text); }
.hz-slabel { font-weight: 600; }
.hz-mix-all circle { stroke: var(--text); }
.hz-mix-all path { fill: var(--text); stroke: var(--text); }
/* Skilling > Total level (totallevel.js): a line per plan (the same first three colours as XP vs Profit's), a hover band
   per point showing a crosshair, each plan's dot and a box of its numbers. */
.tl-wrap { position: relative; overflow-x: auto; margin: 4px 0 12px;
  --tl-s1: light-dark(#2a78d6, #3987e5); --tl-s2: light-dark(#eb6834, #d95926); --tl-s3: light-dark(#1baf7a, #199e70); }
.tl-summary { --tl-s1: light-dark(#2a78d6, #3987e5); --tl-s2: light-dark(#eb6834, #d95926); --tl-s3: light-dark(#1baf7a, #199e70); border-color: var(--border); background: none; }
.tl-table { --tl-s1: light-dark(#2a78d6, #3987e5); --tl-s2: light-dark(#eb6834, #d95926); --tl-s3: light-dark(#1baf7a, #199e70); }
.tl-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tl-line.tl-s1 { stroke: var(--tl-s1); }
.tl-line.tl-s2 { stroke: var(--tl-s2); stroke-dasharray: 6 4; }
.tl-line.tl-s3 { stroke: var(--tl-s3); stroke-dasharray: 0.5 4.5; stroke-width: 2.5; }
.tl-hit rect { fill: transparent; }
.tl-hit .tl-cross, .tl-hit circle { opacity: 0; pointer-events: none; }
.tl-hit:hover .tl-cross, .tl-hit:hover circle { opacity: 1; }
.tl-cross { stroke: var(--muted); stroke-width: 1; }
.tl-hit circle { stroke: var(--panel); stroke-width: 2; }
.tl-hit circle.tl-s1, .tl-key.tl-s1 { fill: var(--tl-s1); background: var(--tl-s1); }
.tl-hit circle.tl-s2, .tl-key.tl-s2 { fill: var(--tl-s2); background: var(--tl-s2); }
.tl-hit circle.tl-s3, .tl-key.tl-s3 { fill: var(--tl-s3); background: var(--tl-s3); }
.tl-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tl-tip { position: absolute; top: 12px; z-index: 2; min-width: 240px; max-width: 340px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel); box-shadow: 0 4px 14px rgb(0 0 0 / 0.15); font-size: 12px; pointer-events: none; }
.tl-tip-head { font-weight: 600; margin-bottom: 6px; }
.tl-tip-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0 8px; align-items: baseline; margin-top: 4px; }
.tl-tip-row strong { font-variant-numeric: tabular-nums; }
.tl-tip-row .muted { grid-column: 2 / 4; }
.tl-tip-row .tl-key { grid-row: span 3; }
.tl-skills th.tl-group { text-align: center; border-left: 1px solid var(--border); }
.tl-skills .tl-first { border-left: 1px solid var(--border); }
.tl-skills tfoot :is(th, td) { font-weight: 600; border-top: 1px solid var(--border); }
.hz-legend { align-items: center; margin-bottom: 4px; }
.hz-leg { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; font: inherit; color: var(--text); background: none;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.hz-leg:hover { border-color: var(--accent); }
.hz-leg.off { color: var(--muted); text-decoration: line-through; }
.hz-leg.off .hz-leg-line { opacity: 0.3; }
.hz-leg:disabled { cursor: default; opacity: 0.5; }
.hz-leg-line { display: inline-block; flex: none; width: 18px; height: 0; border-top: 3px solid var(--c); }
.hz-leg-line.dash-0 { border-top-style: dashed; }
.hz-leg-line.dash-1 { border-top-style: dotted; }
.hz-key-band { width: 18px; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--text) 14%, transparent); }
.hz-key-mix.all { border-color: var(--text); }
.hz-skill-name { display: inline-flex; align-items: center; gap: 8px; }
.hz-hidden-row td { opacity: 0.5; }
.hz-all-table td:nth-child(2) { min-width: 9em; }
.hz-end-name { max-width: 150px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Combat > Abilities: the abilities the plan tries (abilitypage.js). */
.ap-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: 2px 14px; margin-bottom: 8px; }
.ap-pool .ap-ability { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; line-height: 1.6; }
.ap-pool .ap-ability label.check { color: var(--text); cursor: pointer; margin-right: auto; }
.ap-pool .ap-ability label.check input { margin: 0 6px 0 0; vertical-align: -2px; }
.ap-pool .ap-ability.muted label.check { color: var(--muted); }
.ap-pool input.ap-lv { width: 3.6em; padding: 1px 4px; font-size: 0.85em; }
.ap-pool input.ap-lv.set { border-color: var(--accent); font-weight: 600; }
.ap-pool .ap-lvl { color: var(--muted); font-size: 0.8em; font-variant-numeric: tabular-nums; min-width: 4.5em; }
.ap-pool-box > summary { cursor: pointer; }
/* Ability pictures on the game's own dark tile, in the pool and the results; food and drinks use the item sheet. */
.ap-pool label.check svg.ap-ab-icon { width: 22px; height: 22px; margin-right: 5px; vertical-align: -6px; }
svg.ap-ab-icon { flex: none; width: 22px; height: 22px; padding: 2px; box-sizing: border-box; border-radius: 5px; background: #263155; }
.ap-ab { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.ap-ab .item-icon, .ap-ab .item-fallback { flex: none; width: 22px; height: 22px; }
.ap-abs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

/* Labyrinth > Compare (labcompare.js): the setups across the top, the scenario editor beside its changes and the run
   button, then the setups side by side. Each scenario keeps one color (validated categorical slots); yours is gray. */
.lc {
  --lc-0: light-dark(#8a8578, #8f897b);
  --lc-1: light-dark(#2a78d6, #3987e5); --lc-2: light-dark(#eb6834, #d95926); --lc-3: light-dark(#1baf7a, #199e70);
  --lc-4: light-dark(#eda100, #c98500); --lc-5: light-dark(#e87ba4, #d55181); --lc-6: light-dark(#008300, #008300);
}
.lc-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.lc-dot.big { width: 14px; height: 14px; margin: 0; }
.lc-head p { margin: 0 0 8px; }
.lc-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.lc-card {
  all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; min-width: 150px; max-width: 220px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer;
}
.lc-card:hover { border-color: var(--accent); }
.lc-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lc-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--gold); }
.lc-card-top { display: flex; align-items: center; font-weight: 600; min-width: 0; }
.lc-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-card-sub, .lc-glance { font-size: 0.78rem; color: var(--muted); }
.lc-glance { color: var(--text); font-variant-numeric: tabular-nums; }
.lc-glance.stale { color: var(--muted); text-decoration: line-through; }
.lc-new { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.lc-new select { min-height: 28px; font-size: 0.8rem; }
.lc-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; align-items: start; }
@media (max-width: 1100px) { .lc-main { grid-template-columns: minmax(0, 1fr); } }
.lc-side { position: sticky; top: 10px; display: flex; flex-direction: column; }
@media (max-width: 1100px) { .lc-side { position: static; } }
.lc-ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; }
input.lc-name { font: inherit; font-family: var(--display); font-weight: 700; font-size: 1.05rem; flex: 1 1 200px; min-width: 0; max-width: 360px;
  color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; }
input.lc-name:hover, input.lc-name:focus { border-color: var(--border); background: var(--panel); }
input.lc-name.small { font-size: 0.95rem; max-width: 280px; }
.lc-ed-acts, .lc-lo-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.btn.lc-danger:hover { border-color: var(--err); color: var(--err); }
.lc .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lc-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.lc-tabs button { font: inherit; font-size: 0.85rem; cursor: pointer; border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px;
  background: var(--panel); color: var(--muted); }
.lc-tabs button:hover { color: var(--accent); border-color: var(--accent); }
.lc-tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.lc-count { display: inline-block; min-width: 1.5em; padding: 0 5px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-align: center;
  background: var(--accent-fill); color: var(--on-accent); }
.lc-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 4px 22px; align-items: start; }
.lc-sec h3 { margin-top: 4px; }
.lc-sec h4 { margin: 14px 0 6px; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; }
.lc-table { width: 100%; }
.labs .lc-table td { padding: 2px 8px; vertical-align: middle; }
.lc-table td.lc-in select, .lc-table td.lc-in input { min-height: 26px; }
.lc-table td.lc-in select { max-width: 15em; }
.lc-table td.lc-undo-cell { width: 28px; padding: 0; }
.lc-table tr.lc-changed td, .lc-field.changed, .lc-slot.changed, .lc-abilities.changed, .lc-ab-lv.changed {
  background: color-mix(in srgb, var(--accent-fill) 12%, transparent); }
.lc-table tr.lc-changed td:first-child { box-shadow: inset 3px 0 0 var(--accent-fill); font-weight: 600; }
.lc-undo { font: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px;
  background: none; color: var(--muted); }
.lc-undo:hover { color: var(--accent); border-color: var(--accent); }
.lc-was, .lc-slot-was { font-size: 0.78rem; color: var(--muted); }
.lc-field-was { display: inline-flex; align-items: center; gap: 4px; }
.lc-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 8px; }
.lc-bulk > span { margin-right: 4px; }
.lc-fields { display: flex; flex-direction: column; gap: 2px; }
.lc-field { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 8px; border-radius: 8px; }
.lc-field.changed { box-shadow: inset 3px 0 0 var(--accent-fill); }
.lc-field > label { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.9rem; }
.lc-ctl { display: inline-flex; align-items: center; gap: 4px; }
.labs .lc-field input[type="number"] { width: 6em; }
.lc-field .lc-field-was { flex-basis: 100%; justify-content: flex-end; }
.lc-lo { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .lc-lo { grid-template-columns: minmax(0, 1fr); } }
.lc-lo-list { display: flex; flex-direction: column; gap: 2px; }
.lc-lo-list h4 { margin: 6px 0 2px; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lc-lo-item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.lc-lo-item:hover { background: var(--row-alt); }
.lc-lo-item:focus-visible { outline: 2px solid var(--accent); }
.lc-lo-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lc-lo-item .lc-count { margin-left: auto; }
.lc-copy { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; color: var(--muted); }
.lc-copy select { min-height: 28px; }
.lc-lo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.lc-lo-head h3 { margin: 0; }
.lc-uses { margin: 4px 0 0; }
.lc-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 4px 12px; }
.lc-slot { display: grid; grid-template-columns: 74px 24px minmax(0, 1fr) auto; align-items: center; gap: 4px 6px; padding: 3px 6px; border-radius: 8px; }
.lc-slot.changed { box-shadow: inset 3px 0 0 var(--accent-fill); }
.lc-slot-name { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-slot-icon { display: inline-flex; width: 24px; height: 24px; }
.lc-slot-icon .item-icon, .lc-slot-icon .item-fallback { width: 24px; height: 24px; }
.lc-slot-icon .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; color: var(--muted); }
.lc-slot select { min-width: 0; width: 100%; min-height: 28px; }
.lc-enh { display: inline-flex; align-items: center; gap: 1px; color: var(--muted); font-size: 0.85rem; }
.lc-enh[hidden] { display: none; }
.labs .lc-enh input[type="number"] { width: 3.6em; padding-left: 4px; padding-right: 2px; }
.lc-slot-was { grid-column: 2 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.lc-cons { display: flex; flex-wrap: wrap; gap: 4px; }
.lc-cons select { min-height: 28px; max-width: 13em; }
.lc-abilities { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px; border-radius: 8px; }
.lc-ab { display: grid; grid-template-columns: 56px minmax(0, 15em) auto; align-items: center; gap: 6px; }
.lc-ab select { min-height: 28px; }
.lc-ab-lv { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--muted); padding: 1px 4px; border-radius: 6px; }
.labs .lc-ab-lv input[type="number"] { width: 4.5em; }
.lc-changes h3 { display: flex; justify-content: space-between; gap: 8px; }
.lc-chg-group + .lc-chg-group { margin-top: 6px; }
.lc-chg-sec { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
.lc-changes li { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 2px 0; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.lc-changes li:last-child { border-bottom: 0; }
.lc-changes li .lc-undo { padding: 0 6px; }
.lc-combat-note { border-top: 1px solid var(--border); padding-top: 6px; }
.lc-run-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lc-run-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.lc-run-row select { min-height: 28px; }
.lc-ideas { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.lc-idea-list { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-res th.lc-col-head { vertical-align: bottom; min-width: 7.5em; }
.lc-col-name { display: inline-flex; align-items: center; justify-content: flex-end; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-col-head > span.small { display: block; font-weight: 400; }
.lc-res tr.lc-group th { text-align: left; padding-top: 10px; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.lc-res td:first-child { white-space: normal; min-width: 11em; }
.lc-res td.num { vertical-align: top; font-variant-numeric: tabular-nums; }
.lc-res td.lc-top-cell { font-weight: 700; }
.lc-delta { display: block; font-size: 0.75rem; font-weight: 600; }
.lc-delta.muted { font-weight: 400; }
.lc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.lc-legend > span { display: inline-flex; align-items: center; }
.lc-depth { width: 100%; }
.labs .lc-depth td { padding: 3px 6px; vertical-align: middle; }
.lc-depth td.num { width: 5.5em; }
.lc-bars { display: flex; flex-direction: column; gap: 2px; }
.lc-bar-row { display: flex; align-items: center; gap: 6px; height: 10px; }
.lc-bar { display: block; height: 8px; min-width: 0; border-radius: 0 4px 4px 0; }
.lc-bar-num { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Combat > Combat planner (zoneplan.js): the best setup's row, and setups you die in, faded; the run's number inputs, the
   scroll counts, and the top option's XP by skill as bars. */
.zp-table tr.on td { background: var(--accent-soft); }
.zp-table tr.muted td { opacity: 0.55; }
.zp-num { width: 5.5em; }
/* Combat > Level advisor (levelplan.js) uses the planner table; a level change stays on one line. */
.lp-table td.lp-lv { white-space: nowrap; }
.zp-scrolls { display: grid; gap: 6px; margin: 4px 0 8px; }
.zp-scroll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; }
.zp-scroll { display: grid; grid-template-columns: 1fr 4.5em; align-items: center; gap: 2px 8px; }
.zp-scroll input { width: 100%; }
.zp-scroll .small { grid-column: 1 / -1; }
.zp-xp { margin: 12px 0; max-width: 640px; }
.zp-xp h3 { margin: 0 0 6px; }
.zp-xp table { width: 100%; }
.zp-bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--border); vertical-align: middle; overflow: hidden; }
.zp-bar > div { height: 100%; background: var(--accent); }
.zp-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin: 12px 0; }
.zp-top h3 { margin: 0 0 6px; }
.zp-top table { width: 100%; }

/* Skilling > Planner (actionplan.js): the head with the bottom line and tabs, settings, each step as a card (what it
   uses beside what you have, what it makes), the add-a-step card, and net worth over the plan. */
.ap-head { padding-bottom: 0; }
.ap-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 10px; }
.ap-title h2 { margin: 0; }
/* The bottom line: one row of small stats. */
.ap-summary { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 4px; }
.ap-summary .stat { padding: 5px 10px; }
.ap-summary .stat .value { font-size: 1.02rem; }
.ap-summary .stat .muted.small { font-size: 0.72rem; }
.ap-tabs { margin-top: 8px; border-bottom: 0; }
.ap-tabs button:disabled { opacity: 0.4; cursor: not-allowed; }
.ap-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; }
.ap-field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.ap-field input, .ap-field select { font-size: 0.95rem; color: var(--text); }
.ap-field input[type="number"] { width: 6.5em; }
.ap-field.grow { flex: 1 1 260px; min-width: 0; }
.ap-field.grow select, .ap-field.grow input { width: 100%; }
.ap-step { padding: 12px 14px; }
.ap-step.skipped { opacity: 0.7; border-style: dashed; }
/* A grid, so the name column (as wide as the plan's longest name: --ap-name, set on .ap-steps) is the same on every step
   and what follows lines up; narrow screens wrap instead. */
.ap-step-head { display: grid; grid-template-columns: auto auto auto auto var(--ap-name, 15em) minmax(0, 1fr) auto auto; align-items: center; gap: 8px 12px; }
.ap-step-head .ap-name { min-width: 0; }
.ap-step-head .ap-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .ap-step-head { display: flex; flex-wrap: wrap; } }
.ap-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.ap-icon { flex: none; display: inline-flex; }
.ap-icon .item-icon, .ap-icon .item-fallback { width: 32px; height: 32px; }
.ap-icon .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); background: var(--row-alt); border-radius: 6px; }
.ap-name { display: flex; flex-direction: column; flex: 0 1 auto; }
button.ap-name { font: inherit; color: inherit; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; }
button.ap-name:hover strong { color: var(--accent); }
.ap-grip { flex: none; cursor: grab; color: var(--muted); letter-spacing: -2px; padding: 0 2px; user-select: none; }
.ap-grip:hover { color: var(--accent); }
.ap-step.dragging { opacity: 0.45; }
.ap-step.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.ap-step.drop-after { box-shadow: 0 3px 0 var(--accent); }
.ap-fold { flex: none; width: 1.6em; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 0; }
.ap-fold:hover { color: var(--accent); }
.ap-brief { flex: 1 1 8em; min-width: 0; }
.ap-amount { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.ap-step.folded { padding: 6px 12px; margin-bottom: 6px; }
.ap-step.folded .ap-icon .item-icon, .ap-step.folded .ap-icon .item-fallback { width: 24px; height: 24px; }
.ap-step.folded .ap-skip { margin-top: 4px; }
/* A collapsed row stays one line: long details end in an ellipsis, the whole of them in the hover text. */
.ap-step.folded .ap-brief { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-step.folded .ap-amount input { width: 5.5em; }
.ap-step.folded .ap-btns .btn { min-width: 1.8em; padding: 1px 6px; }
.ap-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.ap-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 10px; }
.ap-topbar > span { margin-right: 4px; }
.ap-topbar .ap-alert { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.ap-progress { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ap-progress p { margin: 0 0 6px; }
.ap-dayline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.ap-amount input { width: 7em; }
.ap-btns { display: inline-flex; gap: 4px; }
.ap-btns .btn { min-width: 2.2em; padding: 2px 8px; }
.ap-skip { margin: 8px 0 0; }
.ap-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 8px; color: var(--muted); }
.ap-meta span + span::before { content: "·"; margin: 0 8px; color: var(--border); }
.ap-meta strong, .ap-meta .ok, .ap-meta .neg { color: inherit; }
.ap-meta .ok { color: var(--ok); }
.ap-meta .neg { color: var(--err); }
.ap-io { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 8px 18px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border); }
.ap-io-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.ap-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ap-chips > .ap-io-label { margin: 0 4px 0 0; }
.ap-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); font-size: 0.85rem; white-space: nowrap; }
.ap-chip .item-icon, .ap-chip .item-fallback { width: 22px; height: 22px; flex: none; }
.ap-chip .item-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: var(--muted); background: var(--row-alt); border-radius: 50%; }
.ap-q { font-weight: 650; font-variant-numeric: tabular-nums; }
.ap-have { font-size: 0.75rem; padding: 1px 6px; border-radius: 999px; background: var(--row-alt); color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-chip.covered .ap-have { color: var(--ok); }
.ap-chip.short { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.ap-chip.short .ap-have { color: var(--warn); }
.ap-add { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.ap-add h3 { margin-top: 0; }
.ap-add-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.ap-add-head h3 { margin: 0; }
.ap-add-head .ap-close { order: 9; margin-left: auto; }
/* What opens and closes: Settings, the add form, covered items, levels along the way. */
.ap-toggle.on { border-color: var(--accent); color: var(--accent); }
.ap-settings-panel .ap-about { margin: 10px 0 0; }
.ap-why { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.ap-fold-head { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.ap-fold-head + .table-wrap { margin-top: 10px; }
button.ap-toggle-head { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button.ap-toggle-head:hover { color: var(--accent); }
/* Two panels side by side where there's room (Skills & loadouts, Coins, Tasks & Labyrinth). */
.ap-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 0 14px; align-items: start; }
.ap-shop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-bottom: 8px; }
.ap-shop-head .stats { flex: 1 1 360px; margin-bottom: 0; }
.ap-shop-head .ap-auto { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; }
.ap-buy tr.muted td { color: var(--muted); }
.ap-coins { margin-top: 16px; }
.ap-coins h4 { margin: 0 0 8px; }
/* Gear to buy, on the Coins tab. */
.ap-gear td { vertical-align: top; }
.ap-gear select { max-width: 15em; }
.ap-price-in { width: 7em; text-align: right; }
.ap-buy-form { margin-top: 12px; }
.ap-buy-preview { margin: 10px 0 0; }
.ap-add-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.ap-add-row .seg { align-self: flex-end; }
.ap-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--row-alt); }
/* The coin waterfall: start and end stand on zero, what comes in and goes out floats between. */
.ap-wf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; height: 170px; padding-top: 20px; margin-top: 6px; }
.ap-wf-col { position: relative; }
.ap-wf-zero { position: absolute; left: -5px; right: -5px; border-top: 1px solid var(--border); }
.ap-wf-bar { position: absolute; left: 14%; right: 14%; border-radius: 4px; }
.ap-wf-bar.total { background: var(--accent); }
.ap-wf-bar.total.neg, .ap-wf-bar.down { background: var(--err); }
.ap-wf-bar.up { background: var(--ok); }
.ap-wf-val { position: absolute; left: -4px; right: -4px; text-align: center; font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-wf-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; margin-top: 6px; font-size: 0.75rem; color: var(--muted); text-align: center; }
.ap-ups { max-height: 520px; overflow-y: auto; }
.ap-ups td:last-child { white-space: normal; min-width: 12em; }
.ap-skills td.num { white-space: nowrap; }

/* Combat > Meta builds and Meta builder (metapage.js) */
.mb-grid td, .mb-grid th { white-space: nowrap; }
.mb-grid td.num button.link.on { font-weight: 700; text-decoration: none; background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }
.mb-build { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 14px 0 10px; }
.mb-build h3 { margin-top: 0; }
.mb-build h4 { margin: 10px 0 4px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.mb-build-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px 24px; }
.mb-parts td { padding: 3px 6px; vertical-align: top; }
.mb-parts td.num { white-space: nowrap; }
.mb-parts tr:last-child td { border-bottom: 0; }
/* Tune-up: a monster and its room levels kept on one line */
.nowrap { white-space: nowrap; }
.mb-status { font-variant-numeric: tabular-nums; margin: 6px 0; }
.mb-queue { margin: 4px 0; padding-left: 1.6em; }
.mb-queue li { margin: 2px 0; }
.mb-runbar { position: sticky; top: 0; z-index: 5; margin: 10px -4px 12px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 12px rgb(0 0 0 / 0.06); }
.mb-runbar .controls { margin: 0; align-items: center; }
.mb-runbar .controls { gap: 6px 12px; }
.mb-runbar .controls label { flex-direction: row; align-items: center; gap: 6px; font-size: 0.85rem; }
.mb-runbar .controls select { width: auto; padding-top: 4px; padding-bottom: 4px; }
.mb-runbar-gap { flex: 1; }
.mb-runbar .mb-progress { margin: 6px 0 0; }
.mb-runbar .mb-status { margin: 4px 0 0; }
.mb-queue-list summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.mb-tabs { margin: 4px 0 12px; }
.mb-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 4px 0 10px; }
.mb-list-head p { margin: 0; }
.mb-list-head .controls { margin: 0; }
.mb-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; line-height: 1.5; white-space: nowrap; border: 1px solid var(--border); color: var(--muted); }
.mb-chip.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.mb-chip.queued { color: var(--text); }
.mb-chip.part { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.mb-chip.built { color: var(--text); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.mb-chip.pub { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.mb-pass { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.btn.mb-btn-sm { padding: 2px 10px; font-size: 0.8rem; }
.mb-targets td { vertical-align: middle; }
.mb-targets tr.on td, .mb-targets td.on { background: var(--accent-soft); }
.mb-targets button.link.plain { text-align: left; }
.mb-actions { white-space: nowrap; text-align: right; }
.mb-actions .btn + .btn { margin-left: 4px; }
.mb-ladder-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.mb-ladder-head h3 { margin: 0; }
.mb-ladder-head .btn + .btn { margin-left: 4px; }
.mb-ladder { max-width: none; }
.mb-ladder tr.on td { background: var(--accent-soft); }
.mb-ladder tr.stale td { opacity: 0.7; }
.mb-ladder .mb-took { white-space: nowrap; }
.mb-onebuild, .mb-ladderview { scroll-margin-top: 110px; }
.mb-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 10px; }
.mb-facts > div { display: flex; flex-direction: column; }
.mb-facts dt { font-size: 0.72rem; color: var(--muted); }
.mb-facts dd { margin: 0; font-weight: 600; }
.mb-build-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 28px; align-items: start; }
.mb-build-grid h4 { margin: 12px 0 4px; }
.mb-build-buy h4 { margin-top: 0; }
.mb-loadout-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.mb-loadout-head h4 { margin: 0; }
.mb-build-buy .mb-buy { max-width: none; width: 100%; }
.mb-buy tr.mb-buy-group th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding-top: 8px; border-bottom: 1px solid var(--border); }
.mb-buy tr.mb-buy-group th.num { text-align: right; }
@media (max-width: 820px) { .mb-build-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .mb-runbar { position: static; } .mb-onebuild, .mb-ladderview { scroll-margin-top: 8px; } }
.mb-preview { margin: 4px 0 14px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; }
.mb-preview h4 { margin: 0 0 6px; }
.mb-edited { margin: 8px 0 0; color: var(--muted); }
.mb-edit { max-width: 640px; }
.mb-edit select { max-width: 16em; }
.mb-edit input.mb-enh { width: 4.5em; padding: 2px 6px; text-align: right; }
.mb-edit-loc { display: none; }
/* On a phone the slot's name goes over its piece, leaving room for the + and the price. */
@media (max-width: 700px) {
  .mb-edit .mb-edit-slot { display: none; }
  .mb-edit-loc { display: block; }
  .mb-edit select { max-width: 8.5em; }
  .mb-edit input.mb-enh { width: 3.4em; }
  .mb-edit td, .mb-edit th { padding-left: 4px; padding-right: 4px; }
}
.mb-budgets { max-width: 420px; }
.mb-budgets .mb-budget { width: 6em; padding: 2px 6px; text-align: right; }
.mb-lab th .mb-budget { display: block; width: 5.2em; margin: 3px 0 0 auto; padding: 2px 4px; font-size: 0.78rem; text-align: right; }
.mb-lab td.num { min-width: 70px; }
.mb-how { margin: 8px 0; }
.mb-how summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.mb-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; margin: 8px 0 12px; }
.mb-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; }
.mb-field > span:first-child { color: var(--muted); }
.mb-input { display: flex; align-items: center; gap: 6px; }
.mb-input input { width: 7em; }
.mb-input span { color: var(--muted); white-space: nowrap; }
.mb-seed-cols { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-start; }
.mb-seeds { margin: 8px 0 4px; }
.mb-seeds summary { cursor: pointer; color: var(--muted); }
.mb-history ol { margin: 4px 0; padding-left: 1.6em; }
.mb-build .prof-loadout { margin-top: 4px; }
.mb-trig { font-weight: 400; margin-top: 1px; }
.mb-buy { max-width: 560px; }
.mb-buy td { padding: 3px 8px; }
.mb-buy tr.total td { font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }
.mb-progress { margin: 8px 0 4px; }
.mb-progress .mb-bar { height: 36px; margin-bottom: 8px; }
.mb-estimate { margin: 4px 0; }
.mb-current-head { margin-bottom: 4px; }
.mb-stages { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.mb-stages li { position: relative; flex: 1 1 0; min-width: 64px; height: 26px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg); font-size: 0.78rem; }
.mb-stages li span { position: relative; z-index: 1; display: block; line-height: 24px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mb-stages li.done { background: var(--accent-soft); }
.mb-stages li.done span { color: var(--text); }
.mb-stages li.on { border-color: var(--accent); }
.mb-stages li.on span { color: var(--text); font-weight: 600; }
.mb-stages li .bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width .4s; }
/* Zone strips (zoneTable): a cell per combat level, shaded by tier. Wide: names in a column; narrower: each name on a
   line of its own; narrow: half the levels a line, each cell saying its CL. */
.mb-zwrap { container-type: inline-size; margin: 6px 0; }
.mb-zgrid { display: grid; grid-template-columns: minmax(5rem, 9rem) repeat(var(--n), minmax(0, 1fr)); gap: 3px; align-items: stretch; }
.mb-zh { font-size: 0.72rem; color: var(--muted); text-align: center; padding-bottom: 2px; }
.mb-zh.mb-zname { text-align: left; }
.mb-zname { align-self: center; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.mb-zc { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 3px 1px; border: 1px solid transparent; border-radius: 5px;
  font: inherit; font-size: 0.74rem; line-height: 1.2; color: var(--text); background: var(--bg); text-align: center; overflow: hidden; }
.mb-zc.empty { background: none; }
.mb-zc.dead { color: var(--muted); background: none; border-color: var(--border); }
button.mb-zc { cursor: pointer; }
button.mb-zc:hover { border-color: var(--accent); }
.mb-zc.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mb-zc.t0 { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.mb-zc.t1 { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); }
.mb-zc.t2 { background: color-mix(in srgb, var(--accent) 34%, var(--panel)); }
.mb-zc.t3 { background: color-mix(in srgb, var(--accent) 48%, var(--panel)); }
.mb-zc b { font-weight: 600; white-space: nowrap; }
.mb-zt { font-size: 0.66rem; font-weight: 700; color: var(--muted); }
.mb-zc .mb-zi { font-size: 0.66rem; color: var(--muted); white-space: nowrap; }
.mb-zcl { display: none; font-size: 0.62rem; color: var(--muted); white-space: nowrap; }
@container (max-width: 900px) {
  .mb-zgrid { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .mb-zname { grid-column: 1 / -1; padding-top: 4px; }
  .mb-zh.mb-zname { display: none; }
}
@container (max-width: 560px) {
  .mb-zgrid { grid-template-columns: repeat(var(--half), minmax(0, 1fr)); }
  .mb-zh { display: none; }
  .mb-zcl { display: block; }
}
.mb-goal { margin-left: 3px; font-size: 0.7rem; color: var(--muted); vertical-align: super; }
.mb-goal.warn { color: var(--warn); }
.mb-sub { display: block; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.mb-sub.warn { color: var(--warn); }
.mb-headline { font-size: 1.05rem; margin: 2px 0 6px; }
.mb-model .mb-buy { max-width: 520px; }
.mb-buy tr.on td { background: var(--accent-soft); }
.mb-buy tr.muted td { color: var(--muted); }
.mb-survey td { white-space: nowrap; }
