/* BISburg: one design system for both profiles (owner LAN page and public bisburg.com).
   Modern premium dark: calm surfaces, refined type, soft depth. Colour only where it is small and
   means something (item qualities, status, deltas, numbers). The Diablo flavour belongs to the items.
   Tokens and component rules: docs/design.md (Forge #301). Change a value here, not in a component. */

/* ------------------------------------------------------------- fonts (self-hosted, OFL; static/fonts) */
@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/static/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap; }
/* Metric-matched fallbacks: the swap to Inter moves nothing (CLS). */
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans"), local("Helvetica");
  ascent-override: 90.5%; descent-override: 22.6%; line-gap-override: 0%; size-adjust: 107.1%; }

:root {
  color-scheme: dark;
  /* surfaces, darkest to lightest */
  --bg: #0b0d10;            /* the page */
  --well: #0d0f12;          /* sunken: grids, segment tracks, inputs */
  --surface-1: #121519;     /* panels, cards */
  --surface-2: #171a1f;     /* raised: buttons, hovered rows, pinned bars */
  --surface-3: #1d2127;     /* selected, pressed, active tab */
  --overlay: #16191e;       /* menus, tooltips, dialogs, toasts */
  --scrim: rgba(5, 6, 8, .66);
  /* lines */
  --line-1: #1c2026;        /* hairline dividers inside a panel */
  --line-2: #262b33;        /* panel and card edges */
  --line-3: #343a44;        /* hovered edges */
  --line-control: #666f7d;  /* input boundaries: 3:1 on every surface they sit on */
  /* text levels (all >= 4.5:1 on every surface; docs/design.md has the table) */
  --text-1: #edf0f4;
  --text-2: #c3c9d2;
  --text-3: #9ba3af;
  --text-4: #868e9b;
  /* brand accent: the ember of the logo's gem. Focus, selection, where you are, unsaved edits. */
  --accent: #e48b4f;
  --accent-text: #eea06c;
  --accent-ink: #1a0e06;
  --accent-bg: rgba(228, 139, 79, .12);
  --accent-line: rgba(228, 139, 79, .5);
  /* semantic */
  --ok: #4cc38a;  --ok-bg: rgba(76, 195, 138, .1);  --ok-line: rgba(76, 195, 138, .4);
  --warn: #e5b54a; --warn-bg: rgba(229, 181, 74, .09); --warn-line: rgba(229, 181, 74, .42); --warn-ink: #1d1606;
  --bad: #f07563; --bad-bg: rgba(240, 117, 99, .09); --bad-line: rgba(240, 117, 99, .42); --bad-text: #ffb4a8;
  /* danger: the filled main action of a destructive confirmation (D323.1); --danger-ink >= 4.5:1 on both */
  --danger: #b93a2b; --danger-hover: #c8402c; --danger-ink: #ffffff;
  --mod: #a3b2ff;           /* item property lines, as the game draws them */
  /* item qualities (the game's colours, tuned for >= 6:1 on the tile and tooltip surfaces) */
  --q-inferior: #9ba1aa;
  --q-normal: #d8dbe1;
  --q-superior: #f0f1f3;
  --q-magic: #8c9fff;
  --q-rare: #f0d55c;
  --q-set: #4fd486;
  --q-unique: #d2aa66;
  --q-crafted: #f0903f;
  --q-runeword: #e6d3a0;
  --q-tempered: #f07eb3;
  /* vitals and damage kinds */
  --life: #f08a7b; --mana: #8ea6ff; --stamina: #e4c96b;
  --r-fire: #e8785a; --r-cold: #7fb2ef; --r-lightning: #e8d36a; --r-poison: #73c47a; --r-magic: #c79cf0; --r-physical: #b9b2a6;

  /* type */
  --font: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Inter", "Inter Fallback", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --fs-2xs: 10.5px;  /* tile labels, counters */
  --fs-xs: 11px;     /* overlines, captions */
  --fs-sm: 12px;     /* secondary text, meta */
  --fs-md: 13px;     /* body, controls */
  --fs-lg: 14px;     /* emphasised body */
  --fs-xl: 16px;     /* item names, dialog titles */
  --fs-2xl: 20px;    /* section titles, key numbers */
  --fs-3xl: 26px;    /* view titles */
  --fs-4xl: 34px;    /* landing headline */
  --lh: 1.5;
  --lh-tight: 1.2;
  --track-over: .08em; /* overlines */

  /* spacing: a 4 px scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  /* radii */
  --r-xs: 4px;   /* grid cells, kbd, tags */
  --r-sm: 6px;   /* item tiles, small buttons inside a track */
  --r-md: 8px;   /* buttons, inputs, menu rows */
  --r-lg: 12px;  /* panels, cards, menus, tooltips */
  --r-xl: 16px;  /* dialogs */
  --r-pill: 999px;
  /* elevation */
  --e-1: inset 0 1px 0 rgba(255, 255, 255, .025), 0 1px 2px rgba(0, 0, 0, .3);
  --e-2: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
  --e-3: 0 24px 64px rgba(0, 0, 0, .6), 0 4px 12px rgba(0, 0, 0, .4);
  /* focus */
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --focus-inset: inset 0 0 0 2px var(--accent);
  /* layers */
  --z-raised: 2; --z-header: 20; --z-menu: 30; --z-drawer: 40; --z-tooltip: 60; --z-modal: 70; --z-toast: 80;
  /* motion (off under prefers-reduced-motion) */
  --dur-1: 120ms; --dur-2: 180ms; --ease: cubic-bezier(.2, .8, .2, 1);
  /* frame */
  --top-h: 56px; --nav-h: 44px; --foot-h: 28px;
  --gutter: var(--s-6);
  /* item grids: app.js reads the laid-out track, gap, padding and border (D324.1), so these may change per
     breakpoint; keep --cell and --gap plain px (the paper doll reads them as numbers) */
  --cell: 38px;
  --gap: 2px;

}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--bg); color: var(--text-1); font: var(--fs-md)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "calt";
  /* a faint warm light from the top and a fine grain: depth without decoration */
  background-image:
    radial-gradient(1100px 420px at 50% -260px, rgba(228, 139, 79, .05), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
b, strong { font-weight: 620; }
a { color: var(--accent-text); }
.faint { color: var(--text-4); }
.muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 500 10.5px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--line-3); border-bottom-width: 2px; border-radius: var(--r-xs);
  color: var(--text-2); background: var(--surface-2); }
code { font-family: var(--mono); }
::selection { background: rgba(228, 139, 79, .32); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #252a32; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #303640; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-color: #252a32 transparent; scrollbar-width: thin; }
/* one focus ring for everything a keyboard can reach */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; }
.overline { font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); }

/* ------------------------------------------------------------- icons (masks) */
[class^="i-"] { display: inline-block; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; flex: none; }
.i-search { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); width: 15px; height: 15px; }
.i-plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-chat { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E"); }
.i-out { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h4v16h-4M10 8l-4 4 4 4M6 12h10'/%3E%3C/svg%3E"); }
.i-x { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.i-move { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-copy { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M16 8V4H4v12h4'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-trash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-import { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14v6h16v-6M12 3v11M7.5 9.5 12 14l4.5-4.5'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-down { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-restore { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 3-6.2M4 4v4h4'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
.i-edit { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4'/%3E%3C/svg%3E"); width: 14px; height: 14px; }

/* ------------------------------------------------------------- frame: top bar */
.top {
  position: relative; z-index: var(--z-header); height: var(--top-h); display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--gutter); background: rgba(11, 13, 16, .86); backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-1);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding-right: var(--s-1); }
.logo { width: 28px; height: 28px; flex: none; display: block; }
/* The lock-up (owner 2026-11-21): the burg's gate, then BIS in gold and burg in white. Unchanged. */
.wm { font-size: var(--fs-xl); font-weight: 650; letter-spacing: .01em; color: var(--text-1); }
.wm b { color: #e5b06a; font-weight: 750; letter-spacing: .03em; }
.spacer { flex: 1; }

/* character switcher */
.switcher { position: relative; }
.char-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 5px; min-width: 210px; max-width: 280px;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-1); text-align: left;
  transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.char-btn:hover { border-color: var(--line-3); background: var(--surface-2); }
.char-btn[aria-expanded="true"] { border-color: var(--line-3); background: var(--surface-2); }
.char-avatar { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none;
  font: 700 10.5px/1 var(--font); letter-spacing: .04em; color: var(--accent-text);
  background: linear-gradient(180deg, rgba(228, 139, 79, .16), rgba(228, 139, 79, .07)); box-shadow: inset 0 0 0 1px rgba(228, 139, 79, .28); }
.char-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.char-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--lh-tight); }
.char-sub { color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 7px; height: 7px; flex: none; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: rotate(45deg) translateY(-2px); margin: 0 4px; }

/* menus (character switcher; same rules as the find panel) */
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-menu); width: 340px; max-height: 70vh; overflow: auto; padding: var(--s-1);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--overlay); box-shadow: var(--e-2); animation: rise var(--dur-1) var(--ease); }
.menu .sec { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: var(--track-over); color: var(--text-4); }
.menu .sec:empty { padding: 0; margin: var(--s-1) 0; border-top: 1px solid var(--line-1); }
.menu .opt { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); border: 0; background: none; text-align: left; }
.menu .opt:hover, .menu .opt:focus-visible { background: var(--surface-3); }
.menu .opt:focus-visible { box-shadow: var(--focus-inset); }
.menu .opt.on { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
.menu .opt .char-avatar { width: 28px; height: 28px; }
.menu .opt .lv { margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.menu .opt.bad { opacity: .6; cursor: default; }
.menu .new { color: var(--text-2); font-weight: 500; }
.menu .new [class^="i-"] { color: var(--accent); margin: 0 7px 0 7px; }
.menu .new:hover { color: var(--text-1); }

/* status pills (owner) */
.status { display: flex; gap: var(--s-2); align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: var(--r-pill); font-size: var(--fs-sm);
  border: 1px solid var(--line-2); background: var(--surface-1); color: var(--text-2); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); flex: none; }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.pill.warn { border-color: var(--warn-line); }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.pill.bad { border-color: var(--bad-line); }
.pill.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.pill.staged { transition: border-color var(--dur-1) var(--ease); }
.pill.staged .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
  font-size: var(--fs-xs); font-weight: 700; background: var(--surface-3); color: var(--text-3); font-variant-numeric: tabular-nums; }
.pill.staged.has { border-color: var(--warn-line); color: var(--text-1); }
.pill.staged.has .count { background: var(--warn); color: var(--warn-ink); }
.pill.staged:hover { border-color: var(--line-3); background: var(--surface-2); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; min-width: 34px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface-1); color: var(--text-2); font-weight: 500;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.icon-btn:hover { color: var(--text-1); border-color: var(--line-3); background: var(--surface-2); }
.icon-btn.on { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-bg); }
.icon-btn.ghost { border-color: transparent; background: none; padding: 0 8px; }
.icon-btn.ghost:hover { background: var(--surface-2); }

/* ------------------------------------------------------------- frame: view tabs */
.views { position: relative; z-index: calc(var(--z-header) - 1); height: var(--nav-h); display: flex; align-items: stretch; gap: var(--s-1);
  padding: 0 calc(var(--gutter) - 10px); border-bottom: 1px solid var(--line-1); background: rgba(11, 13, 16, .6);
  overflow-x: auto; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.views button { position: relative; flex: none; border: 0; background: none; color: var(--text-3); padding: 0 10px; font-weight: 500; font-size: var(--fs-md);
  border-radius: var(--r-md); transition: color var(--dur-1) var(--ease); }
.views button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent;
  transition: background-color var(--dur-2) var(--ease); }
.views button:hover { color: var(--text-1); }
.views button:hover::after { background: var(--line-3); }
.views button.on { color: var(--text-1); }
.views button.on::after { background: var(--accent); }
.views button:focus-visible { box-shadow: var(--focus-inset); }

/* ------------------------------------------------------------- frame: layout */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.shell.with-chat { grid-template-columns: minmax(0, 1fr) 380px; }
.shell.with-chat .hint { display: none; }
.main { overflow: auto; min-width: 0; min-height: 0; }
.view { padding: var(--s-5) var(--gutter) var(--s-10); animation: enter var(--dur-2) var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.toolbar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }

/* footer (both profiles) */
.foot { height: var(--foot-h); display: flex; align-items: center; gap: var(--s-4); padding: 0 var(--gutter); border-top: 1px solid var(--line-1);
  color: var(--text-4); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; background: var(--bg); }
.foot > span:not(:empty) + span:not(:empty)::before { content: "·"; margin-right: var(--s-4); color: var(--line-3); }
.foot .foot-legal { margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.foot .foot-legal::before { display: none; }

/* ------------------------------------------------------------- components: search fields */
.search { display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-3); width: 340px; max-width: 100%;
  border: 1px solid var(--line-control); border-radius: var(--r-md); background: var(--well); color: var(--text-3);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.search:hover { border-color: #7a8391; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.search input { flex: 1; min-width: 0; border: 0 !important; outline: 0; background: none !important; color: var(--text-1); box-shadow: none !important; padding: 0 !important; height: auto !important; }
.search input::placeholder { color: var(--text-4); opacity: 1; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

/* find anywhere (header): one search over every character and the shared stash */
.find { position: relative; flex: 0 1 320px; min-width: 160px; }
.find-box { width: 100%; height: 36px; }
.find-box kbd { opacity: .9; }
.find-box:focus-within kbd { display: none; }
.find-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-menu); width: min(600px, calc(100vw - 32px)); max-height: 72vh; overflow: auto; padding: var(--s-1);
  border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--overlay); box-shadow: var(--e-2); animation: rise var(--dur-1) var(--ease); }
.find-panel .fhead { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; font-size: var(--fs-sm); color: var(--text-3); }
.find-panel .fhead b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.find-panel .fsec { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: var(--track-over); color: var(--text-4); }
.find-panel .fctl { display: flex; gap: 6px; padding: 4px 10px 4px; }
.find-panel .fsel { font-size: var(--fs-sm); height: 30px; }
.find-panel .fnote { padding: 10px; color: var(--text-4); font-size: var(--fs-sm); }
.fres { --c: var(--q-normal); width: 100%; min-height: 44px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 5px 8px; border: 0; border-radius: var(--r-md); background: none; text-align: left; }
.fres:hover, .fres.on { background: var(--surface-3); }
.fres:focus-visible { box-shadow: var(--focus-inset); }
.fres.static { cursor: default; }
.fres .th { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c) 8%, var(--well)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.fres .th img { max-width: 30px; max-height: 30px; object-fit: contain; }
.fres .th .fl { font-size: var(--fs-2xs); font-weight: 600; color: var(--c); }
.fres .th.has-img .fl { display: none; }
.fres .tx { min-width: 0; display: flex; flex-direction: column; }
.fres .nm { color: var(--c); font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fres .sub { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fres .sub .ql { color: var(--c); }
.fres .wh { text-align: right; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.fres .wh .ow { display: block; color: var(--text-1); font-weight: 560; }
.fres .cnt { font-variant-numeric: tabular-nums; color: var(--accent-text); font-weight: 620; }
.fres .frolls { display: flex; flex-wrap: wrap; gap: 1px 12px; font-size: var(--fs-sm); color: var(--mod); margin-top: 2px; }
.fres .frl { white-space: nowrap; }
.item.found { animation: found 2.6s var(--ease) 1; }
@keyframes found { 0%, 60% { box-shadow: 0 0 0 3px var(--accent), 0 0 18px rgba(228, 139, 79, .45); } 100% { box-shadow: none; } }

/* ------------------------------------------------------------- components: buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-1); font-weight: 560; font-size: var(--fs-md); white-space: nowrap;
  text-decoration: none; box-shadow: var(--e-1);
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.btn:hover { border-color: var(--line-3); background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; box-shadow: none; }
.btn:focus-visible { box-shadow: var(--focus); }
/* primary: the one main action of a page or dialog */
.btn.primary { background: #eceff3; border-color: #eceff3; color: #0c0e11; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 1px 2px rgba(0, 0, 0, .4); }
.btn.primary:hover { background: #fff; border-color: #fff; }
/* tonal: a card's own commit action, one step above default */
.btn.tonal { background: #23272e; border-color: var(--line-3); }
.btn.tonal:hover { background: #2a2f37; border-color: #424955; }
.btn.danger { color: var(--bad-text); border-color: var(--bad-line); background: var(--bad-bg); box-shadow: none; }
.btn.danger:hover { background: rgba(240, 117, 99, .16); }
/* primary danger: the main action of a confirmation that deletes or drops something (D323.1) */
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 1px 2px rgba(0, 0, 0, .4); }
.btn.primary.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-md); }
.btn.sq { width: 30px; padding: 0; font-variant-numeric: tabular-nums; }
a.btn { text-decoration: none; }
.link { border: 0; background: none; color: var(--text-3); padding: 0; border-radius: var(--r-xs); }
.link:hover { color: var(--text-1); text-decoration: underline; text-underline-offset: 3px; }
body.busy .btn.primary, body.busy .btn.tonal { cursor: progress; }

/* ------------------------------------------------------------- components: chips, segmented, tags */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface-1); color: var(--text-3); font-size: var(--fs-sm); font-weight: 500;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.chip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.chip:hover { color: var(--text-1); border-color: var(--line-3); }
.chip.on { color: var(--text-1); border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 11%, var(--surface-1)); }
.chip.on i { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent); }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-2); flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--text-3); height: 26px; min-width: 28px; padding: 0 9px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500; font-variant-numeric: tabular-nums; position: relative; transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); }
.seg button:hover { color: var(--text-1); }
.seg button.on { background: var(--surface-3); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--line-3), 0 1px 2px rgba(0, 0, 0, .35); }
.seg button:focus-visible { box-shadow: var(--focus-inset); }
.seg button .n { font-size: 9px; color: var(--text-4); margin-left: 2px; vertical-align: super; line-height: 0; }
.seg button.hit::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.seg .sep { width: 1px; background: var(--line-2); margin: 4px 3px; }
.seg .seg-label { align-self: center; padding: 0 6px 0 5px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; color: var(--text-4); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: var(--s-2) 0 10px; }
.tag { font-size: var(--fs-2xs); font-weight: 500; line-height: 18px; padding: 0 7px; border-radius: var(--r-pill); border: 1px solid var(--line-2); color: var(--text-3); text-transform: capitalize; }
.tag.qual { color: var(--c); border-color: color-mix(in srgb, var(--c) 42%, transparent); background: color-mix(in srgb, var(--c) 9%, transparent); }
.tag.dead { color: var(--bad); border-color: var(--bad-line); }
.hint { color: var(--text-4); font-size: var(--fs-sm); }

/* ------------------------------------------------------------- components: forms */
select, input[type=number], input[type=text], input[type=search]:not(.bare), textarea {
  height: 34px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-control); background: var(--well); color: var(--text-1); outline: 0;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
select:hover, input[type=number]:hover, input[type=text]:hover, textarea:hover { border-color: #7a8391; }
select { padding-right: 28px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%239ba3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 9px center / 12px no-repeat; }
select option { background: var(--overlay); color: var(--text-1); }
textarea { height: auto; padding: 8px 10px; resize: none; line-height: 1.45; }
select:focus-visible, input:focus-visible, textarea:focus-visible, select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input::placeholder, textarea::placeholder { color: var(--text-4); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
input[type=number] { width: 100%; font-variant-numeric: tabular-nums; }
label.f { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
label.chk { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); font-size: var(--fs-md); cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); align-items: center; }
.form-foot .note { margin-right: auto; color: var(--text-4); font-size: var(--fs-sm); }
.act-row { display: flex; gap: 6px; align-items: center; }
.act-row select { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- components: panels, cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--s-4); align-items: start; }
.card { background: var(--surface-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--e-1); }
.card h3 { margin: 0 0 var(--s-4); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3);
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: 18px; }
.card.wide { grid-column: 1 / -1; }
.card .lede { margin: calc(-1 * var(--s-2)) 0 var(--s-4); color: var(--text-4); font-size: var(--fs-sm); }
.card h3.sub-h { margin-top: var(--s-5); }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); }
.panel-title .meta { text-transform: none; letter-spacing: 0; font-weight: 450; color: var(--text-4); font-variant-numeric: tabular-nums; }
/* view header (viewHead in app.js): title, description under it, the view's controls on the right */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-3) var(--s-6); margin: 0 0 var(--s-5); }
.section-head h2 { margin: 0; font: 600 var(--fs-2xl)/1.25 var(--font-display); letter-spacing: -.015em; }
.vh-text { flex: 1 1 340px; min-width: 0; }
.vh-desc { margin: var(--s-1) 0 0; max-width: 820px; color: var(--text-3); line-height: 1.55; }
.vh-desc b { color: var(--text-2); font-weight: 600; }
.vh-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }

/* empty, loading, error states */
.empty { text-align: center; color: var(--text-3); padding: var(--s-12) var(--s-5); }
.empty p { margin: 0 0 var(--s-2); }
.empty-mark { width: 44px; height: 44px; margin: 0 auto var(--s-4); border-radius: var(--r-lg); border: 1px dashed var(--line-3); position: relative; }
.empty-mark::after { content: ""; position: absolute; inset: 14px; border-radius: 3px; border: 1.5px solid var(--accent); opacity: .8; transform: rotate(45deg); }
.loading { padding: var(--s-12); text-align: center; color: var(--text-4); }
.skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------- components: overlays */
.tooltip { position: fixed; z-index: var(--z-tooltip); width: 300px; padding: var(--s-4); border-radius: var(--r-lg); pointer-events: none;
  background: rgba(14, 16, 19, .97); border: 1px solid color-mix(in srgb, var(--c) 38%, var(--line-2)); box-shadow: var(--e-2), inset 0 1px 0 rgba(255, 255, 255, .03); }
/* The hover tooltip is centred, as the game draws it; the inspector reads left to right. */
.tooltip .tt-name, .tooltip .tt-base { text-align: center; }
.tooltip .tags { justify-content: center; }
.tooltip .tt-lines li { text-align: center; }
.tooltip .tt-core { grid-template-columns: max-content max-content; justify-content: center; }
.tooltip .tt-req, .tooltip .tt-socks { justify-content: center; text-align: center; }
.tooltip .tt-art { float: none; margin: 0 auto var(--s-3); }
.modal-back { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim); backdrop-filter: blur(4px); display: grid; place-items: center; padding: var(--s-4);
  animation: fade var(--dur-2) var(--ease); }
.modal { width: 520px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); overflow: auto; background: var(--overlay); border: 1px solid var(--line-2);
  border-radius: var(--r-xl); box-shadow: var(--e-3); padding: var(--s-6); animation: pop var(--dur-2) var(--ease); }
.modal h3 { margin: 0 0 6px; font: 600 var(--fs-2xl)/1.25 var(--font-display); letter-spacing: -.01em; }
.modal .sub { margin: 0 0 var(--s-5); color: var(--text-3); font-size: var(--fs-md); line-height: 1.55; }
.modal .form-foot { margin-top: var(--s-6); }
.modal.wide { width: 760px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.drawer { position: fixed; top: calc(var(--top-h) + var(--nav-h) + 8px); right: 12px; width: 420px; max-width: calc(100vw - 24px); max-height: calc(100dvh - var(--top-h) - var(--nav-h) - 24px);
  z-index: var(--z-drawer); display: flex; flex-direction: column; background: var(--overlay); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--e-3);
  animation: rise var(--dur-2) var(--ease); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: var(--s-4) var(--s-4) var(--s-3); border-bottom: 1px solid var(--line-1); }
.drawer-head p { margin: 3px 0 0; font-size: var(--fs-sm); }
.drawer-body { overflow: auto; padding: var(--s-2); }
.drawer-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line-1); }
.st-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r-md); }
.st-item:hover { background: var(--surface-2); }
.st-item .tx { flex: 1; min-width: 0; }
.st-item .tx div { color: var(--text-1); }
.st-item .tx small { color: var(--text-4); font-size: var(--fs-sm); }
.st-empty { padding: 26px; text-align: center; color: var(--text-4); }
.toasts { position: fixed; bottom: calc(var(--foot-h) + 14px); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--s-2);
  align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; max-width: 640px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-lg);
  background: var(--overlay); border: 1px solid var(--line-2); box-shadow: var(--e-2); font-size: var(--fs-md); animation: rise var(--dur-2) var(--ease); }
.toast i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.toast.warn { border-color: var(--warn-line); } .toast.warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.toast .toast-act { flex: none; align-self: center; margin-left: var(--s-2); }
.toast.bad { border-color: var(--bad-line); } .toast.bad i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.busy { position: relative; }

/* ------------------------------------------------------------- components: tables */
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
table.t th { text-align: left; font-weight: 600; font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-1); color: var(--text-2); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: rgba(255, 255, 255, .015); }
table.t td.r, table.t th.r { text-align: right; }
table.t code { font: 11.5px var(--mono); color: var(--text-3); }
.op { display: inline-block; font: 11px var(--mono); padding: 2px 7px; border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-2); }

/* ============================================================= ITEMS VIEW
   Stash left, the character (paper doll, inventory, cube, belt) beside it, as the game lays out its
   two panels; the inspector on the right. Eye path: the character's gear, then the stash, then the item. */
.items-bar .search { width: 380px; }
.board { display: grid; grid-template-columns: max-content max-content minmax(320px, 1fr); gap: var(--s-4); align-items: start; }
.bay { background: var(--surface-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--s-4); box-shadow: var(--e-1); min-width: 0; }
.bay-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.bay-sub { min-height: 0; }
/* character bay: paper doll on top (the game's own slot boxes, Inventory.txt), inventory below, then cube and belt */
.char-side { display: flex; gap: var(--s-5); align-items: flex-start; margin-top: var(--s-5); }
.cube-col, .belt-col { display: flex; flex-direction: column; min-width: 0; }
.inv-title { margin-top: var(--s-5); }
.doll-col { display: flex; flex-direction: column; min-width: 0; }
.doll-head { align-items: center; margin-bottom: var(--s-3); }
.doll-head .seg { text-transform: none; letter-spacing: 0; font-weight: 500; }
.doll { position: relative; margin: 2px 0 0; align-self: center; }
.doll.drop-on { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: var(--r-lg); }
.doll.dead .dslot { opacity: .55; }
.doll .dslot { position: absolute; }
.doll .dslot.drop-on { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: var(--r-md); }
.dslot.vacant { border-radius: var(--r-md); border: 1px dashed #2a3039; background: rgba(13, 15, 18, .7); display: grid; place-items: center; }
.dlabel { font-size: 9.5px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.doll .item { justify-content: center; align-items: center; text-align: center; border-radius: var(--r-md); padding: 4px; }
.doll .item .lbl { font-size: var(--fs-xs); -webkit-line-clamp: 4; }
.doll .item.tiny .lbl { font-size: var(--fs-2xs); }
.doll .item.has-img .socks { left: 4px; top: 4px; }
.swap { position: absolute; display: flex; gap: 2px; height: 20px; padding: 0; }
.swap button { flex: 1; position: relative; padding: 0; border-radius: 5px; border: 1px solid var(--line-2); background: var(--well);
  color: var(--text-4); font: 600 10px/18px var(--font); letter-spacing: .08em; }
.swap button:hover { color: var(--text-2); }
.swap button.on { color: var(--text-1); background: var(--surface-3); border-color: var(--line-3); }
.swap button.used:not(.on)::after { content: ""; position: absolute; top: 3px; right: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--text-2); }
.belt { display: flex; flex-wrap: wrap; gap: var(--gap); padding: 6px; min-height: calc(var(--cell) + 14px); width: calc(4 * var(--cell) + 3 * var(--gap) + 14px);
  border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.belt .item { width: var(--cell); height: var(--cell); }
/* mercenary: same box as the paper doll, its own panel from Inventory.txt "Hireling2" */
.merc { margin-top: var(--s-3); max-width: 420px; display: flex; flex-direction: column; gap: var(--s-2); }
.merc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-2); }
.merc-name { font: 600 var(--fs-xl)/1.3 var(--font-display); }
.merc-sub { color: var(--text-3); font-size: var(--fs-sm); }
.merc-note { font-size: var(--fs-md); color: var(--text-3); margin: 0; }
.merc-xp { font-size: var(--fs-sm); }
.merc-stats { flex-wrap: wrap; }
.merc-skills { display: flex; flex-wrap: wrap; gap: 4px; }
.merc-skills .tag { text-transform: none; }
.merc-type { display: grid; grid-template-columns: 1.1fr 1.3fr .8fr; gap: var(--s-2); }
.merc-form .form-foot { margin-top: var(--s-2); }

/* item grids: the game's cells, in a sunken well */
.grid {
  position: relative; display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), var(--cell)); grid-template-rows: repeat(var(--rows), var(--cell));
  padding: 6px; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-1); width: max-content;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45);
}
.grid-wrap { min-width: 0; }
.grow { display: contents; }  /* ARIA rows (D325.2): no box, so their tiles sit on the .grid tracks */
.cell { border-radius: var(--r-xs); background: linear-gradient(180deg, #13161b, #111418); box-shadow: inset 0 0 0 1px #191d23; }
.grid.empty-note::after { content: attr(data-note); position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-4); font-size: var(--fs-sm); }
.drop-ghost { position: absolute; pointer-events: none; border-radius: var(--r-sm); border: 1.5px dashed var(--ok); background: var(--ok-bg); z-index: 3; }
.drop-ghost.no { border-color: var(--bad); background: var(--bad-bg); }

/* item tiles */
.item {
  --c: var(--q-normal);
  position: relative; z-index: var(--z-raised); border-radius: var(--r-sm); padding: 3px 4px; overflow: hidden; cursor: grab;
  display: flex; flex-direction: column; justify-content: space-between; user-select: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 15%, #1b1e24), color-mix(in srgb, var(--c) 6%, #15181d));
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), opacity var(--dur-2) var(--ease);
}
.item:hover { border-color: color-mix(in srgb, var(--c) 78%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 28%, transparent), 0 6px 16px rgba(0, 0, 0, .45); transform: translateY(-1px); z-index: 3; }
.item:focus-visible { box-shadow: var(--focus); z-index: 4; }
.item.sel { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 50%, transparent), 0 6px 18px rgba(0, 0, 0, .5); z-index: 3; }
.item.dragging { opacity: .35; }
.item.dim { opacity: .2; }
.item.match { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent); }
.item .pic { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); }
.item.has-img .lbl { display: none; }
.item.has-img { background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--c) 12%, #1b1f26), #14171c 80%); }
.item.has-img.q-normal, .item.has-img.q-inferior, .item.has-img.q-superior { background: radial-gradient(120% 90% at 50% 40%, #1f232b, #14171c 80%); }
.item.has-img .socks { position: absolute; left: 3px; top: 3px; flex-direction: column; }
.item .lbl { font-size: var(--fs-2xs); font-weight: 650; line-height: 1.15; color: var(--c); letter-spacing: .015em; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }
.item.tiny { padding: 4px 2px 2px; justify-content: flex-start; align-items: center; }
.item.tiny .lbl { font-size: 10px; text-align: center; -webkit-line-clamp: 2; letter-spacing: .03em; }
.item.tiny .socks { margin-top: auto; justify-content: center; }
.item .qty { position: absolute; right: 3px; bottom: 1px; font-size: 9px; line-height: 1.1; color: var(--text-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.item .socks { display: flex; gap: 2px; flex-wrap: wrap; }
.item .socks i { width: 5px; height: 5px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--c) 60%, #888); }
.item .socks i.f { background: color-mix(in srgb, var(--c) 80%, #fff); border-color: transparent; }
.item .eth { position: absolute; top: 2px; right: 3px; font-size: 9px; color: var(--text-3); }
.doll .item:has(.eth) .lbl { padding: 0 12px; }
.item .stg { position: absolute; left: 2px; bottom: 1px; z-index: 2; min-width: 13px; height: 13px; padding: 0 3px; border-radius: 7px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; line-height: 1; background: var(--warn); color: var(--warn-ink); }
.item.staged { outline: 1.5px dashed var(--warn-line); outline-offset: -1px; }
.item.staged-move, .item.staged-remove { opacity: .55; }
.staged-target { position: relative; z-index: 1; border-radius: var(--r-sm); border: 1.5px dashed var(--warn); background: var(--warn-bg); display: grid; place-items: center; overflow: hidden; pointer-events: auto; }
.staged-target .pic { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; opacity: .45; }
.staged-target span { position: relative; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); background: rgba(10, 12, 15, .7); padding: 1px 4px; border-radius: var(--r-xs); }
.q-inferior { --c: var(--q-inferior); } .q-normal { --c: var(--q-normal); } .q-superior { --c: var(--q-superior); }
.q-magic { --c: var(--q-magic); } .q-rare { --c: var(--q-rare); } .q-set { --c: var(--q-set); } .q-unique { --c: var(--q-unique); }
.q-crafted { --c: var(--q-crafted); } .q-runeword { --c: var(--q-runeword); } .q-tempered { --c: var(--q-tempered); }
.item.q-normal, .item.q-inferior, .item.q-superior { background: linear-gradient(180deg, #1d2127, #171a1f); border-color: #2c323b; }
.item.q-normal:hover, .item.q-inferior:hover, .item.q-superior:hover { border-color: #4a5262; }
.item.q-normal .lbl { color: #d2d6dc; }
.item.q-inferior .lbl { color: var(--q-inferior); }

/* stash money strip */
.money { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--s-3); }
.coin { display: inline-flex; align-items: center; gap: var(--s-2); height: 30px; padding: 0 6px 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-1);
  background: var(--well); font-size: var(--fs-sm); color: var(--text-3); }
.coin:not(:has(button)) { padding-right: 10px; }
.coin b { color: var(--text-1); font-variant-numeric: tabular-nums; font-weight: 600; }
.coin.gold b { color: var(--q-unique); }
.coin button { border: 0; background: none; color: var(--text-3); height: 22px; padding: 0 6px; border-radius: 5px; font-size: var(--fs-xs); font-weight: 500; }
.coin button:hover { color: var(--text-1); background: var(--surface-3); }

/* inspector: the selected item (head, scrolling details, actions pinned at the bottom) */
.inspector { background: var(--surface-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); position: sticky; top: 0; align-self: start; box-shadow: var(--e-1);
  height: calc(100dvh - var(--top-h) - var(--nav-h) - var(--foot-h) - 2 * var(--s-5) - 52px); min-height: 480px; display: flex; flex-direction: column; overflow: hidden; }
.inspector .empty { margin: auto; max-width: 280px; padding: var(--s-10) var(--s-5); }
.inspector .empty p { font-size: var(--fs-md); line-height: 1.55; }
.inspector .results { margin: 0 var(--s-4) var(--s-4); overflow: auto; }
.insp-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ins-head { display: flex; gap: var(--s-4); align-items: center; padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid var(--line-1);
  background: radial-gradient(400px 140px at 0 0, color-mix(in srgb, var(--c) 7%, transparent), transparent 70%); }
.ins-art { position: relative; flex: none; border-radius: var(--r-md); display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 14%, #1d2129), #12151a 75%); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line-2)); }
.ins-art.q-normal, .ins-art.q-inferior, .ins-art.q-superior { background: radial-gradient(circle at 50% 45%, #20242c, #12151a 75%); border-color: var(--line-2); }
.ins-pic { position: absolute; inset: 9px; width: calc(100% - 18px); height: calc(100% - 18px); object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6)); }
.ins-mono { padding: 4px; font-size: var(--fs-xs); font-weight: 650; line-height: 1.2; text-align: center; color: var(--c); }
.ins-art.has-img .ins-mono { display: none; }
.ins-title { min-width: 0; }
.ins-title .tt-name { font-size: var(--fs-2xl); line-height: 1.2; }
.ins-title .tags { margin: var(--s-2) 0 0; }
.ins-scroll { flex: 1; min-height: 0; overflow: auto; padding: var(--s-1) var(--s-5) var(--s-4); }
.ins-props > :first-child { border-top: 0; }
.ins-h { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); }
.ins-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-4); margin: 0; font-size: var(--fs-md); }
.ins-facts dt { color: var(--text-4); }
.ins-facts dd { margin: 0; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.ins-facts code { font: 11.5px var(--mono); color: var(--text-3); }
.ins-staged { margin: var(--s-3) 0 0; color: var(--warn); font-size: var(--fs-md); }
.ins-actions { display: grid; gap: var(--s-2); padding: var(--s-1) var(--s-5) var(--s-4); border-top: 1px solid var(--line-2); background: var(--surface-2); }
.ins-act-head { display: flex; align-items: flex-end; justify-content: space-between; }
.ins-act-head .ins-h { margin: var(--s-3) 0 2px; }
.ins-act-head .seg button { display: inline-flex; align-items: center; gap: 5px; }
.ins-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ins-k { width: 76px; margin-right: 4px; flex: none; font-size: var(--fs-sm); color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-row select { flex: 1; min-width: 0; height: 30px; }
.ins-row.end { justify-content: space-between; margin-top: var(--s-1); font-size: var(--fs-sm); }
.ins-row.ed-open { gap: var(--s-2); padding-top: var(--s-3); }
.ins-row.ed-open .faint { font-size: var(--fs-sm); }
.results { margin-top: var(--s-4); border-top: 1px solid var(--line-1); padding-top: var(--s-3); }
.results h4 { margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); }
.res { width: 100%; min-height: 36px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--r-md); background: none; text-align: left; }
.res:hover { background: var(--surface-3); }
.res:focus-visible { box-shadow: var(--focus-inset); }
.res .nm { color: var(--c); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .wh { color: var(--text-4); font-size: var(--fs-sm); white-space: nowrap; }

/* tooltip and inspector body: what the game's tooltip shows */
.tt-art { float: right; width: 64px; height: 76px; margin: -2px -2px 4px 10px; border-radius: var(--r-md); display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 14%, #1d2129), #13161b 75%); border: 1px solid var(--line-1); }
.tt-art .tt-pic { max-width: 58px; max-height: 70px; object-fit: contain; }
.tt-name { font: 600 var(--fs-xl)/1.25 var(--font-display); letter-spacing: -.005em; color: var(--c); }
.tt-base { color: var(--text-2); font-size: var(--fs-md); margin-top: 2px; }
.tt-core { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; font-size: var(--fs-md); padding: 10px 0; border-top: 1px solid var(--line-1); }
.tt-core dt { color: var(--text-3); }
.tt-core dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--text-1); }
.tt-lines { list-style: none; margin: 0; padding: 10px 0; border-top: 1px solid var(--line-1); display: grid; gap: 3px; }
.tt-lines li { color: var(--mod); font-size: var(--fs-md); line-height: 1.4; }
.tt-lines li.none { color: var(--text-4); font-style: italic; }
.rr { color: var(--text-4); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rr b { font-weight: 650; margin-left: 5px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.rr-perfect b { color: var(--ok); }
.rr-worst b { color: var(--bad); }
.rr-outside b { color: var(--warn); }
.tt-gem { border-top: 1px solid var(--line-1); padding-top: var(--s-2); }
.tt-gem > span { color: var(--text-3); font-size: var(--fs-sm); }
.tt-gem .tt-lines { border-top: 0; padding-top: 3px; }
.tt-socks { padding: 10px 0; border-top: 1px solid var(--line-1); font-size: var(--fs-md); color: var(--text-2); }
.tt-socks span { color: var(--text-3); }
.tt-req { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line-1); font-size: var(--fs-sm); color: var(--text-3); }
.tt-req b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.tt-req .unmet b { color: var(--bad); }
.tt-req .unmet::after { content: " · unmet"; color: var(--bad); }
.tt-req small { color: var(--text-4); font-variant-numeric: tabular-nums; }
.tt-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-1); font-size: var(--fs-sm); color: var(--text-4); }
.tt-foot code { font: 11px var(--mono); }

/* ============================================================= CHARACTER VIEW
   Eye path: the hero (name, class, level, key numbers), then the editable cards, then the skill tree. */
.hero { display: flex; flex-direction: column; gap: var(--s-5); margin-bottom: var(--s-5); padding: var(--s-6); border-radius: var(--r-lg);
  border: 1px solid var(--line-2); box-shadow: var(--e-1);
  background: radial-gradient(640px 220px at 0 0, rgba(228, 139, 79, .075), transparent 70%), var(--surface-1); }
.hero-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-5); }
.hero .char-avatar { width: 56px; height: 56px; font-size: 15px; border-radius: 14px; }
.hero h2 { margin: 0; font: 650 var(--fs-3xl)/1.15 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.hero p { margin: var(--s-1) 0 0; color: var(--text-3); font-size: var(--fs-lg); }
.hero-actions { display: flex; gap: var(--s-2); }
.hero-stats { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.hero .stats-inline, .hero .vitals { display: contents; }
.hero .vitals-note { margin: calc(-1 * var(--s-2)) 0 0; font-size: var(--fs-sm); }
.kv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1 1 130px; min-width: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--well); border: 1px solid var(--line-1); }
.kv span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: var(--track-over); }
.kv b { font: 600 var(--fs-2xl)/1.2 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
/* 12 columns: level and gold either side of the six attributes, then the skill tree; clone (owner) last */
.cards.char-cards { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: stretch; }
.char-cards > .c-level, .char-cards > .c-gold { grid-column: span 3; }
.char-cards > .c-attrs { grid-column: span 6; }
.char-cards > .c-attrs .form-grid.three { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.char-cards > .c-clone { grid-column: 1 / -1; order: 10; }
.char-cards > .c-clone .act-row { max-width: 480px; }
.char-cards > .skill-card { grid-column: 1 / -1; }
.char-cards > .card { display: flex; flex-direction: column; }
.char-cards > .card > .form-foot { margin-top: auto; padding-top: var(--s-5); }
.char-cards > .card.wide > .form-foot { margin-top: var(--s-4); padding-top: 0; }
.char-cards > .card > .act-row { margin-top: auto; }
.char-cards .chk-row { margin-top: var(--s-3); }
.bar { height: 6px; border-radius: 6px; background: var(--well); overflow: hidden; border: 1px solid var(--line-1); margin-top: 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #b8683a, var(--accent)); }
.vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.vital { flex: 1 1 130px; min-width: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-1); position: relative; overflow: hidden; }
.vital::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 0 2px 2px 0; background: var(--v, var(--line-3)); }
.vital span { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: var(--track-over); }
.vital b { display: block; margin-top: 2px; font: 600 var(--fs-2xl)/1.2 var(--font-display); font-variant-numeric: tabular-nums; color: var(--v, var(--text-1)); }
.vital small { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--text-4); font-variant-numeric: tabular-nums; }
.vitals-note { margin: var(--s-3) 0 0; font-size: var(--fs-sm); line-height: 1.5; }
.vital.life { --v: var(--life); } .vital.mana { --v: var(--mana); } .vital.stam { --v: var(--stamina); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.skill { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line-1); }
.skill span { flex: 1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill.has span { color: var(--text-1); }
.skill input { width: 64px; height: 30px; text-align: right; }
.skill.dirty input { border-color: var(--accent-line); }

/* skill tree: the game's own slots (SkillDesc.txt) and icons, drawn in this page's style */
.skill-card h3 { flex-wrap: wrap; }
.skill-card h3 .sk-total { color: var(--text-1); font: 600 var(--fs-xl)/1 var(--font-display); letter-spacing: -.01em; text-transform: none; margin-left: 6px; }
.skill-card h3 .act-row { gap: var(--s-2); }
.sk-allto { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: var(--fs-sm); color: var(--text-4); white-space: nowrap; }
.skill-card h3 input.sk-allto-in { width: 64px; flex: none; height: 30px; }
.sk-body { display: flex; gap: var(--s-6); align-items: flex-start; }
.sk-panel { display: flex; background: var(--well); border: 1px solid var(--line-1); border-radius: var(--r-lg); padding: var(--s-4) 0 10px var(--s-3); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4); }
.sk-tree { position: relative; flex: none; }
.sk-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.sk-lines line { stroke: var(--line-2); stroke-width: 2; }
.sk-lines line.on { stroke: #7a5a43; }
.sk-arrow { fill: var(--line-2); } .sk-arrow-on { fill: #7a5a43; }
.sk-slot { position: absolute; width: 48px; height: 48px; border-radius: var(--r-md); border: 1px dashed #1f242c; }
.sk-node { position: absolute; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; padding: 8px 0 0; color: var(--text-3); cursor: pointer; font: inherit; user-select: none; border-radius: var(--r-md); }
.sk-node:focus-visible { box-shadow: none; }
.sk-node:focus-visible .sk-icon { box-shadow: var(--focus); }
.sk-icon { position: relative; width: 48px; height: 48px; border-radius: var(--r-md); background: #0a0c0f; display: grid; place-items: center;
  box-shadow: 0 0 0 1px var(--line-2); transition: box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.sk-icon img { width: 48px; height: 48px; border-radius: var(--r-md); image-rendering: pixelated; filter: grayscale(1) brightness(.55); transition: filter var(--dur-1); }
.sk-icon b { color: var(--text-4); font-size: var(--fs-sm); font-weight: 650; letter-spacing: .03em; }
.sk-node.has .sk-icon { background: linear-gradient(180deg, #1c2026, #13161a); box-shadow: 0 0 0 1px var(--line-3); }
.sk-node.has .sk-icon b { color: var(--text-1); }
.sk-node.has .sk-icon img { filter: none; }
.sk-node:hover .sk-icon { transform: translateY(-1px); box-shadow: 0 0 0 1px #4a515e; }
.sk-node.sel .sk-icon { box-shadow: 0 0 0 2px var(--text-2); }
.sk-node.dirty .sk-icon { box-shadow: 0 0 0 2px var(--accent); }
.sk-node.staged .sk-icon { outline: 2px dashed var(--warn); outline-offset: 3px; }
.sk-pts { position: absolute; right: -8px; bottom: -8px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--line-3); color: var(--text-4); font: 650 11px/18px var(--font);
  font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }
.sk-node.has .sk-pts { color: var(--text-1); background: #262b33; }
.sk-node.dirty .sk-pts { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sk-staged { position: absolute; left: -8px; top: -8px; padding: 0 4px; height: 17px; border-radius: 6px; background: var(--warn);
  color: var(--warn-ink); font: 700 10.5px/17px var(--font); font-style: normal; }
.sk-node.warn .sk-pts { box-shadow: 0 0 0 2px var(--bad-line); }
.sk-name { max-width: 98px; font-size: var(--fs-sm); line-height: 1.25; text-align: center; background: var(--well); padding: 0 3px; border-radius: var(--r-xs);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sk-node.has .sk-name { color: var(--text-1); }
.sk-tabs { display: flex; flex-direction: column; gap: 6px; margin-left: 6px; width: 156px; border-left: 1px solid var(--line-1); padding: 0 10px; }
.sk-tab { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); text-align: left; min-height: 44px; padding: 8px 10px; border-radius: var(--r-md);
  background: none; border: 1px solid transparent; color: var(--text-3); font: inherit; font-size: var(--fs-md); cursor: pointer; }
.sk-tab:hover { background: var(--surface-2); color: var(--text-2); }
.sk-tab.on { background: var(--surface-3); border-color: var(--line-3); color: var(--text-1); }
.sk-tab b { font: 600 var(--fs-lg)/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--text-2); }
.sk-tab.dirty b { color: var(--accent-text); }
/* skill details beside the tree: the game's own text and values (pd2save skill_info) */
.sk-side { flex: 1; min-width: 300px; max-width: 820px; padding-top: 2px; }
.sk-side.preview { opacity: .96; }
.sk-title { flex: 1; min-width: 0; }
.sk-side-head { display: flex; gap: var(--s-3); align-items: center; }
.sk-side-head h4 { margin: 0; font: 600 var(--fs-2xl)/1.2 var(--font-display); letter-spacing: -.01em; }
.sk-side-head p { margin: 2px 0 0; font-size: var(--fs-sm); }
.sk-side-head .sk-set { margin-left: auto; }
.sk-icon.big img { filter: none; }
.sk-desc { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-1); }
.sk-short { margin: 0; color: var(--text-1); font-weight: 540; }
.sk-long { margin: 6px 0 0; color: var(--text-2); line-height: 1.55; white-space: pre-line; }
.sk-lines-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-md); line-height: 1.45; }
.sk-lines-list li { color: var(--text-2); }
.sk-lines-list li.chg { color: var(--accent-text); }
.sk-base { margin: var(--s-3) 2px 0; }
.sk-levels { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-4); }
.sk-col { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line-1); background: var(--well); }
.sk-col p { margin: 0; font-size: var(--fs-md); }
.sk-col h5, .sk-syn h5 { margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); }
.sk-col h5 b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.sk-syn { margin-top: var(--s-4); }
.sk-syn ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sk-syn li { display: flex; gap: 10px; align-items: center; font-size: var(--fs-md); color: var(--text-2); }
.sk-chip { display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line-2); color: var(--text-2); font: inherit; font-size: var(--fs-md); cursor: pointer; }
.sk-chip:hover { border-color: var(--line-3); color: var(--text-1); }
.sk-chip img { width: 18px; height: 18px; border-radius: var(--r-xs); }
.sk-chip b { font-variant-numeric: tabular-nums; color: var(--text-1); }
.sk-chip.zero b { color: var(--bad); }
.sk-foot { margin: var(--s-4) 0 0; font-size: var(--fs-sm); }
.sk-loading { margin-top: var(--s-4); color: var(--text-4); font-size: var(--fs-md); }
.sk-err { margin: var(--s-4) 0 0; color: var(--bad-text); font-size: var(--fs-md); }
.sk-side.empty { text-align: left; padding: var(--s-4) 0; }
.sk-side.empty p { margin: 0; line-height: 1.55; text-align: left; max-width: 420px; }
.sk-req { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: var(--s-4) 0 0; font-size: var(--fs-md); }
.sk-req > .faint { width: 100%; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: var(--track-over); }
.sk-set { display: flex; gap: 6px; align-items: center; }
.sk-set input { width: 70px; height: 30px; text-align: right; }
.sk-note { margin: var(--s-3) 0 0; color: var(--warn); font-size: var(--fs-md); }
.sk-avail { text-transform: none; letter-spacing: 0; font-weight: 400; margin-right: var(--s-3); white-space: nowrap; }
.sk-other { margin-top: var(--s-4); }
.sk-other summary { cursor: pointer; color: var(--text-3); font-size: var(--fs-md); margin-bottom: var(--s-2); border-radius: var(--r-xs); }

/* ============================================================= PROGRESS VIEW
   One card per act: quests with their reward toggles, then the act's waypoints. */
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: var(--s-4); align-items: start; }
.act { background: var(--surface-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--s-4); box-shadow: var(--e-1); }
.act h4 { margin: 0 0 var(--s-3); display: flex; justify-content: space-between; align-items: baseline; font: 600 var(--fs-lg)/1.3 var(--font-display); }
.act h4 .meta { font: 450 var(--fs-sm) var(--font); color: var(--text-4); font-variant-numeric: tabular-nums; }
.q { display: flex; align-items: flex-start; gap: var(--s-2); padding: 3px 6px; margin: 0 -6px; border-radius: var(--r-sm); border: 1px solid transparent; font-size: var(--fs-md); color: var(--text-2); }
.q .tick { width: 14px; height: 14px; margin-top: 1px; padding: 0; border-radius: var(--r-xs); border: 1px solid var(--line-control); background: none; flex: none; display: grid; place-items: center; cursor: pointer; }
.q .tick:hover:not(:disabled) { border-color: var(--text-4); }
.q .tick:disabled { cursor: default; }
.q.s-done .tick, .q.s-pending .tick { background: var(--ok-bg); border-color: var(--ok-line); }
.q.s-done .tick::after, .q.s-pending .tick::after { content: ""; width: 6px; height: 3px; border-left: 1.5px solid var(--ok); border-bottom: 1.5px solid var(--ok); transform: rotate(-45deg) translate(1px, -1px); }
.q.s-started .tick::after { content: ""; width: 6px; height: 1.5px; background: var(--text-4); }
.q.s-not_started, .q.s-started { color: var(--text-3); }
.q.dirty { background: var(--accent-bg); }
.q.staged { border: 1px dashed var(--accent-line); }
.qbody { min-width: 0; }
.qname { display: flex; align-items: center; gap: 6px; }
.qbadge { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-text); }
.qlines { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 3px; }
.qline { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.qlabel { color: var(--text-4); min-width: 44px; }
.qlabel.wait { color: var(--warn); min-width: 0; }
.qseg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--well); }
.qseg button { border: 0; background: none; color: var(--text-3); padding: 1px 8px; font-size: var(--fs-sm); line-height: 17px; cursor: pointer; }
.qseg button + button { border-left: 1px solid var(--line-2); }
.qseg button:hover:not(:disabled) { color: var(--text-1); background: var(--surface-3); }
.qseg button:disabled { cursor: default; }
.qseg button.on { background: var(--ok-bg); color: var(--ok); }
.qseg button.on.w { background: var(--warn-bg); color: var(--warn); }
.wp { width: 100%; display: flex; align-items: center; gap: var(--s-2); padding: 4px 6px; margin: 0 -6px; border-radius: var(--r-sm); border: 0; background: none; font-size: var(--fs-md); color: var(--text-3); text-align: left; }
.wp:hover { background: var(--surface-3); }
.wp i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--text-4); flex: none; }
.wp.on { color: var(--text-1); }
.wp.on i { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.wp.dirty { background: var(--accent-bg); }
.act-btns { display: flex; gap: var(--s-2); margin-top: var(--s-3); }

/* ============================================================= CHAT (owner)
   A side panel on the panel surface; the log is a sunken well, the owner's messages raised, the bot's on the panel. */
.chat { border-left: 1px solid var(--line-2); background: var(--surface-1); display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line-1); }
.chat-head b { font: 600 var(--fs-lg) var(--font-display); letter-spacing: -.01em; }
.chat-head .faint { margin-left: var(--s-2); font-size: var(--fs-sm); }
.chat-lib { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line-1); font-size: var(--fs-sm); }
.chat-lib .link:disabled { opacity: .45; cursor: default; }
.chat-log { flex: 1; overflow: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); background: var(--well); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.msg { max-width: 92%; padding: 9px 12px; border-radius: var(--r-lg); font-size: var(--fs-md); line-height: 1.5; word-wrap: break-word; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0; padding-left: 18px; }
.msg code { font: 12px var(--mono); background: var(--surface-3); padding: 1px 4px; border-radius: var(--r-xs); }
.msg a { color: var(--accent-text); text-decoration: underline; word-break: break-all; }
.msg.me { align-self: flex-end; background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-1); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; box-shadow: var(--e-1); }
.msg.sys { align-self: center; max-width: 300px; background: none; color: var(--text-3); font-size: var(--fs-sm); padding: var(--s-4) 0; text-align: center; text-wrap: balance; }
.msg.wait { color: var(--text-3); }
.msg.wait::after { content: "…"; }
.chat-form { display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-4) var(--s-2); border-top: 1px solid var(--line-1); align-items: flex-end; }
.chat-form textarea { flex: 1; }
.chat-note { margin: 0; padding: 0 var(--s-4) var(--s-3); font-size: var(--fs-sm); color: var(--text-4); }

/* armory import dialog (Forge #228) ================================
   Colour only for what did not convert (bad), caveats and queueing (warn), success (ok). */
.imp-out { margin-top: var(--s-4); display: grid; gap: var(--s-3); }
.imp-out:empty { display: none; }
.imp-wait { color: var(--text-3); font-size: var(--fs-md); }
.imp-err, .imp-done, .imp-name.taken { padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-md); }
.imp-err { border: 1px solid var(--bad-line); background: var(--bad-bg); color: var(--bad-text); }
.imp-err.warn, .imp-done.warn, .imp-name.taken { border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--text-2); }
.imp-done { border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--text-2); }
.imp-done b, .imp-name b { color: var(--text-1); }
.imp-report { display: grid; gap: 10px; }
.imp-src { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line-1); border-radius: var(--r-lg); background: var(--surface-2); }
.imp-src .char-avatar { width: 38px; height: 38px; font-size: var(--fs-md); border-radius: 10px; }
.imp-src .tags { display: flex; gap: 6px; margin-left: auto; }
.imp-name { font-size: var(--fs-md); color: var(--text-2); }
.imp-counts { display: flex; gap: 22px; padding: 2px 2px 0; }
.imp-counts .kv { align-items: flex-start; background: none; border: 0; padding: 0; min-width: 0; }
.imp-counts .kv.bad b { color: var(--bad); }
.imp-counts .imp-new { margin-left: auto; align-items: flex-end; }
.imp-counts .imp-new b { font-size: var(--fs-lg); line-height: 25px; }
.imp-sec { border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--s-3) var(--s-4); background: var(--surface-2); }
.imp-sec h4 { margin: 0; font-size: var(--fs-xs); letter-spacing: var(--track-over); text-transform: uppercase; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: var(--s-2); }
.imp-sec h4 i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); flex: none; }
.imp-sec.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.imp-sec.bad h4 { color: var(--bad-text); }
.imp-sec.bad h4 i { background: var(--bad); }
.imp-sec.warn h4 i { background: var(--warn); }
.imp-sec.ok h4 i { background: var(--ok); }
.imp-hint { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.imp-list { margin: var(--s-2) 0 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: var(--fs-md); max-height: 240px; overflow: auto; }
.imp-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) minmax(0, 2fr); gap: 10px; align-items: baseline; }
.imp-list b { font-weight: 560; overflow-wrap: anywhere; }
.imp-list .where { color: var(--text-4); font-size: var(--fs-sm); }
.imp-list .why { color: var(--text-2); }
.imp-notes { margin: var(--s-2) 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-md); }
.imp-notes li + li { margin-top: 2px; }
.codes { max-height: 260px; overflow: auto; border: 1px solid var(--line-1); border-radius: var(--r-md); margin: 10px 0; background: var(--well); }
.code-opt { width: 100%; min-height: 36px; display: flex; gap: 10px; align-items: center; padding: 7px 10px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line-1); }
.code-opt:hover { background: var(--surface-2); }
.code-opt:focus-visible { box-shadow: var(--focus-inset); }
.code-opt.on { background: var(--accent-bg); }
/* the row the arrow keys are on in a searchable list (D455.9); the list keeps focus in its search box */
.code-opt.act { background: var(--surface-3); box-shadow: var(--focus-inset); }
.code-opt.on.act { background: var(--accent-bg); }
.code-opt code { font: 11px var(--mono); color: var(--text-4); width: 44px; flex: none; }
.code-opt span { flex: 1; }
.code-opt small { color: var(--text-4); }

/* ============================================================= FORGE VIEW (Forge #235, DECISIONS 42)
   The choices on the left, the preview, rolls and the forge button pinned on the right. */
.forge { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-4); align-items: start; }
.fg-form { display: grid; gap: var(--s-4); min-width: 0; }
.fg-side { display: grid; gap: var(--s-4); position: sticky; top: 0; }
.fg-quals { margin-bottom: 2px; }
.fg-picker { display: grid; gap: 0; }
.fg-search { width: 100%; }
.fg-list { max-height: 300px; margin: var(--s-2) 0 4px; }
.fg-count { font-size: var(--fs-sm); color: var(--text-4); }
.code-opt.off { opacity: .45; cursor: not-allowed; }
.code-opt.off:hover { background: none; }
.fg-nm { color: var(--c); font-weight: 560; }
.code-opt .fg-nm { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-opt .fg-nm + small { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-chosen { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--surface-2); }
.fg-chosen + .fg-chosen, .fg-chosen + .fg-sub, .fg-chosen + label.f, .fg-sub + label.f, .fg-chosen + .fg-row, .fg-sub + .fg-row, label.f + .fg-row { margin-top: var(--s-3); }
.fg-chosen-tx { display: grid; gap: 1px; min-width: 0; flex: 1; }
.fg-chosen-tx .fg-nm { font-size: var(--fs-lg); }
.fg-chosen-tx small { color: var(--text-3); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-sub { margin-top: var(--s-3); }
.fg-k { font-size: var(--fs-sm); color: var(--text-3); }
.fg-sub > .fg-k { display: block; margin-bottom: 6px; }
.fg-row { align-items: end; }
.fg-eth { height: 34px; }
.fg-aff { display: grid; gap: var(--s-2); }
.fg-aff-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.fg-aff-row > .btn { justify-self: start; }
.fg-aff-row select { width: 100%; min-width: 0; }
.fg-aff-row.fg-name { grid-template-columns: 84px minmax(0, 1fr) minmax(0, 1fr); }
.fg-aff-row .fg-hint { margin: 0; }
.fg-aff-row.fg-aff-set { grid-template-columns: 84px minmax(0, 1fr) auto auto; }
.fg-aff-row.fg-aff-pick { grid-template-columns: 84px minmax(0, 1fr); align-items: start; }
.fg-aff-pick .fg-k { padding-top: 9px; }
.fg-aff-now { display: flex; gap: 10px; align-items: baseline; min-width: 0; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--well); }
.fg-aff-now .fg-nm { flex: none; align-self: center; }
.fg-aff-now small { align-self: center; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fgSock { display: grid; gap: var(--s-2); }
.fg-hint { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-4); }
.card h3 .fg-h-note { text-transform: none; letter-spacing: 0; font-weight: 450; color: var(--text-4); font-size: var(--fs-sm); }
.fg-fixed { color: var(--text-2); font-size: var(--fs-md); grid-column: 2 / -1; }
.fg-tip { padding: 12px 14px; border-radius: var(--r-lg); background: rgba(14, 16, 19, .97); border: 1px solid color-mix(in srgb, var(--c, var(--line-2)) 35%, var(--line-2)); transition: opacity var(--dur-1) var(--ease); }
.fg-tip.stale { opacity: .55; }
.fg-tip.empty { border-style: dashed; text-align: center; padding: 28px 18px; }
.fg-tip.empty p { margin: 0; font-size: var(--fs-md); }
#fgNotes .imp-notes { margin-top: 10px; color: var(--text-3); font-size: var(--fs-sm); }
.fg-rolls { display: grid; gap: 10px; max-height: 46vh; overflow: auto; }
.fg-none { font-size: var(--fs-md); }
.fg-roll { padding: 9px 10px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--well); }
.fg-roll-head { display: flex; align-items: baseline; gap: var(--s-2); }
.fg-roll-line { flex: 1; color: var(--mod); font-size: var(--fs-md); line-height: 1.35; }
.fg-best { flex: none; border: 1px solid var(--line-2); background: none; color: var(--text-3); border-radius: var(--r-pill); font-size: var(--fs-2xs); padding: 1px 8px; }
.fg-best:hover { color: var(--text-1); border-color: var(--line-3); }
.fg-roll.perfect .fg-best { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); cursor: default; pointer-events: none; }
.fg-roll-ctl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 64px; gap: var(--s-2); align-items: center; margin-top: 6px; }
.fg-roll-ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.fg-roll-ctl input[type=number] { height: 28px; padding: 0 6px; }
.fg-lo, .fg-hi { font-size: var(--fs-xs); color: var(--text-4); }
.fg-roll-src { margin-top: 4px; font-size: var(--fs-xs); color: var(--text-4); }
.fg-go { display: grid; gap: 6px; }
.fg-go .btn { height: 40px; }
.fg-go-note { font-size: var(--fs-sm); color: var(--text-4); text-align: center; }
.fg-err { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; }
.fg-open { margin-left: 10px; }

/* ============================================================= DIALOGS: item editor (Forge #236)
   The forge's roll rows and tooltip box; colour only where a line or roll changes. */
.modal.wide.edit { width: 1040px; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ed-tips { display: grid; gap: var(--s-3); position: sticky; top: 0; }
.ed-tips .ins-h { margin: 0 0 6px; }
.ed-after { transition: opacity var(--dur-1) var(--ease); }
.ed-after.stale { opacity: .55; }
.ed-tips .tt-lines li.chg { color: var(--text-1); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: var(--r-xs); margin: 0 -4px; padding: 0 4px; }
.ed-side { display: grid; gap: 14px; min-width: 0; }
.ed-sec { border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--s-3) var(--s-4) var(--s-4); background: var(--surface-2); }
.ed-sec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.ed-sec-head .ins-h { margin: 0; }
.ed-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-rolls { max-height: 40vh; }
.fg-roll.changed { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-1)); }
.fg-roll.locked { opacity: .7; }
.ed-why { margin-top: 5px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.35; }
.ed-none { margin: 0; font-size: var(--fs-md); }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-height: 30px; }
.ed-row + .ed-row { margin-top: 6px; }
.ed-row .faint { font-size: var(--fs-sm); }
.ed-row select { flex: 1; min-width: 180px; height: 30px; }
.ed-row input[type=number] { width: 90px; height: 30px; padding: 0 var(--s-2); }
.ed-row input[type=text] { width: 180px; height: 30px; padding: 0 var(--s-2); }
.ed-k { width: 74px; flex: none; color: var(--text-3); font-size: var(--fs-sm); }
.ed-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border: 1px solid var(--line-2); border-radius: var(--r-pill); font-size: var(--fs-sm); color: var(--text-2); }
.ed-chip button { border: 0; background: none; color: var(--text-3); width: 18px; height: 18px; border-radius: 50%; line-height: 1; }
.ed-chip button:hover { color: var(--text-1); background: var(--surface-3); }
#edFoot { position: sticky; bottom: calc(-1 * var(--s-6)); z-index: 2; margin: var(--s-4) calc(-1 * var(--s-6)) calc(-1 * var(--s-6)); padding: 2px var(--s-6) var(--s-4); background: var(--overlay); border-top: 1px solid var(--line-1); }
#edFoot .imp-err, #edFoot .imp-notes { margin-top: var(--s-3); }
.ed-sec .seg button:disabled { opacity: .35; cursor: not-allowed; }

/* ============================================================= SHEET VIEW
   The game's arithmetic (Forge #238): cards of rows, a number opens its sources. Colour only where it means something. */
.sh-aura-row { flex-basis: 100%; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-top: calc(-1 * var(--s-1)); }
.cards.sheet { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: stretch; }
.sh-row { border-bottom: 1px solid var(--line-1); }
.sh-row:last-child { border-bottom: 0; }
.sh-row summary, .sh-row.flat { display: flex; align-items: baseline; gap: 10px; padding: 7px 2px; list-style: none; cursor: pointer; }
.sh-row.flat { cursor: default; }
.sh-row summary::-webkit-details-marker { display: none; }
.sh-row summary::before { content: ""; width: 0; height: 0; border: 4px solid transparent; border-left-color: var(--text-4); margin-right: -2px; transform: translateY(-1px); transition: transform var(--dur-1); }
.sh-row[open] summary::before { transform: rotate(90deg) translateX(-1px); }
.sh-row.flat::before { content: ""; width: 6px; }
.sh-row summary:hover .sh-k { color: var(--text-1); }
.sh-k { color: var(--text-2); }
.sh-v { margin-left: auto; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.sh-bp { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sh-src { list-style: none; margin: 0 0 var(--s-2) 14px; padding: 6px 10px; border-left: 1px solid var(--line-2); font-size: var(--fs-md); }
.sh-src li { display: flex; gap: var(--s-3); padding: 2px 0; color: var(--text-3); }
.sh-src li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-src li b { margin-left: auto; color: var(--text-2); font-weight: 520; }
.sh-src li.k-base span { color: var(--text-4); }
.sh-sub { margin: 6px 0 0 14px; font-size: var(--fs-sm); }
.sh-h { margin: 14px 0 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-4); }
.sh-note { margin: var(--s-2) 0 0; font-size: var(--fs-sm); }
.sh-res th, .sh-res td { padding: 7px 6px; }
.sh-res td:first-child, .sh-res th:first-child { padding-left: 0; }
.sh-row.in-t { border: 0; }
.sh-row.in-t summary { padding: 0; }
.res-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.r-fire { background: var(--r-fire); } .r-cold { background: var(--r-cold); } .r-lightning { background: var(--r-lightning); } .r-poison { background: var(--r-poison); }
.r-magic { background: var(--r-magic); } .r-physical { background: var(--r-physical); }
.sh-row summary .res-dot { margin: 0 -6px 0 0; align-self: center; }
.sh-tgt { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin: 0 0 var(--s-2); }
.sh-tgt .sh-tgt-in { flex: 1 1 100%; min-width: 0; }
.sh-tgt select { flex: 1; }
.sh-tgt-res { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 0 10px; font-size: var(--fs-sm); }
.sh-tgt-r { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.sh-tgt-mods { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0 0 var(--s-2); font-size: var(--fs-sm); }
.sh-tgt-m, .sh-tgt-c { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sh-tgt-lvl { width: 4.5em; }
.ok-t, table.t td.ok-t { color: var(--ok); } .bad-t, table.t td.bad-t { color: var(--bad); }
.sh-items { list-style: none; margin: 0; padding: 0; font-size: var(--fs-md); }
.sh-items li { display: grid; grid-template-columns: 74px 1fr; gap: 2px 10px; padding: 4px 0; border-bottom: 1px solid var(--line-1); }
.sh-items li em { grid-column: 2; font-style: normal; color: var(--warn); font-size: var(--fs-sm); }
.sh-items li.off > span:nth-child(2) { color: var(--text-4); text-decoration: line-through; text-decoration-color: var(--line-3); }
.wi-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: var(--s-3); }
.wi-form .f { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-4); }
.wi-form .f.grow { flex: 1; min-width: 260px; }
.wi-form select { min-width: 170px; }
.wi-items { margin-bottom: var(--s-3); }
.wi-items .fg-list { max-height: 240px; }
.wi-forge { margin: 0; }
.wi-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.wi-head .spacer { flex: 1; }
.wi-note { font-size: var(--fs-sm); }
.wi-t td:first-child { color: var(--text-2); }
.wi-pc { margin-top: 14px; }
.wi-pc h4 { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.wi-t tr.wi-src td { padding-top: 0; font-size: var(--fs-sm); }

/* ============================================================= COMPARE VIEW (damage simulator)
   The builds form, the ranking (its DPS figures are the key numbers), then one card per build. */
.cmp-form { display: grid; gap: var(--s-2); }
.cmp-form .cmp-h { margin-top: 10px; }
.cmp-build { display: flex; gap: var(--s-2); align-items: center; }
.cmp-build input[type=text] { flex: 1; min-width: 220px; }
.cmp-build .cmp-who { min-width: 220px; }
.cmp-n { width: 18px; color: var(--text-4); font-size: var(--fs-sm); text-align: right; }
.cmp-add { justify-self: start; margin-left: 26px; }
.cmp-target { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.cmp-target .f.grow { flex: 1; min-width: 220px; }
.cmp-curse { display: flex; gap: var(--s-2); }
.cmp-curse .f.lvl { width: 72px; }
.cmp-kind { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; flex-basis: 100%; font-size: var(--fs-sm); }
.cmp-kind .sh-tgt-mods { flex: 1; }
.cmp-out { display: grid; gap: var(--s-4); margin-top: var(--s-4); }
.cmp-cards { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
.cmp-sub { font-weight: 500; letter-spacing: .04em; text-transform: none; }
.cmp-meta { margin: -4px 0 10px; }
table.cmp-t th, table.cmp-t td { padding: 7px 6px; }
table.cmp-t td:first-child, table.cmp-t th:first-child { padding-left: 0; }
table.cmp-t tr.best td, table.cmp-rank tr.best td { color: var(--text-1); font-weight: 600; }
table.cmp-rank td:nth-child(4) { font: 600 var(--fs-lg) var(--font-display); color: var(--text-1); font-variant-numeric: tabular-nums; }
table.cmp-t tr.best td:first-child span:first-child { box-shadow: inset 2px 0 0 var(--accent); padding-left: var(--s-2); }
/* A hit's damage over time, on its own line under the skill's row (D368.1) */
table.cmp-t tr.has-ot td { border-bottom: 0; padding-bottom: 2px; }
table.cmp-t tr.cmp-ot td { padding-top: 0; padding-left: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); font-weight: 400; }
.cmp-ot-k { margin-right: var(--s-2); color: var(--text-4); }
.cmp-ot-e + .cmp-ot-e::before { content: " · "; color: var(--text-4); }
.cmp-ot-v { color: var(--text-2); }
.cmp-assume summary { padding: 0; }

/* ============================================================= BACKUPS VIEW */
.card.flush { padding: 0; overflow: hidden; }
.t-scroll { overflow-x: auto; }
.card.flush table.t th, .card.flush table.t td { padding-top: var(--s-3); padding-bottom: var(--s-3); }
.card.flush table.t th:first-child, .card.flush table.t td:first-child { padding-left: var(--s-5); }
.card.flush table.t th:last-child, .card.flush table.t td:last-child { padding-right: var(--s-5); }
.card.flush table.t tr:last-child td { border-bottom: 0; }
.bk-t td:first-child { color: var(--text-1); white-space: nowrap; }
.bk-files { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.bk-files code { font: 11.5px var(--mono); color: var(--text-3); background: var(--well); border: 1px solid var(--line-1); padding: 1px 6px; border-radius: var(--r-xs); }
.bk-restore { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; }

/* ============================================================= CHANGES VIEW: one line per merge request, by day */
.changelog { max-width: 920px; padding: var(--s-1) var(--s-6) var(--s-5); }
.cl-day { padding-top: var(--s-5); }
.cl-day + .cl-day { margin-top: var(--s-1); border-top: 1px solid var(--line-1); }
.cl-date { margin: 0 0 var(--s-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--track-over); text-transform: uppercase; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cl-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s-2); }
.cl-list li { position: relative; padding-left: var(--s-4); line-height: 1.55; color: var(--text-2); }
.cl-list li::before { content: ""; position: absolute; left: 1px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-3); }
.cl-ref { color: var(--text-4); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- public visit (bisburg.com) */
.visit-actions { display: flex; align-items: center; gap: var(--s-2); }
.charmenu-note, .menu .visit-note { text-transform: none; letter-spacing: 0; font-weight: 500; line-height: 1.45; }
.welcome { padding-top: var(--s-10); }
.up-wrap { max-width: 1000px; margin: 0 auto; display: grid; gap: var(--s-6); }
.up-hero { padding: var(--s-2) 0 var(--s-2); }
.up-hero h1 { margin: 0 0 var(--s-3); max-width: 760px; font: 650 var(--fs-4xl)/1.12 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.up-hero p { margin: 0; max-width: 680px; font-size: var(--fs-lg); line-height: 1.6; color: var(--text-3); }
.up-choices { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--s-4); align-items: stretch; }
.up-card { display: flex; flex-direction: column; }
.up-card h3 { margin: 0 0 var(--s-3); }
.up-card > p { margin: 0 0 var(--s-5); line-height: 1.55; color: var(--text-3); }
.up-card > .btn { align-self: flex-start; }
.up-drop { flex: 1; display: grid; justify-items: center; align-content: center; gap: var(--s-3); padding: var(--s-8) var(--s-5); text-align: center; border: 1.5px dashed var(--line-3);
  border-radius: var(--r-lg); background: var(--well); transition: border-color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease); }
.up-drop.over { border-color: var(--accent); background: var(--accent-bg); }
.up-mark { width: 44px; height: 44px; border-radius: var(--r-lg); border: 1px dashed var(--line-3); position: relative; }
.up-mark::after { content: ""; position: absolute; inset: 14px; border-radius: 3px; border: 1.5px solid var(--accent); transform: rotate(45deg); }
.up-lead, .up-sub { margin: 0; }
.up-lead { color: var(--text-2); font-size: var(--fs-lg); }
.up-sub { max-width: 420px; font-size: var(--fs-sm); line-height: 1.55; }
.up-msg { margin: 0; min-height: 1.2em; font-size: var(--fs-md); color: var(--text-3); }
.up-msg.ok { color: var(--ok); }
.up-msg.bad { color: var(--bad); }
.up-privacy { margin: 0; font-size: var(--fs-sm); line-height: 1.55; padding-left: var(--s-3); border-left: 2px solid var(--line-2); }
/* The first screen (Forge #440, D440.1): one main card (the sample), two quieter ones, then what it can do. */
.fs .up-hero h1 { max-width: 820px; }
.fs-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s-6); align-items: center; padding: var(--s-6); border-color: var(--line-3); }
.fs-main h2 { margin: 0 0 var(--s-2); font: 650 var(--fs-2xl)/1.2 var(--font-display); letter-spacing: -.015em; color: var(--text-1); }
.fs-main-text p { margin: 0; line-height: 1.6; color: var(--text-3); }
.fs-samples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.fs-samples .up-msg { grid-column: 1 / -1; }
.fs-samples .up-msg:empty { display: none; }
.fs-sample { display: grid; gap: 2px; padding: var(--s-4); text-align: left; font: inherit; color: var(--text-1); cursor: pointer; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.fs-sample:hover { border-color: var(--line-3); background: var(--surface-3); transform: translateY(-1px); }
.fs-sample:active { transform: translateY(0); }
.fs-sample:focus-visible, .fs-link:focus-visible, .fs-help summary:focus-visible { outline: none; box-shadow: var(--focus); }
.fs-sample-name { font: 650 var(--fs-xl)/1.25 var(--font-display); }
.fs-sample-sub { font-size: var(--fs-sm); color: var(--text-3); }
.fs-sample-go { justify-self: start; margin-top: var(--s-3); padding: 5px var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); border: 1px solid var(--line-control); }
.fs-sample.first .fs-sample-go { background: #eceff3; border-color: #eceff3; color: #0c0e11; }
body.busy .fs-sample, body.busy .fs-link { cursor: progress; }
.fs .up-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fs .up-drop { padding: var(--s-5) var(--s-4); }
.fs-can h3 { margin: 0 0 var(--s-3); }
.fs-can ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-2) var(--s-4); }
.fs-link { display: grid; gap: 2px; width: 100%; padding: var(--s-3); text-align: left; font: inherit; cursor: pointer; background: none; border: 0; border-top: 1px solid var(--line-1); border-radius: var(--r-xs); color: var(--text-1); }
.fs-link-t { font-weight: 600; color: var(--text-1); }
.fs-link-t::after { content: " \2192"; color: var(--text-4); transition: color var(--dur-1) var(--ease); }
.fs-link:hover .fs-link-t::after { color: var(--accent-text); }
.fs-link-s { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-3); }
.fs-help summary { cursor: pointer; color: var(--text-3); border-radius: var(--r-xs); }
.fs-help summary:hover { color: var(--text-1); }
.fs-help[open] summary { margin-bottom: var(--s-3); }
.up-help h3 { margin: 0 0 var(--s-3); }
.up-steps { margin: 0 0 var(--s-4); padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }
.up-paths { display: grid; grid-template-columns: 180px 1fr; gap: var(--s-2) var(--s-4); margin: 0; padding-top: var(--s-4); border-top: 1px solid var(--line-1); font-size: var(--fs-md); }
.up-paths dt { color: var(--text-3); }
.up-paths dd { margin: 0; color: var(--text-2); word-break: break-word; }
.up-help code, .up-drop code { font: 12px var(--mono); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-1); padding: 1px 5px; border-radius: var(--r-xs); }

/* ============================================================= responsive */
/* Wide: three columns (stash, character, inspector). */
@media (max-width: 1360px) {
  .board { grid-template-columns: max-content max-content; }
  .items-bar .chips { order: 3; flex-basis: 100%; }
  #bayStash { width: min-content; }
  .inspector { grid-column: 1 / -1; position: static; height: auto; min-height: 0; }
  .inspector .empty { padding: var(--s-6) var(--s-5); }
  .ins-scroll { max-height: none; }
}
.shell.with-chat .board { grid-template-columns: max-content max-content; }
.shell.with-chat .inspector { grid-column: 1 / -1; position: static; height: auto; min-height: 0; }
@media (max-width: 1180px) {
  :root { --gutter: var(--s-5); }
  .find { flex-basis: 240px; }
  #chatToggle .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 1280px) {
  .char-cards > .c-level, .char-cards > .c-gold { grid-column: span 6; }
  .char-cards > .c-attrs { grid-column: 1 / -1; order: 2; }
  .char-cards > .skill-card { order: 3; }
}
@media (max-width: 1040px) {
  .top:not(:has(.switcher[hidden])) .wm { display: none; }
  .items-bar .hint { display: none; }
}
@media (max-width: 960px) {
  .forge { grid-template-columns: minmax(0, 1fr); }
  .fg-side { position: static; }
}
@media (max-width: 1360px) {
  .shell.with-chat .forge { grid-template-columns: minmax(0, 1fr); }
  .shell.with-chat .fg-side { position: static; }
}
@media (max-width: 980px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .bay { overflow-x: auto; }
  #bayStash { width: auto; }
}
/* Phones and small tablets: the page scrolls as a document, the view tabs stay at the top. */
@media (max-width: 720px) {
  :root { --gutter: var(--s-4); --top-h: auto; --cell: 30px; }
  body { height: auto; min-height: 100dvh; overflow: auto; display: block; }
  .top { flex-wrap: wrap; height: auto; padding-top: var(--s-2); padding-bottom: var(--s-2); row-gap: var(--s-2); }
  .switcher { flex: 1 1 0; min-width: 0; }
  .char-btn { min-width: 0; max-width: none; width: 100%; height: 44px; }
  .menu { width: calc(100vw - 32px); }
  .find { order: 10; flex: 1 1 100%; }
  .find-box { height: 44px; }
  .find-box kbd { display: none; }
  .spacer { display: none; }
  .status { order: 11; flex: 1 1 100%; }
  .pill { height: 32px; }
  .visit-actions { order: 12; flex: 1 1 100%; }
  .visit-actions .btn { height: 40px; flex: 1; }
  .icon-btn { height: 44px; min-width: 44px; }
  .views { position: sticky; top: 0; height: 48px; padding: 0 var(--s-2); background: rgba(11, 13, 16, .94); backdrop-filter: blur(12px); }
  .views button { min-width: 44px; padding: 0 12px; }
  .shell, .shell.with-chat { display: block; }
  .main { overflow: visible; }
  .view { padding: var(--s-4) var(--gutter) var(--s-8); }
  .toolbar { gap: var(--s-2); }
  .search, .items-bar .search { width: 100%; height: 44px; }
  .chip { height: 36px; }
  .btn { height: 44px; }
  .btn.sm { height: 36px; }
  .btn.sq { width: 36px; }
  .bay { padding: var(--s-3); }
  .grid-wrap { overflow-x: auto; padding-bottom: var(--s-1); }  /* fallback only: the 30 px cells fit at 390 px */
  .grid .item.tiny .lbl { -webkit-line-clamp: 1; font-size: 9.5px; }
  .char-side { flex-wrap: wrap; }
  .doll-col { overflow-x: auto; }
  .inspector { min-height: 0; }
  .ins-k { width: 100%; }
  .hero { padding: var(--s-4); gap: var(--s-4); }
  .hero-main { grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3) var(--s-4); }
  .hero h2 { font-size: var(--fs-2xl); }
  .hero-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hero-stats .kv { grid-column: span 3; }
  .hero-stats .vital { grid-column: span 2; padding: var(--s-3); }
  .hero-stats .vital b { font-size: var(--fs-xl); }
  .hero-stats .vital small { font-size: var(--fs-xs); }
  .hero-actions { grid-column: 1 / -1; }
  .hero-actions .btn { flex: 1; }
  .form-grid.three, .char-cards > .c-attrs .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .char-cards > .card { grid-column: 1 / -1 !important; }
  .sk-body { flex-direction: column; }
  .sk-panel { max-width: 100%; overflow-x: auto; }
  .sk-side { min-width: 0; }
  .sk-levels { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-wrap: wrap; height: auto; padding: var(--s-2) var(--gutter); row-gap: 2px; white-space: normal; }
  .foot .foot-legal { margin-left: 0; flex-basis: 100%; }
  .toasts { bottom: var(--s-4); }
  .drawer { top: auto; bottom: 12px; }
  .up-hero h1 { font-size: 28px; }
  .up-choices, .fs .up-choices, .fs-main, .fs-samples { grid-template-columns: minmax(0, 1fr); }
  .welcome { padding-top: var(--s-5); }
  .fs-main { padding: var(--s-4); gap: var(--s-4); }
  .fs-can ul { grid-template-columns: minmax(0, 1fr); }
  .up-paths { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .up-paths dd { margin-bottom: var(--s-2); }
  .cmp-build { flex-wrap: wrap; }
  .fg-aff-row, .fg-aff-row.fg-name { grid-template-columns: 84px minmax(0, 1fr); }
  .fg-aff-row > :nth-child(n+3) { grid-column: 2; }
  .imp-counts, .imp-src { flex-wrap: wrap; }
  .imp-counts { gap: var(--s-3) var(--s-5); }
  .imp-counts .imp-new { margin-left: 0; align-items: flex-start; }
  .imp-list li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .imp-list .why { grid-column: 1 / -1; }
  .ed-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-tips { position: static; }
  .cmp-cards { grid-template-columns: 1fr; }
  .modal { padding: var(--s-5); }
}
/* Narrow phones (360 px class): a 10-wide stash still fits its panel. */
@media (max-width: 374px) {
  :root { --cell: 27px; }
}
/* Large screens: cube and belt go beside the paper doll (#bayChar is wide enough there). */
@media (min-width: 1680px) {
  #bayChar { display: grid; grid-template-columns: auto auto; grid-template-areas: "doll side" "invt invt" "inv inv"; column-gap: var(--s-6); align-items: start; }
  #bayChar > .doll-col { grid-area: doll; }
  #bayChar > .inv-title { grid-area: invt; }
  #bayChar > #invGridWrap { grid-area: inv; }
  #bayChar > .char-side { grid-area: side; flex-direction: column; margin-top: 0; gap: var(--s-4); }
  .shell.with-chat #bayChar { display: block; }
  .shell.with-chat #bayChar > .char-side { flex-direction: row; margin-top: var(--s-5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* The public header has the visit's buttons instead of the owner's pills. */
@media (min-width: 721px) {
  body.public .find { flex-basis: 240px; }
  body.public .find-box kbd { display: none; }
}

/* Patch view (D293.6) */
.pt-stack { display: flex; flex-direction: column; gap: var(--s-4); }
.pt-stack details { margin: var(--s-2) 0; }
.pt-stack summary { cursor: pointer; color: var(--text-2); }
.pt-list { margin: var(--s-2) 0 var(--s-3); padding-left: 20px; color: var(--text-3); font-size: var(--fs-sm); }
.pt-list code { overflow-wrap: anywhere; }
.pt-ev { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font-size: var(--fs-xs); background: var(--well);
  border: 1px solid var(--line-1); border-radius: var(--r-md); padding: var(--s-3); color: var(--text-3); }
.pt-card summary { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pt-token { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pt-token input { flex: 1 1 280px; max-width: 460px; height: 34px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--line-control);
  background: var(--well); color: var(--text-1); outline: 0; }
