/* §174.5: the one look of every HTML window. Colours are the palette the
   UI Toolkit windows already used (GameMenu, RuntimeWindow), so the web
   client changes technology, not identity. Windows use rem only: bridge.js
   scales the root font with the canvas height (§174.5, --hx-scale). */
#hex-ui {
  --hx-dim: rgb(0 0 0 / 0.55);
  --hx-panel: rgb(19 24 28 / 0.97);
  --hx-raised: rgb(34 42 49);
  --hx-hover: rgb(46 56 65);
  --hx-stroke: rgb(255 255 255 / 0.12);
  --hx-stroke-strong: rgb(255 255 255 / 0.22);
  --hx-text: rgb(231 236 239);
  --hx-text-dim: rgb(154 166 173);
  --hx-gold: rgb(240 180 92);
  --hx-gold-hover: rgb(247 197 122);
  --hx-ink: rgb(15 22 26);
  --hx-danger: rgb(191 51 46);
  --hx-warm-red: rgb(242 140 120);
  --hx-leaf: rgb(193 219 141);
  --hx-focus: rgb(240 180 92 / 0.7);
  --hx-radius: 1rem;
  --hx-radius-small: 0.625rem;
  --hx-shadow: 0 1.5rem 3rem rgb(0 0 0 / 0.45), 0 0.25rem 0.75rem rgb(0 0 0 / 0.3);
  --hx-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  position: absolute;
  inset: 0;
  pointer-events: none; /* the canvas gets everything that is not a window */
  overflow: hidden;
  font-family: var(--hx-font);
  color: var(--hx-text);
  font-size: 1rem;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

:where(#hex-ui) *, :where(#hex-ui) *::before, :where(#hex-ui) *::after { box-sizing: border-box; }
/* One wrapper per open screen; it adds no box of its own. */
.hx-screen { display: contents; }
/* :where keeps these resets weaker than any component class. */
:where(#hex-ui) button { font: inherit; color: inherit; }

/* Anything the player can point at. bridge.js reports it to Unity, which
   then keeps the pointer out of the world (HtmlUi.BlocksWorldInput). */
.hx-surface { pointer-events: auto; }

/* ---- modal window ------------------------------------------------------ */
.hx-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hx-dim);
  animation: hx-fade 140ms ease-out;
}

.hx-window {
  position: relative;
  width: 21.25rem;
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  overflow: auto;
  padding: 1.5rem 1.75rem 1.75rem;
  background: var(--hx-panel);
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  box-shadow: var(--hx-shadow);
  animation: hx-rise 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.hx-window__header {
  display: grid;
  grid-template-columns: 2rem 1fr 2rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.hx-title {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hx-close {
  grid-column: 3;
  justify-self: end;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--hx-text-dim);
  cursor: pointer;
}
.hx-close:hover { background: var(--hx-raised); color: var(--hx-text); }
.hx-close svg { width: 1.25rem; height: 1.25rem; }

.hx-stack { display: flex; flex-direction: column; gap: 0.625rem; }

/* ---- buttons --------------------------------------------------------- */
.hx-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: var(--hx-raised);
  color: var(--hx-text);
  font-size: 0.9375rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background-color 90ms ease, border-color 90ms ease, transform 60ms ease;
}
.hx-btn:hover { background: var(--hx-hover); border-color: var(--hx-stroke-strong); }
.hx-btn:active { transform: translateY(1px); }

.hx-btn--primary { background: var(--hx-gold); border-color: transparent; color: var(--hx-ink); }
.hx-btn--primary:hover { background: var(--hx-gold-hover); border-color: transparent; }

/* Destructive actions look ordinary until the pointer commits to them. */
.hx-btn--danger:hover { background: var(--hx-danger); border-color: transparent; }

:where(#hex-ui) :focus { outline: none; }
:where(#hex-ui) :focus-visible { outline: 2px solid var(--hx-focus); outline-offset: 2px; }

/* ---- disclosure (foldout) ------------------------------------------- */
.hx-disclosure {
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: rgb(255 255 255 / 0.02);
}
.hx-disclosure__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem;
  border: 0;
  background: transparent;
  color: var(--hx-text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-radius: var(--hx-radius-small);
}
.hx-disclosure__toggle:hover { background: rgb(255 255 255 / 0.04); }
.hx-disclosure__chevron {
  width: 1rem;
  height: 1rem;
  margin-left: auto;
  color: var(--hx-text-dim);
  transition: transform 140ms ease;
}
.hx-disclosure[data-open="true"] .hx-disclosure__chevron { transform: rotate(180deg); }
.hx-disclosure__body {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 0.25rem 0.875rem 1rem;
}
.hx-hint { margin: 0; color: var(--hx-text-dim); font-size: 0.8125rem; }

/* ---- slider ---------------------------------------------------------- */
.hx-slider { display: flex; flex-direction: column; gap: 0.375rem; }
.hx-slider__head { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.875rem; }
.hx-slider__value { color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-slider input[type="range"] {
  --fill: 50%;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 1.25rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.hx-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: 999px;
  background: linear-gradient(to right, var(--hx-gold) var(--fill), var(--hx-raised) var(--fill));
}
.hx-slider input[type="range"]::-moz-range-track {
  height: 0.375rem;
  border-radius: 999px;
  background: linear-gradient(to right, var(--hx-gold) var(--fill), var(--hx-raised) var(--fill));
}
.hx-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: -0.375rem;
  border-radius: 50%;
  background: var(--hx-text);
  border: 2px solid var(--hx-ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.5);
}
.hx-slider input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--hx-text);
  border: 2px solid var(--hx-ink);
}

/* ---- window variants and dialog content ------------------------------ */
.hx-window--medium { width: 27rem; }
.hx-window--wide { width: 40rem; }
.hx-window--danger { border-color: rgb(242 115 89 / 0.55); }
.hx-window__header--plain { display: flex; gap: 0.625rem; }
.hx-window__header--plain .hx-title { display: flex; align-items: center; gap: 0.5rem; text-align: left; font-size: 1.3125rem; }
.hx-window--danger .hx-title { color: var(--hx-warm-red); }

.hx-text { margin: 0; font-size: 0.9375rem; }
.hx-muted { margin: 0; color: var(--hx-text-dim); font-size: 0.875rem; }
/* The backend's own wording — for a bug report, not for the player. */
.hx-detail {
  margin: 0;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.04);
  color: var(--hx-text-dim);
  font: 0.75rem/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.hx-error { margin: 0; color: var(--hx-warm-red); font-size: 0.875rem; }
.hx-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.5rem; }
.hx-actions .hx-btn { min-width: 8.5rem; }
.hx-section { display: flex; flex-direction: column; gap: 0.5rem; }
.hx-section__title {
  margin: 0;
  color: var(--hx-text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hx-icon { width: 1.125rem; height: 1.125rem; flex: none; }

.hx-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--hx-radius-small);
  background: rgb(242 115 89 / 0.1);
  color: var(--hx-text);
  font-size: 0.9375rem;
}
.hx-notice .hx-icon { color: var(--hx-warm-red); margin-top: 0.0625rem; }

/* ---- character card (assignment, later the character window) --------- */
.hx-character {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: rgb(255 255 255 / 0.02);
}
.hx-character__name { margin: 0; color: var(--hx-leaf); font-size: 1.0625rem; font-weight: 700; }
.hx-attributes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.375rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hx-attributes li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: help;
}
.hx-attributes b { text-align: right; font-variant-numeric: tabular-nums; }
.hx-traits { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.hx-traits li { display: flex; flex-direction: column; gap: 0.125rem; font-size: 0.875rem; }
.hx-traits span { color: var(--hx-text-dim); }

/* ---- pips: a 0–10 score ------------------------------------------------ */
.hx-pips { display: inline-flex; gap: 0.125rem; }
.hx-pips i { width: 0.375rem; height: 0.75rem; border-radius: 0.125rem; background: var(--hx-raised); }
.hx-pips i.on { background: var(--hx-leaf); }

/* The same cells as a control: bigger, clickable, − and + at the ends. */
.hx-pips--edit { align-items: center; gap: 0.375rem; }
.hx-pips__cells { display: inline-flex; gap: 0.1875rem; padding: 0.1875rem; border-radius: 0.375rem; outline-offset: 2px; }
.hx-pips--edit i { width: 0.875rem; height: 1.125rem; border-radius: 0.1875rem; cursor: pointer; transition: background-color 80ms ease; }
.hx-pips--edit i.hint { background: rgb(193 219 141 / 0.4); }
.hx-pips--edit i.off { background: rgb(34 42 49 / 0.45); cursor: not-allowed; }
.hx-pips__step {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.375rem;
  background: var(--hx-raised);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.hx-pips__step:hover:not(:disabled) { background: var(--hx-hover); }
.hx-pips__step:disabled { opacity: 0.35; cursor: default; }

/* ---- HUD: always-on pills over the world ------------------------------- */
/* Weather left, time controls centred while there is room; on a narrow
   canvas the centre column slides right instead of overlapping. */
.hx-hud-top {
  position: absolute;
  top: 0.875rem;
  left: 0.875rem;
  right: 0.875rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 0.5rem;
}
.hx-pill {
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3125rem;
  background: rgb(19 24 28 / 0.94);
  border: 1px solid var(--hx-stroke);
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 0.25);
}
.hx-pill__divider { width: 1px; height: 1.375rem; margin: 0 0.3125rem; background: var(--hx-stroke); }
.hx-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.625rem;
  height: 1.875rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--hx-raised);
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.hx-seg:hover:not(:disabled) { background: var(--hx-hover); }
.hx-seg[aria-pressed="true"] { background: var(--hx-gold); color: var(--hx-ink); }
.hx-seg:disabled { cursor: default; color: rgb(115 125 133); background: rgb(34 42 49 / 0.55); }
.hx-seg .hx-icon { width: 1rem; height: 1rem; }
.hx-seg--wide { gap: 0.375rem; padding: 0 0.75rem; }
.hx-hud-centre { display: flex; align-items: start; gap: 0.5rem; }

.hx-weather { justify-self: start; gap: 0.625rem; padding: 0.4375rem 0.875rem 0.4375rem 0.75rem; font-size: 0.8125rem; }
.hx-weather__day { color: var(--hx-gold); font-size: 0.9375rem; font-weight: 700; }
.hx-weather__temp { font-size: 1.0625rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hx-weather__temp[data-band="cold"] { color: rgb(71 182 230); }
.hx-weather__temp[data-band="hot"] { color: rgb(232 116 107); }
.hx-weather__sky { display: inline-flex; align-items: center; gap: 0.3125rem; }
.hx-weather__sky .hx-icon { width: 1rem; height: 1rem; color: var(--hx-gold); }
.hx-weather__sky[data-rain="true"] .hx-icon { color: rgb(71 182 230); }
.hx-weather__clock { color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-link { display: inline-flex; align-items: center; gap: 0.3125rem; font-weight: 700; }
.hx-link .hx-icon--dot { width: 0.625rem; height: 0.625rem; }
.hx-link[data-state="live"] { color: rgb(115 199 133); }
.hx-link[data-state="stalled"], .hx-link[data-state="reconnecting"] { color: var(--hx-gold); }
.hx-link[data-state="failed"] { color: rgb(217 89 82); }
.hx-link[data-state="connecting"] { color: var(--hx-text); }
.hx-hud-centre { grid-column: 2; }

/* ---- title screen: server card and loading strip ---------------------- */
.hx-title-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.hx-server-card { width: 30rem; display: flex; flex-direction: column; gap: 1rem; }
.hx-server-card__head { display: flex; flex-direction: column; gap: 0.25rem; }
.hx-server-card__head .hx-title { text-align: left; }
.hx-server-card__foot { display: flex; justify-content: center; min-height: 1.5rem; }
.hx-servers { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.hx-server {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "dot name go" "dot ping go";
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.625rem 0.625rem 0.625rem 0.875rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: rgb(255 255 255 / 0.03);
}
.hx-server__dot { grid-area: dot; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--hx-text-dim); }
.hx-server[data-quality="good"] .hx-server__dot { background: rgb(144 226 122); }
.hx-server[data-quality="fair"] .hx-server__dot { background: rgb(245 199 85); }
.hx-server[data-quality="poor"] .hx-server__dot { background: rgb(242 112 104); }
.hx-server[data-quality="offline"] .hx-server__dot { background: transparent; border: 2px solid rgb(115 125 133); }
.hx-server[data-quality="pending"] .hx-server__dot { animation: hx-pulse 1s ease-in-out infinite alternate; }
.hx-server[data-quality="disabled"] .hx-server__dot { background: transparent; border: 2px dashed rgb(115 125 133); }
.hx-server[data-quality="disabled"] .hx-server__name { grid-row: 1 / 3; }
.hx-server__name { grid-area: name; font-size: 1rem; font-weight: 700; }
.hx-server__ping { grid-area: ping; color: var(--hx-text-dim); font-size: 0.8125rem; font-variant-numeric: tabular-nums; cursor: help; }
.hx-server__go { grid-area: go; min-height: 2.5rem; min-width: 8.5rem; }
.hx-btn:disabled { cursor: default; color: rgb(115 125 133); background: rgb(34 42 49 / 0.55); border-color: transparent; transform: none; }
.hx-server[data-state="disabled"], .hx-server[data-state="offline"] { opacity: 0.75; }
.hx-detail-inline { color: var(--hx-text-dim); font-size: 0.8125rem; overflow-wrap: anywhere; }
.hx-spinner-text::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.5rem;
  vertical-align: -0.0625rem;
  border: 2px solid var(--hx-stroke-strong);
  border-top-color: var(--hx-gold);
  border-radius: 50%;
  animation: hx-spin 0.8s linear infinite;
}

/* The bottom strip over the island art, as the UI Toolkit screen had it. */
.hx-loading {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding: 3rem 1.75rem 1.75rem;
  background: linear-gradient(to top, rgb(0 0 0 / 0.72), rgb(0 0 0 / 0.45) 60%, transparent);
}
.hx-loading__row { width: min(60%, 46rem); display: flex; justify-content: space-between; gap: 1rem; }
.hx-loading__status { color: rgb(236 232 221); font-size: 0.9375rem; letter-spacing: 0.04em; }
.hx-loading__percent { color: var(--hx-gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.hx-loading__bar { width: min(60%, 46rem); height: 0.5rem; border-radius: 999px; background: rgb(255 255 255 / 0.15); overflow: hidden; }
.hx-loading__bar i { display: block; height: 100%; border-radius: inherit; background: rgb(242 191 89); transition: width 240ms ease-out; }
.hx-steps { display: flex; gap: 1.25rem; margin: 0.125rem 0 0; padding: 0; list-style: none; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.hx-steps li { display: flex; align-items: center; gap: 0.375rem; color: rgb(140 150 156); }
.hx-steps li::before { content: ""; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; border: 1.5px solid currentColor; }
.hx-steps li[data-state="done"] { color: var(--hx-leaf); }
.hx-steps li[data-state="done"]::before { background: currentColor; }
.hx-steps li[data-state="now"] { color: var(--hx-gold); font-weight: 700; }
.hx-steps li[data-state="now"]::before { background: currentColor; animation: hx-pulse 0.9s ease-in-out infinite alternate; }

/* ---- character creator ------------------------------------------------- */
/* Nothing paints the whole screen: the preview hole paints everything around
   itself with a spread shadow and stays transparent inside, where Unity draws
   the 3D character. Header and panel sit above that shadow. */
.hx-creator {
  position: absolute;
  inset: 0;
  container-type: size;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
  overflow: hidden;
}
.hx-creator__head { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.hx-creator__head .hx-title { text-align: left; font-size: 1.75rem; }
.hx-eyebrow { margin: 0 0 0.25rem; color: var(--hx-gold); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.hx-title--left { text-align: left; }
.hx-creator__body { flex: 1; min-height: 0; display: flex; gap: 1rem; }

.hx-stage { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hx-stage__hole {
  flex: 1;
  border-radius: var(--hx-radius);
  outline: 1px solid var(--hx-stroke);
  box-shadow: 0 0 0 200vmax rgb(12 17 20);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.hx-stage__hole:active { cursor: grabbing; }
.hx-stage__state { margin: 0; padding: 0.5rem 0.875rem; border-radius: 999px; background: rgb(0 0 0 / 0.55); color: var(--hx-text-dim); font-size: 0.8125rem; }
.hx-stage__tools {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: rgb(19 24 28 / 0.85);
  border: 1px solid var(--hx-stroke);
}
.hx-stage__tools .hx-seg { font-weight: 600; }
.hx-stage__hint { position: absolute; bottom: 0.625rem; left: 0; right: 0; margin: 0; text-align: center; color: var(--hx-text-dim); font-size: 0.75rem; pointer-events: none; }
.hx-eyes {
  position: absolute;
  bottom: 2.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 999px;
  background: rgb(19 24 28 / 0.85);
  border: 1px solid var(--hx-stroke);
}
.hx-eyes__title { margin-right: 0.25rem; color: var(--hx-text-dim); font-size: 0.75rem; white-space: nowrap; }
.hx-eye {
  width: 1.75rem;
  height: 1.25rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 50% / 60%;
  background: rgb(240 236 228);
  cursor: pointer;
}
.hx-eye i { width: 0.8125rem; height: 0.8125rem; border-radius: 50%; box-shadow: inset 0 0 0 0.1875rem rgb(0 0 0 / 0.0), 0 0 0 1px rgb(0 0 0 / 0.35); position: relative; }
.hx-eye i::after { content: ""; position: absolute; inset: 0.25rem; border-radius: 50%; background: rgb(10 10 10); }
.hx-eye[aria-pressed="true"] { border-color: var(--hx-gold); }

.hx-panel {
  position: relative;
  z-index: 1;
  width: 27rem;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: rgb(22 29 33);
  min-height: 0;
}
.hx-panel__scroll { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.875rem; padding-right: 0.25rem; }
.hx-panel__foot { display: flex; align-items: center; gap: 0.625rem; padding-top: 0.75rem; border-top: 1px solid var(--hx-stroke); }
.hx-panel__foot .hx-btn--primary { min-width: 10rem; }
.hx-panel__summary { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hx-panel__summary b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-warn { color: rgb(240 191 133); font-size: 0.75rem; }

.hx-field { display: flex; flex-direction: column; gap: 0.3125rem; }
.hx-field__label { font-size: 0.8125rem; font-weight: 700; }
.hx-field input {
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: var(--hx-radius-small);
  background: rgb(11 16 19);
  color: var(--hx-text);
  font: inherit;
  font-size: 1rem;
  user-select: text;
  -webkit-user-select: text;
}
.hx-field input:focus { border-color: var(--hx-gold); outline: none; }
.hx-field input[aria-invalid="true"] { border-color: rgb(242 115 89 / 0.7); }
.hx-field__hint { color: var(--hx-text-dim); font-size: 0.75rem; }
.hx-field__error { color: var(--hx-warm-red); font-size: 0.75rem; }

.hx-steps-tabs { display: flex; gap: 0.25rem; margin: 0; padding: 0.25rem; list-style: none; border-radius: 0.75rem; background: rgb(11 16 19); }
.hx-steps-tabs li { flex: 1; }
.hx-steps-tabs button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  height: 2.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--hx-text-dim);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}
.hx-steps-tabs b {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--hx-raised);
  font-size: 0.6875rem;
}
.hx-steps-tabs button[aria-selected="true"] { background: var(--hx-raised); color: var(--hx-text); }
.hx-steps-tabs button[aria-selected="true"] b { background: var(--hx-gold); color: var(--hx-ink); }

.hx-seg-row { display: flex; gap: 0.5rem; }
.hx-creator-voices { flex-wrap: wrap; }
.hx-creator-voices .hx-choice { flex: 1 0 6rem; }
.hx-choice {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: var(--hx-raised);
  font-weight: 700;
  cursor: pointer;
}
.hx-choice[aria-pressed="true"], .hx-tile[aria-pressed="true"], .hx-camp[aria-pressed="true"] {
  border-color: var(--hx-gold);
  background: rgb(240 180 92 / 0.12);
}
.hx-subtabs { display: flex; gap: 1rem; border-bottom: 1px solid var(--hx-stroke); }
.hx-subtabs button {
  padding: 0.375rem 0 0.5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--hx-text-dim);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}
.hx-subtabs button[aria-selected="true"] { color: var(--hx-text); border-bottom-color: var(--hx-gold); }

.hx-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.75rem, 1fr)); gap: 0.5rem; }
.hx-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: 0.5rem; }
.hx-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.375rem 0.25rem 0.4375rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: rgb(255 255 255 / 0.03);
  cursor: pointer;
}
.hx-tile:hover { border-color: var(--hx-stroke-strong); }
.hx-tile__img { width: 100%; aspect-ratio: 1; border-radius: 0.5rem; overflow: hidden; background: rgb(9 12 14); display: grid; place-items: center; }
.hx-tile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hx-tile__wait { width: 1rem; height: 1rem; border: 2px solid var(--hx-stroke-strong); border-top-color: var(--hx-gold); border-radius: 50%; animation: hx-spin 0.8s linear infinite; }
.hx-tile__swatch { width: 2.5rem; height: 2.5rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18), 0 1px 3px rgb(0 0 0 / 0.4); }
.hx-tile__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }
.hx-stepper { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.25rem; border-radius: var(--hx-radius-small); background: rgb(11 16 19); font-weight: 700; }

.hx-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.hx-budget { color: var(--hx-text-dim); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.hx-budget--over { color: var(--hx-warm-red); font-weight: 700; }
.hx-points { display: grid; grid-template-columns: minmax(0, 1fr) auto 1.25rem; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.hx-points > span { cursor: help; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-points b { text-align: right; font-variant-numeric: tabular-nums; }
.hx-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.375rem; }
.hx-pair__sep { width: 0.625rem; height: 1px; background: var(--hx-stroke-strong); }
.hx-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.hx-chip {
  min-height: 2.125rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 999px;
  background: var(--hx-raised);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.hx-chip[aria-pressed="true"] { border-color: var(--hx-leaf); background: rgb(193 219 141 / 0.16); color: var(--hx-leaf); }

.hx-camps { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.5rem; }
.hx-camp {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius-small);
  background: rgb(255 255 255 / 0.03);
  text-align: left;
  cursor: pointer;
}
.hx-camp span { color: var(--hx-leaf); font-size: 0.75rem; }
.hx-camp .hx-camp__people { color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-camp__bar { align-self: stretch; height: 0.25rem; margin: 0.25rem 0 0.125rem; border-radius: 999px; background: var(--hx-raised); overflow: hidden; }
.hx-camp__bar i { display: block; height: 100%; border-radius: inherit; background: var(--hx-leaf); }
.hx-camp:disabled .hx-camp__bar i { background: rgb(115 125 133); }
.hx-camp:disabled { cursor: default; opacity: 0.5; }
.hx-camp:disabled span { color: var(--hx-text-dim); }

/* A narrow GAME AREA (not browser window): the panel goes under a shorter
   stage. Pixels, because rem inside a query is the browser's default 16 px. */
@container (max-width: 760px) {
  .hx-creator__body { flex-direction: column; overflow: auto; }
  .hx-stage { flex: none; height: 20rem; }
  .hx-panel { width: auto; flex: none; }
}

/* ---- ring meter ------------------------------------------------------- */
.hx-ring {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--ring) var(--ring-v), rgb(255 255 255 / 0.1) 0);
}
.hx-ring__inner {
  position: absolute;
  inset: var(--ring-w);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(15 20 24);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.hx-face { display: block; border-radius: 50%; object-fit: cover; }
.hx-face--initial { display: grid; place-items: center; background: rgb(46 56 65); color: var(--hx-text); font-weight: 700; }
.hx-star { color: var(--hx-gold); }
.hx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- roster (right) --------------------------------------------------- */
.hx-roster {
  position: absolute;
  top: 4.25rem;
  right: 0.75rem;
  width: 14.5rem;
  max-height: calc(100% - 22rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.375rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.875rem;
  background: rgb(19 24 28 / 0.9);
}
.hx-roster__head {
  margin: 0;
  padding: 0.25rem 0.5rem;
  border: 0;
  background: none;
  color: var(--hx-text-dim);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
.hx-roster__head:hover { color: var(--hx-text); }
.hx-roster__head--plain { cursor: default; }
.hx-roster__list { display: flex; flex-direction: column; gap: 0.125rem; margin: 0; padding: 0; list-style: none; }
.hx-roster__card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.375rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.hx-roster__card:hover { background: rgb(255 255 255 / 0.05); }
.hx-roster__card.is-selected { border-color: rgb(240 180 92 / 0.6); background: rgb(240 180 92 / 0.08); }
.hx-roster__card.is-fighting { animation: hx-fight 0.9s ease-in-out infinite alternate; }
.hx-roster__text { min-width: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.hx-roster__text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; }
.hx-roster__status { display: inline-flex; align-items: center; gap: 0.3125rem; color: var(--hx-text-dim); font-size: 0.75rem; white-space: nowrap; }
.hx-roster__status i { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: currentColor; }
.hx-roster__status[data-tone="ok"] i { background: var(--hx-leaf); }
.hx-roster__status[data-tone="warn"] i { background: var(--hx-gold); }
.hx-roster__status[data-tone="danger"] { color: rgb(242 140 120); }
.hx-roster__status[data-tone="danger"] i { background: rgb(232 80 70); }
.hx-roster__relations { display: flex; gap: 0.25rem; flex: none; }
.hx-roster__relation { display: grid; gap: 0.125rem; min-width: 1.38rem; color: var(--hx-leaf); font-size: 0.57rem; white-space: nowrap; }
.hx-roster__relation[data-tone="negative"] { color: rgb(242 140 120); }
.hx-roster__relation[data-tone="familiarity"] { color: rgb(120 170 230); }
.hx-roster__relation[data-tone="trust"] { color: var(--hx-gold); }
.hx-roster__relation > i { height: 2px; border-radius: 2px; background: linear-gradient(to right, currentColor var(--relation-fill), rgb(255 255 255 / 0.12) var(--relation-fill)); }

/* ---- bottom character card -------------------------------------------- */
.hx-bottom { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.hx-character-overlays { display: flex; align-items: flex-end; gap: 0.5rem; }
.hx-pills { align-self: flex-start; display: flex; flex-direction: column; gap: 0.375rem; max-width: 70%; }
.hx-pills__row { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.hx-pill-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 999px;
  background: rgb(19 24 28 / 0.92);
  font-size: 0.875rem;
}
.hx-pill-note--dream { color: rgb(214 196 255); }
.hx-pill-note--directive { color: var(--hx-gold); }
.hx-effects { display: flex; flex-wrap: wrap; gap: 0.3125rem; margin: 0; padding: 0; list-style: none; }
.hx-effects li {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(19 24 28 / 0.92);
  box-shadow: inset 0 0 0 2px var(--fx);
  font-size: 1.0625rem;
  cursor: help;
}
.hx-effects li.is-buff { --fx: var(--hx-leaf); }
/* a debuff shades amber (mild) → red (severe), as EffectRing did */
.hx-effects li.is-debuff { --fx: color-mix(in srgb, rgb(232 87 79) calc(var(--sev, 1) * 100%), rgb(232 178 60)); }

.hx-card {
  position: relative;
  display: grid;
  grid-template-columns: 21rem minmax(0, 1fr) minmax(0, 24rem);
  gap: 0.5rem;
  height: 15.5rem;
}
.hx-card > .hx-sheet, .hx-card > .hx-rel {
  min-width: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: rgb(19 24 28 / 0.95);
  overflow: auto;
}
.hx-card__collapse {
  position: absolute;
  top: 0.375rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.5rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--hx-text-dim);
  font-size: 0.6875rem;
  cursor: pointer;
}
.hx-card__collapse:hover { background: var(--hx-raised); color: var(--hx-text); }
.hx-expand {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  padding: 0.375rem 1rem;
  border: 1px solid var(--hx-stroke);
  border-bottom: 0;
  border-radius: 0.625rem 0.625rem 0 0;
  background: rgb(19 24 28 / 0.95);
  font-weight: 700;
  cursor: pointer;
}

/* Identity: the portrait is a hole — Unity draws the live camera there. */
.hx-id { position: relative; border-radius: var(--hx-radius); outline: 1px solid var(--hx-stroke); overflow: hidden; }
.hx-id__portrait { position: absolute; inset: 0; }
.hx-id__top { position: absolute; top: 0.5rem; left: 0.5rem; right: 4rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; }
.hx-id__name { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 0.25rem 0.5rem; border: 0; border-radius: 0.5rem; background: rgb(0 0 0 / 0.45); color: inherit; text-align: left; cursor: copy; }
.hx-id__name:hover { background: rgb(0 0 0 / 0.6); }
.hx-id__copied { position: absolute; z-index: 3; left: 0.5rem; top: 100%; margin-top: 0.25rem; padding: 0.0625rem 0.375rem; border-radius: 0.375rem; background: var(--hx-leaf); color: var(--hx-ink); font-size: 0.6875rem; font-weight: 700; white-space: nowrap; animation: hx-id-copied 140ms ease-out; }
@keyframes hx-id-copied { from { opacity: 0; transform: translateY(-0.25rem); } }
.hx-id__name b { font-size: 1.125rem; }
.hx-id__nameline { display: flex; align-items: center; gap: 0.375rem; max-width: 100%; }
.hx-id__race { flex: none; width: 1.375rem; height: 1.375rem; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6)); }
.hx-id__badge { position: absolute; left: 0.5rem; top: 6.5rem; padding: 0.1875rem 0.5rem; border-radius: 0.375rem; background: rgb(191 51 46); font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.06em; }
.hx-id__side { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; flex-direction: column; gap: 0.375rem; }
.hx-id__btn {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.75rem;
  background: rgb(19 24 28 / 0.85);
  cursor: pointer;
}
.hx-id__btn .hx-icon { width: 1.25rem; height: 1.25rem; }
.hx-id__btn span { font-size: 0.5625rem; color: var(--hx-text-dim); }
.hx-id__btn:hover { background: var(--hx-hover); }
.hx-dot-count { position: absolute; top: -0.3125rem; right: -0.3125rem; min-width: 1.125rem; height: 1.125rem; padding: 0 0.25rem; border-radius: 999px; background: var(--hx-gold); color: var(--hx-ink); font-size: 0.6875rem; line-height: 1.125rem; }
.hx-id__bottom { position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; display: flex; align-items: flex-end; gap: 0.375rem; }
.hx-toggle { display: inline-flex; padding: 0.1875rem; border-radius: 0.625rem; background: rgb(19 24 28 / 0.9); border: 1px solid var(--hx-stroke); }
.hx-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  height: 1.875rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 0.4375rem;
  background: transparent;
  color: var(--hx-text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.hx-toggle button .hx-icon { width: 1rem; height: 1rem; }
.hx-toggle button[aria-pressed="true"] { background: var(--hx-gold); color: var(--hx-ink); }
.hx-toggle button:disabled { cursor: default; }
.hx-btn--tiny { min-height: 2.25rem; padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.hx-vitals { margin-left: auto; display: flex; align-items: flex-end; gap: 0.5rem; }
.hx-vitals__text { display: flex; flex-direction: column; align-items: flex-end; gap: 0.125rem; padding: 0.25rem 0.5rem; border-radius: 0.5rem; background: rgb(0 0 0 / 0.45); font-size: 0.75rem; }
.hx-vitals__text .hx-muted { font-size: 0.6875rem; }
.hx-vitals__hp { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.hx-vitals__hp b { font-size: 1.125rem; }
/* The heart above the number, one-to-one with the relation rings (player's request 18.10.2026);
   only scaled to this bigger ring. */
.hx-hp.hx-rel__value i { font-size: 0.875rem; margin-bottom: 0.125rem; }
.hx-hp.hx-rel__value b { font-size: 1rem; }

.hx-sheet { display: flex; flex-direction: column; gap: 0.625rem; }
.hx-needs { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.5rem 0.875rem; margin: 0; padding: 0; list-style: none; }
.hx-needs li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.25rem 0.5rem; font-size: 0.75rem; }
.hx-needs__label { display: flex; align-items: center; gap: 0.375rem; min-width: 0; color: var(--hx-text-dim); }
.hx-needs__icon { flex: none; display: grid; place-items: center; width: 1.125rem; height: 1.125rem; }
.hx-needs__icon svg { width: 100%; height: 100%; }
.hx-needs__value { color: var(--hx-text-dim); font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hx-needs__value [data-tone="cold"] { color: rgb(71 182 230); }
.hx-needs__value [data-tone="hot"] { color: rgb(232 116 107); }
.hx-needs__increase { display: inline-block; margin-right: 0.25rem; color: #a5d974; visibility: hidden; }
.hx-needs__increase[data-active="true"] { visibility: visible; animation: hx-need-increase 800ms ease-in-out infinite alternate; }
@keyframes hx-need-increase { from { opacity: 0.65; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hx-needs__increase[data-active="true"] { animation: none; } }
.hx-bar { grid-column: 1 / -1; position: relative; height: 0.4375rem; border-radius: 999px; background: var(--hx-raised); overflow: hidden; }
.hx-bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: inherit; }
.hx-bar--bipolar::after { content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: var(--hx-stroke-strong); }
.hx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.375rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.hx-stats li { display: grid; grid-template-columns: minmax(0, 1fr) auto 1rem; align-items: center; gap: 0.5rem; font-size: 0.8125rem; cursor: help; }
.hx-stats b { text-align: right; font-variant-numeric: tabular-nums; }
.hx-traits--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.625rem 1rem; }

.hx-rel { display: flex; flex-direction: column; gap: 0.5rem; }
.hx-order-row { display: flex; flex: 0 1 auto; gap: 0.3125rem; margin-inline-start: auto; max-width: 50%; min-width: 0; overflow-x: auto; pointer-events: auto; }
.hx-order-chip {
  display: grid;
  place-items: center;
  flex: 0 0 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--hx-stroke);
  border-radius: 50%;
  background: rgb(19 24 28 / 0.92);
  color: var(--hx-text-dim);
}
.hx-order-chip[data-active="true"] { color: var(--hx-leaf); border-color: currentColor; }
.hx-order-chip .hx-icon { width: 1.125rem; height: 1.125rem; }
.hx-order-chip__action, .hx-order-chip__cancel { display: grid; place-items: center; }
.hx-order-chip__cancel { display: none; }
.hx-order-chip:is(:hover, :focus-visible) .hx-order-chip__cancel { display: grid; }
.hx-order-chip:is(:hover, :focus-visible) .hx-order-chip__action { display: none; }
/* §121.13: the action glyph is a white PNG used as a mask, so it takes the chip colour */
.hx-order-glyph { display: block; width: 1.375rem; height: 1.375rem; background: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.hx-tip__icon .hx-order-glyph { width: 1.125rem; height: 1.125rem; }
.hx-order-chip[draggable="true"] { cursor: grab; }
.hx-order-chip[data-dragging="true"] { opacity: 0.5; }
.hx-order-chip[data-drop="before"] { box-shadow: -0.25rem 0 0 -0.0625rem var(--hx-leaf); }
.hx-order-chip[data-drop="after"] { box-shadow: 0.25rem 0 0 -0.0625rem var(--hx-leaf); }
.hx-rel__faces { display: flex; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.125rem; }
.hx-rel__faces button {
  flex: none;
  width: 3.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1875rem;
  padding: 0.3125rem 0.125rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  background: transparent;
  cursor: pointer;
}
.hx-rel__faces button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.6875rem; color: var(--hx-text-dim); }
.hx-rel__faces button[aria-selected="true"] { border-color: rgb(240 180 92 / 0.6); background: rgb(240 180 92 / 0.08); }
.hx-rel__faces button[aria-selected="true"] span { color: var(--hx-text); }
.hx-rel__focus { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: var(--hx-radius-small); background: rgb(255 255 255 / 0.03); }
.hx-rel__who { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.hx-rel__who span { font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-rel__who span[data-tone="good"] { color: var(--hx-leaf); }
.hx-rel__who span[data-tone="warn"] { color: var(--hx-gold); }
.hx-rel__who span[data-tone="bad"] { color: rgb(242 112 104); }
.hx-rel__rings { display: flex; justify-content: space-around; gap: 0.5rem; }
.hx-rel__rings figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.hx-rel__rings b { font-size: 0.8125rem; }
/* The ring's own icon above its number: what kind of bond this is. */
.hx-rel__value { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.hx-rel__value i { font-style: normal; font-size: 0.6875rem; margin-bottom: 0.0625rem; }
.hx-rel__value b { font-size: 0.75rem; }
.hx-rel__rings figcaption { font-size: 0.6875rem; color: var(--hx-text-dim); }

.hx-card--group { grid-template-columns: 16rem minmax(0, 1fr) 16rem; height: 9rem; padding: 0.75rem; border: 1px solid var(--hx-stroke); border-radius: var(--hx-radius); background: rgb(19 24 28 / 0.95); position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; }
.hx-group__sum { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; }
.hx-group__faces { display: flex; align-items: center; gap: 0.375rem; overflow-x: auto; }
.hx-group__faces button { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.hx-group__cmd { display: flex; flex-direction: column; gap: 0.375rem; }
.hx-group__cmd .hx-muted { font-size: 0.75rem; }

/* ---- backpack window ---------------------------------------------------- */
.hx-inv-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.hx-inv-catch { position: absolute; inset: 0; } /* click outside closes; the dim is the window's shadow */
.hx-inv {
  position: relative;
  container-type: inline-size;
  width: min(60rem, 100%);
  height: min(44rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: rgb(19 24 28 / 0.98);
  box-shadow: 0 0 0 200vmax rgb(0 0 0 / 0.5), var(--hx-shadow);
  animation: hx-rise 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
  isolation: isolate;
  overflow: hidden;
}
/* While the doll shows, the window's fill is painted by the doll hole's own
   shadow, so the hole stays clear for Unity; everything else sits above it. */
.hx-inv.has-hole { background: transparent; }
.hx-inv > *, .hx-inv__body > *, .hx-inv__doll > .hx-inv__layers { position: relative; z-index: 1; }
.hx-inv > .hx-inv__head, .hx-inv > .hx-subtabs { z-index: 2; } /* above the body's hole shadow */
.hx-inv__doll, .hx-inv__right { z-index: auto !important; }
.hx-inv__head { display: flex; align-items: center; gap: 0.875rem; }
.hx-inv__head .hx-title { margin-right: auto; text-align: left; font-size: 1.25rem; }
.hx-inv__cap { color: var(--hx-text-dim); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.hx-inv__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 0.875rem; }
.hx-inv__left { min-height: 0; display: flex; flex-direction: column; gap: 0.625rem; overflow: auto; }
.hx-slots { min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); grid-auto-rows: 4.75rem; gap: 0.375rem; margin: 0; padding: 0.125rem; list-style: none; align-content: start; }
.hx-slot { position: relative; }
.hx-slot button {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0.375rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(255 255 255 / 0.04);
  cursor: grab;
}
.hx-slot button:hover { border-color: var(--hx-stroke-strong); background: rgb(255 255 255 / 0.07); }
/* The picture is boxed explicitly: `max-height: 100%` of a content-sized grid
   row does not constrain it in every browser, and a 128 px game icon then
   spilled out of its square (WebGL build, 18.10.2026). */
.hx-slot button img, .hx-slot button .hx-pic-emoji {
  position: absolute;
  inset: 0.375rem;
  width: calc(100% - 0.75rem);
  height: calc(100% - 0.75rem);
  object-fit: contain;
  pointer-events: none;
}
.hx-slot button .hx-pic-emoji { display: grid; place-items: center; font-size: 1.75rem; }
.hx-slot.is-selected button { border-color: var(--hx-gold); background: rgb(240 180 92 / 0.1); }
.hx-slot.is-overflow button { border-color: rgb(240 150 70); }
.hx-slot--empty { border: 1px dashed rgb(255 255 255 / 0.08); border-radius: 0.625rem; }
.hx-slot__name { font-size: 0.6875rem; text-align: center; }
.hx-slot__count { position: absolute; right: 0.25rem; bottom: 0.125rem; font-size: 0.75rem; text-shadow: 0 1px 2px #000; }
.hx-slot__fav { position: absolute; left: 0.3125rem; top: 0.125rem; color: var(--hx-gold); font-size: 0.75rem; }
.hx-slot__tag { position: absolute; left: 0.25rem; bottom: 0.25rem; padding: 0 0.25rem; border-radius: 0.25rem; background: rgb(240 180 92); color: var(--hx-ink); font-size: 0.5625rem; font-weight: 800; letter-spacing: 0.04em; }
.hx-slot__tag--worn { background: var(--hx-leaf); }
.hx-inv__right { min-height: 0; display: flex; flex-direction: column; }
.hx-inv__doll { position: relative; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.hx-inv__layers { align-self: center; flex-wrap: wrap; justify-content: center; }
.hx-inv__hole {
  position: relative;
  z-index: 0;
  flex: 1;
  border-radius: 0.75rem;
  outline: 1px solid var(--hx-stroke);
  box-shadow: 0 0 0 200vmax rgb(19 24 28 / 0.98);
  cursor: grab;
  touch-action: none;
}
.hx-inv__detail { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.625rem; padding: 0.75rem; border: 1px solid var(--hx-stroke); border-radius: 0.75rem; background: rgb(255 255 255 / 0.03); }
.hx-inv__detail-head { display: flex; align-items: center; gap: 0.75rem; }
.hx-inv__detail-head img { width: 3.5rem; height: 3.5rem; object-fit: contain; }
.hx-inv__detail-head h3 { margin: 0; font-size: 1.0625rem; }
.hx-link-back { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--hx-text-dim); font-size: 0.8125rem; cursor: pointer; }
.hx-link-back:hover { color: var(--hx-text); }
.hx-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.875rem; margin: 0; font-size: 0.8125rem; }
.hx-kv dt { color: var(--hx-text-dim); }
.hx-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hx-item-stats { margin: 0; font-size: 0.8125rem; }
.hx-item-stat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0.375rem 0.875rem; padding: 0.5rem 0; border-top: 1px solid var(--hx-stroke); }
.hx-item-stat dt { color: var(--hx-text-dim); }
.hx-item-stat dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hx-item-stat .hx-item-stat__meter { grid-column: 1 / -1; height: 0.625rem; border-radius: 999px; background: var(--hx-raised); overflow: hidden; }
.hx-item-stat__meter i { display: block; height: 100%; border-radius: inherit; }
.hx-actions--left { justify-content: flex-start; }
.hx-actions--left .hx-btn { min-width: 0; }
.hx-qty { display: grid; grid-template-columns: auto 1fr auto 2.5rem; align-items: center; gap: 0.5rem; margin: 0.75rem 0; }
.hx-qty b { text-align: right; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.hx-qty input[type="range"] { --fill: 0%; appearance: none; -webkit-appearance: none; height: 1.25rem; background: transparent; }
.hx-qty input[type="range"]::-webkit-slider-runnable-track { height: 0.375rem; border-radius: 999px; background: linear-gradient(to right, var(--hx-gold) var(--fill), var(--hx-raised) var(--fill)); }
.hx-qty input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 1rem; height: 1rem; margin-top: -0.3125rem; border-radius: 50%; background: var(--hx-text); border: 2px solid var(--hx-ink); }
.hx-qty input[type="range"]::-moz-range-track { height: 0.375rem; border-radius: 999px; background: linear-gradient(to right, var(--hx-gold) var(--fill), var(--hx-raised) var(--fill)); }

.hx-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); gap: 0.375rem; margin: 0; padding: 0; list-style: none; }
.hx-recipe {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(255 255 255 / 0.04);
  font-size: 0.75rem;
  cursor: pointer;
}
.hx-recipe img { width: 3rem; height: 3rem; object-fit: contain; }
.hx-recipe span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-recipe.is-selected { border-color: var(--hx-gold); background: rgb(240 180 92 / 0.1); }
.hx-recipe .hx-slot__tag { top: 0.25rem; right: 0.25rem; bottom: auto; left: auto; }
/* §138.7: how many more she will make */
.hx-recipe__queue { position: absolute; top: 0.25rem; left: 0.25rem; min-width: 1.5rem; padding: 0 0.3125rem; border-radius: 999px; background: var(--hx-leaf); color: var(--hx-ink); font-size: 0.6875rem; line-height: 1.125rem; }
.hx-craft-go { align-items: center; }
.hx-queue { padding: 0.25rem 0.625rem; border-radius: 999px; background: rgb(193 219 141 / 0.16); color: var(--hx-leaf); font-size: 0.8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hx-ingredients { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.hx-ingredients li { display: grid; grid-template-columns: 1.75rem 1fr auto 1rem; align-items: center; gap: 0.5rem; }
.hx-ingredients img { width: 1.75rem; height: 1.75rem; object-fit: contain; }
/* The emoji stand-in keeps the icon's box, so a late icon does not shift the row. */
.hx-pic-emoji { display: grid; place-items: center; line-height: 1; font-size: 1.75rem; }
.hx-inv__detail-head .hx-pic-emoji { width: 3.5rem; height: 3.5rem; font-size: 2.5rem; }
.hx-recipe .hx-pic-emoji { width: 3rem; height: 3rem; font-size: 2rem; }
.hx-ingredients .hx-pic-emoji { width: 1.75rem; height: 1.75rem; font-size: 1.25rem; }
.hx-ingredients b { font-variant-numeric: tabular-nums; }
.hx-ingredients .is-ok > span:last-child { color: var(--hx-leaf); }
.hx-ingredients .is-missing { color: rgb(242 140 120); }

@container (max-width: 560px) { .hx-inv__body { grid-template-columns: minmax(0, 1fr); } }

@keyframes hx-fight { from { background: rgb(191 51 46 / 0.08); } to { background: rgb(191 51 46 / 0.28); } }

@keyframes hx-pulse { from { opacity: 0.35; } }
@keyframes hx-spin { to { transform: rotate(360deg); } }

@keyframes hx-fade { from { opacity: 0; } }
@keyframes hx-rise { from { opacity: 0; transform: translateY(0.5rem) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
  .hx-backdrop, .hx-window { animation: none; }
  .hx-btn, .hx-disclosure__chevron, .hx-loading__bar i { transition: none; }
  .hx-server__dot, .hx-steps li::before, .hx-spinner-text::before { animation: none; }
  .hx-roster__card.is-fighting { animation: none; background: rgb(191 51 46 / 0.2); }
}

/* ---- health (§57) -------------------------------------------------------- */
/* The backpack's hole window, narrower: the doll on the left, zones on the right. */
.hx-inv.hx-health { width: min(54rem, 100%); height: min(42rem, 100%); }
.hx-health__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 0.875rem; }
.hx-health__body > * { position: relative; z-index: 1; }
.hx-health__body > .hx-health__doll { z-index: auto; display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
.hx-health__doll > :not(.hx-inv__hole) { position: relative; z-index: 1; }
.hx-health__note { text-align: center; font-size: 0.75rem; }
.hx-health__legend { display: flex; align-items: center; gap: 0.375rem; font-size: 0.6875rem; color: var(--hx-text-dim); }
.hx-health__legend i { flex: 1; height: 0.375rem; border-radius: 999px; background: linear-gradient(90deg, rgb(92 184 84), rgb(232 178 60), rgb(232 87 79)); }
.hx-health__legend b { width: 0.625rem; height: 0.625rem; margin-left: 0.5rem; border-radius: 50%; }
.hx-zones { margin: 0; padding: 0; list-style: none; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.375rem; }
.hx-zone {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  align-content: center;
  gap: 0.3125rem 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(255 255 255 / 0.03);
}
.hx-zone__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.hx-zone__name { font-size: 0.9375rem; font-weight: 600; }
.hx-zone__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.hx-zone__value small { color: var(--hx-warm-red); font-weight: 600; font-size: 0.8125rem; }
.hx-zone__trauma { background: repeating-linear-gradient(135deg, var(--hx-danger) 0 0.1875rem, rgb(191 51 46 / 0.35) 0.1875rem 0.375rem) !important; border-radius: 0 !important; }
.hx-zone__chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-zone__chip { padding: 0.0625rem 0.4375rem; border-radius: 999px; background: var(--hx-raised); color: var(--hx-text); }
.hx-zone__chip.is-alarm { background: rgb(191 51 46 / 0.25); color: var(--hx-warm-red); }
.hx-zone__chip.is-armor { color: var(--hx-text-dim); }
.hx-zone__damage { margin-left: auto; font-variant-numeric: tabular-nums; }
.hx-zone.is-critical { border-color: rgb(191 51 46 / 0.45); }
.hx-zone.is-severed { background: rgb(61 43 43 / 0.45); }
.hx-zone.is-severed .hx-zone__value { color: var(--hx-warm-red); font-weight: 600; }
@container (max-width: 40rem) {
  .hx-health__body { grid-template-columns: 11rem minmax(0, 1fr); }
  .hx-health__legend span { display: none; }
}

/* ---- journal (§136) ------------------------------------------------------ */
/* Paper and ink, on purpose foreign to the dark glass around it: the one
   place in the game where somebody writes by hand. Caveat, OFL 1.1. */
@font-face { font-family: "HexHand"; src: url("fonts/caveat.woff2") format("woff2"); font-display: swap; }
.hx-journal {
  --paper: rgb(237 227 207);
  --paper-fold: rgb(214 199 172);
  --paper-edge: rgb(201 183 154);
  --ink: rgb(58 46 34);
  --ink-faint: rgb(122 106 86);
  --ink-alarm: rgb(90 32 24);
  --rule: rgb(90 74 55 / 0.16);
  --margin-line: rgb(190 90 80 / 0.35);
  --line: 2rem;
  position: relative;
  width: min(38rem, calc(100% - 2rem));
  height: min(40rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  border-left: 0.5rem solid var(--paper-edge);
  border-radius: 0.25rem;
  background: var(--paper);
  color: var(--ink);
  /* The folded corner: the page is cut, the fold is drawn into the cut. */
  clip-path: polygon(0 0, calc(100% - 1.75rem) 0, 100% 1.75rem, 100% 100%, 0 100%);
  filter: drop-shadow(0 1.25rem 2rem rgb(0 0 0 / 0.45));
  animation: hx-rise 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.hx-journal::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: linear-gradient(45deg, var(--paper-fold) 50%, transparent 50%);
  pointer-events: none;
}
.hx-journal__head { display: flex; align-items: flex-start; gap: 1rem; padding: 1.125rem 2.25rem 0.375rem 2.5rem; }
.hx-journal__head > div { flex: 1; min-width: 0; }
.hx-journal__title { margin: 0; font-family: "HexHand", var(--hx-font); font-size: 2.125rem; font-weight: 400; line-height: 1.1; }
.hx-journal__subtitle { margin: 0.125rem 0 0; font-size: 0.8125rem; font-style: italic; color: var(--ink-faint); }
.hx-journal__subtitle b { font-style: normal; color: rgb(170 70 60); }
.hx-journal__close { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; margin-top: 0.25rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint); cursor: pointer; }
.hx-journal__close:hover { background: rgb(58 46 34 / 0.08); color: var(--ink); }
.hx-journal__close svg { width: 1.125rem; height: 1.125rem; }
.hx-journal__page {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 1.75rem 2rem 2.5rem;
  /* Ruled lines that scroll with the text, and the red margin line. */
  background:
    linear-gradient(90deg, transparent 1.75rem, var(--margin-line) 1.75rem, var(--margin-line) calc(1.75rem + 1px), transparent calc(1.75rem + 1px)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
  background-attachment: local;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-edge) transparent;
}
.hx-journal__entries { margin: 0; padding: 0; list-style: none; }
.hx-journal__entry { position: relative; padding-bottom: var(--line); }
.hx-journal__entry time { display: block; height: var(--line); padding-top: 0.75rem; font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hx-journal__entry p { margin: 0; font-family: "HexHand", var(--hx-font); font-size: 1.4375rem; line-height: var(--line); }
.hx-journal__entry.is-danger p { color: var(--ink-alarm); font-weight: 700; }
/* Unread: a tick on the margin, not a colour — colour already means tone. */
.hx-journal__entry.is-unread::before { content: ""; position: absolute; left: -1.125rem; top: 2.75rem; width: 0.3125rem; height: 0.3125rem; border-radius: 50%; background: rgb(190 90 80); }
.hx-journal__empty { margin: 4rem 0 0; text-align: center; font-family: "HexHand", var(--hx-font); font-size: 1.75rem; color: var(--ink-faint); }

/* ---- context menu (§121) ------------------------------------------------- */
/* The backdrop consumes the closing press before world input resumes. */
.hx-ctx-layer { position: absolute; inset: 0; pointer-events: auto; }
.hx-ctx {
  position: absolute;
  min-width: 12.5rem;
  max-width: 20rem;
  padding: 0.375rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(19 24 28 / 0.97);
  box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 0.45), 0 0.125rem 0.375rem rgb(0 0 0 / 0.3);
  animation: hx-pop 110ms ease-out;
  outline: none;
}
.hx-ctx--sub { min-width: 11rem; }
.hx-ctx__title {
  padding: 0.3125rem 0.5rem 0.4375rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--hx-stroke);
  color: var(--hx-gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hx-ctx__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.125rem; }
.hx-ctx__row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  min-height: 2rem;
  padding: 0.3125rem 0.5rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--hx-text);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.hx-ctx__row.is-active:not(.is-disabled), .hx-ctx__row.is-open { background: var(--hx-raised); }
.hx-ctx__row.is-danger { color: rgb(232 93 93); }
.hx-ctx__row.is-disabled { color: rgb(102 114 122); cursor: default; }
.hx-ctx__hint { grid-column: 1 / -1; margin-top: 0.0625rem; font-size: 0.6875rem; color: rgb(102 114 122); }
.hx-ctx__chevron { display: grid; color: var(--hx-text-dim); }
.hx-ctx__chevron svg { width: 0.875rem; height: 0.875rem; }
@keyframes hx-pop { from { opacity: 0; transform: scale(0.97); } }

/* ---- exchange / gift (§128, §153) --------------------------------------- */
.hx-loot {
  position: relative;
  container-type: inline-size;
  width: min(64rem, calc(100% - 2rem));
  height: min(40rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: var(--hx-panel);
  box-shadow: var(--hx-shadow);
  animation: hx-rise 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.hx-loot__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr); gap: 0.5rem; }
.hx-loot__gutter { align-self: center; justify-self: center; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--hx-raised); color: var(--hx-gold); font-size: 1rem; }
.hx-loot__pane {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 0.025);
  overflow: hidden;
  transition: border-color 120ms, background-color 120ms;
}
.hx-loot__pane.is-target { border-color: var(--hx-gold); background: rgb(240 180 92 / 0.06); }
.hx-loot__pane.is-refused { border-color: rgb(191 51 46 / 0.6); }
.hx-loot__head { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--hx-stroke); }
.hx-loot__head h3 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-loot__face { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; overflow: hidden; background: var(--hx-raised); font-weight: 700; color: var(--hx-text-dim); }
.hx-loot__face img { width: 100%; height: 100%; object-fit: cover; }
.hx-loot__face--thing { border-radius: 0.5rem; color: var(--hx-gold); }
.hx-loot__face--thing svg { width: 1.25rem; height: 1.25rem; }
.hx-loot__scroll { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.625rem; }
.hx-loot__group { display: flex; flex-direction: column; gap: 0.375rem; padding: 0.5rem; border: 1px solid var(--hx-stroke); border-radius: 0.625rem; background: var(--hx-raised); }
.hx-loot__group.is-overflow { border-color: rgb(240 150 70 / 0.7); }
.hx-loot__group-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.5rem; font-size: 0.8125rem; }
.hx-loot__group-head > b, .hx-loot__group-head > .hx-loot__chip { flex: 1; min-width: 0; }
.hx-loot__slots { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr)); grid-auto-rows: 3.5rem; gap: 0.3125rem; }
.hx-loot__slots .hx-slot button { padding: 0.25rem; }
.hx-loot__badge { position: absolute; left: 0.1875rem; top: 0.1875rem; display: flex; align-items: center; gap: 0.0625rem; padding: 0.0625rem 0.25rem 0.0625rem 0.125rem; border-radius: 999px; background: rgb(0 0 0 / 0.5); font-size: 0.625rem; font-weight: 700; color: var(--hx-text-dim); pointer-events: none; }
.hx-loot__badge svg { width: 0.6875rem; height: 0.6875rem; }
.hx-slot--empty .hx-loot__badge { background: transparent; }
.hx-loot__chips { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.3125rem; }
.hx-loot__chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.125rem;
  padding: 0.1875rem 0.5rem 0.1875rem 0.25rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.04);
  font-size: 0.75rem;
  color: var(--hx-text);
  text-align: left;
  cursor: grab;
}
.hx-loot__chip:hover { border-color: var(--hx-stroke-strong); }
.hx-loot__chip.is-selected { border-color: var(--hx-gold); background: rgb(240 180 92 / 0.1); }
.hx-loot__chip img, .hx-loot__chip .hx-pic-emoji { width: 1.625rem; height: 1.625rem; object-fit: contain; font-size: 1.125rem; flex: none; }
.hx-loot__chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-loot__empty { margin: 2rem 0; text-align: center; }
.hx-loot__info {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
  max-height: 60%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 0.75rem;
  background: rgb(24 30 35 / 0.98);
  box-shadow: 0 -0.5rem 1.5rem rgb(0 0 0 / 0.35);
  animation: hx-rise 140ms ease-out;
}
.hx-loot__info .hx-inv__detail-head .hx-close { margin-left: auto; }
.hx-loot__info .hx-inv__detail-head > div { flex: 1; min-width: 0; }
.hx-loot__status { display: flex; align-items: center; gap: 0.5rem; margin: 0; min-height: 1.75rem; font-size: 0.8125rem; color: var(--hx-text-dim); }
.hx-loot__status.is-busy { color: var(--hx-gold); }
.hx-loot__status.is-error { color: var(--hx-warm-red); }
.hx-loot__status .hx-icon, .hx-loot__status svg { width: 1rem; height: 1rem; flex: none; }
.hx-loot__spin { flex: none; width: 0.875rem; height: 0.875rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: hx-spin 0.8s linear infinite; }
.hx-loot.is-pending .hx-loot__scroll { opacity: 0.6; }
@container (max-width: 42rem) {
  .hx-loot__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); }
  .hx-loot__gutter { transform: rotate(90deg); }
}

/* ---- build tray (§120.7) ------------------------------------------------- */
/* Bottom centre, like the Sims Build/Buy tray; the world above stays the stage. */
.hx-build {
  position: absolute;
  left: 50%;
  bottom: 0.875rem;
  transform: translateX(-50%);
  container-type: inline-size;
  width: min(76rem, calc(100% - 1.75rem));
  height: min(15.5rem, 45%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: rgb(19 24 28 / 0.97);
  box-shadow: var(--hx-shadow);
  animation: hx-tray 180ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes hx-tray { from { opacity: 0; transform: translate(-50%, 1rem); } }
.hx-build__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.hx-build__tools { display: flex; gap: 0.25rem; padding: 0.25rem; border: 1px solid var(--hx-stroke); border-radius: 0.625rem; }
.hx-build__tools .hx-seg { height: 1.875rem; font-size: 0.8125rem; font-weight: 600; }
.hx-build__status { flex: 1; min-width: 12rem; margin: 0; font-size: 0.8125rem; color: var(--hx-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-build__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 10.5rem minmax(0, 1fr) 15rem; gap: 0.75rem; }
.hx-build__cats { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.1875rem; padding-right: 0.5rem; border-right: 1px solid var(--hx-stroke); }
.hx-build__cat { min-height: 2rem; padding: 0 0.75rem; border: 0; border-radius: 0.5rem; background: transparent; color: var(--hx-text-dim); font-size: 0.875rem; text-align: left; cursor: pointer; }
.hx-build__cat:hover { background: var(--hx-raised); color: var(--hx-text); }
.hx-build__cat[aria-pressed="true"] { background: var(--hx-raised); color: var(--hx-gold); font-weight: 700; box-shadow: inset 0.1875rem 0 0 var(--hx-gold); }
.hx-build__catalog { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.hx-build__catalog .hx-section__title { margin: 0; }
.hx-build__cards { flex: 1; min-height: 0; margin: 0; padding: 0 0 0.25rem; list-style: none; display: flex; gap: 0.5rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.hx-build__card {
  width: 8.25rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4375rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: var(--hx-raised);
  color: var(--hx-text);
  text-align: left;
  cursor: pointer;
}
.hx-build__card:hover { background: var(--hx-hover); border-color: var(--hx-stroke-strong); }
.hx-build__card.is-active { border-color: var(--hx-gold); box-shadow: inset 0 0 0 1px var(--hx-gold); }
.hx-build__thumb { flex: 1; min-height: 3rem; display: grid; place-items: center; border-radius: 0.5rem; background: rgb(0 0 0 / 0.22); }
.hx-build__thumb { position: relative; }
.hx-build__thumb img { position: absolute; inset: 0.375rem; width: calc(100% - 0.75rem); height: calc(100% - 0.75rem); object-fit: contain; }
.hx-build__glyph { font-size: 2rem; line-height: 1; color: var(--hx-text-dim); }
.hx-build__card.is-active .hx-build__glyph { color: var(--hx-gold); }
.hx-build__card b { font-size: 0.75rem; line-height: 1.2; }
.hx-build__card small { font-size: 0.6875rem; line-height: 1.25; color: var(--hx-text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hx-build__sel { min-height: 0; display: flex; flex-direction: column; gap: 0.3125rem; padding-left: 0.75rem; border-left: 1px solid var(--hx-stroke); overflow: auto; }
.hx-build__sel-title { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; color: var(--hx-text-dim); }
.hx-build__sel-name { font-size: 1rem; }
.hx-build__sel-desc { margin: 0; font-size: 0.8125rem; line-height: 1.35; color: var(--hx-text-dim); }
.hx-build__avail { align-self: start; padding: 0.1875rem 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; }
.hx-build__avail.is-ready { background: rgb(193 219 141 / 0.16); color: var(--hx-leaf); }
.hx-build__avail.is-blocked { background: rgb(191 51 46 / 0.2); color: var(--hx-warm-red); }
.hx-build__sel-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.hx-build-arrows { position: absolute; display: flex; gap: 4.5rem; transform: translate(-50%, -50%); pointer-events: none; }
.hx-build-arrow { pointer-events: auto; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 1px solid var(--hx-stroke-strong); border-radius: 50%; background: rgb(19 24 28 / 0.92); color: var(--hx-text); cursor: pointer; box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 0.35); }
.hx-build-arrow:hover { color: var(--hx-gold); border-color: var(--hx-gold); }
.hx-build-arrow svg { width: 1.25rem; height: 1.25rem; }
@container (max-width: 48rem) {
  .hx-build__body { grid-template-columns: 8rem minmax(0, 1fr); }
  .hx-build__sel { display: none; }
}

/* ---- bug tracker (§114) -------------------------------------------------- */
.hx-bug-quick__text, .hx-bug-editor textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 0.625rem;
  background: rgb(0 0 0 / 0.25);
  color: var(--hx-text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}
.hx-bug-quick__text:focus, .hx-bug-editor textarea:focus { outline: 2px solid var(--hx-focus); outline-offset: 1px; }
.hx-bug-context { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-bug-chip { display: inline-flex; align-items: center; padding: 0.0625rem 0.4375rem; border-radius: 0.375rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; background: rgb(184 140 51 / 0.25); color: rgb(240 200 120); }
.hx-bug-chip[data-status="in_progress"] { background: rgb(199 110 41 / 0.25); color: rgb(245 160 96); }
.hx-bug-chip[data-status="ready_for_test"] { background: rgb(87 117 199 / 0.28); color: rgb(150 180 250); }
.hx-bug-chip[data-status="fixed"] { background: rgb(77 140 97 / 0.28); color: var(--hx-leaf); }
.hx-bug-chip[data-status="rework"] { background: rgb(184 87 71 / 0.28); color: var(--hx-warm-red); }
.hx-chip.hx-bug-chip { padding: 0.25rem 0.625rem; border: 1px solid transparent; cursor: pointer; }
.hx-chip.hx-bug-chip[aria-pressed="true"] { border-color: currentColor; }
.hx-bug-build { font-size: 0.6875rem; font-weight: 700; color: rgb(240 170 90); }
.hx-bug-build[data-in="true"] { color: var(--hx-leaf); }
.hx-bugs {
  position: relative;
  container-type: inline-size;
  width: min(70rem, calc(100% - 2rem));
  height: min(44rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--hx-stroke);
  border-radius: var(--hx-radius);
  background: var(--hx-panel);
  box-shadow: var(--hx-shadow);
  animation: hx-rise 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.hx-bugs .hx-inv__head .hx-title { margin-right: auto; text-align: left; font-size: 1.25rem; }
.hx-count { padding: 0 0.375rem; border-radius: 999px; background: var(--hx-raised); font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-bugs__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.hx-bugs__body.has-card { grid-template-columns: minmax(16rem, 2fr) minmax(0, 3fr); }
.hx-bugs__list { min-height: 0; overflow: auto; margin: 0; padding: 0 0.25rem 0 0; list-style: none; display: flex; flex-direction: column; gap: 0.375rem; }
.hx-bugs__empty { margin: 2rem 0; text-align: center; }
.hx-bug-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(255 255 255 / 0.03);
  color: var(--hx-text);
  text-align: left;
  cursor: pointer;
}
.hx-bug-row:hover { background: rgb(255 255 255 / 0.06); border-color: var(--hx-stroke-strong); }
.hx-bug-row.is-selected { border-color: var(--hx-gold); background: rgb(240 180 92 / 0.08); }
.hx-bug-row__top { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; }
.hx-bug-row__count { margin-left: auto; color: var(--hx-text-dim); }
.hx-bug-row__title { font-size: 0.875rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hx-bug-card { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.625rem; padding: 0.875rem 1rem; border: 1px solid var(--hx-stroke); border-radius: 0.75rem; background: rgb(255 255 255 / 0.03); user-select: text; -webkit-user-select: text; }
.hx-bug-card__head { display: flex; align-items: center; gap: 0.625rem; }
.hx-bug-card__head .hx-link-back { margin-right: auto; }
.hx-bug-card__meta { margin: 0; font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-bug-card__text { margin: 0; font-size: 0.9375rem; line-height: 1.45; white-space: pre-wrap; }
.hx-bug-commits { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0; font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-bug-commits code { padding: 0.0625rem 0.375rem; border-radius: 0.375rem; background: var(--hx-raised); color: var(--hx-text); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.hx-bug-thread { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.hx-bug-thread li { display: flex; flex-direction: column; gap: 0.1875rem; padding: 0.5rem 0.625rem; border-left: 3px solid rgb(150 180 250 / 0.6); border-radius: 0.375rem; background: rgb(255 255 255 / 0.035); }
.hx-bug-thread li[data-author="user"] { border-left-color: var(--hx-gold); }
.hx-bug-thread li b { font-size: 0.75rem; color: var(--hx-text-dim); }
.hx-bug-thread li p { margin: 0; font-size: 0.875rem; line-height: 1.4; white-space: pre-wrap; }
.hx-bug-thread .hx-link-back { align-self: flex-start; }
.hx-bug-editor { display: flex; flex-direction: column; gap: 0.5rem; }
.hx-bug-card__actions { flex-wrap: wrap; margin-top: auto; }
@container (max-width: 44rem) {
  .hx-bugs__body.has-card { grid-template-columns: minmax(0, 1fr); }
  .hx-bugs__body.has-card .hx-bugs__list { display: none; }
}

/* ---- colony history (GameHistoryPanel) ----------------------------------- */
/* A drawer on the left under the HUD; it stops above the character card. */
.hx-history-tab {
  position: absolute;
  top: calc(4.75rem + var(--hx-left-stack, 0px)); /* under the map (map.js reports its height) */
  left: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.625rem;
  background: rgb(19 24 28 / 0.94);
  color: var(--hx-gold);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}
.hx-history-tab .hx-icon { width: 1rem; height: 1rem; }
.hx-history {
  position: absolute;
  top: calc(4.75rem + var(--hx-left-stack, 0px));
  left: 0.875rem;
  width: min(24rem, calc(100% - 1.75rem));
  max-height: calc(100% - 4.75rem - var(--hx-left-stack, 0px) - 22.5rem); /* the card and its pills below */
  min-height: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0.625rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.875rem;
  background: rgb(19 24 28 / 0.96);
  box-shadow: var(--hx-shadow);
  animation: hx-rise 160ms ease-out;
}
.hx-history__head { display: flex; align-items: flex-start; gap: 0.5rem; }
.hx-history__head > div { flex: 1; min-width: 0; }
.hx-history__title { margin: 0; font-size: 1rem; }
.hx-history__chip { padding: 0.1875rem 0.5rem; font-size: 0.6875rem; }
.hx-history__list { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0 0.25rem 0 0.875rem; list-style: none; border-left: 1px solid var(--hx-stroke); margin-left: 0.3125rem; }
.hx-history__item { position: relative; display: flex; flex-direction: column; gap: 0.0625rem; padding: 0.3125rem 0 0.4375rem; }
.hx-history__item::before { content: ""; position: absolute; left: -1.1875rem; top: 0.625rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--hx-gold); box-shadow: 0 0 0 2px rgb(19 24 28); }
.hx-history__item[data-tone="good"]::before { background: rgb(87 184 115); }
.hx-history__item[data-tone="bad"]::before { background: rgb(199 89 87); }
.hx-history__item[data-tone="danger"]::before { background: rgb(235 82 71); }
.hx-history__item[data-tone="social"]::before { background: rgb(158 122 224); }
.hx-history__item[data-tone="build"]::before { background: rgb(102 168 235); }
.hx-history__item time { font-size: 0.6875rem; color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-history__item b { font-size: 0.8125rem; font-weight: 600; line-height: 1.3; }
.hx-history__item[data-tone="danger"] b { color: var(--hx-warm-red); }
.hx-history__item span { font-size: 0.75rem; line-height: 1.3; color: var(--hx-text-dim); }
.hx-history__empty { padding: 1.5rem 0; text-align: center; }
.hx-history__more { align-self: center; min-height: 1.75rem; font-size: 0.75rem; }

/* ---- end of the game (EndSummaryPanel) ----------------------------------- */
.hx-backdrop--deep { background: rgb(0 0 0 / 0.68); }
.hx-end {
  position: relative;
  container-type: inline-size;
  width: min(56rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 1.125rem;
  background: radial-gradient(120% 60% at 50% 0%, rgb(240 180 92 / 0.12), transparent 60%), rgb(19 24 28 / 0.98);
  box-shadow: var(--hx-shadow);
  animation: hx-rise 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.hx-end__close { position: absolute; top: 0.875rem; right: 0.875rem; }
.hx-end__head { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; }
.hx-end__eyebrow { color: var(--hx-gold); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.16em; }
.hx-end__head h2 { margin: 0; font-size: 2rem; line-height: 1.15; text-wrap: balance; }
.hx-end__head p { margin: 0; color: var(--hx-text-dim); font-size: 0.9375rem; }
.hx-end__metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; }
.hx-end__metric { display: flex; flex-direction: column; align-items: center; gap: 0.125rem; padding: 0.625rem 0.25rem; border: 1px solid var(--hx-stroke); border-radius: 0.75rem; background: rgb(255 255 255 / 0.03); }
.hx-end__metric b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.hx-end__metric span { font-size: 0.6875rem; color: var(--hx-text-dim); text-align: center; }
.hx-end__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.hx-end__people { margin: 0.5rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.hx-end__people li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.625rem; border: 1px solid var(--hx-stroke); border-radius: 0.75rem; background: rgb(255 255 255 / 0.03); }
.hx-end__people li > div { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.hx-end__people b { font-size: 0.9375rem; }
.hx-end__stats { display: flex; flex-wrap: wrap; gap: 0.125rem 0.625rem; font-size: 0.75rem; color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-end__ghost { display: grid; place-items: center; width: 3rem; height: 3rem; filter: grayscale(1) brightness(0.75); }
.hx-end__cause { align-self: flex-start; margin-top: 0.125rem; padding: 0.0625rem 0.5rem; border-radius: 999px; background: rgb(191 51 46 / 0.2); color: var(--hx-warm-red); font-size: 0.6875rem; font-weight: 600; }
@container (max-width: 40rem) {
  .hx-end__metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hx-end__cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---- craft project in the world (CraftProjectDetailsPanel) --------------- */
.hx-project { display: flex; align-items: center; gap: 0.875rem; }
.hx-project__pic { position: relative; flex: none; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 0.75rem; background: rgb(0 0 0 / 0.25); }
.hx-project__pic img { position: absolute; inset: 0.375rem; width: calc(100% - 0.75rem); height: calc(100% - 0.75rem); object-fit: contain; }
.hx-project__what { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.hx-project__what b { font-size: 1.0625rem; }
.hx-project__status { align-self: flex-start; padding: 0.0625rem 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; background: rgb(240 180 92 / 0.18); color: var(--hx-gold); }
.hx-project__status[data-status="ready"] { background: rgb(193 219 141 / 0.18); color: var(--hx-leaf); }
.hx-project__status[data-status="paused"] { background: var(--hx-raised); color: var(--hx-text-dim); }
.hx-project__worker { margin: 0.75rem 0 0.375rem; font-size: 0.875rem; }
.hx-project__progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.625rem; }
.hx-project__progress .hx-bar { grid-column: auto; height: 0.5625rem; }
.hx-project__progress b { font-variant-numeric: tabular-nums; }

/* ---- HUD map (§150 TacticalMapPanel) ------------------------------------- */
/* Top of the left column; the history follows below it. */
.hx-map {
  position: absolute;
  top: 4.25rem;
  left: 0.875rem;
  width: min(16rem, calc(100% - 1.75rem));
  height: 13rem;
  padding: 0.375rem;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 0.75rem;
  background: rgb(14 41 54);
  box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 0.3);
}
.hx-map__canvas { display: block; width: 100%; height: 100%; border-radius: 0.5rem; cursor: crosshair; }
.hx-map__fold {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.375rem;
  background: rgb(14 20 24 / 0.85);
  color: var(--hx-text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.hx-map-tab {
  position: absolute;
  top: 4.25rem;
  left: 0.875rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.5rem;
  background: rgb(14 20 24 / 0.94);
  color: var(--hx-text);
  font-size: 1.125rem;
  cursor: pointer;
}

/* ---- developer tools (DebugControlsPanel) -------------------------------- */
.hx-hud__badge { min-width: 1.125rem; height: 1.125rem; padding: 0 0.25rem; border-radius: 999px; background: rgb(87 117 199); color: #fff; font-size: 0.6875rem; line-height: 1.125rem; }
.hx-debug {
  position: absolute;
  top: 4.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(40rem, calc(100% - 1.75rem)); /* stays clear of the roster on the right */
  max-height: calc(100% - 6rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem 0.875rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.875rem;
  background: rgb(19 24 28 / 0.97);
  box-shadow: var(--hx-shadow);
  animation: hx-pop 120ms ease-out;
}
.hx-debug__head { display: flex; align-items: center; gap: 0.75rem; }
.hx-debug__head h2 { margin: 0; font-size: 0.875rem; letter-spacing: 0.14em; color: var(--hx-gold); }
.hx-debug__head .hx-close { margin-left: auto; }
.hx-debug__groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 0.75rem 1rem; }
.hx-debug__group .hx-section__title { margin: 0 0 0.375rem; }
.hx-debug__note { margin: 0 0 0.375rem; font-size: 0.6875rem; }
.hx-debug__buttons { display: flex; flex-wrap: wrap; gap: 0.3125rem; }
.hx-debug__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.875rem;
  padding: 0 0.625rem;
  border: 1px solid var(--hx-stroke);
  border-radius: 0.5rem;
  background: var(--hx-raised);
  color: var(--hx-text);
  font-size: 0.75rem;
  cursor: pointer;
}
.hx-debug__btn:hover:not(:disabled) { background: var(--hx-hover); }
.hx-debug__btn:disabled { opacity: 0.45; cursor: default; }
.hx-debug__btn.is-danger { border-color: rgb(191 51 46 / 0.6); }
.hx-debug__btn.is-accent { background: rgb(71 97 140); }
.hx-debug__btn[aria-pressed="true"] { border-color: var(--hx-gold); }
.hx-debug__check { display: grid; place-items: center; width: 0.875rem; height: 0.875rem; border: 1px solid var(--hx-stroke-strong); border-radius: 0.1875rem; font-style: normal; font-size: 0.625rem; color: var(--hx-gold); }

/* ---- the rich tooltip (tooltip.js) --------------------------------------- */
.hx-tip {
  position: absolute;
  z-index: 50;
  width: max-content;
  max-width: 21rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 0.75rem;
  background: rgb(19 24 28 / 0.98);
  box-shadow: var(--hx-shadow);
  pointer-events: none;
  animation: hx-pop 90ms ease-out;
}
.hx-tip header { display: flex; align-items: center; gap: 0.625rem; }
.hx-tip[data-interactive="true"] { pointer-events: auto; }
.hx-tip li button { background: transparent; color: inherit; border: 0; padding: 0; text-align: left; text-decoration: underline; cursor: pointer; }
.hx-tip header b { font-size: 1rem; }
.hx-tip[data-tone="buff"] header b { color: var(--hx-leaf); }
.hx-tip[data-tone="debuff"] header b { color: rgb(242 196 192); }
.hx-tip__icon { font-size: 1.5rem; line-height: 1; }
.hx-tip p { margin: 0.375rem 0 0; color: var(--hx-text-dim); font-size: 0.8125rem; line-height: 1.4; }
.hx-tip ul { margin: 0.375rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3125rem; }
.hx-tip li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; align-items: center; gap: 0.375rem; padding: 0.3125rem 0.5rem; border-radius: 0.4375rem; background: rgb(242 196 192 / 0.08); font-size: 0.75rem; }
.hx-tip li[data-positive="true"] { background: rgb(95 196 106 / 0.08); }
.hx-tip li > span:first-child { font-size: 1.125rem; }
.hx-tip li b { font-size: 1.125rem; color: rgb(242 196 192); }
.hx-tip li[data-positive="true"] b { color: var(--hx-leaf); }

/* §174.7 hex inspector — left of the roster, under the HUD; the world stays live */
.hx-inspect {
  position: absolute;
  top: 4.25rem;
  right: 15.75rem; /* roster 14.5rem + its 0.75rem margin + a gap */
  width: 21rem;
  max-height: calc(100% - 22rem); /* ends where the roster does, clear of the character card */
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 0.875rem;
  background: var(--hx-panel);
  box-shadow: var(--hx-shadow);
  animation: hx-pop 120ms ease-out;
}
.hx-inspect__head { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 0.75rem 0.5rem 0.875rem; }
.hx-inspect__head > div { display: flex; flex-direction: column; gap: 0.125rem; }
.hx-inspect__head h2 { margin: 0; font-size: 1rem; }
.hx-inspect__head .hx-muted { font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.hx-inspect__head .hx-close { margin-left: auto; }
.hx-inspect__body { display: flex; flex-direction: column; gap: 0.5rem; overflow: auto; padding: 0 0.875rem 0.875rem; }
.hx-inspect__body .hx-section__title { margin-top: 0.25rem; }
.hx-inspect__object { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.625rem 0.6875rem; border: 1px solid var(--hx-stroke); border-radius: 0.5rem; background: var(--hx-raised); }
.hx-inspect__object > header { display: flex; align-items: center; gap: 0.6875rem; }
.hx-inspect__object > header > div { display: flex; flex-direction: column; min-width: 0; }
.hx-inspect__object > header b { font-size: 0.9375rem; }
.hx-inspect__object > header span { color: var(--hx-text-dim); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.hx-inspect__object > p { margin: 0; color: var(--hx-text-dim); font-size: 0.8125rem; line-height: 1.4; }
.hx-inspect__pic { position: relative; flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border: 1px solid var(--hx-stroke); border-radius: 0.5rem; background: rgb(25 31 36); }
.hx-inspect__pic img { position: absolute; inset: 0.25rem; width: calc(100% - 0.5rem); height: calc(100% - 0.5rem); object-fit: contain; }
.hx-inspect__pic .hx-pic-emoji { font-size: 1.5rem; }
.hx-inspect__stats { display: flex; flex-direction: column; gap: 0.1875rem; margin: 0; padding: 0.5rem 0.625rem; border-radius: 0.375rem; background: rgb(25 31 36); font-size: 0.8125rem; }
.hx-inspect__stats.is-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 1rem; }
.hx-inspect__stats > div { display: flex; justify-content: space-between; gap: 0.75rem; min-width: 0; }
.hx-inspect__stats dt { color: var(--hx-text-dim); }
.hx-inspect__stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hx-inspect__stats dd[data-tone="good"] { color: var(--hx-leaf); }
.hx-inspect__stats dd[data-tone="warn"] { color: var(--hx-gold); }
.hx-inspect__stats dd[data-tone="bad"] { color: var(--hx-warm-red); }
.hx-inspect__stats dd[data-tone="water"] { color: rgb(120 190 235); }
.hx-inspect__stats dd[data-tone="dim"] { color: var(--hx-text-dim); }
.hx-inspect__people { display: flex; flex-direction: column; gap: 0.1875rem; margin: 0; padding: 0; list-style: none; }
.hx-inspect__people li { display: flex; justify-content: space-between; padding: 0.3125rem 0.625rem; border-radius: 0.375rem; background: rgb(25 31 36); font-size: 0.8125rem; }
.hx-inspect__people li span { color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-inspect__junctions { display: flex; flex-direction: column; gap: 0.125rem; margin: 0; padding: 0.5rem 0.625rem; border-radius: 0.375rem; background: rgb(25 31 36); list-style: none; color: var(--hx-text-dim); font: 0.6875rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* §174.7 voice: the admin window, the shared recording card, the reply line */
.hx-admin { display: flex; flex-direction: column; gap: 0.75rem; padding: 0 1.25rem 1.25rem; }
.hx-admin__status { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; padding: 0.625rem 0.75rem; border-left: 3px solid var(--hx-stroke-strong); border-radius: 0.375rem; background: var(--hx-raised); font-size: 0.875rem; line-height: 1.4; }
.hx-admin__status span { color: var(--hx-text-dim); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.hx-admin__status.is-approved { border-left-color: var(--hx-leaf); }
.hx-admin__status.is-pending { border-left-color: var(--hx-gold); }
.hx-admin__status.is-rejected, .hx-admin__status.is-expired, .hx-admin__status.is-revoked,
.hx-admin__status.is-invalid, .hx-admin__status.is-queue_full { border-left-color: var(--hx-warm-red); }
.hx-admin__field { display: flex; flex-direction: column; gap: 0.3125rem; font-size: 0.8125rem; font-weight: 700; }
.hx-admin textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--hx-stroke-strong);
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.25);
  color: var(--hx-text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}
.hx-admin textarea:focus { outline: 2px solid var(--hx-focus); outline-offset: 1px; }
.hx-admin__typed textarea { font: 0.8125rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hx-admin__hint { margin: 0; color: var(--hx-text-dim); font-size: 0.75rem; line-height: 1.45; white-space: pre-line; }
.hx-admin__row { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.hx-admin__mic { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-right: auto; border: 1px solid var(--hx-stroke-strong); border-radius: 50%; background: var(--hx-raised); color: var(--hx-gold); cursor: pointer; }
.hx-admin__mic:hover:not(:disabled) { background: var(--hx-hover); }
.hx-admin__mic:disabled { opacity: 0.45; cursor: default; }
.hx-admin__mic.is-on { background: var(--hx-danger); color: var(--hx-text); border-color: transparent; animation: hx-pulse 0.9s ease-in-out infinite alternate; }
.hx-admin__mic svg { width: 1.375rem; height: 1.375rem; }
.hx-admin__confirm { display: flex; flex-direction: column; gap: 0.375rem; padding: 0.625rem 0.75rem; border: 1px solid rgb(242 115 89 / 0.55); border-radius: 0.5rem; background: rgb(191 51 46 / 0.12); font-size: 0.875rem; }
.hx-admin__confirm p { margin: 0; white-space: pre-line; }
.hx-admin__typed { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--hx-stroke); }
.hx-admin__typed[open] { gap: 0.5rem; }
.hx-admin__typed summary { color: var(--hx-text-dim); font-size: 0.8125rem; font-weight: 700; cursor: pointer; }
.hx-admin__typed > :not(summary) { margin-top: 0.5rem; }
.hx-admin__typed .hx-btn { align-self: flex-end; }

.hx-capture { display: flex; justify-content: center; align-items: flex-start; padding-top: 6rem; background: rgb(2 9 14 / 0.6); } /* high enough to leave the reply line below it readable */
.hx-capture__card { display: flex; flex-direction: column; align-items: center; width: min(19rem, 90%); padding: 1.75rem; border: 1px solid rgb(45 133 144); border-radius: 1.5rem; background: rgb(7 24 31); box-shadow: var(--hx-shadow); animation: hx-rise 160ms ease-out; }
.hx-capture__icon { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; background: rgb(46 235 225 / 0.1); color: rgb(46 235 225); }
.hx-capture__icon svg { width: 2.5rem; height: 2.5rem; }
.hx-capture__card h2 { margin: 1rem 0 0; color: rgb(222 244 247); font-size: 1.25rem; font-weight: 600; text-align: center; }
.hx-capture__meter { display: flex; align-items: center; gap: 0.1875rem; height: 2.375rem; margin: 1.25rem 0 1.5rem; }
.hx-capture__meter i { width: 0.4375rem; height: 100%; border-radius: 0.25rem; background: rgb(23 61 71); transition: background 60ms linear; }
.hx-capture__meter i.is-lit { background: rgb(69 222 209); }
.hx-capture__done { align-self: stretch; height: 2.875rem; border: 0; border-radius: 0.875rem; background: rgb(45 178 165); color: rgb(3 23 29); font: inherit; font-size: 1.125rem; font-weight: 700; cursor: pointer; }
.hx-capture__done:hover { background: rgb(69 205 191); }
.hx-capture__cancel { margin-top: 0.625rem; padding: 0.375rem 0.75rem; border: 0; background: none; color: rgb(140 180 186); font: inherit; font-size: 0.9375rem; cursor: pointer; }
.hx-capture__cancel:hover { color: rgb(222 244 247); }

.hx-subtitle {
  position: absolute;
  z-index: 5; /* over the recording card's dimmer: a reply can arrive mid-recording */
  left: 25%;
  right: 25%;
  bottom: 14.5rem; /* above the character card */
  margin: 0;
  padding: 0.625rem 1.125rem;
  border: 1px solid rgb(30 98 104);
  border-radius: 0.625rem;
  background: rgb(3 8 10 / 0.94);
  color: rgb(220 227 230);
  font-size: 1.125rem;
  line-height: 1.4;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  animation: hx-fade 160ms ease-out;
}
.hx-subtitle[data-tone="success"] { border-color: rgb(61 140 80); color: rgb(133 230 151); }
.hx-subtitle[data-tone="error"] { border-color: rgb(170 65 63); color: rgb(255 154 150); }
.hx-seg.is-recording { background: var(--hx-danger); color: var(--hx-text); animation: hx-pulse 0.9s ease-in-out infinite alternate; }

.hx-tip p { white-space: pre-line; }

/* §174.7 the right end of the HUD row: the account's coins and full screen */
.hx-hud-corner { grid-column: 3; justify-self: end; display: flex; align-items: start; gap: 0.5rem; }
.hx-coins { gap: 0.25rem; height: calc(2.5rem + 2px); padding: 0 0.5rem; font-size: 0.9375rem; font-variant-numeric: tabular-nums; cursor: help; }
.hx-coins b { font-weight: 700; }
.hx-coins span { font-size: 1.0625rem; line-height: 1; }
.hx-coins[data-off="true"] { color: var(--hx-text-dim); }
.hx-fullscreen { justify-content: center; width: calc(2.5rem + 2px); height: calc(2.5rem + 2px); padding: 0; color: var(--hx-text); cursor: pointer; }
.hx-fullscreen:hover { background: var(--hx-hover); }
.hx-fullscreen .hx-icon { width: 1.125rem; height: 1.125rem; }

/* the Escape menu's language row, above the sound sliders */
.hx-lang-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; font-size: 0.875rem; font-weight: 600; }
.hx-segmented { display: flex; gap: 0.25rem; padding: 0.1875rem; border-radius: 0.625rem; background: rgb(0 0 0 / 0.25); }
.hx-segmented .hx-seg { padding: 0 0.75rem; }

/* §174.7 simulation debug overlay (Tab): two columns at the top left, over the map */
.hx-sdbg {
  position: absolute;
  top: 4.25rem;
  left: 0.75rem;
  display: flex;
  gap: 0.5rem;
  max-height: calc(100% - 5rem);
  font-size: 0.75rem;
  --sd-hunger: rgb(235 140 51); --sd-energy: rgb(102 199 89); --sd-comfort: rgb(102 158 235);
  --sd-social: rgb(158 112 219); --sd-health: rgb(217 64 89); --sd-thirst: rgb(77 166 230);
  --sd-thermal: rgb(230 89 89); --sd-blue: rgb(77 143 235); --sd-teal: rgb(102 217 179); --sd-score: rgb(140 115 217);
}
.hx-sdbg__col { display: flex; flex-direction: column; gap: 0.375rem; width: 19rem; overflow: auto; padding: 0.625rem 0.75rem 0.75rem; border: 1px solid rgb(51 51 61); border-radius: 0.625rem; background: rgb(18 18 23 / 0.94); box-shadow: var(--hx-shadow); }
.hx-sdbg__col--wide { width: 25rem; }
.hx-sdbg__head { display: flex; align-items: center; gap: 0.5rem; }
.hx-sdbg__head h2 { margin: 0; font-size: 0.875rem; }
.hx-sdbg__head .hx-close { margin-left: auto; }
.hx-sdbg .hx-section__title { margin-top: 0.25rem; font-size: 0.625rem; }
.hx-sdbg__who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.375rem; }
.hx-sdbg__who b { font-size: 0.9375rem; }
.hx-sdbg__who > span { color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }
.hx-sdbg__badge { padding: 0.0625rem 0.375rem; border-radius: 0.25rem; background: rgb(191 31 31); color: #fff; font-style: normal; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.hx-sdbg__kv { display: flex; flex-direction: column; gap: 0.1875rem; margin: 0; padding: 0.375rem 0.5rem; border-radius: 0.375rem; background: rgb(31 31 36 / 0.9); }
.hx-sdbg__kv > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.5rem; }
.hx-sdbg__kv dt { color: var(--hx-text-dim); }
.hx-sdbg__kv dd { margin: 0; overflow-wrap: anywhere; }
.hx-sdbg .is-mono, .hx-sdbg__trace, .hx-sdbg__need b, .hx-sdbg__score b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.hx-sdbg [data-tone="hunger"] { color: var(--sd-hunger); } .hx-sdbg [data-tone="energy"] { color: var(--sd-energy); }
.hx-sdbg [data-tone="comfort"] { color: var(--sd-comfort); } .hx-sdbg [data-tone="social"] { color: var(--sd-social); }
.hx-sdbg [data-tone="thermal"] { color: var(--sd-thermal); } .hx-sdbg [data-tone="blue"] { color: var(--sd-blue); }
.hx-sdbg [data-tone="teal"] { color: var(--sd-teal); } .hx-sdbg [data-tone="dim"] { color: var(--hx-text-dim); }
.hx-sdbg__needs, .hx-sdbg__scores { display: flex; flex-direction: column; gap: 0.3125rem; padding: 0.375rem 0.5rem; border-radius: 0.375rem; background: rgb(31 31 36 / 0.9); }
.hx-sdbg__need, .hx-sdbg__score { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.125rem; }
.hx-sdbg__need b, .hx-sdbg__score b { color: var(--hx-text-dim); font-weight: 400; font-size: 0.6875rem; }
.hx-sdbg__need i, .hx-sdbg__score i { grid-column: 1 / -1; height: 0.3125rem; border-radius: 0.1875rem; background: linear-gradient(90deg, var(--bar) calc(var(--v) * 100%), rgb(36 36 41) 0); }
.hx-sdbg__need[data-need="health"] { --bar: var(--sd-health); } .hx-sdbg__need[data-need="hunger"] { --bar: var(--sd-hunger); }
.hx-sdbg__need[data-need="thirst"] { --bar: var(--sd-thirst); } .hx-sdbg__need[data-need="energy"] { --bar: var(--sd-energy); }
.hx-sdbg__need[data-need="comfort"] { --bar: var(--sd-comfort); } .hx-sdbg__need[data-need="social"] { --bar: var(--sd-social); }
.hx-sdbg__need[data-need="thermal"] { --bar: var(--sd-thermal); }
.hx-sdbg__score { --bar: var(--sd-score); }
.hx-sdbg__score i { height: 0.5rem; }
.hx-sdbg__lines { margin: 0; padding: 0.375rem 0.5rem; border-radius: 0.375rem; background: rgb(31 31 36 / 0.9); list-style: none; display: flex; flex-direction: column; gap: 0.125rem; }
.hx-sdbg__controls { display: flex; flex-wrap: wrap; gap: 0.3125rem; }
.hx-sdbg__speeds { display: flex; gap: 0.25rem; }
.hx-sdbg__btn { display: inline-flex; align-items: center; gap: 0.3125rem; height: 1.75rem; padding: 0 0.5rem; border: 1px solid rgb(51 51 61); border-radius: 0.375rem; background: rgb(41 43 51); color: var(--hx-text); font: inherit; font-size: 0.6875rem; cursor: pointer; }
.hx-sdbg__btn:hover:not(:disabled) { background: rgb(56 59 69); }
.hx-sdbg__btn[aria-pressed="true"] { background: var(--sd-blue); border-color: transparent; color: #fff; }
.hx-sdbg__btn:disabled { opacity: 0.45; cursor: default; }
.hx-sdbg__btn .hx-icon { width: 0.875rem; height: 0.875rem; }
.hx-sdbg__note { margin: 0; color: var(--hx-text-dim); font-size: 0.625rem; }
.hx-sdbg__trace { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; font-size: 0.625rem; }
.hx-sdbg__trace li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.375rem; padding: 0.1875rem 0; border-bottom: 1px solid rgb(46 46 56); }
.hx-sdbg__trace span { color: var(--hx-text-dim); }
.hx-sdbg__trace b { color: var(--sd-blue); font-weight: 600; overflow-wrap: anywhere; }
.hx-sdbg__trace p { grid-column: 1 / -1; margin: 0; color: var(--hx-text); overflow-wrap: anywhere; }


/* §121 why her order was refused or cut short: amber, on the card and in the backpack, 2.5 s */
.hx-order-toast { max-width: 100%; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid rgb(232 178 60 / 0.4); border-radius: 0.4375rem; background: rgb(0 0 0 / 0.6); color: rgb(232 178 60); font-size: 0.75rem; line-height: 1.3; animation: hx-toast-in 160ms ease-out; }
.hx-order-toast--inline { padding: 0.125rem 0.5rem; }
@keyframes hx-toast-in { from { opacity: 0; transform: translateY(-0.25rem); } }
/* §171 the call: a ringing handset rocks, in a call it is red and hangs up */
.hx-call.is-ringing .hx-icon { color: var(--hx-leaf); animation: hx-ring 0.35s ease-in-out infinite alternate; }
.hx-call.is-listening .hx-icon, .hx-call.is-speaking .hx-icon { color: rgb(232 87 79); transform: rotate(135deg); }
.hx-call.is-failed .hx-icon { color: rgb(232 178 60); }
@keyframes hx-ring { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.hx-call-state { padding: 0.0625rem 0.4375rem; border-radius: 0.375rem; background: rgb(0 0 0 / 0.55); color: var(--hx-text-dim); font-size: 0.6875rem; }
.hx-call-state[data-state="failed"] { color: rgb(232 178 60); font-size: 0.75rem; }
.hx-call-state[data-state="listening"], .hx-call-state[data-state="speaking"] { color: var(--hx-text); }

/* card details the old card had (18.10.2026): UV band colour, compassion share, perks, fighting faces */
.hx-uv[data-uv="low"] { color: var(--hx-leaf); }
.hx-uv[data-uv="mid"] { color: rgb(232 178 60); }
.hx-uv[data-uv="high"] { color: rgb(232 87 79); }
.hx-stats li.hx-stats__share { grid-template-columns: minmax(0, 1fr) 5.25rem 2.25rem; }
.hx-stats__share .hx-bar { height: 0.375rem; }
.hx-stats__share .hx-bar i { background: rgb(222 143 186); }
.hx-perks { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0 0 0.5rem; padding: 0; list-style: none; }
.hx-perks li { padding: 0.1875rem 0.5rem; border: 1px solid var(--hx-stroke); border-radius: 0.5rem; background: var(--hx-raised); color: var(--hx-text-dim); font-size: 0.6875rem; }
.hx-perks li.is-gift { border-color: rgb(240 180 92 / 0.55); color: var(--hx-gold); }
.hx-group__faces button.is-fighting { box-shadow: 0 0 0 2px rgb(232 87 79); }
.hx-stats__share .hx-bar { grid-column: auto; }

/* the constructor's hint line; a loot slot kept for one kind of thing */
.hx-build__hint { margin: 0; padding: 0.3125rem 0.75rem 0.375rem; border-top: 1px solid var(--hx-stroke); color: var(--hx-text-dim); font-size: 0.6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-slot--empty.is-typed { outline: 1px dashed rgb(240 180 92 / 0.55); outline-offset: -0.1875rem; cursor: help; }

.hx-bug-screenshot { display: block; width: 100%; max-height: 11rem; object-fit: contain; border-radius: .5rem; background: var(--hx-panel); }
.hx-bug-queue { display: grid; gap: .375rem; max-height: 12rem; overflow-y: auto; }
.hx-bug-queue__row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem; border: 1px solid var(--hx-stroke); border-radius: .5rem; }
.hx-bug-queue__row > span { min-width: 0; overflow-wrap: anywhere; }
.hx-bug-queue__row .hx-actions { flex-shrink: 0; margin: 0; }
.hx-hud__report-toast { position: absolute; top: calc(100% + .5rem); right: 0; padding: .5rem .75rem; border-radius: .5rem; background: var(--hx-panel); color: var(--hx-text); max-width: min(24rem, 85vw); font-size: .75rem; }
.hx-bug-mic { color: var(--hx-gold); }
.hx-hud-centre { flex-direction: column; align-items: center; }
.hx-hud-primary { display: flex; align-items: start; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.hx-hud-tools { max-width: calc(100vw - 2rem); flex-wrap: wrap; }
.hx-bug-mic svg { transition: transform 80ms ease-out; transform: scale(calc(1 + var(--voice-level, 0) * .16)); }
.hx-bug-mic.is-recording { color: #ffca75; background: rgb(226 153 61 / .18); }
.hx-bug-delivery { display: flex; align-items: center; gap: .5rem; padding: 0 .35rem; white-space: nowrap; font-size: .8rem; }
.hx-bug-delivery__pending { color: var(--hx-gold); }
.hx-bug-delivery__sent, .hx-hud__report-toast.is-sent { color: #79d69b; }
.hx-bug-spin { display: inline-block; font-style: normal; animation: hx-bug-spin 1s linear infinite; }
.hx-bug-retry { color: #f4a07c; font-size: .75rem; white-space: nowrap; }
.hx-debug__btn svg { width: 1rem; height: 1rem; margin-right: .4rem; vertical-align: middle; }
.hx-bug-voice { width: min(34rem, calc(100vw - 2rem)); border-color: rgb(215 165 85 / .45); background: var(--hx-panel); }
.hx-bug-voice__mic { width: 6rem; height: 6rem; color: var(--hx-gold); background: rgb(224 167 82 / .09); transition: transform 80ms ease-out; box-shadow: 0 0 calc(var(--voice-level, 0) * 3rem) rgb(224 167 82 / .24); }
.hx-bug-voice__mic svg { width: 3.75rem; height: 3.75rem; }
.hx-bug-voice__wave { display: flex; align-items: center; justify-content: center; gap: clamp(2px, .25vw, 5px); height: 7rem; width: 100%; margin-top: 1rem; }
.hx-bug-voice__wave i { flex: 0 1 7px; min-width: 2px; border-radius: 3px; background: var(--hx-gold); transition: height 90ms ease-out; }
.hx-bug-voice__wave i:nth-child(3n) { background: var(--hx-text); }
.hx-bug-voice__wave.is-speaking i { animation-name: hx-bug-wave; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.hx-bug-voice__time { margin: .25rem 0; font-variant-numeric: tabular-nums; }
.hx-bug-voice > p { text-align: center; }
.hx-bug-voice > p[role="status"] { margin: .5rem 0 1.1rem; max-width: 28rem; font-size: .875rem; line-height: 1.45; }
.hx-bug-voice .hx-capture__done { background: var(--hx-gold); color: #172025; }
.hx-bug-voice .hx-capture__done:disabled { opacity: .45; cursor: default; }
@keyframes hx-bug-spin { to { transform: rotate(360deg); } }
@keyframes hx-bug-wave { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
@media (max-width: 520px) { .hx-capture:has(.hx-bug-voice) { padding-top: 2rem; } .hx-bug-voice { padding: 1.25rem; } }
@media (max-width: 760px) { .hx-hud-top { display: flex; flex-direction: column; align-items: center; gap: .5rem; } .hx-hud-centre { width: 100%; } .hx-weather { max-width: 100%; flex-wrap: wrap; row-gap: .15rem; } }
@media (prefers-reduced-motion: reduce) { .hx-bug-voice__wave.is-speaking i { animation: none; } }
@media (max-width: 40rem) { .hx-bug-queue__row { align-items: stretch; flex-direction: column; } .hx-bug-screenshot { max-height: 8rem; } }
