/* Lair Flair editor layout and components, in the hub's Field Manual look. Tokens and base styles are in tokens.css. */

/* ---------- App frame ---------- */
/* The hidden attribute always wins over display rules below (e.g. #paneBrowse's flex, buttons' inline-flex). */
[hidden] { display: none !important; }
/* Minimal by default: header, decoration panel and map. The Tools panel (aside.right) only shows when
   the Tools button turns it on (body.tools-open, set by layout.js). */
body {
  display: grid;
  grid-template-columns: var(--side-left) 1fr;
  grid-template-rows: auto 1fr auto;
  height: 100vh; height: 100dvh;
}
body.tools-open { grid-template-columns: var(--side-left) 1fr var(--side-right); }
body:not(.tools-open) aside.right { display: none; }

header {
  grid-column: 1 / -1;
  display: flex; gap: var(--sp-4); align-items: center;
  padding: var(--sp-4) var(--sp-6);
  background: var(--c-sunken);
  border-bottom: 1px solid var(--c-line);
  position: relative; z-index: 5;
}
header h1 {
  font: 700 24px/1 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--tracking-display); margin: 0 var(--sp-6) 0 0;
  color: var(--c-heading); white-space: nowrap;
}
/* The hcpoe.tools wordmark (tokens.css), then "/ Lair Flair": one site, one look (UX review X1, X2). */
.hub-mark:not([hidden]) + h1::before { content: "/"; margin-right: var(--sp-4); color: var(--c-text-faint); font-weight: 600; }
header select#hoSelect { width: auto; max-width: 300px; }
header select#hoSelect:disabled { display: none; }   /* nothing to pick until a hideout is open */
header .hdr-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-5); }
header button { white-space: nowrap; }   /* a two-line button makes the header taller */
/* The wordmark leaves less room: short "Check owned" label up to 1400 px */
@media (max-width: 1400px) {
  header #btnCheckOwned .wide-only { display: none; }
  header #btnCheckOwned .phone-only { display: inline; }
}
#btnTools[aria-pressed=true] { color: var(--c-select); border-color: var(--c-select); background: var(--c-select-soft); }

/* Main menu (☰): a <details> drop-down */
.menu { position: relative; }
.menu > summary {
  list-style: none; display: inline-flex; align-items: center; gap: var(--sp-3);
  min-height: var(--control-h); padding: var(--sp-2) var(--sp-5);
  border: 1px solid var(--c-line-strong); cursor: pointer; font-weight: 500; user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; font-size: var(--fs-xs); color: var(--c-text-muted); }
/* the menu button is a hamburger icon: three bars drawn with borders */
.menu > summary:has(.burger) { padding: var(--sp-2) var(--sp-4); }
.menu > summary:has(.burger)::after { display: none; }
.burger { display: block; width: 18px; height: 2px; background: currentColor; position: relative; margin: 7px 0; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.menu > summary:hover, .menu[open] > summary { background: var(--c-raised); border-color: var(--c-accent); color: var(--c-heading); }
.menu-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 6; min-width: 220px;
  display: flex; flex-direction: column; padding: var(--sp-2);
  background: var(--c-raised); border: 1px solid var(--c-line-strong);
  box-shadow: var(--shadow-pop);
}
.menu-list > button, .menu-list > label.btn {
  justify-content: flex-start; border: 0; border-bottom: 1px dotted var(--c-line); padding: var(--sp-3) var(--sp-4);
}
.menu-list > :last-child { border-bottom: 0; }
.menu-list > button:hover, .menu-list > label.btn:hover { background: var(--c-hover); }

aside { background: var(--c-surface); overflow: auto; padding: var(--sp-5); }
aside.left { border-right: 1px solid var(--c-line-strong); display: flex; flex-direction: column; overflow: hidden; position: relative; }
/* drag handle on the panel's right edge (layout.js); wide screens only */
.side-resize { position: absolute; top: 0; right: -3px; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; touch-action: none; }
.side-resize:hover, .side-resize:focus-visible, body.resizing-side .side-resize { background: linear-gradient(to right, transparent 3px, var(--c-focus) 3px, var(--c-focus) 5px, transparent 5px); outline: none; }
body.resizing-side { cursor: col-resize; user-select: none; }
@media (max-width: 1100px) { .side-resize { display: none; } }
#paneBrowse .hb-credit { margin-top: var(--sp-2); font-size: var(--fs-xs); }
aside.right { border-left: 1px solid var(--c-line-strong); counter-reset: chap; }

h2 {
  font: 600 19px/1.1 var(--font-caps); text-transform: var(--display-case); letter-spacing: var(--tracking-display);
  color: var(--c-heading);
  margin: var(--sp-3) 0 var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-4);
}
h2::after { content: ""; flex: 1; height: 0; border-top: 1px solid var(--c-line-strong); }
hr { border: 0; height: 1px; background: var(--c-line); margin: var(--sp-5) 0; }

footer {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-5);
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--fs-xs); color: var(--c-text-faint);
  background: var(--c-sunken); border-top: 1px solid var(--c-line);
}
footer .info { color: var(--c-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
footer .links { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5); font-style: normal; }
footer .notice { margin-left: auto; }
/* Footer links, the Feedback button and dialog-opening buttons look like plain links */
footer a, .linkish {
  color: var(--c-text-muted); font: inherit; font-style: normal; text-decoration: none;
  background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; cursor: pointer;
}
footer a:hover, .linkish:hover, .linkish:active { color: var(--c-focus); background: none; box-shadow: none; text-decoration: underline; }
header .linkish { font-size: var(--fs-sm); }

/* ---------- Collapsible side-panel sections: numbered 01, 02... like a field manual ---------- */
details.sect { padding-bottom: var(--sp-4); margin-bottom: var(--sp-3); counter-increment: chap; }
details.sect > summary { list-style: none; cursor: pointer; user-select: none; }
details.sect > summary::-webkit-details-marker { display: none; }
details.sect > summary h2 { margin: var(--sp-2) 0; }
details.sect > summary h2::before { content: counter(chap, decimal-leading-zero); font: 500 13px/1 var(--font-mono); color: var(--c-accent-strong); min-width: 22px; }
details.sect > summary:hover h2 { color: var(--c-accent-strong); }
details.sect[open] > summary { margin-bottom: var(--sp-3); }
details.sect:not([open]) { padding-bottom: 0; }

/* ---------- Tabs: an underline marks the open one ---------- */
.tabs { display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-4); border-bottom: 1px solid var(--c-line-strong); }
.tabs button {
  flex: 1; min-height: 34px; padding: var(--sp-2) var(--sp-3);
  background: none; border: 1px solid transparent; border-bottom: 0;
  color: var(--c-text-muted); font: 600 15px/1.1 var(--font-caps); text-transform: var(--display-case); letter-spacing: var(--tracking-display);
}
.tabs button:hover { color: var(--c-text); background: var(--c-raised); }
.tabs button.on { color: var(--c-heading); border-bottom: 3px solid var(--c-accent); margin-bottom: -1px; }
.pane { flex: 1; min-height: 0; overflow: auto; }

/* ---------- Canvas area ---------- */
/* The map stays dark in both themes, so the floor art and piece colours read the same. */
#canvasWrap { position: relative; overflow: hidden; background: var(--c-map-bg); overscroll-behavior: contain; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
/* The map handles its own touch gestures (editor.js): no page scroll, zoom, text selection or
   long-press callout while a finger is on it. */
#cv { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#tip {
  position: absolute; pointer-events: none; z-index: 4;
  background: var(--c-raised); color: var(--c-text);
  border: 1px solid var(--c-line-strong);
  padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm);
  display: none; white-space: nowrap; box-shadow: var(--shadow-pop);
}
#drop {
  position: absolute; inset: 0; z-index: 4;
  /* The card centres with auto margins, so when it is taller than the space (short phones) it
     starts at the top and the area scrolls, instead of the top being cut off. */
  display: flex; align-items: flex-start; justify-content: center; padding: var(--sp-6);
  overflow-y: auto; overscroll-behavior: contain;
  color: var(--c-text-muted); font-size: var(--fs-lg);
}
#drop .start, dialog, #notes {
  background: var(--c-raised); color: var(--c-text);
  border: 1px solid var(--c-line-strong);
  box-shadow: var(--shadow-pop);
}
#drop .start { padding: var(--sp-7); max-width: 460px; font-size: var(--fs-md); margin: auto; }
#drop .start h2 { font: 700 24px/1.2 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--tracking-display); }
#drop .start h2::after { display: none; }
/* Until the scripts have run (they're deferred, so the page paints first): one line instead of empty
   pickers (UX review S11). start-card.js takes the class off. */
#drop .start-loading { color: var(--c-text-muted); margin: var(--sp-3) 0 0; }
#drop .start.loading > :not(h2, .start-loading, noscript) { display: none; }
#drop .start:not(.loading) .start-loading { display: none; }
.start-noscript { color: var(--c-danger); }
/* Keyboard: a skip link to the map (UX review S12), shown when focused */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--c-accent); color: var(--c-accent-ink); }
.skip-link:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#cv:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
#drop .start select { flex: 1; width: auto; }
#drop .start .start-search { display: block; width: 100%; box-sizing: border-box; margin-bottom: var(--sp-3); }
#drop .start .start-note { margin: var(--sp-2) 0 var(--sp-4); }
#notes {
  position: absolute; top: 70px; left: var(--sp-6); right: var(--sp-6); max-width: 640px;
  z-index: 4; max-height: 40%; overflow: auto; padding: var(--sp-4) var(--sp-5);
}
#notes ul { margin: 0; padding-left: 18px; color: var(--c-text-muted); }
#notes li { margin: var(--sp-1) 0; }
#notes button { min-height: 22px; padding: 0 var(--sp-3); }

/* ---------- Map toolbar: icon buttons floating over the map ---------- */
.maptools {
  position: absolute; z-index: 3; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: var(--sp-3); padding: 5px; max-width: calc(100% - 24px);
  background: var(--c-float); border: 1px solid var(--c-line-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}
.mt-group { display: flex; }
.mt-group + .mt-group { padding-left: var(--sp-3); border-left: 1px solid var(--c-line); }
.mt { position: relative; width: 36px; height: 36px; min-height: 0; padding: 0; border-color: transparent; }
.mt svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mt svg .fill { fill: currentColor; stroke: none; }
.mt:hover { border-color: var(--c-line-strong); }
.mt:disabled, .mt:disabled:hover { border-color: transparent; color: var(--c-line-strong); }
.mt.on { color: var(--c-accent-ink); border-color: var(--c-accent); background: var(--c-accent); }
.mt-danger:hover { color: var(--c-danger); border-color: var(--c-danger); }
/* Tooltip with the name and the hotkey, from data-tip and data-key */
.mt::after {
  content: attr(data-tip) "   " attr(data-key); white-space: pre;
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: var(--sp-2) var(--sp-4); font: var(--fs-sm)/1.2 var(--font-ui); color: var(--c-text);
  background: var(--c-raised); border: 1px solid var(--c-line-strong); box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity .1s .25s;
}
.mt:hover::after, .mt:focus-visible::after { opacity: 1; }

/* ---------- Dialogs ---------- */
dialog { padding: var(--sp-6); width: min(640px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog h2, dialog h3 { font: 700 20px/1.2 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--tracking-display); color: var(--c-heading); }
dialog h2::after { display: none; }
dialog.info-dlg { width: min(480px, 92vw); }
dialog.info-dlg p { line-height: 1.5; }
dialog.info-dlg .row { justify-content: flex-end; margin-top: var(--sp-5); }
/* One pattern for every dialog (dialogs.js, UX review E22): an ✕ at the top right and the actions
   pinned to the bottom, so the main button is on screen however tall the dialog is (E18, E23). */
dialog { max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; }
/* The ✕ is put first in the dialog but skipped by autofocus (dialogs.js); it floats to the top right and
   sticks there while a tall dialog scrolls. */
dialog > .dlg-x {
  position: sticky; top: calc(-1 * var(--sp-6) + var(--sp-3)); float: right; z-index: 2;
  margin: calc(-1 * var(--sp-6) + var(--sp-3)) calc(-1 * var(--sp-6) + var(--sp-3)) 0 var(--sp-3);
  min-width: 32px; min-height: 32px; padding: 0 var(--sp-2);
}
dialog .dlg-foot {
  position: sticky; bottom: calc(-1 * var(--sp-6)); z-index: 1;
  justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-3);
  margin: var(--sp-5) calc(-1 * var(--sp-6)) calc(-1 * var(--sp-6));
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  background: var(--c-raised); border-top: 1px solid var(--c-line);
}
dialog .dlg-foot.dlg-foot-empty { display: none; }
/* Ask.confirm / Ask.prompt (ask.js): the site's own confirm and name boxes */
dialog.ask-dlg { width: min(420px, 92vw); }
dialog.ask-dlg h2 { margin-top: 0; }
dialog.ask-dlg .ask-input { width: 100%; margin-top: var(--sp-3); }
dialog.ask-dlg .ask-input[hidden] { display: none; }
dialog.ask-dlg .row { gap: var(--sp-3); }

/* ---------- Controls (side panel) ---------- */
.ctl h3 {
  margin: var(--sp-4) 0 var(--sp-2);
  font: 400 var(--fs-sm)/1.2 var(--font-ui);
  color: var(--c-accent-strong);
}
.ctl h3:first-child { margin-top: 0; }
.ctl .help { margin: var(--sp-3) 0 0; }
dl.keys {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--sp-2) var(--sp-4);
  margin: 0; font-size: var(--fs-sm); line-height: 1.4;
}
dl.keys dt { color: var(--c-text-muted); }
dl.keys dt, dl.keys dd { border-bottom: 1px dotted var(--c-line); padding-bottom: 2px; }
dl.keys dd { margin: 0; color: var(--c-text); }
dl.keys kbd { white-space: nowrap; }
/* Show the touch gestures only where there is a touch screen, and the mouse and keyboard
   controls only where there is a mouse. A laptop with a touch screen gets both. */
.ctl-touch { display: none; }
@media (any-pointer: coarse) {
  .ctl-touch { display: block; }
  .ctl-mouse + .ctl-touch { margin-top: var(--sp-5); }
  @media not all and (any-pointer: fine) { .ctl-mouse { display: none; } }
}

dialog textarea { height: 280px; font: var(--fs-sm)/1.4 var(--font-mono); padding: var(--sp-3); resize: vertical; }

/* ---------- Types in this layout ---------- */
.types { list-style: none; margin: 0; padding: 0; }
.types li, .types-head {
  display: grid; grid-template-columns: 15px 12px minmax(0, 1fr) auto 22px 48px; gap: var(--sp-3); align-items: center;
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); cursor: pointer; min-height: 28px;
}
.types li { border-bottom: 1px dotted var(--c-line); }
.types-head { padding: 0 var(--sp-2) var(--sp-1); font-size: var(--fs-xs); color: var(--c-text-faint); border-bottom: 1px solid var(--c-line); }
.types-head span:nth-child(4), .types-head span:nth-child(5) { text-align: center; }
.types li:hover { background: var(--c-hover); }
.types li.hl { background: var(--c-select-soft); box-shadow: inset 3px 0 0 var(--c-select); }
.types .sw { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.types .n { color: var(--c-text-muted); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.types input[type=number] { width: 48px; min-height: 22px; padding: 0 var(--sp-2); }
.types input.ovr { border-color: var(--c-accent-strong); color: var(--c-accent-strong); }
.types .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Decoration browser ---------- */
#paneBrowse { display: flex; flex-direction: column; overflow: hidden; overflow-x: clip; overflow-y: auto; }   /* clip: nothing can scroll it sideways */
#paneBrowse .hb-searchrow { display: flex; gap: var(--sp-2); }
#paneBrowse .hb-searchrow .hb-q { flex: 1; min-width: 0; }
#paneBrowse .hb-filterbtn { flex: none; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
#paneBrowse .hb-filterbtn.on { background: var(--c-raised); border-color: var(--c-line-strong); }
#paneBrowse .hb-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin: var(--sp-2) 0 0; padding: var(--sp-3); background: var(--c-raised); border: 1px solid var(--c-line); }
#paneBrowse .hb-flabel { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); color: var(--c-text-muted); min-width: 0; }
#paneBrowse .hb-flabel select { width: 100%; min-width: 0; }
#paneBrowse .hb-groupby { grid-column: 1 / -1; }
#paneBrowse .hb-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
#paneBrowse .hb-chip { min-height: 24px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: 12px; }
#paneBrowse .hb-chip-x { color: var(--c-text-faint); }
#paneBrowse .hb-chip:hover .hb-chip-x { color: var(--c-text); }
#paneBrowse .hb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin: var(--sp-3) 0; font-size: var(--fs-sm); }
#paneBrowse .hb-count { color: var(--c-text-faint); }
#paneBrowse .hb-scope { display: inline-flex; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); overflow: hidden; }
#paneBrowse .hb-scope button { min-height: 26px; padding: 0 var(--sp-4); border: 0; border-radius: 0; box-shadow: none; background: none; color: var(--c-text-muted); font-size: var(--fs-sm); }
#paneBrowse .hb-scope button + button { border-left: 1px solid var(--c-line-strong); }
#paneBrowse .hb-scope button.on { background: var(--c-select-soft); color: var(--c-heading); }
#paneBrowse .hb-scope .hb-n { color: var(--c-text-faint); font-variant-numeric: tabular-nums; margin-left: 2px; }
#paneBrowse .hb-scope button.on .hb-n { color: var(--c-text-muted); }
#paneBrowse .hb-groupby select { width: 100%; }
#paneBrowse .hb-more { padding: var(--sp-1) var(--sp-3) var(--sp-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); }
#paneBrowse .hb-list {
  /* at least about ten rows, even when the help and buttons below don't fit: the pane scrolls instead */
  flex: 1 0 auto; height: 0; min-height: 320px; overflow: auto; margin: 0 calc(var(--sp-2) * -1);
  border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); padding: var(--sp-2) 0;
}
#paneBrowse .hb-tip { margin: 0; }
#paneBrowse .hb-howto { margin: 0 0 var(--sp-2); }
#paneBrowse .hb-markbar { margin: 0 0 var(--sp-2); }
#paneBrowse .hb-markbar button { width: 100%; min-height: 26px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
#paneBrowse .hb-howto[hidden] { display: none; }
/* A shared link or gallery post open read-only: no decoration list beside it, just how to edit (UX review S8) */
#paneBrowse .hb-viewonly { display: none; margin: 0; }
body.share-viewing #paneBrowse .hb-viewonly { display: block; }
body.share-viewing #paneBrowse :is(.hb-searchrow, .hb-filters, .hb-chips, .hb-bar, .hb-howto, .hb-list, .hb-collection, .hb-credit) { display: none; }
#paneBrowse .hb-collection {
  flex: none; display: block; width: 100%; margin-top: var(--sp-3); min-height: 0; height: auto;
  padding: var(--sp-2) var(--sp-3); text-align: left; font: inherit; font-size: var(--fs-sm); text-transform: none; letter-spacing: 0;
  background: none; border: 1px solid var(--c-line); border-radius: var(--r-sm); color: var(--c-text); cursor: pointer;
}
#paneBrowse .hb-collection::after { content: " …"; color: var(--c-text-faint); }
#paneBrowse .hb-collection:hover { background: var(--c-hover); }
#paneBrowse .hb-collection.empty { border-color: var(--c-accent); }
#paneBrowse .hb-collection.empty .hb-coll-title { color: var(--c-accent-strong); }
/* "Mark what you own" as a dialog (hideout-browser.js) */
.hb-coll-dlg .hb-ownedbar { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
.hb-coll-dlg .hb-ownedbar label, .hb-coll-dlg .hb-ownedbar button { display: flex; width: 100%; justify-content: center; }
.hb-coll-dlg > .row { justify-content: flex-end; margin-top: var(--sp-5); }
.hb-coll-dlg .hb-ownedbar label[hidden], .hb-coll-dlg .hb-ownedbar button[hidden] { display: none; }
.hb-coll-dlg .hb-firststep, .hb-coll-dlg .hb-tip { margin: 0; }
.hb-coll-dlg .hb-firststep[hidden] { display: none; }

/* Import from the PoE account page (mtx-import.js) */
dialog.mtx-dlg { width: min(560px, 92vw); }
.hb-ho-dlg .hb-ho-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-1) var(--sp-3); max-height: 55vh; overflow: auto; }
.hb-ho-dlg .hb-ho-list:focus { outline: none; }
.hb-ho-dlg .hb-ho-row { display: flex; align-items: center; gap: var(--sp-1); min-height: 28px; cursor: pointer; }
.mtx-dlg .mtx-steps { padding-left: 1.2em; line-height: 1.6; }
.mtx-dlg .mtx-steps li { margin-bottom: var(--sp-2); }
.mtx-dlg .mtx-bm { display: inline-flex; cursor: grab; text-decoration: none; padding: var(--sp-1) var(--sp-3); border: 1px solid var(--accent); border-radius: var(--r-sm); color: var(--accent); font-weight: 500; }
.mtx-dlg textarea { height: 140px; width: 100%; box-sizing: border-box; }
.mtx-dlg .row { justify-content: flex-end; margin-top: var(--sp-3); }
.oc-dlg .oc-skinrow { gap: var(--sp-2); }
.oc-dlg .oc-skinrow select { flex: 1; min-width: 0; }
.oc-dlg .oc-base { margin-top: var(--sp-1); }

.hb-group summary {
  display: flex; align-items: baseline; gap: var(--sp-3);
  cursor: pointer; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); user-select: none;
  list-style: none; font-weight: 500;
}
.hb-group summary::-webkit-details-marker { display: none; }
.hb-group summary { border-bottom: 1px solid var(--c-line); }
.hb-group summary::before { content: "▸"; color: var(--c-text-faint); width: 12px; flex: none; }
.hb-group[open] > summary::before { content: "▾"; color: var(--c-accent-strong); }
.hb-group summary .hb-gcount { font-size: var(--fs-xs); }
.hb-group summary:hover { background: var(--c-hover); }
.hb-group[open] > summary { color: var(--c-accent-strong); }
.hb-groupmark { margin-left: auto; }
.hb-dots { min-height: 22px; min-width: 26px; padding: 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 400; line-height: 1; letter-spacing: 1px; }
.hb-group summary .hb-dots { visibility: hidden; }
.hb-group summary:hover .hb-dots, .hb-group summary .hb-dots:focus-visible, .hb-group summary .hb-dots[aria-expanded=true] { visibility: visible; }
#paneBrowse .hb-bar .hb-markall { margin-left: auto; }
.hb-group .hb-group { margin-left: var(--sp-4); }   /* sub-groups: hideouts, or types inside Free and Shop */

.hb-items { list-style: none; margin: 0 0 var(--sp-2); padding: 0; }
.hb-group .hb-items { padding-left: var(--sp-3); border-left: 1px solid var(--c-line); margin-left: var(--sp-3); }
/* icon | name (two lines at most) | placed | star | +
   icon | variants · theme · tags      | owned badge */
.hb-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto auto; column-gap: var(--sp-3); row-gap: 1px; align-items: center;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); cursor: pointer; min-height: 44px;
}
.hb-item { border-bottom: 1px dotted var(--c-line); }
.hb-item:hover { background: var(--c-hover); }
.hb-item.hl { background: var(--c-select-soft); box-shadow: inset 3px 0 0 var(--c-select); }
.hb-icon { grid-row: 1 / span 2; width: 36px; height: 36px; object-fit: contain; display: block; }
.hb-name { grid-column: 2; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: break-word; hyphens: auto; }
.hb-item.owned .hb-name { color: var(--c-owned); }
.hb-meta { grid-column: 2 / 5; font-size: var(--fs-xs); line-height: 1.25; color: var(--c-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-used { color: var(--c-text-muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-used:empty { display: none; }
.hb-add, .hb-fav { opacity: .45; transition: opacity .1s; }
.hb-item:hover .hb-add, .hb-item:hover .hb-fav, .hb-item.hl .hb-add, .hb-item.hl .hb-fav, .hb-add:focus-visible, .hb-fav:focus-visible, .hb-fav.on { opacity: 1; }
.hb-add { min-height: 24px; width: 24px; padding: 0; line-height: 1; font-weight: 600; }
.hb-fav { min-height: 24px; width: 20px; padding: 0; line-height: 1; border: 0; background: none; box-shadow: none; color: var(--c-text-faint); }
.hb-fav.on { color: var(--c-owned); }
.hb-fav:hover { color: var(--c-owned); background: none; }
.hb-own {
  grid-column: 5; justify-self: end; min-height: 18px; padding: 0 var(--sp-2); font-size: 11px; line-height: 16px; white-space: nowrap;
  border: 1px solid var(--c-line); border-radius: 9px; background: none; box-shadow: none; color: var(--c-text-faint);
}
.hb-own.on { color: var(--c-owned); border-color: color-mix(in srgb, var(--c-owned) 45%, transparent); }
.hb-own:not(:disabled):hover { color: var(--c-text); border-color: var(--c-line-strong); background: var(--c-raised); }
.hb-own:disabled { border-color: transparent; border-style: solid; opacity: .8; cursor: default; }
.hb-empty { padding: var(--sp-3) var(--sp-2); font-size: var(--fs-sm); }

.hb-name mark { background: none; color: var(--c-heading); font-weight: 600; text-decoration: underline; text-decoration-color: var(--c-accent); text-underline-offset: 2px; }
.hb-item:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.hb-none { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: baseline; }
.hb-none p { flex-basis: 100%; margin: 0; }
/* hover preview (pointer resting on a row) */
.hb-peek {
  position: fixed; z-index: 58; display: flex; gap: var(--sp-4); align-items: flex-start; max-width: 340px; padding: var(--sp-4);
  background: var(--c-raised); border: 1px solid var(--c-line-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, .55); pointer-events: none; font-size: var(--fs-sm);
}
.hb-peek-icon { width: 96px; height: 96px; object-fit: contain; flex: none; }
.hb-peek-name { font-weight: 600; color: var(--c-heading); margin-bottom: var(--sp-2); }
.hb-peek-row { line-height: 1.35; }
@media (hover: none) { .hb-peek { display: none !important; } }

/* ⋯ menu (Mark all) and the "Added · Undo" note */
.hb-menu { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 180px; padding: var(--sp-1); background: var(--c-raised); border: 1px solid var(--c-line-strong); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.hb-menu button { justify-content: flex-start; text-align: left; border: 0; box-shadow: none; background: none; font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3); }
.hb-menu button:hover, .hb-menu button:focus-visible { background: var(--c-hover); }
.hb-toast {
  position: fixed; z-index: 55; left: calc(var(--side-left) + 24px); bottom: 56px; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4); background: var(--c-raised); border: 1px solid var(--c-line-strong); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); font-size: var(--fs-sm);
}
.hb-toast-undo { min-height: 26px; padding: 0 var(--sp-3); }
@media (max-width: 720px) { .hb-toast { left: 12px; right: 12px; bottom: 12px; justify-content: space-between; } }

.hb-var { font-style: normal; color: var(--c-select); }
.hb-poe2 { font-style: normal; }
.hb-poe2.unconfirmed { color: var(--c-text); }
.hb-poe2.poe1 { color: var(--c-danger); }

/* ---------- Variant picker (variant-picker.js) ---------- */
.var-picker { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px dotted var(--c-line); }
.var-head { display: flex; align-items: center; gap: var(--sp-3); }
.var-title { color: var(--c-text-muted); font-size: var(--fs-sm); min-width: 74px; }
.var-step { min-width: 28px; padding: 0 var(--sp-3); font-weight: 600; }
.var-pos { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.var-toggle { margin-left: auto; font-size: var(--fs-xs); }
.var-name { margin: var(--sp-3) 0 var(--sp-3) calc(74px + var(--sp-3)); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.var-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: var(--sp-3);
  max-height: 236px; overflow-y: auto; padding: var(--sp-1);
}
.var-tile {
  position: relative; display: block; aspect-ratio: 1; min-height: 0; padding: var(--sp-2);
  background: var(--c-sunken); border: 1px solid var(--c-line); border-radius: var(--r-sm);
}
.var-tile:hover { border-color: var(--c-line-strong); background: var(--c-hover); }
.var-tile.on { border-color: var(--c-select); box-shadow: inset 0 0 0 1px var(--c-select); background: var(--c-select-soft); }
.var-thumb { display: block; width: 100%; height: 100%; overflow: visible; }
.var-box { fill: none; stroke: var(--c-text-faint); }
.var-walk { fill: var(--c-map-floor); stroke: var(--c-text-muted); fill-opacity: .9; }
.var-tile.on .var-walk { fill: var(--c-select-soft); stroke: var(--c-select); }
.var-tile.on .var-box { stroke: var(--c-select); }
.var-none { fill: var(--c-text-faint); }
.var-num {
  position: absolute; right: 3px; bottom: 1px; font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.var-tile.on .var-num { color: var(--c-select); }
.var-hint { margin-top: var(--sp-3); font-size: var(--fs-xs); }

/* ---------- "Can I build this?" (build-check.js) ---------- */
.tabs button { line-height: 1.15; }
#paneBuild { display: flex; flex-direction: column; overflow: hidden; }
.bc-summary { margin: var(--sp-2) 0 var(--sp-3); }
.bc-headline { margin: 0 0 var(--sp-3); font: 700 19px/1.25 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--tracking-display); color: var(--c-heading); }
.bc-headline.bc-done { color: var(--c-ok); }
.bc-meter {
  display: block; width: 100%; height: 8px; margin: 0 0 var(--sp-3);
  appearance: none; -webkit-appearance: none; border: 1px solid var(--c-line);
  background: var(--c-danger-soft); overflow: hidden;
}
.bc-meter::-webkit-progress-bar { background: var(--c-danger-soft); }
.bc-meter::-webkit-progress-value { background: var(--c-accent); }
.bc-meter::-moz-progress-bar { background: var(--c-accent); }
.bc-detail { margin: 0; font-size: var(--fs-sm); }
.bc-bar { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5); margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.bc-chk { display: flex; gap: var(--sp-2); align-items: center; color: var(--c-text-muted); cursor: pointer; }
.bc-chk:hover { color: var(--c-text); }
.bc-actions { display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.bc-actions button { min-height: 26px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
.bc-markall { flex: 1; }
.bc-list {
  /* at least about ten rows, even when the help and buttons below don't fit: the pane scrolls instead */
  flex: 1 0 auto; height: 0; min-height: 320px; overflow: auto; margin: 0 calc(var(--sp-2) * -1);
  border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); padding: var(--sp-2) 0;
}
.bc-ghead {
  display: flex; align-items: baseline; gap: var(--sp-2); margin: var(--sp-3) var(--sp-3) var(--sp-1);
  font: 600 16px/1.3 var(--font-caps); text-transform: var(--display-case); letter-spacing: var(--tracking-display); color: var(--c-heading);
}
.bc-ghead .muted { font-size: var(--fs-xs); font-weight: 400; }
.bc-items { list-style: none; margin: 0 0 var(--sp-2); padding: 0; }
.bc-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; column-gap: var(--sp-3); align-items: center;
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-sm); min-height: 30px;
}
.bc-item { border-bottom: 1px dotted var(--c-line); }
.bc-item:hover { background: var(--c-hover); }
.bc-own { margin: 0; cursor: pointer; }
.bc-name {
  display: flex; align-items: center; justify-content: flex-start; gap: var(--sp-3); min-width: 0; min-height: 0; padding: 0;
  background: none; border: 0; box-shadow: none; color: var(--c-text); text-align: left; font: inherit; cursor: pointer;
}
.bc-name:hover, .bc-name:active { background: none; box-shadow: none; color: var(--c-text); }
.bc-name:hover .bc-label { text-decoration: underline; }
.bc-label { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.25; overflow-wrap: anywhere; }
.bc-item.missing .bc-label { color: var(--c-text); }
.bc-item.owned .bc-label { color: var(--c-owned); }
.bc-icon { flex: none; display: inline-block; width: 24px; height: 24px; object-fit: contain; border-radius: var(--r-sm); background: var(--c-sunken); }
.bc-tags { display: flex; gap: var(--sp-1); }
.bc-tag { font-size: var(--fs-xs); line-height: 16px; padding: 0 var(--sp-2); border: 1px solid var(--c-line); color: var(--c-text-muted); }
.bc-tag.bc-mtx { color: var(--c-accent-strong); border-color: var(--c-accent); }
.bc-tag.bc-ho { color: var(--c-owned); }
.bc-item.short .bc-label { color: var(--c-text); }
.bc-count .bc-copies { width: 3.4em; min-width: 0; min-height: 22px; height: 22px; padding: 0 2px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; text-align: right; -moz-appearance: textfield; }
.bc-count .bc-copies::-webkit-inner-spin-button, .bc-count .bc-copies::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.bc-count .bc-copies.short { color: var(--c-danger); border-color: var(--c-danger); }
.bc-count:has(.bc-copies) { white-space: nowrap; }
.bc-honote { margin: 0 0 var(--sp-3); }
.bc-honote .help { margin: 0 0 var(--sp-2); }
.bc-poe2 { margin: 0 0 var(--sp-3); }
.bc-poe2 .help { margin: 0 0 var(--sp-2); }
.bc-homark { width: 100%; min-height: 26px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
/* "Swap N for look-alikes you own" (swap-owned.js) */
.bc-swap { margin: 0 0 var(--sp-3); padding: var(--sp-2); border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); }
.bc-swap .help { margin: 0 0 var(--sp-2); }
.bc-swapbtn { width: 100%; min-height: 26px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
.bc-count { color: var(--c-text-muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.bc-note { margin-top: var(--sp-3); }
.bc-warn { color: var(--c-danger); }
.bc-empty { padding: var(--sp-3) var(--sp-2); font-size: var(--fs-sm); }
.tools-sheet-bar { display: none; }   /* the phone sheet's title and close button (layout.js) */
/* text shown only on phones (header button labels) */
.phone-only { display: none; }

@media (max-width: 720px) {
  .bc-item { min-height: 40px; }
  .bc-actions button, .bc-homark, .bc-swapbtn { min-height: 36px; }
  .bc-chk { min-height: 32px; }
}

/* ---------- Header up to 1,200 px: half a 1080p monitor, an upright tablet, a phone on its side ----------
   The header wraps instead of pushing Export off the screen, and "Check what you own" gets its short label. */
@media (max-width: 1200px) {
  header { flex-wrap: wrap; row-gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); }
  header h1 { margin-right: var(--sp-3); font-size: 21px; }
  header select#hoSelect { flex: 1 1 180px; min-width: 0; }
  header .hdr-end { flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); }
  header #btnCheckOwned .wide-only { display: none; }
  header #btnCheckOwned .phone-only { display: inline; }
}

/* ---------- Tablet: the Tools panel moves under the map ---------- */
@media (max-width: 1100px) {
  :root { --side-left: 250px; }
  body, body.tools-open { grid-template-columns: var(--side-left) 1fr; grid-template-rows: auto minmax(360px, 75dvh) auto auto; height: auto; min-height: 100dvh; }
  aside.left { grid-row: 2; }
  aside.right {
    grid-column: 1 / -1; grid-row: 3; border-left: 0; border-top: var(--rule-double); box-shadow: none;
    columns: 2 260px; column-gap: var(--sp-7);
  }
  aside.right > * { break-inside: avoid; }
  footer { grid-row: 4; }
}

/* ---------- Map narrower than its toolbar (tablets, or Tools open below ~1,400 px) ----------
   The toolbar wraps to a second row rather than losing its last buttons off the map's edge. */
#canvasWrap { container-type: inline-size; }
@container (max-width: 660px) {
  .maptools { left: 12px; right: 12px; transform: none; width: fit-content; max-width: none; margin: 0 auto; flex-wrap: wrap; justify-content: center; row-gap: var(--sp-2); }
}

/* ---------- Phone: one column, map first ---------- */
@media (max-width: 720px) {
  :root { --control-h: 38px; --fs-md: 15px; }
  body, body.tools-open { display: flex; flex-direction: column; height: auto; min-height: 100dvh; }

  /* above the sticky map (z-index 20 below), so the ☰ menu opens over it instead of behind it */
  header { flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); z-index: 30; }
  /* basis 0, so the title shrinks (with an ellipsis) instead of pushing Sign in onto its own row */
  header h1 { flex: 1 1 0; min-width: 0; margin: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wide-only { display: none; }
  .phone-only { display: inline; }
  header::after { content: ""; order: 2; flex-basis: 100%; height: 0; }   /* line break after Account */
  /* Menu (☰), title and Account on the first line; Export, the hideout picker, Tools and Feedback on the second */
  header .hdr-end { display: contents; }
  header .menu { order: 0; }
  .hub-mark .hm-b { display: none; }   /* just "HCPOE" on a phone */
  header #btnAccount { order: 1; }
  header #btnSave { order: 3; }
  header select#hoSelect { order: 4; flex: 1 1 150px; min-width: 0; max-width: none; }   /* wraps to its own line before it shrinks to a letter */
  header #btnTools, header #btnCheckOwned { order: 5; }
  header .hdr-end > .linkish { order: 6; }

  /* The map stays at the top of the screen while the decoration list scrolls with the page under it,
     so a tapped decoration is always seen landing, and there is no list scrolling inside the page. */
  #canvasWrap { height: 50vh; height: 50svh; min-height: 260px; order: 1; position: sticky; top: 0; z-index: 20; }
  aside.left { order: 2; border: 0; box-shadow: none; border-top: var(--rule-double); height: auto; min-height: 50svh; padding: var(--sp-4); overflow: visible; }
  aside.left .pane { overflow: visible; flex: none; }
  #paneBrowse { overflow: visible; }
  #paneBrowse .hb-list { flex: none; height: auto; min-height: 0; overflow: visible; }
  /* Tools: a sheet over the lower half of the screen, under the map that stays at the top (layout.js
     scrolls the header away when it opens). Its bar holds the close button. */
  aside.right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 50svh; min-height: 220px;
    border: 0; border-top: 2px solid var(--c-line-strong); box-shadow: 0 -10px 28px rgba(0, 0, 0, .6);
    overflow: auto; overscroll-behavior: contain; columns: auto; padding: 0 var(--sp-4) var(--sp-6);
  }
  .tools-sheet-bar {
    display: flex; position: sticky; top: 0; z-index: 1; align-items: center; justify-content: space-between;
    margin: 0 calc(-1 * var(--sp-4)) var(--sp-3); padding: var(--sp-2) var(--sp-4);
    background: var(--c-surface); border-bottom: 1px solid var(--c-line);
    font: 600 19px/1.1 var(--font-caps); text-transform: var(--display-case); letter-spacing: var(--tracking-display); color: var(--c-heading);
  }
  .tools-sheet-close { min-width: 44px; min-height: 44px; font-size: 18px; }
  footer { order: 4; padding: var(--sp-4); gap: var(--sp-3) var(--sp-5); font-size: var(--fs-sm); }
  footer .info { max-width: none; flex-basis: 100%; }
  footer .notice { margin-left: 0; flex-basis: 100%; }
  footer .linkish, footer a { min-height: 32px; display: inline-flex; align-items: center; }

  /* Map tools: along the bottom of the map, big targets, swipe sideways for the rest */
  .maptools { flex-wrap: nowrap; justify-content: flex-start; top: auto; bottom: 10px; overflow-x: auto; scrollbar-width: none; gap: var(--sp-2); padding: var(--sp-2); }
  .maptools::-webkit-scrollbar { display: none; }
  .mt { width: 44px; height: 44px; }
  .mt svg { width: 22px; height: 22px; }
  .mt::after { display: none; }
  /* A phone can't fit every button: show the zoom group (pinch also zooms) until something is
     selected, then the selection group in its place. */
  .maptools:not(.has-sel) .mt-sel, .maptools.has-sel .mt-view { display: none; }
  #notes { top: var(--sp-4); }

  details.sect > summary { padding: var(--sp-2) 0; }
  details.sect > summary h2 { font-size: 22px; }
  #drop { padding: var(--sp-4); align-items: flex-start; }
  #drop .start { padding: var(--sp-6); }
  #drop .start .row { flex-direction: column; align-items: stretch; }
  .hb-add, .hb-fav, .hb-group summary .hb-dots { opacity: 1; visibility: visible; }
  .hb-item, .types li { min-height: 38px; }
  .hb-group summary { min-height: 36px; align-items: center; }
  .tabs button { min-height: 40px; }
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }

  /* Touch sizes in the decoration list: the add button, star, Owned and All switch and owned badge */
  .hb-add { width: 44px; min-height: 44px; font-size: 20px; }
  .hb-fav { width: 36px; min-height: 44px; font-size: 18px; }
  #paneBrowse .hb-scope button { min-height: 40px; }
  .hb-own { min-height: 30px; line-height: 28px; padding: 0 var(--sp-3); border-radius: 15px; font-size: var(--fs-xs); }
}
@media (max-width: 360px) {
  .mt { width: 36px; }   /* still 44px tall; narrow enough for seven buttons on a 320px screen */
}

/* ---------- My hideouts library (hideout-library.js) ---------- */
dialog.lib-dlg { width: min(720px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
dialog.lib-dlg:not([open]) { display: none; }
.lib-head { display: flex; align-items: baseline; gap: var(--sp-4); }
.lib-head h2 { margin: 0; }
.lib-head button { margin-left: auto; }
.lib-dlg .help { margin: var(--sp-3) 0 0; }
#libStatus:empty { display: none; }
.lib-list { list-style: none; margin: var(--sp-5) 0 0; padding: 0; overflow: auto; min-height: 0; }
.lib-item {
  display: grid; grid-template-columns: 160px minmax(0, 1fr); grid-template-areas: "pic meta" "pic acts";
  gap: var(--sp-3) var(--sp-5); align-items: start;
  padding: var(--sp-4); border: 1px solid var(--c-line); border-radius: var(--r-sm);
  background: var(--c-raised); margin-bottom: var(--sp-4);
}
.lib-item.open { border-color: var(--c-line-strong); box-shadow: inset 3px 0 0 var(--c-accent); }
.lib-thumb {
  grid-area: pic; width: 160px; height: 100px; padding: 0; min-height: 0;
  background: var(--c-sunken); border: 1px solid var(--c-line); border-radius: var(--r-sm);
  box-shadow: none; overflow: hidden; cursor: pointer;
}
.lib-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.lib-thumb:hover { border-color: var(--c-line-strong); }
.lib-meta { grid-area: meta; min-width: 0; }
.lib-name { font-weight: 600; color: var(--c-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-sub, .lib-when { font-size: var(--fs-sm); color: var(--c-text-muted); margin-top: var(--sp-1); }
.lib-when { color: var(--c-text-faint); }
.lib-rename { width: 100%; }
.lib-acts { grid-area: acts; display: flex; flex-wrap: wrap; gap: var(--sp-3); align-self: end; }
.lib-acts .danger { color: var(--c-danger); }
/* Version history view inside My hideouts */
.lib-history { overflow: auto; min-height: 0; margin-top: var(--sp-4); }
.lib-history[hidden] { display: none; }
.lib-history .lib-list { overflow: visible; }
.lib-hist-head { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.lib-hist-title { margin: 0; font-size: var(--fs-md, 1rem); min-width: 0; overflow-wrap: anywhere; }
.lib-hist-sub { margin: var(--sp-5) 0 0; }
.lib-history div.lib-thumb { cursor: default; }
.lib-history .lib-thumb:hover { border-color: var(--c-line); }
@media (max-width: 520px) {
  .lib-item { grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "pic meta" "acts acts"; }
  .lib-thumb { width: 96px; height: 60px; }
}

/* Farming setup (farm-setup.js) */
.fs-pick { width: 100%; }
.fs-pieces { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-3); margin: var(--sp-2) 0; }
.fs-pieces .chk { margin: 2px 0; }
.fs-h { margin: var(--sp-4) 0 var(--sp-2); }
.fs-skins { list-style: none; padding: 0; margin: var(--sp-2) 0; }
.fs-skins li { margin: 0 0 var(--sp-2); }
.fs-skins label { display: grid; gap: 2px; }
.fs-skins select { width: 100%; }
.fs-status:empty { display: none; }

/* ---------- Lock by type, stamps, history, measure ---------- */
.types li { grid-template-columns: 15px 12px 1fr auto 24px 48px; }
.types .lock { width: 24px; height: 22px; min-height: 0; padding: 0; border-color: transparent; background: none; color: var(--c-text-faint); display: inline-flex; align-items: center; justify-content: center; }
.types .lock svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.types .lock:hover { color: var(--c-text); border-color: var(--c-line-strong); }
.types .lock.on { color: var(--c-accent-strong); }
.types li.locked .name { color: var(--c-text-muted); }
.stamp-form { display: flex; gap: var(--sp-2); margin: var(--sp-2) 0; }
.stamp-form input { flex: 1; min-width: 0; }
.stamps, .history { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.stamps li { display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--sp-3); align-items: center; padding: var(--sp-1) 0; border-bottom: 1px dotted var(--c-line); }
.stamps .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stamps .n { color: var(--c-text-muted); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.stamps button { min-height: 24px; padding: 0 var(--sp-3); }
.stamps .x { padding: 0 var(--sp-2); }
.stamps .empty, .history .empty { display: block; border: 0; font-size: var(--fs-sm); }
.history { max-height: 260px; overflow-y: auto; }
.history button { display: block; width: 100%; text-align: left; min-height: 26px; padding: 0 var(--sp-3); border-color: transparent; background: none; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history button:hover { border-color: var(--c-line-strong); }
.history .now button { color: var(--c-select); box-shadow: inset 3px 0 0 var(--c-select); background: var(--c-select-soft); }
.history .redo button { color: var(--c-text-faint); }
#canvasWrap.measuring canvas { cursor: crosshair !important; }
/* Start screen: "Continue your latest layout for this hideout" (hideout-library.js) */
#drop .start .start-continue { border: 1px solid var(--c-line); border-left: 3px solid var(--c-accent); padding: var(--sp-4) var(--sp-5); margin: var(--sp-4) 0; display: grid; gap: var(--sp-3); }
#drop .start .start-continue[hidden] { display: none; }
#drop .start .start-continue p { margin: 0; }
#drop .start .start-continue .muted { font-size: var(--fs-sm); }

/* The beta's "the site has moved" notice (account.js, shown only when the Worker's MOVED_TO is set). */
.moved-notice {
  position: fixed; z-index: 60; left: 50%; bottom: 44px; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px)); box-sizing: border-box;
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); background: var(--c-raised); color: var(--c-text);
  border: 1px solid var(--c-line-strong); border-left: 3px solid var(--c-accent); box-shadow: var(--shadow-pop);
}
.moved-notice p { margin: 0; flex: 1; }
.moved-notice a { color: inherit; font-weight: 600; }
.moved-notice button { flex: none; min-width: 32px; min-height: 32px; }
