/* ui16: readable in day AND night mode everywhere (owner, wave 11) — loaded last (index.html + the landing pages).
   1. Tokens: the base text tokens of style.css re-tuned to WCAG AA (4.5:1) on every panel shade of their theme, plus
      day-mode values for the rarity / good / bad / warn colours (they were the night colours in both themes, e.g. a
      common item name was near-white on parchment) and a few new surface tokens (--u16-*) the components below use.
   2. Components that had a light background hardcoded under theme-coloured (light at night) text — the phone cards of
      NPC / manual tables (npc6 cardify: the manual's rebirth "20 rounds" cards were white with pale text at night) and
      the rest found by tools/contrast_ui16.mjs — now take the surface tokens, so both themes follow automatically.
   3. Account page: the Enter-game bar fixed to the bottom (accui16.js), the farm card's More / Less.
   4. NPC shop sort row (shopsort16.js). */

/* ================================================================ 1. tokens */
:root {
  --ink-dim: #c2ad86; --ink-mute: #b39d78; /* was #b8a27a / #8a7655: 2.6–4.4:1 on the darker panels */
  --u16-card: rgba(255, 236, 190, .07); --u16-card-line: rgba(201, 154, 59, .4); --u16-card-top: rgba(255, 210, 90, .7);
  --u16-label: var(--ink-mute); --u16-sub: rgba(0, 0, 0, .28);
  --u16-bar-bg: linear-gradient(180deg, rgba(26, 49, 104, .97), rgba(9, 18, 44, .98)); --u16-bar-line: rgba(246, 215, 126, .6);
  --u16-link: #ffd77a;
  --u16-row: rgba(255, 236, 190, .07); /* a list row / tile on a window */
  --u16-gold-ink: #f0c060; --u16-ok-ink: #7fe08e; --u16-hot-ink: #ffa061; --u16-red-ink: #ff8a7a; --u16-blue-ink: #8cc4ff; /* accent text on a dark panel */
}
:root[data-theme="light"] {
  --gold-3: #7a4f08; /* text on parchment: was #8f5f0e (3.7–5.2:1) */
  --ink-dim: #5e4a30; --ink-mute: #655238; /* was #725a3c / #9a8566 (2.4–3.3:1) */
  --r-common: #3b2a17; --r-good: #1b6627; --r-rare: #17559a; --r-epic: #6a34b0; --r-legend: #8a4500; --r-divine: #a10f25;
  --good: #1b6627; --bad: #a10f25; --warn: #8a4f00;
  --u16-card: rgba(255, 252, 240, .88); --u16-card-line: rgba(185, 138, 53, .45); --u16-card-top: #c98a10;
  --u16-sub: rgba(140, 95, 30, .08);
  --u16-bar-bg: linear-gradient(180deg, rgba(255, 252, 244, .98), rgba(244, 232, 204, .98)); --u16-bar-line: rgba(160, 112, 36, .55);
  --u16-link: #7a4f08;
  --u16-row: rgba(255, 255, 255, .5);
  --u16-gold-ink: #7a4a08; --u16-ok-ink: #1b6627; --u16-hot-ink: #9a3a05; --u16-red-ink: #a10f25; --u16-blue-ink: #17559a;
}
/* the HUD floats over the world and keeps the night colours in both themes (style.css #hud) */
#hud {
  --ink-dim: #c2ad86; --ink-mute: #b39d78;
  --r-common: #e9e4d6; --r-good: #6fdc7e; --r-rare: #5ab0ff; --r-epic: #b27cff; --r-legend: #ff9a3c; --r-divine: #ff4d5e;
  --good: #6fdc7e; --bad: #ff6464; --warn: #ffb347;
  --u16-row: rgba(255, 236, 190, .07); --u16-gold-ink: #f0c060; --u16-ok-ink: #7fe08e; --u16-hot-ink: #ffa061; --u16-red-ink: #ff8a7a; --u16-blue-ink: #8cc4ff;
}
/* windows that are parchment in both themes (settings, job popup, Starter Pack): the day inks, always */
.modal.set2, .modal.jpop, .o7-pop {
  --ink: #3b2a17; --ink-dim: #5e4a30; --ink-mute: #655238; --gold-3: #7a4f08;
  --r-common: #3b2a17; --r-good: #1b6627; --r-rare: #17559a; --r-epic: #6a34b0; --r-legend: #8a4500; --r-divine: #a10f25;
  --good: #1b6627; --bad: #a10f25; --warn: #8a4f00;
  --u16-row: rgba(255, 255, 255, .5); --u16-gold-ink: #7a4a08; --u16-ok-ink: #1b6627; --u16-hot-ink: #9a3a05; --u16-red-ink: #a10f25; --u16-blue-ink: #17559a;
  --u16-card: rgba(255, 252, 240, .88); --u16-card-line: rgba(185, 138, 53, .45); --u16-label: #655238;
}

/* ================================================================ 2. components */
/* NPC / manual tables as cards on phones (npc6.css cardify): the card surface follows the theme */
@media (max-width: 640px), (max-height: 500px) {
  table.n6-ct tr { background: var(--u16-card); box-shadow: inset 0 0 0 1px var(--u16-card-line), 0 2px 4px -3px rgba(0, 0, 0, .4); color: var(--ink); }
  table.n6-ct tr.top { box-shadow: inset 0 0 0 2px var(--u16-card-top), 0 0 10px rgba(255, 200, 60, .25); }
  table.n6-ct td:first-child { border-bottom-color: var(--u16-card-line); }
  table.n6-ct td[data-l]:not(:first-child)::before { color: var(--u16-label); }
}

/* rows / tiles that were a fixed white wash (grey under light text at night) */
:root .s8-glrow { background: var(--u16-row); }                                   /* AUTO job-gear list (svc8.css: it followed the device, not the game's theme) */
:root .h6-rbt-row, :root .h6-fx-row { background: var(--u16-row); }                    /* rebirth table rows, effect settings rows (hud6.css) */
:root .f10-rec-pick { background: var(--u16-card); color: var(--ink); }           /* Tool Dealer → Recommended cards (fx10.css) */
/* accent text that was one shade for both themes */
:root .h6-rbsum, :root .h6-rbt-add { color: var(--u16-gold-ink); }
:root .h6-rbt-at, :root .h6-home-free { color: var(--u16-ok-ink); }
:root .h6-rbt-at.next, :root .h6-rbcheer, :root .h6-home-free.none { color: var(--u16-hot-ink); }
:root .h6-rbt-main b, :root .h6-rbnow b, :root .h6-rbnext-h b { color: color-mix(in srgb, var(--rb-c, #b07020) 40%, var(--ink)); }
:root .jl8-man b.jl8-h, :root .po-sect > summary, :root .pet-warn { color: var(--u16-red-ink); }
:root .dp-rule b { color: var(--u16-blue-ink); }
:root .n6-why { color: var(--u16-hot-ink); }
:root .wx-h small { color: var(--ink); }                                          /* weather hours on coloured tiles */
:root .pp-why { opacity: 1; color: var(--ink-dim); }
:root .bf-tab .bf-n { opacity: 1; }
:root .tab.on .bf-n { background: rgba(255, 255, 255, .55); color: #2a1300; }
/* locked / switched-off parts stay readable (they were faded to .55–.62) */
:root .apx-pro.locked .ap-grp, :root .apx-pro .ap-grp.locked > :not(h5):not(.apx-lock):not(small), :root .apx-movsec.locked .as-opt, :root .ap-sec.locked .ap-grp, :root .h6-fx-list.off { opacity: .82; }
:root .ap-chip.off { opacity: 1; }
:root .lt-chk.dis { opacity: .78; }
/* coloured badges with white text: deep enough for 4.5:1 */
:root .f10-rec-pick .f10-rec-badge { background: #a8620a; }
:root .f10-rec-badge.b1 { background: #1f7a3e; }
:root .jg-qs-n { background: #23804a; }
:root .tp9-f.on { background: #b35a0c; border-color: #8a4508; }
:root .s4-tag { background: linear-gradient(#e0483c, #b8241c); }
:root .s6-fab:not(.on) { background: linear-gradient(160deg, #d63a6e, #b0245a); }
:root .eqb:not(.grey):not(.gold) { background: linear-gradient(#3a6ad0, #2a55b0); }
:root .rb-badge.t4 { color: #fff; text-shadow: 0 0 2px #000, 0 1px 2px #000, 0 0 1px #000; } /* light and dark badge colours: an outline carries the number */
/* the equipment window (always light): the slot hints a shade darker */
:root .modal.eqw { --eq-mute: #5d6270; }
:root .eqw-sub { color: #fff8e6; }
/* the website's "skip to sign in" link (shown on keyboard focus): dark ink on its gold (it was gold on gold) */
body.w2 a.w2-skip { color: #241400; }

/* faded rows (locked / past / not owned) stay readable */
:root .ts-lock { opacity: .82; }
:root .wx-h.past { opacity: .85; }
:root .eq-cardcell.dim { opacity: .9; }
/* Tool Dealer "too weak for you" potion rows (potpct.css faded the whole row to .72, 3.5:1 by day): the text stays full
   strength, only the picture is dimmed and the row gets a dashed edge */
:root .pp-weakrow { opacity: 1; border-style: dashed; }
:root .pp-weakrow canvas, :root .pp-weakrow img { opacity: .6; filter: grayscale(.6); }
/* manual highlight tiles with their own dark picture (polar fire, tomb): light ink on every line */
:root .man-hl.po-fire .man-hl-l, :root .man-hl.po-fire .man-hl-s, :root .man-hl.po-fire .man-hl-v, :root .man-hl.tb-hl .man-hl-l, :root .man-hl.tb-hl .man-hl-s, :root .man-hl.tb-hl .man-hl-v { color: #fff3dc !important; }
:root .inft-kicker { color: #ffe27a; } :root .inft-st { color: #fff; }
:root .tb-title { color: #ffb0b6; }
/* day mode (and the always-parchment settings window): accent colours that were made for a dark window */
:root[data-theme="light"] .chip.bs-ok { color: #17652f; }
:root .modal.set2 .chip.bs-ok { color: #17652f; }
:root[data-theme="light"] .jg-tags i { background: rgba(140, 95, 30, .12); }
:root[data-theme="light"] .jg-tags i.d1 { color: #17652f; } :root[data-theme="light"] .jg-tags i.d2 { color: #7a4a00; } :root[data-theme="light"] .jg-tags i.d3 { color: #a10f25; }
:root[data-theme="light"] .s8-kept, :root[data-theme="light"] .ws-off, :root[data-theme="light"] .tu2-x, :root[data-theme="light"] .rw-chip.exp, :root[data-theme="light"] .ah-tile.e b, :root[data-theme="light"] .bl-pro, :root[data-theme="light"] .bl-tag.t-farm, :root[data-theme="light"] .bl-tchk.t-farm span { color: #17652f; }
:root .modal.set2 .s8-kept, :root .modal.set2 .ws-off, :root .modal.set2 .tu2-x, :root .modal.set2 .rw-chip.exp, :root .modal.set2 .ah-tile.e b, :root .modal.set2 .bl-pro, :root .modal.set2 .bl-tag.t-farm, :root .modal.set2 .bl-tchk.t-farm span { color: #17652f; }
:root[data-theme="light"] .b14-tab-tk span, :root[data-theme="light"] .b14-tab-tk .b14-tn, :root[data-theme="light"] .bty-gold, :root[data-theme="light"] .bl-tag.t-boss { color: #7a4a00; }
:root .modal.set2 .b14-tab-tk span, :root .modal.set2 .b14-tab-tk .b14-tn, :root .modal.set2 .bty-gold, :root .modal.set2 .bl-tag.t-boss { color: #7a4a00; }
:root[data-theme="light"] .mh-ast-h, :root[data-theme="light"] .ap-sec.locked .as-h, :root[data-theme="light"] .ap-note { color: #0b6a62; }
:root .modal.set2 .mh-ast-h, :root .modal.set2 .ap-sec.locked .as-h, :root .modal.set2 .ap-note { color: #0b6a62; }
:root[data-theme="light"] .as-sec.aq .as-h, :root[data-theme="light"] .row > .link, :root[data-theme="light"] .man-hl.m4 .man-hl-v { color: #17559a; }
:root .modal.set2 .as-sec.aq .as-h, :root .modal.set2 .row > .link, :root .modal.set2 .man-hl.m4 .man-hl-v { color: #17559a; }
:root[data-theme="light"] .po-nofit, :root[data-theme="light"] .d3-have.none, :root[data-theme="light"] .d3-have.none .num, :root[data-theme="light"] .bl-con, :root[data-theme="light"] .bl-off, :root[data-theme="light"] .bl-tag.t-gvg { color: #9a3a05; }
:root .modal.set2 .po-nofit, :root .modal.set2 .d3-have.none, :root .modal.set2 .d3-have.none .num, :root .modal.set2 .bl-con, :root .modal.set2 .bl-off, :root .modal.set2 .bl-tag.t-gvg { color: #9a3a05; }
:root[data-theme="light"] .rw-chip.jexp { color: #5a2fa8; }
:root .modal.set2 .rw-chip.jexp { color: #5a2fa8; }
:root[data-theme="light"] .row.wrap > b.grow { color: color-mix(in srgb, var(--rb-c, #3b2a17) 35%, #2a1d0e); }
:root .modal.set2 .row.wrap > b.grow { color: color-mix(in srgb, var(--rb-c, #3b2a17) 35%, #2a1d0e); }
:root[data-theme="light"] .chip.el-fire { color: #a8300a; } :root[data-theme="light"] .chip.el-earth { color: #6a4a10; } :root[data-theme="light"] .chip.el-water { color: #1a5a9a; }
:root[data-theme="light"] .chip.el-light { color: #7a5a00; } :root[data-theme="light"] .chip.el-wind { color: #2f6a12; } :root[data-theme="light"] .chip.el-dark { color: #5a2fa0; }
:root[data-theme="light"] .gd-price .chip.no, :root[data-theme="light"] .gs3-need .chip.no { color: #5a2a00; } :root[data-theme="light"] .gd-price .chip.ok { color: #145a2f; }
:root .modal.set2 .gd-price .chip.no, :root .modal.set2 .gs3-need .chip.no { color: #5a2a00; } :root .modal.set2 .gd-price .chip.ok { color: #145a2f; }
:root[data-theme="light"] .jl8-man b.jl8-h { color: #a10f25; }
:root .modal.set2 .jl8-man b.jl8-h { color: #a10f25; }
:root[data-theme="light"] .r3-usenow { color: #145a2f; }
:root .modal.set2 .r3-usenow { color: #145a2f; }
:root[data-theme="light"] .s2-track, :root[data-theme="light"] .s2-foot span { color: #5e4a30; }
:root .modal.set2 .s2-track, :root .modal.set2 .s2-foot span { color: #5e4a30; }
:root[data-theme="light"] .f10-link, :root[data-theme="light"] .fv-sum .grow { color: #0a5a90; }
:root .modal.set2 .f10-link, :root .modal.set2 .fv-sum .grow { color: #0a5a90; }

/* round 3 (tools/contrast_ui16.mjs): faded parts, colours a more specific rule kept */
:root .wg-sub.dim, :root .ab-sec.locked .ab-row, :root .ab-sec.locked .ab-switch, :root .st2-tab.lk, :root .st2-fx.dim { opacity: .85; }
:root .pp-why { opacity: 1 !important; }
:root .wg-head b { color: var(--u16-blue-ink); }
:root .fv-chip { color: var(--ink-dim); }
:root .apx-lock-t small { color: var(--ink); }
:root .sh2-cats .tab.s6-mtab, :root .sh2-cats .tab.gsx-settab, :root .tab.s4-ptab { color: var(--ink); }
:root .man-cat.on small, :root .man-sub.on small, :root .qa-cat.on small { color: #2a1600; }
:root .b8-chip .b8-n { background: rgba(0, 0, 0, .5); color: #fff6dc; }
:root:not([data-theme="light"]) .wx-lg { color: #fff; }
:root .tb-title { color: #ffe6e9; text-shadow: 0 0 2px #2a0006, 0 1px 3px #2a0006, 0 0 8px rgba(255, 40, 60, .5); }
:root .inft-kicker { color: #fff6cc; text-shadow: 0 1px 2px rgba(40, 10, 60, .8), 0 0 1px #000; }
:root .modal.set2 .as-d { color: #554430; }
:root .modal.set2 .as-v { color: #6e4508; }
:root .o7-pop, :root .tu2-pop { --o7-gold: #5a3000; --ink-mute: #4e3d26; --ink-dim: #4e3d26; }
:root .o7-save { color: #0b3d1f; } /* on its green pill over the gold ribbon: 5:1 */
:root .s8-gltabs .tab.s8-kept:not(.on) { color: var(--u16-ok-ink); }
:root[data-theme="light"] .s8-gltabs .tab.on { color: #2a1600; }
:root[data-theme="light"] .b14-cst.off, :root[data-theme="light"] .b14-cst.once { color: #fff3dc; }
:root[data-theme="light"] .b14-cst.on { color: #17652f; } :root[data-theme="light"] .b14-cst.paused { color: #7a4a00; }
:root[data-theme="light"] .modal .r3-usenow { color: #145a2f !important; }
:root[data-theme="light"] .chip.ok, :root[data-theme="light"] .jg-qs-h { color: #145a2f; }
:root[data-theme="light"] .bl-tag.t-gvg, :root .modal.set2 .bl-tchk.t-gvg span, :root[data-theme="light"] .bl-tchk.t-gvg span { color: #7f2e04; }
:root[data-theme="light"] .bl-tag.t-boss, :root .modal.set2 .bl-tchk.t-boss span, :root[data-theme="light"] .bl-tchk.t-boss span { color: #5e3900; }
:root[data-theme="light"] .bl-tag.t-farm { color: #0f4a22; }
:root[data-theme="light"] .man-cyc-x { color: #5a3a00 !important; }
/* the rebirth tier names (my path) are glow colours written on the element: on parchment they take the day ink */
:root[data-theme="light"] .modal .row > b.grow[style*="color"] { color: var(--ink) !important; }

/* the landing pages / website in day mode: the cards, tabs, FAQ and language chips kept their night navy wash */
:root[data-theme="light"] body.w2 { --w2-card: linear-gradient(180deg, #fffdf8, #f6ead0); }
:root[data-theme="light"] body.w2 .w2-tab, :root[data-theme="light"] body.w2 .w2-rk-tab, :root[data-theme="light"] body.w2 .w2-qa, :root[data-theme="light"] body.w2 .w2-lang-cloud a, :root[data-theme="light"] body.w2 .w2-ghost, :root[data-theme="light"] body.w2 .w12-ghost, :root[data-theme="light"] body.w2 .w2-btn-ghost {
  background: rgba(255, 252, 244, .92); color: #2a2116; border-color: rgba(160, 112, 36, .45); }
:root[data-theme="light"] body.w2 .w2-tab.on, :root[data-theme="light"] body.w2 .w2-tab[aria-selected="true"], :root[data-theme="light"] body.w2 .w2-rk-tab.on, :root[data-theme="light"] body.w2 .w2-rk-tab[aria-selected="true"] { background: linear-gradient(180deg, #fff1c8, #f6dc98); color: #2a1700; }
:root[data-theme="light"] body.w2 .w2-tab small, :root[data-theme="light"] body.w2 .w2-qa p { color: #4c3f2e; }
:root[data-theme="light"] body.w2 a, :root[data-theme="light"] body.w2 .w2-lang-cloud a { color: #6e4508; }
:root[data-theme="light"] body.w2 .w12-kicker { color: #7a4f08; }
:root[data-theme="light"] body.w2 .w2-foot, :root[data-theme="light"] body.w2 .w2-foot p, :root[data-theme="light"] body.w2 .w2-foot h2 { color: #4c3f2e; }
/* night: the job cards' small lines a shade brighter on their coloured art */
:root:not([data-theme="light"]) body.w2 .w12-job small, :root:not([data-theme="light"]) body.w2 .w12-why-jobs p { color: #dfe5f3; }

/* news kind chips (community.css): white text needs the darker end of their colours (were 2.5–3.5:1) */
:root .nw-kind.k-news { background: linear-gradient(#2f72cc, #1f56a8); }
:root .nw-kind.k-event { background: linear-gradient(#c4307a, #9a2462); }
:root .nw-kind.k-maint { background: linear-gradient(#c0392b, #962d22); }

/* ================================================================ 3. account page */
.sel-wrap.w12-acc { padding-bottom: calc(84px + var(--safe-b, 0px)) !important; scroll-padding-bottom: calc(84px + var(--safe-b, 0px)); }
.sel-wrap.w12-acc .u16-actbar { position: fixed; z-index: 40; inset-inline: calc(10px + var(--safe-l, 0px)) calc(10px + var(--safe-r, 0px)); bottom: calc(8px + var(--safe-b, 0px));
  max-width: 620px; margin-inline: auto; padding: 8px; border-radius: 22px; background: var(--u16-bar-bg); border: 1px solid var(--u16-bar-line);
  box-shadow: 0 -6px 26px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .1); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
:root[data-theme="light"] .sel-wrap.w12-acc .u16-actbar { box-shadow: 0 -6px 22px rgba(90, 60, 10, .2); }
.sel-wrap.w12-acc .u16-actbar .sel-btns { display: flex; gap: 8px; align-items: center; margin: 0; flex-wrap: nowrap; }
.sel-wrap.w12-acc .u16-actbar .sel-btns .btn.small { flex: none; min-height: 44px; }
.sel-wrap.w12-acc .u16-actbar .sel-btns .btn.gold { flex: 1 1 auto; min-width: 0; min-height: 48px; font-size: 17px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 340px) {
  .sel-wrap.w12-acc .u16-actbar { padding: 6px; inset-inline: calc(6px + var(--safe-l, 0px)) calc(6px + var(--safe-r, 0px)); }
  .sel-wrap.w12-acc .u16-actbar .sel-btns { gap: 5px; }
  .sel-wrap.w12-acc .u16-actbar .sel-btns .btn.small { padding: 5px 8px; font-size: 12px; }
  .sel-wrap.w12-acc .u16-actbar .sel-btns .btn.gold { font-size: 15px; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .sel-wrap.w12-acc { padding-bottom: calc(66px + var(--safe-b, 0px)) !important; }
  .sel-wrap.w12-acc .u16-actbar { padding: 5px 8px; bottom: calc(5px + var(--safe-b, 0px)); }
  .sel-wrap.w12-acc .u16-actbar .sel-btns .btn.small { min-height: 38px; }
  .sel-wrap.w12-acc .u16-actbar .sel-btns .btn.gold { min-height: 42px; font-size: 16px; }
}
/* wide screens: the bar sits under the preview column (the column the buttons used to be in) */
@media (min-width: 900px) and (min-height: 521px) {
  .sel-wrap.w12-acc .u16-actbar { inset-inline: auto calc(10px + var(--safe-r, 0px)); width: min(380px, 34vw); max-width: none; }
}
/* the offline-farm card: a few lines, then More / Less */
.sel-wrap.w12-acc .fv-sel.u16-clamp:not(.u16-open):not(.u16-fits) .fv-sel-t { max-height: 7.4em; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.sel-wrap.w12-acc .u16-more { justify-self: start; margin-top: -4px; padding: 4px 12px; min-height: 32px; border-radius: 999px; border: 1px solid var(--u16-bar-line);
  background: rgba(0, 0, 0, .25); color: #ffe8a8; font: 600 13px var(--f-ui); cursor: pointer; }
:root[data-theme="light"] .sel-wrap.w12-acc .u16-more { background: #fffaf0; color: #14224a; }
.sel-wrap.w12-acc .u16-more[hidden] { display: none; }
@media (max-height: 430px) { .sel-wrap.w12-acc .fv-sel.u16-clamp:not(.u16-open):not(.u16-fits) .fv-sel-t { max-height: 4.6em; } }

/* ================================================================ 4. NPC shop sort row */
.ss16-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; min-width: 0; }
.ss16-lb { font-size: 12.5px; font-weight: 700; color: var(--ink-dim); white-space: nowrap; }
.ss16-sel { flex: 1 1 9em; min-width: 0; max-width: 16em; min-height: 36px; padding: 4px 8px; font-size: 13.5px; }
.ss16-dir { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; white-space: nowrap; }
.ss16-arr { font-weight: 800; font-size: 15px; line-height: 1; }
.ss16-dir:disabled { opacity: .5; }

/* ================================================================ 5. HUD: the chat box and the quest card never squeeze each other (owner 03:18)
   hudctl.js fitHud keeps the chat at least 240 px wide (the quest card gives way); if fixed panels still leave it
   narrow, the tabs drop their labels (icon only) instead of wrapping one letter per line. */
#hud .chat-log { container: u16chat / inline-size; min-width: min(120px, calc(100vw - 20px)); }
#hud .chat-log > .lt-tabs { min-width: 0; max-width: 100%; }
#hud .chat-log .lt-tab { display: inline-flex; align-items: center; gap: 3px; flex: 0 1 auto; min-width: 0; white-space: nowrap; word-break: keep-all; overflow-wrap: normal; }
#hud .chat-log .lt-tab .u16-ic { flex: none; line-height: 1; }
#hud .chat-log .lt-tab .u16-lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud .chat-log .lt-tab.lt-more { flex: none; }
@container u16chat (max-width: 300px) { #hud .chat-log .lt-tab:not(.on) .u16-lb { display: none; } #hud .chat-log .lt-tab { padding: 0 6px; } }
@container u16chat (max-width: 140px) { #hud .chat-log .lt-tab .u16-lb { display: none; } #hud .chat-log > .lt-tabs { gap: 3px; } }
#hud .quest-card > * { min-width: 0; }

/* ================================================================ 6. ▲ / ▼ to the top / end of a long list (scrolljump16.js, owner 04:07)
   Placed by script over the window's right border, inside the window's backdrop (so it stacks and goes inert with it). */
.sj16 { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.sj16[hidden], .sj16-b[hidden] { display: none; }
.sj16-b { pointer-events: auto; width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px/1 system-ui, sans-serif; color: var(--u16-sj-ink); background: var(--u16-sj-bg); border: 1.5px solid var(--u16-sj-line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); opacity: .82; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sj16-b:hover, .sj16-b:focus-visible { opacity: 1; }
.sj16-b:focus-visible { outline: 2px solid var(--u16-sj-line); outline-offset: 2px; }
.sj16-b:active { transform: scale(.92); }
:root { --u16-sj-bg: rgba(18, 30, 64, .94); --u16-sj-ink: #ffe3a0; --u16-sj-line: rgba(246, 215, 126, .75); }
:root[data-theme="light"] { --u16-sj-bg: rgba(255, 250, 236, .96); --u16-sj-ink: #6a4106; --u16-sj-line: rgba(160, 112, 36, .7); }
@media (pointer: coarse) { .sj16-b { width: 38px; height: 38px; font-size: 14px; } }

/* ================================================================ 7. long-list tools (listtools16.js, owner 04:27)
   Tabs (All first) · search · filter chips · list ↔ grid · folding group headers with counts. Theme tokens only. */
:root { --u16-chip-bg: rgba(255, 236, 190, .08); --u16-chip-ink: #f3e6c8; --u16-chip-line: rgba(201, 154, 59, .45); --u16-chip-on-bg: #f0c060; --u16-chip-on-ink: #241400; }
:root[data-theme="light"], .modal.set2 { --u16-chip-bg: rgba(255, 255, 255, .6); --u16-chip-ink: #3b2a17; --u16-chip-line: rgba(160, 112, 36, .5); --u16-chip-on-bg: #7a4f08; --u16-chip-on-ink: #fffaf0; }
.lt16-bar { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; min-width: 0; }
.lt16-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.lt16-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.lt16-q { flex: 1 1 140px; min-width: 0; min-height: 36px; }
.lt16-chip { flex: none; min-height: 34px; padding: 0 11px; border-radius: 17px; white-space: nowrap; font-weight: 600; font-size: 13px; line-height: 1; font-family: inherit; cursor: pointer;
  color: var(--u16-chip-ink); background: var(--u16-chip-bg); border: 1px solid var(--u16-chip-line); touch-action: manipulation; }
.lt16-chip.on { color: var(--u16-chip-on-ink); background: var(--u16-chip-on-bg); border-color: var(--u16-chip-on-bg); }
.lt16-chip:focus-visible { outline: 2px solid var(--u16-chip-on-bg); outline-offset: 2px; }
.lt16-mode { min-width: 38px; padding: 0 8px; font-size: 16px; }
.lt16-n { margin-left: auto; color: var(--ink-dim); white-space: nowrap; }
.lt16-x { display: none !important; }
.lt16-gh { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; margin: 6px 0 2px; padding: 0 10px; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 14px; line-height: 1.2; font-family: inherit; text-align: start; color: var(--ink); background: var(--u16-sub); border: 1px solid var(--u16-card-line); grid-column: 1 / -1; }
.lt16-gh .lt16-gt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt16-gh .lt16-gc { color: var(--ink-dim); font-weight: 600; }
/* grid: rows become tiles that wrap (2+ per line on phones) */
.lt16-list.lt16-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: stretch; }
.lt16-list.lt16-grid > :not(.lt16-gh):not(.lt16-bar) { flex-wrap: wrap; align-content: flex-start; min-width: 0; margin: 0; }
.lt16-list.lt16-grid > :not(.lt16-gh):not(.lt16-bar) .grow { flex: 1 1 100%; min-width: 0; order: 1; }
.lt16-list.lt16-grid > :not(.lt16-gh):not(.lt16-bar) > canvas { order: 0; }
.lt16-list.lt16-grid > :not(.lt16-gh):not(.lt16-bar) > .btn, .lt16-list.lt16-grid > :not(.lt16-gh):not(.lt16-bar) > button { order: 2; }
@media (max-width: 380px) { .lt16-list.lt16-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* easy to tap on touch screens: rows and their buttons at least 44 px */
@media (pointer: coarse) { .lt16-list > .li { min-height: 48px; } .lt16-list > .li .btn.small { min-height: 36px; min-width: 40px; } .lt16-chip { min-height: 38px; } }
/* narrow screens (folded phones): a row never pushes the window wider — its buttons wrap under the name */
.lt16-list:not(.lt16-grid):not(.inv-grid):not(.shop-grid) { grid-template-columns: minmax(0, 1fr); } /* bag49: never the bag's / storage's slot grid / the shops' card grid (they became one column of giant tiles) */
@media (max-width: 360px) {
  .lt16-list:not(.lt16-grid) > .li { flex-wrap: wrap; row-gap: 6px; }
  .lt16-list:not(.lt16-grid) > .li > .grow { flex: 1 1 calc(100% - 56px); min-width: 0; }
  .lt16-list:not(.lt16-grid) > .li > .btn { margin-inline-start: auto; }
  .lt16-list:not(.lt16-grid) > .li > .btn ~ .btn { margin-inline-start: 0; }
}
/* …and a window body's single column never grows past the window (a row of 3 tabs was 266 px in a 256 px body) */
@media (max-width: 360px) {
  .modal-body { grid-template-columns: minmax(0, 1fr); }
  .modal-body .tabs { overflow-x: auto; scrollbar-width: none; }
}
