/* ==========================================================================
   Skill calculators — the same folio, one ticket per skill
   ==========================================================================
   The page keeps the tool bench's near-black ground and hairline rules. The
   left ticket owns the goal, filter and real training bonuses; the right side
   prices each method underneath. The skill icon is the only extra colour. */

.bench-tool { --tool-tone: var(--accent); }
.tool-high-alch-calculator { --tool-tone: #f6bd3a; }
.skillview { --tool-tone: var(--accent); }

/* The hub now has eighteen rows instead of one. It is a document like the
   skill worksheets, not a one-screen board; the root must grow so the last
   skill and the planner below it can be reached. */
html:has(.toolview-hub),
body:has(.toolview-hub) {
  height: auto; min-height: 100%; overflow: auto;
}
.shell[data-screen="tools"]:has(.toolview-hub) {
  height: auto; min-height: 100dvh; overflow: visible;
}
.shell[data-screen="tools"]:has(.toolview-hub) .workspace,
.shell[data-screen="tools"]:has(.toolview-hub) .list-card,
.shell[data-screen="tools"]:has(.toolview-hub) #board {
  height: auto; min-height: 0; overflow: visible;
}
/* The skill index is two columns of ruled rows, not a wall of cards. */
.bench-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
}
.bench-list-grid .bench-tool { min-height: 52px; }

@media (min-width: 1280px) {
  /* Three rows of six keep every skill above the fold on a desk without
     turning the index into a long list. The two-column form takes over below
     this width; the phone gets one column. */
  .bench-list-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.bench-head .page-mast-lede:empty { display: none; }

/* ---------------------------------------------------------------- mast ---- */
.skill-mast .page-mast-copy { min-width: 0; }
.skill-mast .page-mast-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans); font-size: var(--text-title);
  font-weight: var(--fw-display); letter-spacing: var(--track-display);
  line-height: var(--leading-display);
}
.skill-mast .page-mast-lede:empty { display: none; }

/* --------------------------------------------------------------- desk ----- */

/* The controls are the ticket in the left rail; the goal and the method
   ledger are the sheet it answers on. A skill worksheet is a two-column page,
   not a full-width control strip above the answer. */
.skillview .skill-desk {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0; overflow: hidden;
}
.skillview .skill-desk > .skill-bar {
  grid-column: 1; grid-row: 1 / -1;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 0; min-height: 0; padding: 20px 24px 20px 0;
  border: 0; border-right: 1px solid var(--line);
  background: transparent; position: static;
}
/* The rail's own ground. The controls are a ticket stub beside the receipt:
   the same paper, one shade under it, so the column reads as a column without
   a card's border or a second panel's shadow. */
.shell[data-screen="tools"] .skillview .skill-desk > .skill-bar {
  background: var(--bg-2);
}
.skillview .skill-desk > .skill-bar .calc-bar-fields {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 0; width: 100%;
}
.skillview .skill-desk > .skill-bar .calc-group {
  display: flex; flex-direction: column; align-items: stretch;
  justify-content: flex-start; gap: 6px;
  width: 100%; padding: 14px 0;
  border: 0; border-top: 1px solid var(--line-soft);
}
.skillview .skill-desk > .skill-bar .calc-group:first-child {
  padding-top: 0; border-top: 0;
}
.skillview .skill-desk > .skill-bar .calc-group > .calc-group-label {
  color: var(--ink-2);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
  letter-spacing: 0;
}
.skillview .skill-desk > .skill-bar .calc-group-row { width: 100%; }
.skillview .skill-desk > .skill-bar .skill-filter-group { gap: 10px; }
.skillview .skill-desk > .skill-bar .calc-filter-block {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 6px; min-width: 0;
  margin: 0; padding: 10px 0 0;
  border: 0; border-top: 1px solid var(--line-soft);
}
.skillview .skill-desk > .skill-bar .calc-filter-block > .calc-filter-label {
  color: var(--ink-3);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--sans);
  letter-spacing: 0;
}

/* Current and target are one goal, read across, not two field groups. */
.skill-goal-matrix {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 12px minmax(0, 1fr);
  align-items: center; column-gap: 8px; row-gap: 4px;
  min-width: 0;
}
.skill-goal-heading {
  padding-bottom: 2px; color: var(--ink-4);
  font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
}
.skill-goal-heading.is-target { color: var(--ink-3); }
.skill-goal-axis {
  color: var(--ink-4); text-align: right;
  font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  letter-spacing: .06em; text-transform: uppercase;
}
.skill-goal-arrow { display: block; width: 12px; height: 8px; color: var(--ink-4); }
.skill-goal-field { display: block; min-width: 0; }
.skill-goal-field .calc-input-line { height: 34px; }
.skill-goal-field input { height: 32px; font-size: var(--text-label); }
.skill-goal-field.is-current input { color: var(--ink-3); }
.skill-goal-field.is-target input { color: var(--ink); }
.skill-goal-delta {
  display: flex; justify-content: flex-end; gap: 4px;
  margin: 8px 0 0; padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-4); font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.skill-goal-delta b { color: var(--ink-3); font-weight: var(--fw-medium); }
.skillview .skill-desk > .skill-bar .calc-checks {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  width: 100%;
}
.skillview .skill-desk > .skill-bar .calc-pouch-note {
  margin: 0;
  color: var(--ink-4);
  font: var(--fw-regular) var(--text-micro)/1.45 var(--sans);
}
.skillview .skill-desk > .skill-bar .calc-pouch-group .calc-check {
  white-space: normal;
}
.skillview .skill-desk > .skill-bar .calc-pouch-group .calc-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 8px;
}
@media (min-width: 901px) {
  .skillview .skill-desk > .skill-bar {
    overflow-y: auto;
    scrollbar-width: thin;
  }
}
.skillview .skill-desk > .skill-bar .calc-check {
  width: 100%; margin: 0; padding: 6px 0; border-radius: 4px;
  transition: background-color var(--t-quick) var(--ease),
    color var(--t-quick) var(--ease);
}
.skillview .skill-desk > .skill-bar .calc-check:hover {
  background: var(--hover); color: var(--ink);
}
.skillview .skill-desk > .skill-bar .calc-check:has(input:checked) {
  color: var(--ink);
}
.skillview .skill-desk > .skill-bar .calc-check input {
  width: 16px; height: 16px;
}
.skillview .skill-desk > .skill-bar .calc-check input:focus-visible {
  outline: 2px solid var(--accent-line); outline-offset: 2px;
}
.skillview .skill-desk > .skill-bar .calc-input-line {
  padding: 0 6px; border-radius: 4px 4px 0 0;
  transition: border-color var(--t-quick) var(--ease),
    background-color var(--t-quick) var(--ease);
}
.skillview .skill-desk > .skill-bar .calc-input-line:hover {
  border-bottom-color: var(--line-strong);
}
.skillview .skill-desk > .skill-bar .calc-input-line:focus-within {
  background: var(--accent-soft); border-bottom-color: var(--accent);
}
.skillview .skill-desk > .skill-bar .calc-hiscore-note {
  flex: 0 0 auto; width: 100%; margin-top: 4px;
}
.skillview .skill-desk > .skill-bar .calc-hiscore-note:empty { display: none; }
.skillview .skill-desk > .skill-bar .calc-bar-actions {
  width: 100%; margin: auto 0 0; padding-top: 14px;
  border-top: 1px solid var(--line-soft); justify-content: flex-start;
}
.skillview .skill-main {
  grid-column: 2; grid-row: 1 / -1;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; padding: 0 0 20px 28px;
}

/* The table's 840px floor is a desk measure. Between a phone and a desk the
   ledger is narrower than that, so the reader had to scroll sideways for the
   Net column; here the table takes the column and squeezes its cells instead. */
@media (min-width: 901px) and (max-width: 1265px) {
  .skillview .skill-ledger .skill-table { min-width: 0; }
  /* The method and materials cells keep a desk floor as well; with the sheet's
     narrower ledger they are what pushes the Net column out of reach. */
  .skillview .skill-ledger .skill-table .skill-method-cell,
  .skillview .skill-ledger .skill-table .skill-materials { min-width: 0; }
}

/* On a phone the goal reads first, then the ticket, then the ledger. */
@media (max-width: 900px) {
  .skillview .skill-desk {
    display: flex; flex-direction: column;
    min-height: 0; overflow: visible;
  }
  .skillview .skill-desk > .skill-bar {
    order: 2; width: 100%; padding: 16px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .skillview .skill-main { display: contents; }
  .skillview .skill-ledger { order: 3; padding: 16px 0 20px; }
}

/* --------------------------------------------------------------- ticket --- */

.skillview .data-form { padding: 20px 24px 22px; }
.skill-form .calc-hiscore-note { flex-basis: 100%; }
.skill-form .calc-hiscore-note.bad { color: var(--down); }
.skill-form .calc-hiscore-note:empty { display: none; }
.skill-form .tool-field-head label,
.skill-form .tool-field-label { color: var(--ink-3); font-size: var(--text-label); }

/* ---------------------------------------------------------------- ledger --- */

.skill-ledger { padding-top: 16px; }
.skill-ledger-head { align-items: center; }
/* The worksheet stays inside the viewport on a desk. The controls hold the
   rail; the ledger takes its content height until the table has to scroll,
   then it shrinks to the available space. */
@media (min-width: 901px) {
  .skillview .skill-ledger {
    display: flex; flex-direction: column;
    flex: 0 1 auto; min-height: 0; padding-bottom: 0;
  }
  .skillview .skill-table-scroll {
    flex: 1 1 auto; min-height: 0; max-height: none;
  }
}
.skill-table-scroll {
  max-height: min(56vh, 620px);
  overflow-x: auto; overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.skill-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--card);
  box-shadow: inset 0 -1px var(--line);
}
.skill-table {
  /* One item scale for the whole ledger: method art and material chips use
     the same box, so a ring is not visually louder than its ingredients. */
  --skill-icon-size: 18px;
  width: 100%; min-width: 840px;
  border-collapse: collapse; table-layout: auto;
}
.skill-table th {
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-4);
  font: var(--fw-regular) var(--text-micro)/1.2 var(--sans);
  text-align: left; white-space: nowrap;
}
.skill-table th.skill-num { text-align: right; }
.skill-sort {
  appearance: none; background: none; border: 0; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; font: inherit; letter-spacing: inherit;
  text-transform: none; white-space: nowrap; cursor: pointer;
}
.skill-sort:hover { color: var(--ink-2); }
.skill-sort:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.skill-table th[aria-sort="ascending"] .skill-sort::after { content: "↑"; color: var(--accent); }
.skill-table th[aria-sort="descending"] .skill-sort::after { content: "↓"; color: var(--accent); }
.skill-table th.skill-num .skill-sort { text-align: right; }
.skill-sortbar { display: none; }
.skill-sort-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center;
  height: 40px; min-width: 44px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 5px;
  background: transparent; color: var(--ink-3);
  font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
}
.skill-sort-chip:hover { color: var(--ink); }
.skill-sort-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skill-sort-chip[aria-pressed="true"] {
  border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent);
}
@media (max-width: 900px) {
  .skill-sortbar {
    display: flex; align-items: center; gap: 6px;
    width: 100%; padding: 0 24px 10px 0; overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  }
  .skill-sortbar::-webkit-scrollbar { display: none; }
  .skill-sort-chip { height: 44px; }
}
.skill-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-3); font-size: var(--text-label);
}
/* The board's generic table aligns and no-wraps every cell for the market
   columns. A skill row is prose: left-align the method, let its note wrap,
   and keep only the numeric columns right-aligned. */
.skillview .skill-table th,
.skillview .skill-table td { text-align: left; white-space: normal; }
.skillview .skill-table th.skill-num,
.skillview .skill-table td.skill-num,
.skillview .skill-table td.skill-net {
  text-align: right; white-space: nowrap;
}
.skillview .skill-table .skill-method-copy { flex: 1 1 auto; }
.skill-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.skill-lvl { width: 32px; }
.skill-lvl span {
  color: var(--ink-3);
  font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.skill-method-cell { min-width: 205px; }
.skill-method { display: flex; align-items: center; min-width: 0; }
.skill-method-icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 26px; height: 26px; margin-right: 9px; padding: 2px;
  border-radius: 4px; background: var(--field);
}
.skill-method-img {
  width: 22px; height: 22px;
  object-fit: contain; image-rendering: pixelated;
}
.skill-method-copy { min-width: 0; }
.skill-method-copy b {
  display: block; color: var(--ink-2);
  font-size: var(--text-label); font-weight: var(--fw-medium);
  line-height: var(--leading-heading);
}
.skill-num {
  text-align: right; white-space: nowrap;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.skill-materials { min-width: 156px; }
.skill-reagent {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 8px 3px 0;
  color: var(--ink-3); font-size: var(--text-micro);
  white-space: nowrap;
}
.skill-reagent-img {
  width: var(--skill-icon-size); height: var(--skill-icon-size);
  object-fit: contain; image-rendering: pixelated;
}
.skill-none { color: var(--ink-4); }
.skill-net {
  text-align: right; white-space: nowrap;
  color: var(--ink-2);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.skill-net.up { color: var(--up); }
.skill-net.down { color: var(--down); }
.skill-row.is-locked .skill-method-copy b { color: var(--ink-3); }
.skillview:has([data-skill-filter]:checked) .skill-row.is-locked { display: none; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 900px) {
  /* The app shell is fixed-height on desk. A skill worksheet is a document on
     a phone, so the root scroll box has to grow with the result and the
     ledger instead of clipping them at the first viewport. */
  html:has(.skillview),
  body:has(.skillview) {
    height: auto; min-height: 100%; overflow: auto;
  }
  .skillview .data-desk {
    display: flex; flex-direction: column;
    min-height: 0; overflow: visible;
  }
  .skillview .data-result { order: 1; border-bottom: 1px solid var(--line); }
  .skillview .data-form {
    order: 2; border-right: 0; border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .skillview .data-table {
    display: block; order: 3;
    overflow: visible;
  }
  .skill-table { min-width: 600px; }
  /* The ledger is a document on a phone, not a scrollport. Leaving one axis
     auto keeps the other axis a scroll container, and `contain` then swallows
     the wheel before the page can move; make both axes visible. */
  .calcview .skill-ledger .skill-table-scroll {
    max-height: none; overflow: visible; overscroll-behavior: auto;
  }
  .bench-list-grid { grid-template-columns: minmax(0, 1fr); }
  .bench-list-grid .bench-tool { min-height: 56px; }
}

@media (max-width: 760px) {
  .skill-mast .page-mast-title { font-size: var(--text-heading); }
  .skill-ledger .calc-read-head { flex-wrap: wrap; align-items: flex-start; gap: 4px 16px; }
  .skillview .data-form { padding: 16px; }
  .skillview .data-result { padding: 16px; }
  .skillview .data-table { padding: 14px 16px 18px; }
  .skill-table th, .skill-table td { padding-left: 6px; padding-right: 6px; }

  .skill-ledger-head { align-items: flex-start; }
}

/* At phone and tablet widths the ledger becomes a compact method list. The
   row is read in one glance: level, method and net on the top line; XP and
   actions together beneath; materials last. Desktop keeps the full table. */
@media (max-width: 900px) {
  .board-body .skill-ledger .skill-table {
    display: block; width: 100%; min-width: 0;
    border-collapse: separate;
  }
  .board-body .skill-ledger .skill-table thead { display: none; }
  .board-body .skill-ledger .skill-table tbody { display: block; }
  .board-body .skill-ledger .skill-table tr {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) minmax(84px, auto);
    grid-template-areas:
      "lvl method method net"
      ". xp runs runs"
      ". materials materials materials";
    column-gap: 8px; row-gap: 7px;
    align-items: start;
    padding: 12px 10px 13px;
    border-bottom: 1px solid var(--line-soft);
  }
  /* No materials on this page means no reserved materials row in the card. */
  .board-body .skill-ledger .skill-table.no-materials tr {
    grid-template-areas:
      "lvl method method net"
      ". xp runs runs";
  }
  /* The worksheet's base cells carry desktop padding and a rule per cell. A
     phone row owns both now: one rule per method, no inner boxes. */
  .shell[data-screen="tools"] #board.board-body .skillview .skill-ledger .skill-table tbody td {
    display: block; width: auto; height: auto;
    padding: 0; border: 0; background: transparent;
    text-align: left; white-space: normal;
    overflow: visible; text-overflow: clip;
  }
  .shell[data-screen="tools"] #board.board-body .skillview .skill-ledger .skill-table tbody td.skill-num,
  .shell[data-screen="tools"] #board.board-body .skillview .skill-ledger .skill-table tbody td.skill-net {
    white-space: nowrap;
  }
  .board-body .skill-ledger .skill-table td.skill-lvl {
    grid-area: lvl; width: auto; text-align: left;
  }
  .board-body .skill-ledger .skill-table .skill-method-cell {
    grid-area: method; min-width: 0;
  }
  .board-body .skill-ledger .skill-table .skill-method {
    align-items: flex-start; gap: 8px;
  }
  .board-body .skill-ledger .skill-table .skill-method-icon {
    width: 26px; height: 26px; margin: 0; padding: 2px;
  }
  .board-body .skill-ledger .skill-table .skill-method-copy b {
    color: var(--ink); font-size: var(--text-label);
    font-weight: var(--fw-semibold); line-height: 1.25;
  }
  .board-body .skill-ledger .skill-table .skill-num[data-label="XP"] { grid-area: xp; }
  .board-body .skill-ledger .skill-table .skill-runs { grid-area: runs; }
  .board-body .skill-ledger .skill-table .skill-materials {
    grid-area: materials; display: flex; flex-wrap: wrap;
    align-items: baseline; gap: 3px 6px;
  }
  .board-body .skill-ledger .skill-table .skill-net {
    grid-area: net; align-self: start;
    padding: 0; text-align: right;
    font-size: var(--text-label); font-weight: var(--fw-semibold);
  }
  .board-body .skill-ledger .skill-table td.skill-num {
    font-size: var(--text-label);
  }
  .board-body .skill-ledger .skill-table .skill-reagent {
    font-size: var(--text-micro);
  }
  .board-body .skill-ledger .skill-table .skill-lvl span {
    display: grid; place-items: center;
    width: 24px; height: 24px;
    border: 1px solid var(--line); border-radius: 4px;
    background: var(--field); color: var(--ink-2);
    font-size: var(--text-label);
  }
  .board-body .skill-ledger .skill-table td[data-label]::before {
    content: attr(data-label);
    display: block; margin: 0 0 2px;
    color: var(--ink-3);
    font: var(--fw-semibold) var(--text-micro)/1.1 var(--mono);
    letter-spacing: .02em; text-transform: uppercase;
  }
  .board-body .skill-ledger .skill-table td.skill-lvl::before { content: none; }
  /* XP and actions share one reading line; their labels sit in the line. The
     server's compact "#" is the table's column name, but "Actions" is what
     the number means to someone reading one row on a phone. */
  .board-body .skill-ledger .skill-table td[data-label="XP"]::before,
  .board-body .skill-ledger .skill-table td.skill-runs::before {
    display: inline; margin: 0 4px 0 0;
  }
  .board-body .skill-ledger .skill-table td.skill-runs::before { content: "Actions"; margin-right: 6px; }
  .board-body .skill-ledger .skill-table td.skill-materials::before {
    display: inline; margin: 0 6px 0 0; flex: 0 0 auto;
  }
  .board-body .skill-ledger .skill-table .skill-net::before {
    content: "Net"; display: block; margin: 0 0 2px;
  }
  .board-body .skill-ledger .skill-table .skill-reagent { margin: 0; }
  .board-body .skill-ledger .skill-table .skill-net.up { color: var(--up); }
  .board-body .skill-ledger .skill-table .skill-net.down { color: var(--down); }

  /* The worksheet's desktop 14px table rule outranks the compact cell rules.
     Keep the phone at the smaller scale it had before the readability pass. */
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table tbody td.skill-num,
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td.skill-net {
    font-size: var(--text-label);
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table .skill-method-copy b {
    font-size: var(--text-label);
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table .skill-reagent {
    font-size: var(--text-micro);
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td[data-label]::before {
    font-size: 11px;
  }
  /* The mobile cell reset turns every cell left; money must stay right-edged. */
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td.skill-net {
    text-align: right;
  }
  /* The cell reset also drops the materials flex context. Without it the
     caption and the reagent sit on different inline baselines. */
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td.skill-materials {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 4px;
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td.skill-materials::before {
    margin: 0;
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table .skill-reagent {
    align-items: baseline;
  }
}

@media (max-width: 440px) {
  .skill-form .calc-hiscore-note { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .skill-sortbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding-right: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .skill-sort-chip {
    width: 100%; min-width: 0; height: 44px;
    padding: 0 2px; justify-content: center;
    font-size: var(--text-micro); letter-spacing: -.01em;
  }
  #shell[data-screen="tools"] #board .toolview.calcview .skill-sortbar .skill-sort-chip {
    font-size: 12px; letter-spacing: -.04em;
  }
}

/* At the narrowest phone the category select crowded the method search until
   its placeholder was cut off. Stack the two controls instead of shrinking
   the field below a readable measure. */
@media (max-width: 340px) {
  .skill-sort-chip { padding: 0 1px; letter-spacing: -.03em; }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table .skill-reagent {
    font-size: 12px; letter-spacing: -.03em;
  }
  #shell[data-screen="tools"] #board .toolview.calcview #skill-methods-table td.skill-materials {
    gap: 3px 2px;
  }
  .calcview .skill-ledger .skill-method-tools { flex-wrap: wrap; }
  .calcview .skill-ledger .skill-method-search,
  .calcview .skill-ledger .skill-method-category {
    flex: 1 1 100%; max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bench-tool, .skill-reset { transition: none; }
}

/* ------------------------------------------------------------ toolboxes --- */

/* The wiki-backed tools share a workbench, not one fixed grid. DPS needs a
   tall setup rail; the two-input money tools open with a control band; the
   account planner gives the skill sheet and the quest ledger the full width. */

.toolbox-select {
  width: 100%; min-width: 0; height: 36px;
  padding: 0 22px 0 0;
  border: 0; outline: 0;
  background: transparent; color: var(--ink);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  cursor: pointer;
}
.toolbox-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toolboxview { --toolbox-rail: 340px; }
.toolboxview .calc-group-fields {
  display: flex; flex-direction: column; gap: 0; min-width: 0;
}
.toolboxview .calc-input { min-width: 0; }
.toolboxview .calc-submit {
  flex: 1 1 auto; height: 40px; padding: 0 14px;
  border: 0; border-radius: 5px;
  background: var(--accent); color: var(--on-accent);
  font: var(--fw-medium) var(--text-label)/1 var(--sans); cursor: pointer;
  transition: background var(--t-quick) var(--ease);
}
.toolboxview .calc-submit:hover { background: var(--accent-2); }
.toolboxview .calc-submit:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.toolboxview .calc-reset {
  flex: 0 0 auto; color: var(--ink-4);
  font-size: var(--text-label); text-decoration: none;
}
.toolboxview .calc-reset:hover { color: var(--ink); }
.toolboxview .toolbox-live-status {
  margin-right: auto; color: var(--down);
  font-size: var(--text-micro);
}
.toolboxview .toolbox-live-status:empty { display: none; }
.toolboxview[aria-busy="true"] .skill-main {
  opacity: .55; transition: opacity var(--t-quick) var(--ease);
}

/* --------------------------------------------------------------- split ---- */

/* DPS is the one calculator with a long setup. Give it a wider rail, pair the
   level fields, and leave the answer and the gear ledger the rest of the desk. */
.toolboxview-split .skill-desk {
  display: grid;
  grid-template-columns: var(--toolbox-rail) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0; overflow: hidden;
}
.toolboxview-split .skill-desk > .skill-bar {
  grid-column: 1; grid-row: 1 / -1;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 0; min-height: 0; padding: 18px 24px 18px 0;
  border: 0; border-right: 1px solid var(--line);
  background: transparent; position: static; overflow: hidden;
}
.toolboxview-split .skill-desk > .skill-bar .calc-bar-fields {
  flex: 1 1 0; min-height: 0; padding-right: 6px;
  flex-wrap: nowrap; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.toolboxview-split .calc-group {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 8px; width: 100%; margin: 0;
  padding: 14px 0; border: 0; border-top: 1px solid var(--line-soft);
}
.toolboxview-split .calc-group:first-child {
  padding-top: 0; border-top: 0;
}
.toolboxview-split .calc-group > .calc-group-label {
  color: var(--ink-2);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
  letter-spacing: 0;
}
.toolboxview-split .calc-group-fields {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 12px; width: 100%;
}
.toolboxview-split .calc-group:nth-child(1) .calc-group-fields,
.toolboxview-split .calc-group:nth-child(3) .calc-group-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.toolboxview-split .calc-group-fields:not(:has(.calc-input-attack-type)) .calc-input-style {
  grid-column: 1 / -1;
}
.toolboxview-split .calc-input { width: 100%; margin: 0; }
.toolboxview-split .calc-input-line { width: 100%; }
.dps-skill-grid {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; min-width: 0;
}
.dps-skill-grid .calc-input-label.has-icon {
  display: flex; align-items: center; gap: 5px;
}
.toolbox-skill-icon {
  width: 15px; height: 15px; flex: 0 0 15px;
  object-fit: contain; image-rendering: pixelated;
}
.toolboxview-split .calc-group.dps-boosts-group .calc-group-fields {
  grid-template-columns: minmax(0, 1fr);
}
.dps-prayer-summary .calc-input-label.has-icon {
  display: flex; align-items: center; gap: 5px;
}
.toolboxview-split .calc-bar-actions {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: auto 0 0; padding-top: 14px;
  border-top: 1px solid var(--line-soft); justify-content: flex-start;
}
.toolboxview-split .skill-main {
  grid-column: 2; grid-row: 1 / -1;
  display: block; min-width: 0; min-height: 0;
  padding: 0 0 20px 28px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.toolboxview-split .skill-main .calc-reading:first-child { padding-top: 16px; }

/* ---------------------------------------------------------------- gear ---- */

/* The gear desk is the equipment tab, not a card tray: one warm panel, the
   game's three-column silhouette, and the totals in their own rail. */
.dps-gear { padding: 18px 0 30px; border-top: 1px solid var(--line); }
.dps-gear .calc-read-head { padding-bottom: 10px; }
.dps-gear .tax-state { color: var(--accent); }
.dps-grid {
  display: grid;
  grid-template-columns: repeat(3, 78px);
  grid-template-rows: repeat(5, 78px);
  grid-template-areas:
    ". head ."
    "cape neck ammo"
    "weapon body shield"
    ". legs ."
    "hands feet ring";
  gap: 6px;
  place-content: center;
  padding: 18px 20px;
}
.dps-slot {
  position: relative;
  display: grid; place-items: center;
  min-width: 0; min-height: 0; padding: 0;
  border: 1px solid var(--line); border-radius: 2px;
  background: var(--card); color: var(--ink-2);
  font: inherit; text-align: left; cursor: pointer;
  appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), inset 0 -1px 0 rgba(0, 0, 0, .45);
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease), box-shadow var(--t-quick) var(--ease);
}
.dps-slot:hover { border-color: var(--accent-line); background: var(--card-2); }
.dps-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dps-slot.is-open {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.dps-slot.is-locked { cursor: default; opacity: .55; }
.dps-slot-label, .dps-slot-name {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.dps-slot-icon { display: grid; place-items: center; width: 46px; height: 46px; }
.dps-slot-img { width: 40px; height: 40px; object-fit: contain; }
.dps-slot-glyph { width: 30px; height: 30px; color: var(--ink-4); }
.dps-slot:hover .dps-slot-glyph,
.dps-slot:focus-visible .dps-slot-glyph { color: var(--accent); }
.dps-slot.is-locked .dps-slot-glyph { color: var(--ink-4); }
.dps-slot-badge {
  position: absolute; right: 4px; bottom: 3px;
  color: var(--ink-4); font: var(--fw-medium) var(--text-micro)/1 var(--mono);
  letter-spacing: .03em;
}
.dps-bonus {
  display: flex; flex-direction: column;
  min-width: 0; padding: 18px;
  border-left: 1px solid var(--line-soft);
  background: var(--card);
}
.dps-bonus-label {
  color: var(--ink-2);
  font: var(--fw-medium) var(--text-micro)/1 var(--sans);
  letter-spacing: .06em; text-transform: uppercase;
}
.dps-bonus-list { display: grid; margin: 14px 0 0; }
.dps-bonus-list > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line-soft);
}
.dps-bonus-list > div:last-child { border-bottom: 1px solid var(--line-soft); }
.dps-bonus-list dt {
  color: var(--ink-2); font: var(--fw-regular) var(--text-label)/1.2 var(--sans);
}
.dps-bonus-list dd {
  margin: 0; color: var(--ink);
  font: var(--fw-medium) var(--text-title)/1 var(--sans);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dps-bonus-list dd span {
  margin-left: 4px; color: var(--ink-4);
  font: var(--fw-medium) var(--text-micro)/1 var(--mono);
}

/* The prayer book is the same warm inventory page as the gear silhouette.
   A prayer stays lit until it is clicked again or another one is chosen. */
.dps-prayer {
  padding: 18px 0 30px; border-top: 1px solid var(--line);
  scroll-margin-top: 16px;
}
.dps-prayer .calc-read-head { padding-bottom: 10px; }
.dps-prayer .tax-state { color: var(--accent); }
.dps-prayer-book {
  max-width: 720px; padding: 14px;
  border: 1px solid var(--line-strong); border-radius: 5px;
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), var(--shadow);
}
.dps-prayer-form { margin: 0; }
.dps-prayer-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px; padding-top: 10px;
}
.dps-prayer-card {
  position: relative; display: flex; align-items: center; gap: 9px;
  min-width: 0; min-height: 62px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 2px;
  background: var(--card); color: var(--ink-2);
  font: inherit; text-align: left; cursor: pointer; appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), inset 0 -1px 0 rgba(0, 0, 0, .45);
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease), box-shadow var(--t-quick) var(--ease);
}
.dps-prayer-card:hover { border-color: var(--accent-line); background: var(--card-2); }
.dps-prayer-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dps-prayer-card.is-active {
  border-color: var(--accent); background: var(--accent-soft);
}
.dps-prayer-card.is-active::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.dps-prayer-icons { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.dps-prayer-icon { width: 26px; height: 26px; flex: 0 0 26px; object-fit: contain; }
.dps-prayer-card.is-active .dps-prayer-none-icon { color: var(--accent); }
.dps-prayer-name {
  color: var(--ink); font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
}
.dps-prayer-detail {
  color: var(--ink-4); font: var(--fw-regular) var(--text-micro)/1.3 var(--sans);
}
.dps-prayer-card.is-active .dps-prayer-name { color: var(--ink); }
.dps-prayer-card.is-active .dps-prayer-detail { color: var(--ink-2); }

.dps-picker {
  grid-column: 1 / -1;
  margin: 0; padding: 14px 18px 16px;
  border: 0; border-top: 1px solid var(--line-strong); border-radius: 0;
  background: var(--bg-2); box-shadow: none;
}
.dps-picker-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.dps-picker-head h3 {
  color: var(--ink); font: var(--fw-medium) var(--text-body)/1.2 var(--sans);
}
.dps-picker-close {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: 3px;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.dps-picker-close svg { width: 16px; height: 16px; }
.dps-picker-close:hover { border-color: var(--accent-line); background: var(--card-2); color: var(--ink); }
.dps-picker-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dps-picker-filter { display: block; margin: 9px 0 6px; }
.dps-picker-filter input {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 3px;
  background: var(--card); color: var(--ink);
  font: var(--fw-regular) var(--text-label)/1 var(--sans);
}
.dps-picker-filter input::placeholder { color: var(--ink-4); }
.dps-picker-filter input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dps-picker-count {
  margin: 0 0 7px; color: var(--ink-2);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}
.dps-picker-form { margin: 0; }
.dps-pick-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  max-height: 310px; overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--accent-line) var(--card);
}
.dps-pick {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; min-height: 38px; padding: 5px 8px;
  border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--ink-2);
  font: var(--fw-regular) var(--text-micro)/1.25 var(--sans);
  text-align: left; cursor: pointer;
}
.dps-pick:hover { border-color: var(--accent-line); background: var(--card-2); }
.dps-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dps-pick[aria-current="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.dps-pick-img { width: 24px; height: 24px; flex: 0 0 24px; object-fit: contain; }
.dps-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dps-pick-empty {
  width: 24px; height: 24px; flex: 0 0 24px;
  border: 1px dashed var(--accent-line); border-radius: 2px;
}
.dps-pick-clear .dps-pick-name { color: var(--ink-2); }
.dps-picker-empty { margin: 0; padding: 10px 0 2px; color: var(--ink-2); font-size: var(--text-label); }

/* ---------------------------------------------------------------- band ---- */

/* Dry streak, boss profit and herb runs have two to four controls. A vertical
   rail would be mostly empty, so the controls become one ruled band and the
   answer gets the whole sheet underneath it. */
.toolboxview-band .skill-desk {
  display: flex; flex-direction: column;
  min-height: 0; overflow: visible;
}
.toolboxview-band .skill-desk > .skill-bar {
  order: 1; display: flex; flex: 0 0 auto;
  flex-flow: row wrap; align-items: flex-end;
  gap: 12px 24px; width: 100%; min-height: 0;
  padding: 14px 0 16px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; position: static; overflow: visible;
}
.toolboxview-band .skill-desk > .skill-bar .calc-bar-fields {
  display: flex; flex: 1 1 620px;
  flex-flow: row wrap; align-items: flex-end;
  gap: 12px 22px; width: auto; min-width: 0; overflow: visible;
}
.toolboxview-band .skill-desk > .skill-bar .calc-group {
  display: flex; flex: 0 1 auto; flex-direction: column; gap: 5px;
  width: auto; min-width: 0; margin: 0; padding: 0; border: 0;
}
.toolboxview-band .skill-desk > .skill-bar .calc-group + .calc-group {
  padding-left: 22px; border-left: 1px solid var(--line-soft);
}
.toolboxview-band .skill-desk > .skill-bar .calc-group-fields {
  display: flex; flex-direction: row; align-items: flex-end;
  flex-wrap: wrap; gap: 12px 16px; min-width: 0;
}
.toolboxview-band .skill-desk > .skill-bar .calc-input {
  flex: 0 1 auto; width: var(--toolbox-field-width, 160px); margin: 0;
}
.toolboxview-band .skill-desk > .skill-bar .calc-input-line { width: 100%; }
.toolboxview-band .skill-desk > .skill-bar .calc-bar-actions {
  display: flex; flex: 0 0 auto; align-items: center; gap: 10px;
  width: auto; margin: 0 0 0 auto; padding: 0; border: 0; align-self: flex-end;
}
.toolboxview-band .skill-desk > .skill-bar .calc-submit {
  flex: 0 0 auto; min-width: 150px; height: 38px;
}
.toolboxview-band .skill-main {
  order: 2; display: block; flex: 1 1 auto;
  min-height: 0; width: 100%; padding: 0;
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.toolboxview-band .toolbox-table-scroll { max-height: none; overflow: visible; }

/* The answer's number and its facts read as one band, not a hero stacked on a
   second equal-width block. */
.toolbox-answer-body {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
  gap: 18px 28px; align-items: end;
}
.toolbox-answer-body .calc-hero { padding: 12px 0 8px; align-content: end; }
/* The facts are a column beside the hero figure, not a register: their rules
   began and ended inside the block, so the sheet showed lines running nowhere. */
.toolboxview .calc-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.toolboxview .calc-facts > div {
  padding: 8px 12px 9px;
}
.toolboxview .calc-facts > div:nth-child(odd) {
  padding-left: 0;
}
.toolboxview .calc-facts > div:nth-child(-n + 2) {
  padding-top: 0;
}
.toolboxview .calc-facts dd { white-space: normal; }
.toolboxview .calc-read-head h2 {
  color: var(--ink-2);
  font: var(--fw-medium) var(--text-body)/1.2 var(--sans);
}

/* Boss loot and supplies are two halves of one statement; the same split
   gives the dry-streak answer its threshold table. */
.toolbox-split-results,
.toolbox-ledger-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px; align-items: start; min-width: 0;
}
.toolbox-split-results > .calc-reading,
.toolbox-ledger-grid > .calc-reading {
  min-width: 0; padding: 16px 0 18px;
}
.toolbox-split-results > .calc-reading + .calc-reading,
.toolbox-ledger-grid > .calc-reading + .calc-reading {
  padding-left: 32px; border-left: 1px solid var(--line-soft);
}
.toolbox-ledger-grid {
  border-top: 1px solid var(--line); margin-top: 2px;
}
.toolbox-ledger-grid > .calc-ledgerwrap { border-top: 0; padding-top: 16px; }

/* -------------------------------------------------------------- account --- */

/* The skill sheet is a compact account summary, not a 24-row table holding the
   quest ledger off the bottom of the page. */
.toolbox-profile { min-width: 0; padding: 16px 0 0; }
.toolbox-profile .calc-read-head { padding-bottom: 10px; }
.toolbox-profile > .calc-read-head h2 {
  color: var(--ink); font: var(--fw-medium) var(--text-body)/1.2 var(--sans);
}
.toolbox-skill-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px; margin: 10px 0 0; padding: 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--line-soft);
}
.toolbox-skill {
  min-width: 0; padding: 8px 11px 9px; background: var(--bg);
}
.toolbox-skill dt {
  overflow: hidden; color: var(--ink-4);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--mono);
  letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap;
}
.toolbox-skill dd {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin: 4px 0 0;
}
.toolbox-skill dd b {
  color: var(--ink); font: var(--fw-medium) var(--text-label)/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
}
.toolbox-skill dd span {
  overflow: hidden; color: var(--ink-4); text-overflow: ellipsis;
  font: var(--fw-regular) var(--text-micro)/1.2 var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.toolbox-profile + .toolbox-quests { border-top: 0; padding-top: 14px; }
.toolboxview-band .skill-main > .calc-ledgerwrap:first-child { border-top: 0; }
.toolbox-quests { min-width: 0; }
.toolbox-quests .calc-read-head { margin-bottom: 8px; }

.toolbox-empty,
.toolbox-error {
  margin: 0; padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3); font-size: var(--text-label);
}
.toolbox-error { color: var(--down); }

/* ---------------------------------------------------------------- tables -- */

.toolbox-table-scroll {
  overflow: auto; max-height: min(52vh, 560px);
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.toolbox-table {
  width: 100%; border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
/* The board's default table cell is right-aligned mono. A toolbox ledger is
   read left to right: names and thresholds left, figures right. */
.board-body .toolboxview .toolbox-table th,
.board-body .toolboxview .toolbox-table td {
  text-align: left; font-family: var(--sans); font-weight: var(--fw-regular);
}
.board-body .toolboxview .toolbox-table th {
  color: var(--ink-4);
  font-family: var(--mono); font-weight: var(--fw-medium);
  white-space: nowrap;
}
.board-body .toolboxview .toolbox-table td {
  color: var(--ink-3); white-space: normal;
}
.board-body .toolboxview .toolbox-table th.skill-num,
.board-body .toolboxview .toolbox-table td.skill-num {
  text-align: right; font-family: var(--mono);
}
.board-body .toolboxview .toolbox-table td.skill-num { white-space: nowrap; }
.board-body .toolboxview .toolbox-table tbody tr { cursor: default; }
.toolbox-table th {
  padding: 0 12px 8px; border-bottom: 1px solid var(--line);
  color: var(--ink-4);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--mono);
  letter-spacing: .05em; text-align: left; text-transform: uppercase;
  white-space: nowrap;
}
.toolbox-table th.skill-num { text-align: right; }
.toolbox-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3); font-size: var(--text-label);
  vertical-align: middle;
}
.toolbox-table tbody tr:last-child td { border-bottom: 0; }
.toolbox-table tbody tr:hover td { background: var(--hover); }
.toolbox-table td:first-child { color: var(--ink-2); }
.toolbox-table td.skill-num {
  color: var(--ink-2); text-align: right; white-space: nowrap;
  font-family: var(--mono);
}
/* Boss and herb ledgers carry the same four columns. Fixing the widths keeps
   long item names from being squeezed by the three numeric columns. */
.toolbox-ledger-grid .toolbox-table { table-layout: fixed; }
.toolbox-ledger-grid .toolbox-table th:nth-child(1) { width: 42%; }
.toolbox-ledger-grid .toolbox-table th:nth-child(2) { width: 16%; }
.toolbox-ledger-grid .toolbox-table th:nth-child(3) { width: 21%; }
.toolbox-ledger-grid .toolbox-table th:nth-child(4) { width: 21%; }
.toolbox-ledger-grid .toolbox-table-scroll {
  max-height: min(45vh, 400px); overflow-y: auto;
}
.toolbox-ledger-grid .toolbox-table thead th,
.toolbox-quests .toolbox-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
}
.toolbox-quests .toolbox-table { table-layout: fixed; }
.toolbox-quests .toolbox-table th:nth-child(1) { width: 24%; }
.toolbox-quests .toolbox-table th:nth-child(2) { width: 12%; }
.toolbox-quests .toolbox-table th:nth-child(3) { width: 12%; }
.toolbox-quests .toolbox-table th:nth-child(4) { width: 52%; }
.toolbox-quests .toolbox-table td:first-child { padding-right: 20px; }
.toolbox-req-note {
  display: block; min-width: 0; max-width: 100%;
  color: var(--ink-3); font-size: var(--text-label); line-height: 1.45;
}
.toolbox-guide-item { color: var(--ink-2); }
.toolbox-quest-name b { color: var(--ink-2); font-weight: var(--fw-medium); }
.toolbox-reqs { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.toolbox-req {
  display: inline-flex; align-items: center;
  min-height: 22px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink-3); font: var(--fw-medium) var(--text-micro)/1.2 var(--mono);
  white-space: nowrap;
}
.toolbox-req.is-met {
  border-color: color-mix(in srgb, var(--up) 36%, var(--line));
  background: color-mix(in srgb, var(--up) 7%, transparent);
  color: var(--up);
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1180px) {
  .toolbox-skill-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  html:has(.toolboxview),
  body:has(.toolboxview) {
    height: auto; min-height: 100%; overflow: auto;
  }
  .toolboxview .skill-desk {
    display: flex; flex-direction: column;
    min-height: 0; overflow: visible;
  }
  .toolboxview .skill-main {
    display: block; width: 100%; overflow: visible;
  }
  .toolboxview-band .skill-desk > .skill-bar {
    order: 1; flex-direction: column; align-items: stretch;
    gap: 12px; width: 100%; padding: 16px;
    border-right: 0; border-top: 0; border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .toolboxview-band .skill-desk > .skill-bar .calc-bar-fields {
    display: flex; flex-direction: column; flex: 0 0 auto;
    align-items: stretch; gap: 12px; width: 100%; overflow: visible;
  }
  .toolboxview-band .skill-desk > .skill-bar .calc-group + .calc-group {
    padding-left: 0; padding-top: 12px;
    border-left: 0; border-top: 1px solid var(--line-soft);
  }
  .toolboxview-band .skill-desk > .skill-bar .calc-group-fields {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px; width: 100%;
  }
  .toolboxview-band .skill-desk > .skill-bar .calc-input { width: auto; }
  .toolboxview-band .skill-desk > .skill-bar .calc-bar-actions {
    width: 100%; margin: 2px 0 0; padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }
  .toolboxview-band .skill-desk > .skill-bar .calc-submit { flex: 1 1 auto; }
  .toolboxview .skill-desk > .skill-bar .calc-bar-actions:not(:has(.calc-submit)) {
    width: 100%; margin: 0; padding-top: 0;
    border-top: 0; justify-content: flex-end;
  }
  .toolboxview-band .skill-main {
    order: 2; padding: 0 16px 78px; overflow: visible;
  }
  .toolboxview-split .skill-desk > .skill-bar {
    order: 2; width: 100%; padding: 16px 16px 24px;
    border-right: 0; border-top: 1px solid var(--line); border-bottom: 0;
    overflow: visible;
  }
  .toolboxview-split .skill-desk > .skill-bar .calc-bar-fields {
    flex: 0 0 auto; overflow: visible;
  }
  .toolboxview-split .calc-group-fields,
  .toolboxview-split .calc-group:nth-child(1) .calc-group-fields,
  .toolboxview-split .calc-group:nth-child(3) .calc-group-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .toolboxview-split .calc-group:nth-child(2) .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolboxview-split .calc-group.dps-boosts-group .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolboxview-split .calc-bar-actions { margin-top: 14px; }
  .toolboxview-split .calc-submit { flex: 1 1 auto; }
  .toolboxview-split .skill-main { display: contents; }
  .toolboxview-split .skill-main > .calc-reading:first-child {
    order: 1; width: 100%; min-width: 0; padding: 16px 16px 18px;
  }
  .toolboxview-split .skill-main > .calc-reading:not(:first-child) {
    order: 3; width: 100%; min-width: 0; padding: 0 16px 80px;
  }
  .toolboxview-split .skill-main > .calc-reading.dps-prayer {
    padding: 14px 16px 18px;
  }
  .toolboxview-split .skill-main > .calc-reading.dps-gear {
    padding: 0 16px 80px;
  }
  .dps-prayer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolboxview .calc-submit,
  .toolboxview .calc-reset { min-height: 44px; }
  .toolboxview .calc-reset { display: inline-flex; align-items: center; }
  .toolboxview .skill-main .calc-reading { padding: 14px 0; }
  .toolboxview .skill-main .calc-reading:first-child { padding-top: 16px; }
  .toolboxview-band .skill-main > .calc-ledgerwrap:first-child { border-top: 0; }
  .toolbox-answer-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toolbox-answer-body .calc-hero { padding: 12px 0 10px; }
  .toolbox-split-results,
  .toolbox-ledger-grid {
    grid-template-columns: minmax(0, 1fr); gap: 0;
  }
  .toolbox-split-results > .calc-reading + .calc-reading,
  .toolbox-ledger-grid > .calc-reading + .calc-reading {
    padding-left: 0; padding-top: 16px;
    border-left: 0; border-top: 1px solid var(--line-soft);
  }
  .toolbox-ledger-grid { border-top: 1px solid var(--line); }
  .toolbox-ledger-grid > .calc-reading { padding-top: 16px; }
  .toolbox-ledger-grid > .calc-reading:first-child { padding-top: 16px; }
  .toolbox-profile { padding-top: 14px; }
  .toolbox-skill-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbox-profile + .toolbox-quests { padding-top: 14px; }
  .toolbox-table-scroll { max-height: none; overflow: visible; }
  .toolboxview .toolbox-ledger-grid .toolbox-table-scroll {
    max-height: min(56vh, 430px); overflow-y: auto;
  }
  .toolboxview .toolbox-quests .toolbox-table-scroll {
    max-height: min(62vh, 480px); overflow-y: auto;
  }
  .toolboxview-empty .skill-desk { display: block; }
  .toolboxview-empty .skill-main { padding: 0 16px 78px; }
  .toolboxview-empty .skill-desk > .skill-bar { display: none; }

  /* These pages live inside the board, whose phone table turns every row into
     a Buy/Sell card. Reset that geometry with enough specificity that the
     toolbox ledger is a ledger, not a market row. */
  .board-body .toolboxview .toolbox-table,
  .board-body .toolboxview .toolbox-table tbody {
    display: block; width: 100%; min-width: 0;
  }
  .board-body .toolboxview .toolbox-table thead { display: none; }
  .board-body .toolboxview .toolbox-table tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: none; gap: 7px 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  }
  .board-body .toolboxview .toolbox-table td:nth-child(n) {
    display: block; grid-area: auto; align-items: initial;
    width: auto; min-width: 0; padding: 0;
    border: 0; text-align: left; white-space: normal;
    color: var(--ink-3); font-size: var(--text-label);
  }
  .board-body .toolboxview .toolbox-table td::before { content: none; }
  .board-body .toolboxview .toolbox-table td:first-child {
    grid-column: 1 / -1; color: var(--ink-2);
  }
  .board-body .toolboxview .toolbox-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    color: var(--ink-4);
    font: var(--fw-medium) var(--text-micro)/1 var(--mono);
    letter-spacing: .04em; text-transform: uppercase;
  }
  .board-body .toolboxview .toolbox-table td.skill-num { text-align: left; }
  .board-body .toolboxview .toolbox-table td.toolbox-reqs { grid-column: 1 / -1; }
  /* A loot or supply row is four short fields, not a three-card stack. Keep the
     item on its own line, then read qty, unit price and value across one base. */
  .board-body .toolboxview .toolbox-ledger-grid .toolbox-table tr {
    gap: 6px 10px; padding: 10px 0;
  }
  .board-body .toolboxview .toolbox-ledger-grid .toolbox-table td[data-label]::before {
    margin-bottom: 2px;
  }

  .toolboxview-split .skill-main > .calc-reading.dps-gear {
    order: 3; width: 100%; padding: 16px 16px 80px;
  }
  .dps-pick-grid { grid-template-columns: minmax(0, 1fr); max-height: 300px; }
  .toolboxview[aria-busy="true"] .skill-main > * {
    opacity: .55; transition: opacity var(--t-quick) var(--ease);
  }
}

@media (max-width: 560px) {
  /* The equipment tab stays a paper doll at phone width, but its stat rail
     becomes a ruled strip under the slots instead of a second column. */
  .dps-bonus {
    border-left: 0; border-top: 1px solid var(--line-soft);
    padding: 12px 16px 14px;
  }
  .dps-bonus-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 8px;
  }
  .dps-bonus-list > div {
    display: block; padding: 0 10px;
    border-top: 0; border-left: 1px solid var(--line-soft);
  }
  .dps-bonus-list > div:first-child { padding-left: 0; border-left: 0; }
  .dps-bonus-list > div:last-child { border-bottom: 0; }
  .dps-bonus-list dt { font-size: var(--text-micro); }
  .dps-bonus-list dd { margin-top: 4px; font-size: var(--text-body); }
}

@media (max-width: 520px) {
  .board-body .toolboxview .toolbox-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .board-body .toolboxview .toolbox-ledger-grid .toolbox-table tr {
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.15fr) minmax(0, 1.15fr);
  }
  .toolbox-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolboxview .calc-hero b { font-size: 2rem; }
  .toolboxview .calc-facts > div { padding: 8px 10px; }
  .toolboxview .calc-facts > div:nth-child(odd) {
    padding-left: 0;
  }
  .dps-grid {
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(5, 72px);
    gap: 4px; padding: 14px 16px;
  }
  .dps-slot-icon { width: 42px; height: 42px; }
  .dps-slot-img { width: 36px; height: 36px; }
  .dps-slot-glyph { width: 28px; height: 28px; }
  .dps-picker { padding: 12px 14px 14px; }
  .dps-pick-grid { max-height: 280px; }
  .dps-prayer-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   DPS — one combat setup sheet
   ==========================================================================
   The setup is a compact rail. The answer is one reading, and the equipment
   and prayer books share one tabbed loadout page instead of stacking into a
   long document. Fields are boxed because they are editable, not labels. */

/* ============================================================== DPS -------- */

/* The DPS screen is a single combat workbench: an iron ground, warm brass
   only where it marks state, and the game's own equipment and prayer boards
   in the middle. The score is a calibrated reading, not a dashboard hero. Its type comes from
   the terminal's shared Roboto scale so it reads as the same instrument as
   the skill worksheets. */
.dps-calc {

  --dps-panel: var(--card);
  --dps-panel-2: var(--card-2);
  --dps-line: var(--line);
  --dps-line-soft: var(--line-soft);
  --dps-line-bright: var(--line-strong);
  --dps-bone: var(--ink);
  --dps-bone-dim: var(--ink-2);
  --dps-muted: var(--ink-3);
  --dps-brass: var(--accent);
  --dps-brass-hi: var(--accent-2);
  --dps-brass-quiet: color-mix(in srgb, var(--accent) 70%, var(--ink-3));
  --dps-ink: var(--on-accent);
  --dps-cell: 74px;
  --dps-gap: 8px;
  --dps-prayer-cell: 44px;
  --dps-prayer-gap: 5px;
  width: 100%;
  max-width: 1280px;
  margin: -4px auto 0;
  padding: 0 0 26px;
  border: 0;
  color: var(--dps-bone);
  font-family: var(--sans);
}
.dps-calc *,
.dps-calc *::before,
.dps-calc *::after { box-sizing: border-box; }
.dps-calc ::selection { background: var(--dps-brass); color: var(--dps-ink); }
.dps-calc a { color: inherit; }
.dps-forecast-score .calc-hero-label {
  grid-column: 1;
  align-self: start;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.dps-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 304px);
  align-items: stretch;
  border-bottom: 1px solid var(--dps-line);
}
.dps-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 26px;
}
.dps-form {
  min-width: 0;
}
.dps-form-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}
.dps-form .dps-target-group,
.dps-form .dps-skills-group { grid-column: 1 / -1; }
.dps-form .dps-attack-group { padding-right: 16px; }
.dps-form .dps-effects-group { padding-left: 16px; }
.dps-form .calc-group {
  min-width: 0;
  margin: 0;
  padding: 0 0 12px;
  border: 0;
  border-bottom: 1px solid var(--dps-line-soft);
}
.dps-form .calc-group + .calc-group { padding-top: 12px; }
.dps-form .calc-group-label {
  display: block;
  width: 100%;
  margin: 0 0 7px;
  padding: 0;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dps-form .calc-group-fields { display: grid; gap: 8px; min-width: 0; }
.dps-form .dps-target-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}
.dps-form .calc-input {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.dps-form .calc-input-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--dps-bone-dim);
  font: var(--fw-regular) var(--text-label)/1.2 var(--sans);
}
.dps-form .calc-input-line { display: block; width: 100%; }
.dps-form input,
.dps-form select {
  width: 100%;
  height: 42px;
  min-width: 0;
  padding: 0 11px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  outline: 0;
  background: var(--dps-panel-2);
  color: var(--dps-bone);
  font: var(--fw-regular) var(--text-label)/1 var(--sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease);
}
.dps-form input { cursor: text; }
.dps-form input:hover,
.dps-form select:hover { border-color: var(--dps-line-bright); }
.dps-form input:focus-visible,
.dps-form select:focus-visible {
  border-color: var(--dps-brass);
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-form .dps-skill-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
}
.dps-form .dps-attack-group .calc-group-fields,
.dps-form .dps-effects-group .calc-group-fields {
  grid-template-columns: minmax(0, 1fr);
}
.dps-form .dps-effects-group .calc-help { grid-column: 1 / -1; }
.dps-form .dps-skill-grid .calc-input-label { gap: 5px; }
.dps-form .toolbox-skill-icon { width: 15px; height: 15px; }
.dps-calc .dps-monster-stats {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-stats-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px 12px;
}
.dps-calc .dps-stats-groups .dps-stats-group { min-width: 0; }
.dps-calc .dps-stats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 8px;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-label)/1.35 var(--sans);
}
.dps-calc .dps-stats-head b { font-weight: var(--fw-medium); }
.dps-calc .dps-stats-head span {
  color: var(--dps-muted);
  font-weight: var(--fw-regular);
}
.dps-calc .dps-stats-weakness {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 7px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dps-bone);
  font: var(--fw-regular) var(--text-label)/1.3 var(--sans);
}
.dps-calc .dps-stats-weakness span {
  color: var(--dps-muted);
  font-size: var(--text-micro);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dps-calc .dps-stats-weakness b {
  color: var(--dps-bone);
  font-weight: var(--fw-medium);
}
.dps-calc .dps-stats-group h3 {
  margin: 0 0 4px;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dps-calc .dps-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 2px 10px;
  margin: 0;
  padding: 0;
}
.dps-calc .dps-stats-grid > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.dps-calc .dps-stats-grid dt {
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-label)/1.35 var(--sans);
  white-space: nowrap;
}
.dps-calc .dps-stats-grid dd {
  margin: 0;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-label)/1.35 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dps-calc .dps-stats-note {
  margin: 7px 0 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.4 var(--sans);
}
.dps-calc .dps-stats-note b {
  color: var(--dps-bone-dim);
  font-weight: var(--fw-medium);
}
.dps-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-form .calc-submit {
  flex: 0 0 auto;
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--dps-brass);
  border-radius: 2px;
  background: var(--dps-brass);
  color: var(--dps-ink);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  cursor: pointer;
}
.dps-form .calc-submit:hover { background: var(--dps-brass-hi); }
.dps-form .calc-submit:focus-visible { outline: 2px solid var(--dps-brass-hi); outline-offset: 2px; }
.dps-form .calc-reset {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-label)/1 var(--sans);
  text-decoration: none;
}
.dps-form .calc-reset:hover { color: var(--dps-bone); text-decoration: underline; text-underline-offset: 3px; }
.dps-calc .toolbox-live-status { margin-right: auto; color: var(--dps-muted); font-size: var(--text-micro); }
.dps-calc .toolbox-live-status:empty { display: none; }
.dps-loadout {
  min-width: 0;
  padding: 18px 24px 24px;
  border-right: 1px solid var(--dps-line);
}
.dps-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--dps-line);
}
.dps-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  text-decoration: none;
  transition: color var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease);
}
.dps-tab:hover { color: var(--dps-bone); }
.dps-tab:focus-visible { outline: 2px solid var(--dps-brass); outline-offset: 3px; }
.dps-tab.is-active { border-color: var(--dps-brass); color: var(--dps-bone); }
.dps-tab-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--dps-line);
  background: var(--dps-panel);
  color: var(--dps-muted);
}
.dps-tab-mark .dps-slot-glyph { width: 15px; height: 15px; color: currentColor; }
.dps-tab-mark img { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.dps-tab.is-active .dps-tab-mark { border-color: var(--dps-brass); color: var(--dps-bone); }
.dps-tab-dot {
  width: 5px;
  height: 5px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--dps-brass);
}
.dps-loadout-body { padding-top: 16px; min-width: 0; }
.dps-calc .dps-loadout-page { padding: 0; border: 0; }
.dps-equipment-board {
  position: relative;
  width: calc(3 * var(--dps-cell) + 2 * var(--dps-gap) + 34px);
  max-width: 100%;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid var(--dps-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.dps-wires {
  position: absolute;
  inset: 16px;
  width: auto;
  height: auto;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}
.dps-wires path {
  fill: none;
  stroke: var(--dps-line-soft);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.dps-calc .dps-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, var(--dps-cell));
  grid-template-rows: repeat(5, var(--dps-cell));
  grid-template-areas:
    ". head ."
    "cape neck ammo"
    "weapon body shield"
    ". legs ."
    "hands feet ring";
  gap: var(--dps-gap);
  place-content: center;
  width: 100%;
  padding: 0;
}
.dps-calc .dps-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--dps-cell);
  height: var(--dps-cell);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  background: var(--dps-panel);
  color: var(--dps-bone-dim);
  font: inherit;
  cursor: pointer;
  appearance: none;
  box-shadow: none;
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease), box-shadow var(--t-quick) var(--ease);
}
.dps-calc .dps-slot::after { display: none; }
.dps-calc .dps-slot:hover { border-color: var(--dps-line-bright); background: var(--dps-panel-2); }
.dps-calc .dps-slot:focus-visible { outline: 2px solid var(--dps-brass); outline-offset: 2px; }
.dps-calc .dps-slot.is-open { border-color: var(--dps-brass); background: var(--dps-panel-2); box-shadow: none; }
.dps-calc .dps-slot.is-locked { cursor: default; opacity: .5; }
.dps-calc .dps-slot.is-locked:hover { border-color: var(--dps-line); background: var(--dps-panel); }
.dps-calc .dps-slot-label,
.dps-calc .dps-slot-name {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.dps-calc .dps-slot-icon { display: grid; place-items: center; width: 50px; height: 50px; }
.dps-calc .dps-slot-img { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; }
.dps-calc .dps-slot-glyph { width: 33px; height: 33px;  color: var(--ink-4); }
.dps-calc .dps-slot:hover .dps-slot-glyph { color: var(--dps-bone-dim); }
.dps-calc .dps-slot:focus-visible .dps-slot-glyph { color: var(--dps-brass); }
.dps-calc .dps-slot-badge {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1 var(--sans);
  letter-spacing: .08em;
}
.dps-calc .dps-slot-head { grid-area: head; }
.dps-calc .dps-slot-cape { grid-area: cape; }
.dps-calc .dps-slot-neck { grid-area: neck; }
.dps-calc .dps-slot-ammo { grid-area: ammo; }
.dps-calc .dps-slot-weapon { grid-area: weapon; }
.dps-calc .dps-slot-body { grid-area: body; }
.dps-calc .dps-slot-shield { grid-area: shield; }
.dps-calc .dps-slot-legs { grid-area: legs; }
.dps-calc .dps-slot-hands { grid-area: hands; }
.dps-calc .dps-slot-feet { grid-area: feet; }
.dps-calc .dps-slot-ring { grid-area: ring; }
.dps-calc .dps-bonus {
  width: calc(3 * var(--dps-cell) + 2 * var(--dps-gap) + 34px);
  max-width: 100%;
  margin: 13px auto 0;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--dps-line-soft);
  background: transparent;
}
.dps-calc .dps-bonus-label {
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dps-calc .dps-bonus-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
}
.dps-calc .dps-bonus-list > div {
  display: block;
  min-width: 0;
  padding: 0 10px;
  border-left: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-bonus-list > div:first-child { padding-left: 0; border-left: 0; }
.dps-calc .dps-bonus-list > div:last-child { border-bottom: 0; }
.dps-calc .dps-bonus-list dt {
  overflow: hidden;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.2 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dps-calc .dps-bonus-list dd {
  margin: 4px 0 0;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-body)/1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dps-calc .dps-bonus-list dd span { margin-left: 3px; color: var(--dps-muted);  font-size: var(--text-micro); }
.dps-calc .dps-prayer-book {
  width: calc(5 * var(--dps-prayer-cell) + 4 * var(--dps-prayer-gap) + 30px);
  max-width: 100%;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--dps-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.dps-calc .dps-prayer-grid {
  display: grid;
  grid-template-columns: repeat(5, var(--dps-prayer-cell));
  gap: var(--dps-prayer-gap);
  justify-content: center;
  padding: 0;
}
.dps-calc .dps-prayer-card {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--dps-prayer-cell);
  height: var(--dps-prayer-cell);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  background: var(--dps-panel);
  color: var(--dps-bone-dim);
  font: inherit;
  appearance: none;
  box-shadow: none;
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease), opacity var(--t-quick) var(--ease);
}
.dps-calc .dps-prayer-card:hover { border-color: var(--dps-line-bright); background: var(--dps-panel-2); }
.dps-calc .dps-prayer-card:focus-visible { outline: 2px solid var(--dps-brass); outline-offset: 2px; }
.dps-calc .dps-prayer-card.is-active {
  border-color: var(--dps-brass);
  background: color-mix(in srgb, var(--dps-brass) 7%, var(--dps-panel));
  box-shadow: none;
}
.dps-calc .dps-prayer-card.is-active::after { display: none; }
.dps-calc .dps-prayer-icons { display: grid; place-items: center; }
.dps-calc .dps-prayer-icon {
  width: calc(var(--dps-prayer-cell) - 10px);
  height: calc(var(--dps-prayer-cell) - 10px);
  object-fit: contain;
  image-rendering: pixelated;
}
.dps-calc .dps-prayer-blank { width: var(--dps-prayer-cell); height: var(--dps-prayer-cell); }
.dps-calc .dps-prayer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-prayer-active {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 7px;
  min-width: 0;
  margin: 0;
}
.dps-prayer-active-label {
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1.4 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.dps-prayer-active b {
  overflow: hidden;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-label)/1.4 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dps-prayer-active span:last-child {
  grid-column: 2;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.3 var(--sans);
}
.dps-prayer-clear {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  background: transparent;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1 var(--sans);
  cursor: pointer;
}
.dps-prayer-clear:hover { border-color: var(--dps-line-bright); color: var(--dps-bone); }
.dps-prayer-clear:focus-visible { outline: 2px solid var(--dps-brass); outline-offset: 2px; }
.dps-calc .dps-picker {
  width: min(100%, 100%);
  max-height: 380px;
  margin: 14px auto 0;
  padding: 13px;
  border: 1px solid var(--dps-line);
  background: var(--dps-panel);
  box-shadow: none;
}
.dps-calc .dps-picker-head { border-color: var(--dps-line-soft); }
.dps-calc .dps-picker-head h3 { color: var(--dps-bone); }
.dps-calc .dps-picker-close { color: var(--dps-muted); }
.dps-calc .dps-picker-close:hover { border-color: var(--dps-line-bright); background: var(--dps-panel-2); color: var(--dps-bone); }
.dps-calc .dps-picker-filter input {
  border-color: var(--dps-line);
  background: var(--dps-panel-2);
  color: var(--dps-bone);
}
.dps-calc .dps-picker-filter input::placeholder { color: var(--dps-muted); }
.dps-calc .dps-picker-count { color: var(--dps-muted);  font-size: var(--text-label); }
.dps-calc .dps-pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.dps-calc .dps-pick {
  color: var(--dps-bone-dim);
  font: var(--fw-regular) var(--text-label)/1.25 var(--sans);
}
.dps-calc .dps-pick-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}
.dps-calc .dps-pick:hover { border-color: var(--dps-line-bright); background: var(--dps-panel-2); }
.dps-calc .dps-pick[aria-current="true"] { border-color: var(--dps-brass); background: color-mix(in srgb, var(--dps-brass) 7%, var(--dps-panel)); color: var(--dps-bone); }
.dps-calc .dps-pick-meta { color: var(--dps-muted);  font-size: var(--text-micro); }
.dps-calc .dps-pick-clear .dps-pick-name { color: var(--dps-muted); }
.dps-calc .dps-picker-empty { color: var(--dps-muted); }
.dps-readout {
  min-width: 0;
  padding: 20px 0 22px 24px;
}
.dps-readout h2 {
  margin: 0 0 11px;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.dps-calc[aria-busy="true"] .dps-loadout-body,
.dps-calc[aria-busy="true"] .dps-readout { opacity: .55; transition: opacity var(--t-quick) var(--ease); }

/* The target is the header band of the control desk; the forecast is a
   separate ledger that runs the full height of the workbench. */
.dps-target-form {
  min-width: 0;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--dps-line);
}
.dps-target-form .calc-group {
  padding: 0;
  border: 0;
}
.dps-target-form .calc-group-label { margin-bottom: 6px; }
.dps-target-form .calc-group-fields {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.dps-target-form .dps-monster-stats {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  grid-template-areas:
    "head groups"
    "weak groups"
    "note groups";
  gap: 4px 24px;
  margin: 0;
  padding: 0;
  border: 0;
}
.dps-target-form .dps-stats-head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}
.dps-target-form .dps-stats-weakness { grid-area: weak; }
.dps-target-form .dps-stats-groups {
  grid-area: groups;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 20px;
}
.dps-target-form .dps-stats-note { grid-area: note; margin: 0; }
.dps-npc-control { min-width: 0; }
.dps-npc-control > .calc-input-label {
  display: flex;
  margin: 0 0 5px;
  color: var(--dps-bone-dim);
  font: var(--fw-regular) var(--text-label)/1.2 var(--sans);
}
.dps-npc-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  background: var(--dps-panel-2);
  color: var(--dps-bone);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease);
}
.dps-npc-trigger:hover,
.dps-npc-trigger[aria-expanded="true"] { border-color: var(--dps-line-bright); }
.dps-npc-trigger:focus-visible {
  border-color: var(--dps-brass);
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-npc-trigger-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
.dps-npc-trigger-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  image-rendering: pixelated;
}
.dps-npc-trigger-icon svg.dps-npc-trigger-img { color: var(--dps-muted); }
.dps-npc-trigger-copy { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.dps-npc-trigger-copy b {
  overflow: hidden;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dps-npc-trigger-copy small {
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.2 var(--sans);
  letter-spacing: .03em;
}
.dps-npc-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-left: auto;
  color: var(--dps-muted);
  transition: transform var(--t-quick) var(--ease);
}
.dps-npc-trigger[aria-expanded="true"] .dps-npc-chevron { transform: rotate(180deg); }
.dps-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}
.dps-picker-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}
.dps-picker-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  height: min(80dvh, 680px);
  max-height: min(80dvh, 680px);
  min-width: 0;
  margin: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--dps-line-bright);
  border-radius: 2px;
  background: var(--dps-panel);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.dps-picker-dialog-slot { height: auto; }
body:has(.dps-picker-overlay) { overflow: hidden; }
.dps-picker-dialog [hidden] { display: none !important; }
.dps-calc .dps-pick[hidden] { display: none; }
.dps-picker-dialog .dps-pick-grid {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 2px;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dps-picker-dialog .dps-picker-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.dps-picker-pending {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 8px;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-label)/1.4 var(--sans);
}
@media (max-width: 560px) {
  .dps-picker-overlay { padding: 10px; }
  .dps-picker-dialog {
    max-height: min(80dvh, 680px);
    padding: 14px;
  }
  .dps-picker-dialog .dps-pick-grid { grid-template-columns: minmax(0, 1fr); }
  .dps-picker-overlay .dps-picker-close { width: 44px; height: 44px; }
  .dps-picker-overlay .dps-picker-filter input { height: 44px; }
}
.dps-npc-pick .dps-pick-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.dps-npc-portrait {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}
.dps-npc-trigger-icon .dps-npc-portrait {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
.dps-npc-portrait > * { grid-area: 1 / 1; max-width: 100%; max-height: 100%; }
.dps-npc-portrait [hidden] { display: none !important; }
.dps-npc-row-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
}
.dps-console {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
}
.dps-console .dps-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--dps-line);
}
.dps-console .dps-tab {
  justify-content: center;
  height: 44px;
  min-height: 44px;
  padding: 0 8px;
  border-left: 1px solid var(--dps-line-soft);
  white-space: nowrap;
}
.dps-console .dps-tab:first-child { border-left: 0; }
.dps-console .dps-tab-dot {
  position: absolute;
  right: 12px;
  margin: 0;
}
.dps-console .dps-tab.is-active {
  border-left-color: var(--dps-line-soft);
  border-bottom-color: var(--dps-brass);
}
.dps-console-body {
  flex: 1 1 auto;
  min-width: 0;
  /* Every tab holds the equipment page's footprint: the five-row board, its
     gutter, the gear-bonus strip and this panel's top padding. Without the
     floor, switching to Combat, Levels or Prayer shrinks the workbench and
     moves the console foot under the reader's pointer. */
  min-height: calc(5 * var(--dps-cell) + 4 * var(--dps-gap) + 136.4px);
}
.dps-console-panel { min-width: 0; padding: 16px 0 0; }
.dps-calc .dps-console .dps-loadout-page {
  padding: 0;
  border: 0;
}
.dps-calc .dps-console .dps-gear,
.dps-calc .dps-console .dps-prayer { padding: 0; border: 0; }
.dps-calc .dps-console .dps-gear {
  display: grid;
  grid-template-columns: minmax(280px, 300px) minmax(0, 1fr);
  grid-template-areas: "board bonus";
  gap: 0 24px;
  align-items: start;
}
.dps-calc .dps-console .dps-gear .dps-equipment-board {
  grid-area: board;
  margin: 0 auto;
}
.dps-calc .dps-console .dps-gear .dps-bonus {
  grid-area: bonus;
  width: auto;
  max-width: none;
  margin: 0;
}
.dps-calc .dps-console .dps-gear .dps-picker { grid-column: 1 / -1; }
.dps-panel-form { min-width: 0; }
.dps-panel-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  min-width: 0;
}
.dps-panel-fields .calc-help { grid-column: 1 / -1; }
.dps-panel-fields .dps-skill-grid {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}
.dps-panel-form .calc-group {
  padding: 0;
  border: 0;
}
.dps-panel-form .calc-group-label { margin-bottom: 8px; }
.dps-panel-fields > .dps-combat-group { min-width: 0; }
.dps-combat-group .calc-group-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dps-combat-group .calc-help { grid-column: 1 / -1; }
@media (max-width: 780px) {
  .dps-combat-group .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
.dps-console-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-console-foot .toolbox-live-status { margin-right: auto; }
.dps-console-foot .calc-reset {
  margin-left: auto;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  text-decoration: none;
}
.dps-console-foot .calc-reset:hover { color: var(--dps-bone); }
.dps-readout {
  align-self: stretch;
  padding: 18px 0 22px 26px;
  border-left: 1px solid var(--dps-line);
}


@media (max-width: 1040px) {
  .dps-workbench {
    grid-template-columns: minmax(0, 1fr) 270px;
  }
  .dps-workspace { padding-right: 20px; }
  .dps-target-form .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .dps-readout { padding-left: 20px; }
  .dps-calc .dps-console .dps-gear {
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-areas: "board bonus";
    gap: 14px 18px;
  }
}

@media (max-width: 780px) {
  .dps-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .dps-workspace { padding-right: 0; }
  .dps-target-form {
    padding: 14px 0 16px;
    border-bottom: 1px solid var(--dps-line);
  }
  .dps-target-form .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .dps-target-form .dps-monster-stats {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "weak" "groups" "note";
    gap: 6px;
  }
  .dps-target-form .dps-stats-groups {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  }
  .dps-console {
    border-bottom: 1px solid var(--dps-line);
  }
  .dps-panel-form { padding: 0; border: 0; }
  .dps-calc .dps-console .dps-gear {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "bonus";
  }
  .dps-form .dps-skill-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dps-console .dps-tabs { width: 100%; }
  .dps-readout {
    padding: 18px 0;
    border-top: 0;
    border-left: 0;
  }
  .dps-readout h2 { margin: 0 0 10px; }
  .dps-readout .dps-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dps-readout .dps-facts > div { padding: 9px 10px 8px; }
  .dps-readout .dps-facts > div:nth-child(1),
  .dps-readout .dps-facts > div:nth-child(4) { padding-left: 0; }
}

@media (max-width: 520px) {
  .dps-calc { --dps-cell: 64px; --dps-gap: 6px; --dps-prayer-cell: 38px; --dps-prayer-gap: 4px; }
  .dps-console-body {
    min-height: calc(5 * var(--dps-cell) + 4 * var(--dps-gap) + 130.8px);
  }
  .dps-form .dps-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dps-equipment-board { padding: 14px; }
  .dps-wires { inset: 14px; }
  .dps-calc .dps-slot-icon { width: 44px; height: 44px; }
  .dps-calc .dps-slot-img { width: 40px; height: 40px; }
  .dps-calc .dps-slot-glyph { width: 28px; height: 28px; }
  .dps-calc .dps-bonus-list > div { padding: 0 6px; }
  .dps-calc .dps-bonus-list dt {  font-size: var(--text-micro); line-height: 1.15; white-space: normal; }
  .dps-calc .dps-prayer-book { padding: 12px; }
  .dps-readout .dps-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dps-readout .dps-facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .dps-readout .dps-facts > div:nth-child(2),
  .dps-readout .dps-facts > div:nth-child(4) { padding-left: 10px; border-left: 1px solid var(--dps-line-soft); }
}

/* ------------------------------------------------------- requirements -- */

.dps-calc .dps-slot.is-unmet {  border-color: var(--down); }
.dps-calc .dps-slot.is-unmet::after { border-color: rgba(214, 139, 110, .35); }
.dps-calc .calc-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--dps-line);
  border-radius: 6px;
  background: var(--dps-panel-2);
  color: var(--dps-bone-dim);
  font: var(--fw-medium) var(--text-label)/1.25 var(--sans);
  cursor: pointer;
}
.dps-calc .calc-check:hover { border-color: var(--dps-line-bright); }
.dps-calc .calc-check:has(input:checked) {
  border-color: var(--dps-brass);
  background: color-mix(in srgb, var(--dps-brass) 7%, var(--dps-panel-2));
  color: var(--dps-bone);
}
.dps-calc .calc-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--dps-brass);
}
.dps-calc .calc-check input:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-calc .calc-help {
  margin: 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-modifiers,
.dps-calc .dps-specials {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-modifiers h3,
.dps-calc .dps-specials h3 {
  margin: 0;
  color: var(--dps-muted);
  font: var(--fw-medium) var(--text-micro)/1.2 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dps-calc .dps-modifiers ul,
.dps-calc .dps-specials ul {
  display: grid;
  gap: 0;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.dps-calc .dps-modifiers li,
.dps-calc .dps-specials li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  padding: 5px 0;
  border-top: 1px solid var(--dps-line-soft);
  font: var(--fw-regular) var(--text-micro)/1.3 var(--sans);
}
.dps-calc .dps-modifiers li span,
.dps-calc .dps-specials li span { min-width: 0; color: var(--dps-bone-dim); }
.dps-calc .dps-modifiers li b,
.dps-calc .dps-specials li b {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--dps-bone);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.dps-calc .dps-modifiers-empty,
.dps-calc .dps-spec-note,
.dps-calc .dps-traits {
  margin: 5px 0 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-traits { color: var(--dps-bone-dim); }

@media (max-width: 520px) {
  .dps-calc .dps-reqs { padding: 10px 11px; }
  .dps-calc .dps-req-item-name b { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .dps-calc .dps-forecast-score b { animation: none; }
  .dps-calc .dps-slot,
  .dps-calc .dps-prayer-card,
  .dps-calc .dps-tab { transition: none; }
}
/* --------------------------------------------------- dps workbench: thirds -- */
/* The target, controls and forecast are three equal ledgers. The target form
   is the left rail, the loadout console is the centre, and the forecast is the
   right rail; the shared 1px rules are the only containers. */
.dps-workbench {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  border-top: 1px solid var(--dps-line);
  border-bottom: 1px solid var(--dps-line);
}
.dps-workbench > .dps-workspace { display: contents; }
.dps-workbench .dps-target-form {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: 16px 20px 20px 0;
  border: 0;
  border-right: 1px solid var(--dps-line);
}
.dps-workbench .dps-target-form .calc-group-fields {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.dps-workbench .dps-target-form .dps-monster-stats {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "weak" "note" "groups";
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
}
.dps-workbench .dps-target-form .dps-stats-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}
.dps-workbench .dps-console {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 0 18px;
  border-right: 1px solid var(--dps-line);
}
.dps-workbench .dps-console .dps-gear {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "board" "bonus";
  gap: 16px;
}
.dps-workbench .dps-console .dps-gear .dps-equipment-board { margin: 0 auto; }
.dps-workbench .dps-console .dps-gear .dps-bonus {
  width: auto;
  max-width: none;
  margin: 0;
}
.dps-workbench .dps-console .dps-panel-fields { grid-template-columns: minmax(0, 1fr); }
.dps-workbench .dps-console .dps-combat-group .calc-group-fields { grid-template-columns: minmax(0, 1fr); }
.dps-workbench .dps-readout {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  padding: 16px 0 22px 18px;
  border-left: 0;
}

/* Wide workbenches have room for a four-column skill grid. Keeping seven
   fields in three columns leaves the Prayer field alone on its own row. */
@media (min-width: 1181px) {
  .dps-workbench .dps-console .dps-skill-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Short desktop windows: trim the loadout board so the workbench clears the
   fixed app board instead of clipping the console foot and forecast. */
@media (min-width: 1181px) and (max-height: 820px) {
  .dps-calc { --dps-cell: 70px; --dps-gap: 6px; }
}

/* Narrow desktops keep all three columns: a fixed target rail, a fluid
   console, and a fixed forecast rail. The target no longer becomes a second
   row, which was what pushed the calculator below the viewport. */
@media (min-width: 781px) and (max-width: 1180px) {
  .dps-workbench {
    grid-template-columns: minmax(240px, 260px) minmax(0, 1fr) minmax(240px, 260px);
  }
  .dps-calc { --dps-cell: 70px; --dps-gap: 6px; }
  .dps-workbench .dps-target-form {
    grid-column: 1;
    grid-row: 1;
    padding: 16px 18px 20px 0;
    border-right: 1px solid var(--dps-line);
    border-bottom: 0;
  }
  .dps-workbench .dps-target-form .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .dps-workbench .dps-target-form .dps-monster-stats {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "weak" "note" "groups";
    gap: 8px;
  }
  .dps-workbench .dps-target-form .dps-stats-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }
  .dps-workbench .dps-console {
    grid-column: 2;
    grid-row: 1;
    padding: 0 18px;
    border-right: 1px solid var(--dps-line);
  }
  .dps-console-body {
    min-height: calc(5 * var(--dps-cell) + 4 * var(--dps-gap) + 134.4px);
  }
  .dps-workbench .dps-console .dps-gear {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "bonus";
    gap: 14px;
  }
  .dps-workbench .dps-readout {
    grid-column: 3;
    grid-row: 1;
    padding: 16px 0 16px 18px;
    border-left: 0;
  }
}

/* Below 900 the two outer ledgers stay, but tighten their gutters and give
   the target stats a single column so they do not force the height. */
@media (min-width: 781px) and (max-width: 900px) {
  .dps-workbench {
    grid-template-columns: 200px minmax(0, 1fr) 200px;
  }
  .dps-workbench .dps-target-form { padding: 14px 14px 16px 0; }
  .dps-workbench .dps-target-form .dps-stats-groups {
    grid-template-columns: minmax(0, 1fr);
  }
  .dps-workbench .dps-console { padding: 0 14px; }
  .dps-workbench .dps-readout { padding: 14px 0 16px 14px; }
}

@media (max-width: 780px) {
  .dps-workbench { grid-template-columns: minmax(0, 1fr); }
  .dps-workbench .dps-target-form {
    grid-column: 1;
    grid-row: 1;
    padding: 14px 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--dps-line);
  }
  .dps-workbench .dps-target-form .calc-group-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .dps-workbench .dps-target-form .dps-monster-stats {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "weak" "groups" "note";
    gap: 6px;
  }
  .dps-workbench .dps-target-form .dps-stats-groups {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 8px 12px;
  }
  .dps-workbench .dps-console {
    grid-column: 1;
    grid-row: 3;
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--dps-line);
  }
  .dps-workbench .dps-console .dps-gear {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "bonus";
    gap: 16px;
  }
  .dps-workbench .dps-readout {
    grid-column: 1;
    grid-row: 2;
    padding: 18px 0;
    border-right: 0;
    border-left: 0;
  }
}

/* NPC pages and the phone picker's place above the fixed bottom rail. */
.dps-picker-pages {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-picker-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  color: var(--dps-bone-dim);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  text-decoration: none;
}
.dps-picker-page:hover {
  border-color: var(--dps-line-bright);
  color: var(--dps-bone);
}
.dps-picker-page:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-picker-page.is-disabled {
  opacity: .45;
  pointer-events: none;
}
.dps-picker-page-count {
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-label)/1.2 var(--sans);
  text-align: center;
}
.dps-calc .calc-reset {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 6px;
}

@media (max-width: 620px) {
  .dps-calc .dps-picker {
    position: relative;
    z-index: 100;
    margin-bottom: 64px;
    scroll-margin-bottom: 88px;
  }
  .dps-calc .calc-reset { min-height: 44px; }
  .dps-picker-page { min-height: 44px; }
}

/* ------------------------------------------------ dps panel boards -- */
/* The equipment board sets the console's spatial scale. Combat and Levels
   now fill the same body with a ruled setup board and a two-column skill
   board; the prayer book keeps the gear grid's four-across rhythm. A tab
   switch changes the instrument, not the amount of desk it occupies. */

.dps-calc .dps-console-body {
  display: flex;
  flex-direction: column;
}
.dps-calc .dps-console-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.dps-calc .dps-panel-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.dps-calc .dps-panel-form .dps-panel-fields {
  flex: 1 1 auto;
  min-height: 0;
}

/* Combat: one framed ledger. The two groups share the full height and each
   entry is a row, so target conditions do not read as a footnote to Attack. */
.dps-calc .dps-console .dps-panel-form-attack .dps-panel-fields {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--dps-line);
}
.dps-calc .dps-console .dps-panel-form-attack .dps-combat-group {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.dps-calc .dps-console .dps-panel-form-attack .dps-combat-group + .dps-combat-group {
  border-top: 1px solid var(--dps-line);
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-label {
  margin: 0;
  padding: 10px 14px 9px;
  border-bottom: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  padding: 0;
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-input,
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-check {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 4px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-input {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > * + * {
  border-top: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-console .dps-panel-form-attack .calc-check:hover {
  background: var(--dps-panel-2);
}
.dps-calc .dps-console .dps-panel-form-attack .calc-check:has(input:checked) {
  background: color-mix(in srgb, var(--dps-brass) 7%, transparent);
}
.dps-calc .dps-console .dps-panel-form-attack .calc-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.dps-calc .dps-console .dps-panel-form-attack .calc-help {
  flex: 0 0 auto;
  padding: 8px 14px;
}

/* Levels: the seven inputs are the same board as the gear slots, two across.
   Prayer closes the grid on its own full-width row instead of leaving a gap. */
.dps-calc .dps-console .dps-panel-form-stats .dps-panel-fields {
  display: flex;
  flex-direction: column;
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skills-group {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--dps-line);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid > .calc-input {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  background: var(--dps-panel);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid > .calc-input:focus-within {
  border-color: var(--dps-brass);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid .calc-input-label {
  color: var(--dps-bone-dim);
  font: var(--fw-medium) var(--text-label)/1.2 var(--sans);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid .toolbox-skill-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid input {
  height: 44px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--dps-line-bright);
  border-radius: 0;
  background: transparent;
  color: var(--dps-bone);
  font: var(--fw-medium) var(--text-body)/1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid input:hover {
  border-bottom-color: var(--dps-brass-quiet);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid input:focus-visible {
  border-bottom-color: var(--dps-brass);
}
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid > .calc-input:last-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, 120px);
  align-items: center;
  gap: 14px;
}

/* Prayer: four across and five down, the equipment board's dimensions. The
   board itself takes the console height so it no longer floats above the
   reset rule with a field of empty desk underneath. */
.dps-calc .dps-console .dps-prayer {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.dps-calc .dps-console .dps-prayer-form {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}
.dps-calc .dps-console .dps-prayer-book {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  min-height: 0;
  margin: 0 auto;
}
.dps-calc .dps-console .dps-prayer-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--dps-prayer-gap);
  justify-content: stretch;
  min-height: 0;
  padding: 0;
}
.dps-calc .dps-console .dps-prayer-card {
  width: 100%;
  height: auto;
  min-width: 0;
  min-height: 0;
}
.dps-calc .dps-console .dps-prayer-icons {
  width: 100%;
  height: 100%;
}
.dps-calc .dps-console .dps-prayer-icon {
  width: 58px;
  height: 58px;
  max-width: calc(100% - 12px);
  max-height: calc(100% - 12px);
}
.dps-calc .dps-console .dps-prayer-blank {
  width: auto;
  height: auto;
}

@media (max-width: 520px) {
  .dps-calc .dps-console .dps-panel-form-attack .calc-group-label {
    padding: 8px 12px 7px;
  }
  .dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-input,
  .dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-check {
    padding-left: 12px;
    padding-right: 12px;
  }
  .dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid {
    gap: 6px;
    padding: 8px;
  }
  .dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid > .calc-input {
    gap: 6px;
    padding: 8px 10px;
  }
  .dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid > .calc-input:last-child {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 10px;
  }
  .dps-calc .dps-console .dps-prayer-book {
    padding: 12px;
  }
}

/* ------------------------------------------------ first-run and warnings -- */
/* Empty is a state, not zero. The level inputs start blank, the forecast says
   what is missing, and the Levels tab offers a one-link maxed setup. */
.dps-form input::placeholder { color: var(--dps-muted); opacity: 1; }
.dps-calc .dps-levels-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
.dps-calc .dps-levels-status {
  margin: 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-label)/1.3 var(--sans);
}
.dps-calc .dps-levels-max {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--dps-line);
  border-radius: 2px;
  color: var(--dps-bone-dim);
  font: var(--fw-medium) var(--text-label)/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
}
.dps-calc .dps-levels-max:hover {
  border-color: var(--dps-line-bright);
  color: var(--dps-bone);
}
.dps-calc .dps-levels-max:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-calc .dps-forecast-score.is-unset b {
  color: var(--dps-muted);
  font-size: clamp(var(--text-title), 3.3vw, var(--text-display));
}
.dps-calc .dps-setup-state {
  margin: 10px 0 0;
  max-width: 34ch;
  color: var(--dps-bone-dim);
  font: var(--fw-regular) var(--text-label)/1.45 var(--sans);
}
.dps-calc .dps-setup-link {
  color: var(--dps-brass-hi);
  text-underline-offset: 2px;
}
.dps-calc .dps-setup-link:hover { color: var(--dps-bone); }
.dps-calc .dps-setup-link:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-calc .dps-warnings,
.dps-calc .dps-reqs {
  margin: 10px 0 12px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--down) 55%, var(--dps-line));
  border-left-width: 3px;
  background: color-mix(in srgb, var(--down) 7%, var(--dps-panel));
  color: var(--dps-bone-dim);
  font: var(--fw-regular) var(--text-micro)/1.4 var(--sans);
}
.dps-calc .dps-warnings b,
.dps-calc .dps-reqs-title b { color: var(--dps-bone); font-weight: var(--fw-medium); }
.dps-calc .dps-warnings ul,
.dps-calc .dps-reqs ul {
  display: grid;
  gap: 3px;
  margin: 4px 0 0;
  padding: 0 0 0 14px;
}
.dps-calc .dps-reqs-title { margin: 0; }
.dps-calc .dps-reqs {
  grid-column: 1 / -1;
  margin: 12px 0 0;
}
.dps-calc .dps-console .dps-gear .dps-reqs { grid-column: 1 / -1; }
.dps-calc .dps-warnings li::marker,
.dps-calc .dps-reqs li::marker { color: var(--down); }
.dps-calc .dps-slot.is-unmet { background: color-mix(in srgb, var(--down) 6%, var(--dps-panel)); }
.dps-calc .dps-slot-flag,
.dps-calc .dps-prayer-flag {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid var(--down);
  border-radius: 50%;
  background: var(--dps-panel);
  color: var(--down);
  font: var(--fw-semibold) 10px/1 var(--sans);
}
.dps-calc .dps-slot-name {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  width: max-content;
  max-width: 190px;
  height: auto;
  margin: 0;
  padding: 4px 6px;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  border: 1px solid var(--dps-line-bright);
  border-radius: 2px;
  background: var(--dps-panel-2);
  color: var(--dps-bone);
  font: var(--fw-regular) var(--text-micro)/1.2 var(--sans);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 8;
}
.dps-calc .dps-slot:hover .dps-slot-name,
.dps-calc .dps-slot:focus-visible .dps-slot-name {
  opacity: 1;
  visibility: visible;
}
.dps-calc .dps-equipped {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-equipped-list {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.dps-calc .dps-equipped-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font: var(--fw-regular) var(--text-micro)/1.3 var(--sans);
}
.dps-calc .dps-equipped-list span { color: var(--dps-muted); }
.dps-calc .dps-equipped-list b {
  overflow: hidden;
  color: var(--dps-bone-dim);
  font-weight: var(--fw-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dps-calc .dps-prayer-card::before {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  width: max-content;
  max-width: 170px;
  padding: 4px 6px;
  border: 1px solid var(--dps-line-bright);
  border-radius: 2px;
  background: var(--dps-panel-2);
  color: var(--dps-bone);
  font: var(--fw-regular) var(--text-micro)/1.2 var(--sans);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 9;
}
.dps-calc .dps-prayer-card:hover::before,
.dps-calc .dps-prayer-card:focus-visible::before {
  opacity: 1;
  visibility: visible;
}
.dps-calc .dps-prayer-card.is-unmet {
  border-color: color-mix(in srgb, var(--down) 65%, var(--dps-line));
}
.dps-calc .dps-prayer-warning {
  grid-column: 2;
  color: var(--down);
  font: var(--fw-regular) var(--text-micro)/1.3 var(--sans);
}
.dps-calc .dps-prayer-legend {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--dps-line-soft);
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-prayer-legend summary {
  cursor: pointer;
  color: var(--dps-bone-dim);
  font-weight: var(--fw-medium);
}
.dps-calc .dps-prayer-legend summary:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-calc .dps-prayer-legend ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.dps-calc .dps-prayer-legend li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.dps-calc .dps-prayer-legend b {
  overflow: hidden;
  color: var(--dps-bone-dim);
  font-weight: var(--fw-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 780px) {
  /* Compact target first, then the controls/proof, then the detailed ledger.
     The full target stats live in the forecast's target line on a phone. */
  .dps-workbench .dps-target-form {
    grid-column: 1;
    grid-row: 1;
    padding: 10px 0 12px;
  }
  .dps-workbench .dps-target-form .dps-monster-stats { display: none; }
  .dps-workbench .dps-target-form .calc-group-label { margin-bottom: 4px; }
  .dps-workbench .dps-console {
    grid-column: 1;
    grid-row: 2;
  }
  .dps-workbench .dps-readout {
    grid-column: 1;
    grid-row: 3;
    padding: 16px 0 48px;
    border-top: 1px solid var(--dps-line);
    border-bottom: 0;
  }
  .dps-calc .dps-levels-max { min-height: 44px; }
  .dps-calc .dps-prayer-legend ul { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .dps-calc .dps-levels-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .dps-calc .dps-levels-max { width: 100%; justify-content: center; }
  .dps-calc .dps-prayer-flag { top: 2px; right: 2px; }
}

/* --------------------------------------------------- dps wiki workbench -- */
/* Loadout rail, target reference, and result readout, in that order. The
   console and target are fixed rails so the result card takes the remainder. */
.dps-calc .dps-workbench {
  grid-template-columns: 344px 316px minmax(0, 1fr);
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--dps-line);
  border-bottom: 0;
}
.dps-calc .dps-workbench > .dps-workspace { display: contents; }
.dps-calc .dps-workbench .dps-console {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--dps-line);
  background: var(--dps-panel);
}
.dps-calc .dps-workbench .dps-target-form {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--dps-line);
  background: var(--dps-panel);
}
.dps-calc .dps-workbench .dps-readout {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--dps-line);
  background: var(--dps-panel);
}
.dps-calc .dps-loadout-tabbar {
  display: flex;
  align-items: flex-end;
  height: 32px;
  padding: 0 8px;
  border-bottom: 1px solid var(--dps-line);
  background: var(--dps-panel-2);
}
.dps-calc .dps-loadout-tab {
  display: grid;
  place-items: center;
  width: 38px;
  height: 28px;
  color: var(--dps-bone-dim);
  font: var(--fw-medium) 12px/1 var(--sans);
}
.dps-calc .dps-loadout-tab.is-active {
  background: var(--dps-brass);
  color: #17130c;
}
.dps-calc .dps-loadout-add {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--dps-muted);
  font: var(--fw-regular) 16px/1 var(--sans);
}
.dps-calc .dps-loadout-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-loadout-head h2 {
  margin: 0;
  color: var(--dps-bone);
  font: var(--fw-medium) 15px/1.2 var(--sans);
}
.dps-calc .dps-loadout-head p {
  margin: 3px 0 0;
  color: var(--dps-muted);
  font: var(--fw-regular) 10px/1.2 var(--sans);
}
.dps-calc .dps-console .dps-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0 8px;
  border-bottom: 1px solid var(--dps-line);
}
.dps-calc .dps-console .dps-tab {
  min-height: 42px;
  height: 42px;
  padding: 0;
}
.dps-calc .dps-console .dps-tab.is-active { background: var(--dps-panel-2); }
.dps-calc .dps-tab-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}
.dps-calc .dps-tab-icon svg { width: 20px; height: 20px; }
.dps-calc .dps-console .dps-console-body {
  min-height: 0;
  padding: 10px 12px 0;
}
.dps-calc .dps-console .dps-console-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--dps-line-soft);
}
.dps-calc .dps-console .dps-prayer-grid { margin-inline: auto; }
.dps-calc .dps-readout h2 {
  margin: 0 0 2px;
  color: var(--dps-bone);
  font: var(--fw-medium) 18px/1.2 var(--sans);
}
.dps-calc .dps-result-table {
  width: 100%;
  margin: 10px 0 6px;
  border-collapse: collapse;
  table-layout: fixed;
}
.dps-calc .dps-result-table th,
.dps-calc .dps-result-table td {
  padding: 9px 2px;
  border-bottom: 1px solid var(--dps-line-soft);
  text-align: right;
}
.dps-calc .dps-result-table thead th {
  color: var(--dps-muted);
  font: var(--fw-medium) 10px/1.2 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dps-calc .dps-result-table thead th:first-child { text-align: left; }
.dps-calc .dps-result-table tbody th {
  color: var(--dps-muted);
  font: var(--fw-regular) 12px/1.25 var(--sans);
  text-align: left;
}
.dps-calc .dps-result-table tbody td {
  color: var(--dps-bone);
  font: var(--fw-medium) 14px/1.15 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.dps-calc .dps-result-table tbody tr:first-child td {
  color: var(--dps-brass-hi);
  font-size: 22px;
}
.dps-calc .dps-result-note {
  margin: 8px 0 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.45 var(--sans);
}
.dps-calc .dps-show-more {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--dps-line-soft);
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-show-more summary { cursor: pointer; color: var(--dps-bone-dim); }
.dps-calc .dps-show-more summary:focus-visible {
  outline: 2px solid var(--dps-brass);
  outline-offset: 2px;
}
.dps-calc .dps-show-more-body {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}
.dps-calc .dps-show-more-body div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.dps-calc .dps-show-more-body b { color: var(--dps-bone); font-weight: var(--fw-medium); }
.dps-calc .dps-legacy-forecast[hidden] { display: none !important; }
.dps-calc .dps-workbench .dps-prayer-legend,
.dps-calc .dps-workbench .dps-prayer-foot { display: none; }

@media (min-width: 781px) and (max-width: 1180px) {
  .dps-calc .dps-workbench {
    grid-template-columns: minmax(260px, 300px) minmax(250px, 280px) minmax(0, 1fr);
  }
}
@media (max-width: 980px) {
  .dps-calc .dps-workbench {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .dps-calc .dps-workbench .dps-console {
    grid-column: 1;
    grid-row: 1;
  }
  .dps-calc .dps-workbench .dps-target-form {
    grid-column: 1;
    grid-row: 2;
  }
  .dps-calc .dps-workbench .dps-readout {
    grid-column: 1;
    grid-row: 3;
  }
}

/* ------------------------------------------------ audit fixes: 2026-11-23 -- */
/* The console's flex-shrink chain let Combat and Levels collapse to a few
   pixels, so fieldsets overlapped their own labels. Panels keep their natural
   height now; the console itself is the only thing that scrolls. */
.dps-calc .dps-console .dps-console-body {
  display: block;
  flex: 0 0 auto;
  height: 540px;
  min-height: 0;
  padding: 10px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dps-calc .dps-console .dps-console-panel,
.dps-calc .dps-console .dps-panel-form,
.dps-calc .dps-console .dps-panel-form .dps-panel-fields {
  flex: 0 0 auto;
  min-height: 0;
}
.dps-calc .dps-console .dps-panel-fields > fieldset,
.dps-calc .dps-console .dps-panel-fields .calc-field {
  flex-shrink: 0;
  min-height: 0;
}
@media (min-width: 1181px) {
  .dps-calc .dps-console .dps-console-body { height: 540px; }
}
@media (min-width: 781px) and (max-width: 1180px) {
  .dps-calc .dps-console .dps-console-body { height: 430px; }
}
@media (max-width: 980px) {
  .dps-calc .dps-console .dps-console-body { height: 400px; }
  /* Target first, then the controls, then the proof. The later 980px media
     rule in this file used to put the console above the target again. */
  .dps-calc .dps-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
    gap: 10px;
  }
  .dps-calc .dps-workbench .dps-target-form {
    grid-column: 1;
    grid-row: 1;
  }
  .dps-calc .dps-workbench .dps-console {
    grid-column: 1;
    grid-row: 2;
  }
  .dps-calc .dps-workbench .dps-readout {
    grid-column: 1;
    grid-row: 3;
  }
}
/* A 316px target rail fits two stat columns, not three. */
@media (min-width: 981px) {
  .dps-calc .dps-workbench .dps-target-form .dps-stats-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
  }
}
/* Results: fixed 45/55 columns stop Accuracy and the spec row from pushing
   the value column past the rail, and the figures use the brand sans. */
.dps-calc .dps-result-table { table-layout: fixed; }
.dps-calc .dps-result-table thead th {
  font-size: 11px;
  letter-spacing: .06em;
}
.dps-calc .dps-result-table th:first-child { width: 45%; }
.dps-calc .dps-result-table tbody th { padding-right: 10px; }
.dps-calc .dps-result-table tbody td {
  padding-left: 6px;
  font: var(--fw-medium) 14px/1.15 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dps-calc .dps-result-table tbody tr:first-child td { font-size: 18px; }
/* Touch targets: 44px for the disclosure, reset and loadout tabs. */
.dps-calc .dps-show-more summary {
  display: flex;
  align-items: center;
  min-height: 44px;
}
.dps-calc .dps-console-foot .calc-reset {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
}
.dps-calc .dps-console .dps-tab {
  height: 44px;
  min-height: 44px;
}
.dps-calc .dps-loadout-tab.is-active { color: var(--dps-ink); }
/* The active prayer is stated once, in the open, with its requirement and a
   way out; the removed legend duplicated every card's tooltip. */
.dps-calc .dps-workbench .dps-prayer-foot { display: flex; }
.dps-calc .dps-prayer-active-meta {
  grid-column: 2;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-prayer-warning {
  grid-column: 2;
  color: var(--down);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-prayer-clear {
  min-height: 44px;
  padding: 0 14px;
}
/* The disclosure now carries the detail blocks; keep their rules spaced. */
.dps-calc .dps-show-more-body { gap: 10px; }
.dps-calc .dps-show-more-body .dps-show-more-grid {
  display: grid;
  gap: 4px;
}
.dps-calc .dps-show-more-body .dps-modifiers,
.dps-calc .dps-show-more-body .dps-specials {
  padding-top: 8px;
  border-top: 1px solid var(--dps-line-soft);
}

/* Combat and Levels distribute rows with flex-basis:0 inside a column that
   now has no definite height; give those rows their content height back. */
.dps-calc .dps-console .dps-panel-form-attack .dps-panel-fields,
.dps-calc .dps-console .dps-panel-form-attack .dps-combat-group,
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields,
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-input,
.dps-calc .dps-console .dps-panel-form-attack .calc-group-fields > .calc-check,
.dps-calc .dps-console .dps-panel-form-stats .dps-skills-group,
.dps-calc .dps-console .dps-panel-form-stats .dps-skill-grid {
  flex: 0 0 auto;
  min-height: 0;
}

/* Results keep the target beside the answer when the target panel has
   scrolled away on a phone. */
.dps-calc .dps-result-target {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 4px 0 0;
  color: var(--dps-muted);
  font: var(--fw-regular) var(--text-micro)/1.35 var(--sans);
}
.dps-calc .dps-result-target b {
  color: var(--dps-bone-dim);
  font-weight: var(--fw-medium);
}
.dps-calc .dps-result-target + .dps-result-table { margin-top: 8px; }
