/* Lost Bonds UI v2 (Starlit Shrine) — component stylesheet (load tokens/tokens.css first, then lostbonds.js for the
   parchment's torn edge, the line-art layer and the motes).
   Lengths are canvas units at the 1920x1080 reference resolution. Colours, radii, depth and timing come from
   tokens.css. The few literals below are gradients of those tokens and the inline SVG ornaments (sparkle, flank),
   which a data URI cannot take from a variable.

   Two materials and one light: dusk holds (windows, trays, the HUD), parchment tells (everything you read), gold is
   light (thin lines, line-art, sparkles, the selection). A window is always dusk (.lb-panel), a sheet always
   parchment (.lb-parchment): tokens.css switches the semantic colours inside each. */

:root {
  --lb-tap: var(--dur-tap, 80ms);
  --lb-quick: var(--dur-quick, 140ms);
  --lb-fade: var(--dur-fade, 180ms);
  --lb-pop: var(--dur-pop, 280ms);
  --lb-unfold: var(--dur-unfold, 320ms);
  --lb-bounce: var(--dur-bounce, 480ms);
  --lb-reward: var(--dur-reward, 650ms);
  --lb-bob: var(--dur-bob, 800ms);
  --lb-drain: var(--dur-drain, 1500ms);
  --lb-twinkle: var(--dur-twinkle, 4000ms);
  --lb-step: var(--stagger-list, 90ms);
  --lb-e-out: var(--ease-out, cubic-bezier(0.33, 1, 0.68, 1));
  --lb-e-in: var(--ease-in, cubic-bezier(0.32, 0, 0.67, 0));
  --lb-e-pop: var(--ease-pop, cubic-bezier(0.34, 1.45, 0.64, 1));
  --lb-e-sink: var(--ease-sink, cubic-bezier(0.36, 0, 0.66, -0.56));
  --lb-e-bounce: var(--ease-bounce, cubic-bezier(0.34, 1.45, 0.64, 1));
  --lb-e-settle: var(--ease-settle, cubic-bezier(0.5, 1, 0.89, 1));
  --lb-e-sway: var(--ease-sway, cubic-bezier(0.37, 0, 0.63, 1));

  /* the gold line: lit at the top, deep in the middle, warm again at the foot */
  --lb-gold-line: linear-gradient(170deg, var(--gold-100) 0%, var(--gold-300) 22%, var(--gold-600) 55%, var(--gold-400) 85%, var(--gold-200) 100%);
  /* parchment fibres (assets/textures, 768 tile) */
  --lb-washi: url("../assets/textures/AI_GEN_washi.png") 0 0 / 768px;
  /* inline ornaments: a four-point sparkle with its glow, and a title flourish (as a mask) */
  --lb-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23ffd889' stop-opacity='.55'/%3E%3Cstop offset='1' stop-color='%23ffd889' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='13' cy='13' r='13' fill='url(%23g)'/%3E%3Cpath d='M13 2C13.8 9 17 12.2 24 13C17 13.8 13.8 17 13 24C12.2 17 9 13.8 2 13C9 12.2 12.2 9 13 2Z' fill='%23ffe9b0'/%3E%3C/svg%3E");
  --lb-flank: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 24'%3E%3Cg stroke='%23000' stroke-width='1.5' fill='none' stroke-linecap='round'%3E%3Cpath d='M2 12H24' opacity='.12'/%3E%3Cpath d='M24 12H48' opacity='.3'/%3E%3Cpath d='M48 12H72' opacity='.55'/%3E%3Cpath d='M72 12H97' opacity='.85'/%3E%3Cpath d='M104 6.5L109.5 12L104 17.5L98.5 12Z'/%3E%3Cpath d='M110 12H120'/%3E%3C/g%3E%3Cpath d='M126 7.5L130.5 12L126 16.5L121.5 12Z'/%3E%3Cpath d='M141 3C141.6 9.6 143.4 11.4 150 12C143.4 12.6 141.6 14.4 141 21C140.4 14.4 138.6 12.6 132 12C138.6 11.4 140.4 9.6 141 3Z'/%3E%3C/svg%3E");
  /* Corner moon redrawn from the supplied crescent reference. */
  --lb-corner-moon: url("../assets/ornaments/LOS_corner-moon.svg");
  --lb-star: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* Reduced motion: movement becomes instant, fades stay, loops stop. */
@media (prefers-reduced-motion: reduce) {
  :root { --lb-tap: 1ms; --lb-quick: 1ms; --lb-pop: 1ms; --lb-unfold: 1ms; --lb-bounce: 1ms; --lb-reward: 1ms; --lb-drain: 1ms; --lb-step: 0ms; }
  .lb-bob, .lb-glow, .lb-dialogue__next, .lb-item__new, .lb-slot__add, .lb-turn__chevron, .lb-bar.is-low .lb-bar__track,
  .lb-mote, .lb-item.is-selected::before, .lb-pedestal__circle, .lb-row.is-selected::before, .lb-part.is-available .lb-part__node { animation: none !important; }
}
:root.lb-reduced { --lb-tap: 1ms; --lb-quick: 1ms; --lb-pop: 1ms; --lb-unfold: 1ms; --lb-bounce: 1ms; --lb-reward: 1ms; --lb-drain: 1ms; --lb-step: 0ms; }
:root.lb-reduced :is(.lb-mote, .lb-item.is-selected::before, .lb-pedestal__circle) { animation: none !important; }

/* ---------- base ---------- */
.lb-root { font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
.lb-root *, .lb-root *::before, .lb-root *::after { box-sizing: border-box; }
.lb-root img { display: block; max-width: 100%; }
.lb-ground { background: radial-gradient(120% 70% at 50% 0%, var(--dusk-800), var(--dusk-900) 50%, var(--dusk-950)); color: var(--ink); }

/* ---------- motion vocabulary (keyframes) ---------- */
@keyframes lb-pop-in { from { transform: scale(var(--lb-from, 0)); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes lb-sink-out { from { transform: scale(1); opacity: 1; } to { transform: scale(0); opacity: 0; } }
@keyframes lb-land { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes lb-unfold-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lb-fold-x { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes lb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes lb-slide-in { from { transform: translateX(-48px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes lb-punch {
  0% { transform: scale(1); animation-timing-function: var(--lb-e-settle); }
  28% { transform: scale(var(--lb-punch, 1.14)); animation-timing-function: var(--lb-e-pop); }
  100% { transform: scale(1); }
}
@keyframes lb-bob { from { transform: translateY(0); } to { transform: translateY(var(--lb-bob-distance, 8px)); } }
@keyframes lb-glow-pulse { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes lb-wiggle { 0% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 65% { transform: rotate(5deg); } 100% { transform: rotate(0); } }
@keyframes lb-ring-burst { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }
@keyframes lb-shake {
  0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(3px); }
}
@keyframes lb-mote { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx, 0), -90px) scale(0); opacity: 0; } }
@keyframes lb-twinkle { from { opacity: calc(var(--o, 0.7) * 0.25); translate: 0 0; } to { opacity: var(--o, 0.7); translate: 0 -6px; } }
@keyframes lb-breathe { from { transform: scale(1); } to { transform: scale(1.05); } }
@keyframes lb-turn-slow { to { rotate: 360deg; } }
@keyframes lb-point { from { scale: 0.8; } to { scale: 1.1; } }
@keyframes lb-num-rise {
  0% { transform: translate(-50%, 0) scale(0.4); opacity: 0; animation-timing-function: var(--lb-e-pop); }
  22% { transform: translate(-50%, -12px) scale(1.12); opacity: 1; animation-timing-function: var(--lb-e-settle); }
  34% { transform: translate(-50%, -16px) scale(1); opacity: 1; animation-timing-function: var(--lb-e-out); }
  72% { transform: translate(-50%, -56px) scale(1); opacity: 1; animation-timing-function: var(--lb-e-in); }
  100% { transform: translate(-50%, -76px) scale(0.92); opacity: 0; }
}

/* utilities */
.lb-bob { animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; }
.lb-glow { position: relative; box-shadow: var(--glow-bond); }
/* Keep the resting rim on the component; only the extra light is composited. */
.lb-glow::after, .lb-item.is-ready::after, .lb-part.is-available .lb-part__node::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 40px rgba(102, 255, 237, 0.35); opacity: 0;
  animation: lb-glow-pulse calc(var(--lb-bob) * 4) var(--lb-e-sway) infinite;
}
.lb-glow::after { animation-duration: calc(var(--lb-bob) * 2); }
.lb-pop-in { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) both; }
.lb-sink-out { animation: lb-sink-out var(--lb-quick) var(--lb-e-sink) both; }
.lb-punch { animation: lb-punch calc(var(--lb-tap) + var(--lb-pop)) both; }
.lb-shake { animation: lb-shake var(--lb-pop) var(--lb-e-out); }
.lb-stagger > * { animation: lb-slide-in var(--lb-unfold) var(--lb-e-out) both; animation-delay: calc(var(--i, 0) * var(--lb-step)); }
.lb-stagger-pop > * { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) both; animation-delay: calc(var(--i, 0) * var(--lb-step)); }
.lb-ghost-text { opacity: 0; }
/* the gold line on any positioned element: a ring masked out of a gradient, following its radius */
.lb-gold { position: relative; }
.lb-gold::before {
  content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: var(--stroke-rim); pointer-events: none; background: var(--lb-gold-line);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* ---------- keycap: a small parchment tile with a visible thickness ---------- */
.lb-key {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 11px; translate: 0 -2px;
  border-radius: var(--radius-sm); background: linear-gradient(180deg, var(--parchment-50), var(--parchment-300)); color: var(--umber-900);
  font: 900 22px/1 var(--font-ui); letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(176, 122, 64, 0.45), var(--key-edge);
}
.lb-key--sm { min-width: 36px; height: 36px; padding: 0 8px; font-size: 19px; border-radius: 9px; }
.lb-key--xs { min-width: 30px; height: 30px; padding: 0 6px; font-size: 17px; border-radius: var(--radius-xs); }
.lb-key--round { width: 56px; min-width: 56px; height: 56px; padding: 0; border-radius: 50%; font-size: 24px; }

/* ---------- button: a lacquered key with a lit top and a visible thickness ---------- */
.lb-btn {
  --face-1: var(--amber-400); --face-2: var(--amber-500); --face-3: var(--amber-600); --side: var(--amber-700); --lip: rgba(255, 220, 196, 0.45);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  height: 76px; min-width: 200px; padding: 0 44px; border: 0; border-radius: 18px;
  background: linear-gradient(180deg, var(--face-1), var(--face-2) 52%, var(--face-3)); color: var(--on-action);
  font: 900 28px/30px var(--font-ui); letter-spacing: 0.02em; white-space: nowrap; text-shadow: none;
  box-shadow: inset 0 2px 0 var(--lip), inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 0 0 2px var(--side), 0 6px 0 var(--side), 0 11px 16px rgba(14, 7, 2, 0.5);
  cursor: pointer; transform: translateY(0);
  transition: transform var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) var(--lb-e-out), filter var(--lb-quick) linear;
}
.lb-btn:hover, .lb-btn.is-hover {
  --face-1: var(--amber-300); --face-2: var(--amber-400); transform: translateY(-2px);
  box-shadow: inset 0 2px 0 var(--lip), inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 0 0 2px var(--side), 0 8px 0 var(--side), 0 15px 20px rgba(14, 7, 2, 0.5), var(--glow-soft);
}
.lb-btn:active, .lb-btn.is-pressed {
  transform: translateY(5px); transition-duration: var(--lb-tap); transition-timing-function: var(--lb-e-settle);
  box-shadow: inset 0 2px 0 var(--lip), inset 0 -2px 0 rgba(0, 0, 0, 0.16), 0 0 0 2px var(--side), 0 1px 0 var(--side), 0 3px 6px rgba(14, 7, 2, 0.4);
}
.lb-btn:focus-visible, .lb-btn.is-focus { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 8px; }
/* reward: gold */
.lb-btn--hero { --face-1: var(--gold-200); --face-2: var(--gold-300); --face-3: var(--gold-400); --side: var(--gold-700); --lip: #fff8e6; color: var(--on-highlight); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); }
.lb-btn--hero:hover, .lb-btn--hero.is-hover { --face-1: var(--gold-100); --face-2: var(--gold-200); }
/* the other answer: parchment */
.lb-btn--quiet { --face-1: var(--parchment-50); --face-2: var(--parchment-200); --face-3: var(--parchment-300); --side: var(--parchment-600); --lip: #fff; color: var(--umber-900); text-shadow: none; }
.lb-btn--quiet:hover, .lb-btn--quiet.is-hover { --face-1: #fffbf2; --face-2: var(--parchment-100); }
.lb-btn--bond { --face-1: #3fd0c2; --face-2: var(--bond-500); --face-3: var(--bond-700); --side: var(--bond-900); --lip: rgba(220, 255, 250, 0.5); color: var(--cream); }
.lb-btn--bond:hover, .lb-btn--bond.is-hover { box-shadow: inset 0 2px 0 var(--lip), 0 0 0 2px var(--side), 0 8px 0 var(--side), var(--glow-bond); }
.lb-btn--sm { height: 58px; min-width: 0; padding: 0 var(--space-5); border-radius: 14px; font-size: 23px; line-height: 26px; }
.lb-btn[disabled], .lb-btn.is-disabled {
  opacity: var(--opacity-disabled); transform: none; filter: grayscale(0.75); cursor: not-allowed;
  box-shadow: inset 0 2px 0 var(--lip), 0 0 0 2px var(--side), 0 3px 0 var(--side);
}
.lb-btn .lb-key { translate: 0 0; margin-left: calc(var(--space-3) * -1); }

/* ---------- close: a dusk disc with a gold line ---------- */
.lb-close {
  position: relative; width: 64px; height: 64px; border: 0; border-radius: 50%; cursor: pointer; color: var(--cream-300);
  background: radial-gradient(circle at 50% 35%, var(--dusk-600), var(--dusk-850));
  box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.55), var(--elev-1);
  transition: transform var(--lb-pop) var(--lb-e-pop), color var(--lb-quick) linear, box-shadow var(--lb-quick) linear;
}
.lb-close::before, .lb-close::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 4.5px; border-radius: 3px;
  background: currentColor; transform: translate(-50%, -50%) rotate(45deg);
}
.lb-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.lb-close:hover { color: var(--cream); transform: rotate(90deg); box-shadow: inset 0 0 0 1.5px var(--gold-300), var(--elev-1), var(--glow-soft); }
.lb-close:active { transform: rotate(90deg) scale(0.92); transition-duration: var(--lb-tap); }
.lb-close:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 6px; }

/* ---------- HUD menu button: a dusk disc ringed in gold light ---------- */
.lb-hud { position: relative; display: inline-flex; align-items: center; height: 104px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; }
.lb-hud__disc {
  position: relative; z-index: 1; display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, var(--dusk-500), var(--dusk-800) 60%, var(--dusk-900));
  box-shadow: inset 0 0 0 2px rgba(255, 216, 137, 0.6), 0 0 0 3px rgba(14, 7, 2, 0.55), var(--elev-2);
  transition: transform var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) linear;
}
.lb-hud__disc img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45)); }
.lb-hud__label {
  position: absolute; left: 52px; top: 50%; height: 60px; margin-top: -30px; display: flex; align-items: center;
  padding: 0 var(--space-5) 0 calc(52px + var(--space-5)); border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: linear-gradient(180deg, var(--dusk-600), var(--dusk-850)); color: var(--cream); font: 700 26px/30px var(--font-ui); white-space: nowrap;
  box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.5), var(--elev-2); transform-origin: left center; transform: scaleX(0);
  transition: transform var(--lb-quick) var(--lb-e-in);
}
.lb-hud__label > span { opacity: 0; transition: opacity 130ms linear; }
.lb-hud__key { position: absolute; z-index: 2; left: -6px; bottom: -4px; }
.lb-hud:hover .lb-hud__label, .lb-hud:focus-visible .lb-hud__label, .lb-hud.is-open .lb-hud__label { transform: scaleX(1); transition: transform 190ms var(--lb-e-out); }
.lb-hud:hover .lb-hud__label > span, .lb-hud:focus-visible .lb-hud__label > span, .lb-hud.is-open .lb-hud__label > span { opacity: 1; transition-delay: 60ms; }
.lb-hud:hover .lb-hud__disc, .lb-hud.is-open .lb-hud__disc { box-shadow: inset 0 0 0 2px var(--gold-300), 0 0 0 3px rgba(14, 7, 2, 0.55), var(--elev-2), var(--glow-strong); }
.lb-hud:hover .lb-hud__disc img, .lb-hud.is-open .lb-hud__disc img { animation: lb-wiggle var(--lb-unfold) var(--lb-e-out); }
.lb-hud:active .lb-hud__disc { transform: scale(0.92); transition-duration: var(--lb-tap); }
.lb-hud:focus-visible { outline: none; }
.lb-hud:focus-visible .lb-hud__disc { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 6px; }
.lb-hud__badge { position: absolute; z-index: 2; top: 4px; left: 80px; width: 18px; height: 18px; border-radius: 50%; background: var(--new-500); box-shadow: 0 0 0 3px var(--cream), 0 0 12px rgba(255, 120, 80, 0.7); }

/* ---------- interaction prompt: a key and a verb over the world ---------- */
.lb-prompt { position: relative; display: inline-flex; align-items: center; height: 72px; }
.lb-prompt__capsule {
  display: flex; align-items: center; height: 60px; padding: 0 var(--space-5) 0 calc(28px + var(--space-4)); margin-left: 28px;
  border-radius: 16px; background: linear-gradient(180deg, var(--dusk-600), var(--dusk-850)); color: var(--cream);
  font: 700 26px/30px var(--font-ui); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.55), var(--elev-2), var(--glow-soft);
  transform-origin: left center; transform: scaleX(0);
}
.lb-prompt__capsule > span { opacity: 0; }
.lb-prompt .lb-key--round { position: absolute; left: 0; top: 8px; z-index: 1; transform: scale(0); transform-origin: 50% 50%; translate: 0 0; }
.lb-prompt.is-open .lb-prompt__capsule { animation: lb-unfold-x 240ms var(--lb-e-out) both; }
.lb-prompt.is-open .lb-prompt__capsule > span { animation: lb-fade-in var(--lb-fade) linear 120ms both; }
.lb-prompt.is-open .lb-key--round { animation: lb-land var(--lb-bounce) var(--lb-e-bounce) 35ms both; }
.lb-prompt.is-closing .lb-prompt__capsule { transform: scaleX(1); animation: lb-fold-x var(--lb-quick) var(--lb-e-in) both; }
.lb-prompt.is-closing .lb-key--round { transform: scale(1); animation: lb-sink-out var(--lb-quick) var(--lb-e-sink) both; }
.lb-prompt.is-static .lb-prompt__capsule, .lb-prompt.is-static .lb-key--round { transform: none; }
.lb-prompt.is-static .lb-prompt__capsule > span { opacity: 1; }

/* ---------- command foot: what you can do now, as keys and verbs ---------- */
.lb-actions { display: flex; align-items: center; gap: var(--space-6); }
.lb-action {
  display: inline-flex; align-items: center; gap: var(--space-3); padding: 6px 8px; margin: -6px -8px; border: 0; border-radius: 12px; background: none;
  font: 700 26px/1 var(--font-ui); color: var(--ink); cursor: pointer; transition: background-color var(--lb-quick) linear;
}
.lb-action:hover { background: rgba(255, 226, 186, 0.08); }
.lb-action.is-disabled, .lb-action[disabled] { opacity: 0.4; cursor: default; }
.lb-action.is-disabled:hover, .lb-action[disabled]:hover { background: none; }
.lb-action:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 4px; }

/* ---------- tabs: words on the surface; the open one glows, underlined in gold. Tab / Shift+Tab switch them ---------- */
.lb-tabs { display: inline-flex; align-items: center; gap: var(--space-1); }
.lb-tabs > .lb-key { margin: 0 var(--space-2); }
.lb-tab {
  position: relative; display: inline-flex; align-items: center; gap: 10px; height: 60px; padding: 0 var(--space-4); border: 0; background: none;
  font: 900 26px/30px var(--font-ui); color: var(--ink-hint); white-space: nowrap; cursor: pointer;
  transition: color var(--lb-quick) linear;
}
.lb-tab:hover { color: var(--ink); }
.lb-tab__icon { width: 34px; height: 34px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.lb-tab__count { font-weight: 700; font-size: 20px; opacity: 0.75; }
.lb-tab img { width: 44px; height: 44px; border-radius: 50%; }
.lb-tab.is-selected { color: var(--gold-200); text-shadow: 0 0 14px rgba(255, 190, 100, 0.55); }
.lb-tab.is-selected::after {
  content: ""; position: absolute; left: var(--space-4); right: var(--space-4); bottom: 4px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-300) 20%, var(--gold-200) 50%, var(--gold-300) 80%, transparent);
  box-shadow: 0 0 10px rgba(255, 196, 110, 0.8); animation: lb-unfold-x var(--lb-unfold) var(--lb-e-out) both;
}
.lb-tab:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 2px; border-radius: 12px; }
.lb-parchment .lb-tab.is-selected, [data-theme="parchment"] .lb-tab.is-selected { color: var(--umber-900); text-shadow: none; }
.lb-parchment .lb-tab.is-selected::after, [data-theme="parchment"] .lb-tab.is-selected::after { background: linear-gradient(90deg, transparent, var(--gold-600) 20%, var(--gold-500) 50%, var(--gold-600) 80%, transparent); box-shadow: none; }
.lb-dots { display: inline-flex; gap: var(--space-3); }
.lb-dots > i { width: 14px; height: 14px; background: var(--ink-hint); clip-path: var(--lb-star); transition: transform var(--lb-pop) var(--lb-e-pop), background-color var(--lb-quick) linear; }
.lb-dots > i.is-on { background: var(--gold-300); transform: scale(1.5); }

/* ---------- window (.lb-panel): dusk, a gold line, a fainter line inside it with a crescent moon at each corner ---------- */
.lb-panel {
  position: relative; padding: 120px var(--space-7) var(--space-6); border-radius: var(--radius-xl); color: var(--ink);
  background:
    var(--lb-corner-moon) left var(--space-1) top var(--space-1) / var(--space-7) no-repeat, var(--lb-corner-moon) right var(--space-1) top var(--space-1) / var(--space-7) no-repeat,
    var(--lb-corner-moon) left var(--space-1) bottom var(--space-1) / var(--space-7) no-repeat, var(--lb-corner-moon) right var(--space-1) bottom var(--space-1) / var(--space-7) no-repeat,
    radial-gradient(120% 70% at 50% 0%, var(--dusk-600) 0%, var(--dusk-800) 45%, var(--dusk-900) 100%);
  outline: var(--stroke-hair) solid var(--line); outline-offset: -14px;
  box-shadow: var(--elev-3), 0 0 60px rgba(255, 180, 90, 0.08), inset 0 1px 0 rgba(255, 230, 190, 0.12);
}
.lb-panel::before {
  content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: var(--stroke-rim); pointer-events: none; background: var(--lb-gold-line);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.lb-panel > * { position: relative; z-index: 1; }
.lb-panel__title {
  position: absolute; left: 50%; top: 30px; z-index: 4; translate: -50% 0; display: flex; align-items: center; gap: 18px; white-space: nowrap;
  font: 400 54px/56px var(--font-display); color: var(--gold-200); letter-spacing: 0.02em;
  text-shadow: 0 0 22px rgba(255, 190, 100, 0.5), 0 3px 0 rgba(0, 0, 0, 0.55);
}
.lb-panel__title::before, .lb-panel__title::after {
  content: ""; width: 150px; height: 24px; flex: none; background: var(--gold-400);
  -webkit-mask: var(--lb-flank) center / contain no-repeat; mask: var(--lb-flank) center / contain no-repeat;
  filter: drop-shadow(0 0 6px rgba(255, 190, 100, 0.5));
}
.lb-panel__title::after { transform: scaleX(-1); }
/* a narrow window (under about 1000 wide) keeps its title clear of the close disc: shorter flourishes, a smaller title */
.lb-panel--compact .lb-panel__title { font-size: 44px; line-height: 48px; gap: 12px; }
.lb-panel--compact .lb-panel__title::before, .lb-panel--compact .lb-panel__title::after { width: 72px; }
.lb-panel--compact .lb-panel__title img { width: 46px; height: 46px; }
.lb-panel__title img { width: 56px; height: 56px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5)); }
.lb-panel__close { position: absolute; top: 30px; right: 30px; z-index: 5; }
.lb-panel__section + .lb-panel__section { margin-top: var(--space-7); }
/* the command foot: a faint line, what you hold on the left, what you can do on the right */
.lb-panel__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); min-height: 88px; margin-top: var(--space-5);
  border-top: var(--stroke-hair) solid var(--line); font: 700 24px/1 var(--font-ui); color: var(--ink-muted);
}
.lb-panel__foot b { color: var(--ink); font-weight: 900; }
/* a rule: a faint line broken by a gold star */
.lb-divider { position: relative; height: 20px; margin: var(--space-4) 0; border: 0;
  background: linear-gradient(90deg, transparent, var(--line) 14%, var(--line) calc(50% - 18px), transparent calc(50% - 18px),
    transparent calc(50% + 18px), var(--line) calc(50% + 18px), var(--line) 86%, transparent) center / 100% 1.5px no-repeat; }
.lb-divider::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; translate: -50% -50%; background: var(--rim); clip-path: var(--lb-star); }
/* a section label: tracked caps followed by a fading gold line */
.lb-label { margin: 0; display: flex; align-items: center; gap: 14px; font: 900 19px/20px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }
.lb-label::after { content: ""; flex: 1; height: 1.5px; background: linear-gradient(90deg, var(--rim), transparent); opacity: 0.6; }

/* ---------- line-art: Lunacia's patterns in gold light, blooming where --lb-bloom lets them through ----------
   .lb-pattern + one variant draws one pattern behind a surface's content (::after). lostbonds.js's lineArt() builds
   the full layer (constellations, clouds, Atia's crest and motes) as .lb-art. --lb-bloom is a list of radial
   gradients: where they are opaque the art shows, elsewhere it fades. Busy screens bloom less. */
.lb-pattern { position: relative; isolation: isolate; }
.lb-pattern::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; background: var(--pattern);
  -webkit-mask: var(--lb-pattern) var(--lb-pattern-pos, 0 0) / var(--lb-pattern-size) var(--lb-pattern-repeat, repeat), var(--lb-bloom, linear-gradient(#000 0 0));
  -webkit-mask-composite: source-in;
  mask: var(--lb-pattern) var(--lb-pattern-pos, 0 0) / var(--lb-pattern-size) var(--lb-pattern-repeat, repeat), var(--lb-bloom, linear-gradient(#000 0 0));
  mask-composite: intersect;
}
.lb-pattern--atia-crest { --lb-pattern: var(--pattern-atia-crest); --lb-pattern-size: min(96%, 1080px) auto; --lb-pattern-pos: 50% 40%; --lb-pattern-repeat: no-repeat; }
.lb-pattern--cloud-drift { --lb-pattern: var(--pattern-cloud-drift); --lb-pattern-size: var(--pattern-cloud-drift-size); }
.lb-pattern--star-chart { --lb-pattern: var(--pattern-star-chart); --lb-pattern-size: var(--pattern-star-chart-size); }
.lb-pattern--totem-weave { --lb-pattern: var(--pattern-totem-weave); --lb-pattern-size: var(--pattern-totem-weave-size); --lb-pattern-pos: 0 var(--space-5); --lb-pattern-repeat: repeat-x; }
.lb-band { height: 88px; --lb-pattern-pos: 0 0; }
/* the layer lineArt() builds */
.lb-art { position: absolute; inset: 0; z-index: 0; border-radius: inherit; overflow: hidden; pointer-events: none;
  -webkit-mask: var(--lb-bloom, radial-gradient(70% 80% at 100% 0%, #000, transparent 75%), radial-gradient(60% 70% at 0% 100%, #000, transparent 75%));
  mask: var(--lb-bloom, radial-gradient(70% 80% at 100% 0%, #000, transparent 75%), radial-gradient(60% 70% at 0% 100%, #000, transparent 75%)); }
.lb-art__stars, .lb-art__clouds, .lb-art__crest { position: absolute; inset: 0; background: var(--gold-300); }
.lb-art__stars { -webkit-mask: var(--pattern-star-chart) 0 0 / var(--pattern-star-chart-size); mask: var(--pattern-star-chart) 0 0 / var(--pattern-star-chart-size); opacity: 0.2; }
.lb-art__clouds { -webkit-mask: var(--pattern-cloud-drift) 40px 20px / var(--pattern-cloud-drift-size); mask: var(--pattern-cloud-drift) 40px 20px / var(--pattern-cloud-drift-size); opacity: 0.12; }
.lb-art__crest { inset: var(--lb-crest-at, -60px -90px auto auto); width: var(--lb-crest, 620px); height: var(--lb-crest, 620px);
  -webkit-mask: var(--pattern-atia-crest) center / contain no-repeat; mask: var(--pattern-atia-crest) center / contain no-repeat; opacity: 0.16; }
/* the damask: the faintest cloud pattern all over a dusk surface */
.lb-damask { position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; background: var(--gold-200); opacity: 0.035;
  -webkit-mask: var(--pattern-cloud-drift) 0 0 / 300px; mask: var(--pattern-cloud-drift) 0 0 / 300px; }
/* a mote of light; lineArt() scatters them, more of them toward the edges */
.lb-mote { position: absolute; width: var(--m, 4px); height: var(--m, 4px); border-radius: 50%; pointer-events: none; z-index: 1;
  background: radial-gradient(circle, #fffbe8 0%, var(--gold-300) 45%, rgba(255, 200, 110, 0) 72%); box-shadow: 0 0 calc(var(--m, 4px) * 2.4) var(--glow);
  opacity: var(--o, 0.7); animation: lb-twinkle var(--t, var(--lb-twinkle)) var(--lb-e-sway) var(--d, 0s) infinite alternate; }
.lb-mote.is-bond { background: radial-gradient(circle, #f0fffd 0%, var(--bond-300) 45%, transparent 72%); box-shadow: 0 0 10px rgba(102, 255, 237, 0.7); }
.lb-sparkle { position: absolute; width: var(--k, 22px); height: var(--k, 22px); translate: -50% -50%; pointer-events: none; z-index: 2; background: var(--lb-sparkle) center / contain no-repeat; }
/* a reading veil, for text that must sit over line-art in full bloom */
.lb-veil { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--veil); }
.lb-veil > :first-child { margin-top: 0; }
.lb-veil > :last-child { margin-bottom: 0; }

/* ---------- parchment: everything you read. lostbonds.js gives each sheet a torn edge drawn for its size ---------- */
.lb-parchment { position: relative; isolation: isolate; color: var(--ink); border-radius: var(--radius-lg);
  background: var(--lb-washi), radial-gradient(130% 110% at 35% 15%, var(--parchment-50) 0%, var(--parchment-100) 30%, var(--parchment-200) 62%, var(--parchment-300) 88%, var(--parchment-400) 100%);
  filter: drop-shadow(0 8px 10px rgba(14, 7, 2, 0.5)) drop-shadow(0 1px 1px rgba(14, 7, 2, 0.4)); }
.lb-parchment.has-sheet { background: none; }
.lb-parchment__sheet { position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: var(--lb-washi), radial-gradient(130% 110% at 35% 15%, var(--parchment-50) 0%, var(--parchment-100) 30%, var(--parchment-200) 62%, var(--parchment-300) 88%, var(--parchment-400) 100%);
  box-shadow: inset 0 0 40px rgba(176, 122, 64, 0.28), inset 0 0 6px rgba(125, 81, 36, 0.35);
  -webkit-mask: var(--lb-edge) 0 0 / 100% 100% no-repeat; mask: var(--lb-edge) 0 0 / 100% 100% no-repeat; }
/* the watermark: spiral clouds pressed into the paper */
.lb-parchment__sheet::after { content: ""; position: absolute; inset: 0; background: var(--parchment-600); opacity: 0.1;
  -webkit-mask: var(--pattern-cloud-drift) var(--lb-watermark-at, 30px 10px) / 320px; mask: var(--pattern-cloud-drift) var(--lb-watermark-at, 30px 10px) / 320px; }

/* ---------- scrollbar: a thread and a bead, on whatever element scrolls. The tokens switch with the theme, and the
   pseudo-elements read them from the scroller. In Chrome 121+ a scrollbar-width or scrollbar-color on an element turns
   these rules off for it, so screens declare neither (scrollbar-width: none is the one exception). ---------- */
:root { --lb-scroll-gutter: var(--space-4); }
:root, [data-theme="dusk"], .lb-panel, .lb-dusk, .lb-ground {
  --lb-bead-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 .6 7.4 4 4 7.4.6 4Z' fill='%233b200e'/%3E%3C/svg%3E");
  --lb-bead-lit: transparent; --lb-bead-deep: rgba(217, 154, 60, 0.6); --lb-bead-edge: rgba(59, 32, 14, 0.25);
}
[data-theme="parchment"], .lb-parchment {
  --lb-bead-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 .6 7.4 4 4 7.4.6 4Z' fill='%23fff7e8'/%3E%3C/svg%3E");
  --lb-bead-lit: rgba(255, 247, 232, 0.16); --lb-bead-deep: transparent; --lb-bead-edge: transparent;
}
*::-webkit-scrollbar { width: var(--lb-scroll-gutter); height: var(--lb-scroll-gutter); background: transparent; }
*::-webkit-scrollbar-button { display: none; }
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-track { background: linear-gradient(var(--scroll-thread) 0 0) center / var(--stroke-rim) 100% no-repeat; }
*::-webkit-scrollbar-track:vertical { margin-block: var(--space-3); }
*::-webkit-scrollbar-track:horizontal { margin-inline: var(--space-3); background-size: 100% var(--stroke-rim); }
*::-webkit-scrollbar-thumb {
  min-width: var(--space-7); min-height: var(--space-7); border: var(--space-1) solid transparent; border-radius: var(--radius-pill);
  background-color: var(--scroll-bead); background-clip: padding-box; background-origin: padding-box; background-repeat: no-repeat; background-position: center;
  background-image: var(--lb-bead-mark), linear-gradient(90deg, var(--lb-bead-lit), var(--lb-bead-deep));
  background-size: 6px 6px, auto; box-shadow: inset 0 0 0 var(--stroke-hair) var(--lb-bead-edge);
}
*::-webkit-scrollbar-thumb:horizontal { background-image: var(--lb-bead-mark), linear-gradient(180deg, var(--lb-bead-lit), var(--lb-bead-deep)); }
*::-webkit-scrollbar-thumb:hover, *::-webkit-scrollbar-thumb:active { background-color: var(--scroll-bead-hover); }
/* a browser without these pseudo-elements (Firefox): the same colours on its own thin bar, with no thread */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-bead) transparent; }
}
/* a thumb has no bar to grab: on touch the bar goes, and .lb-scroll-fade says there is more */
@media (hover: none), (pointer: coarse) {
  :root { --lb-scroll-gutter: 0px; }
  * { scrollbar-width: none; }
  *::-webkit-scrollbar { display: none; }
}

/* what lies beyond the edge shows: the content melts into the sheet on the side it can still scroll to. On a scroller
   inside a sheet, never on the sheet itself: the mask would show the dusk behind it. Where scroll timelines are missing
   nothing fades, and with nothing to scroll the timeline stays inactive and both ends keep their 0. */
@property --lb-scroll-top { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --lb-scroll-bottom { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes lb-scroll-top { from { --lb-scroll-top: 0px; } to { --lb-scroll-top: var(--space-6); } }
@keyframes lb-scroll-bottom { from { --lb-scroll-bottom: var(--space-6); } to { --lb-scroll-bottom: 0px; } }
@supports (animation-timeline: scroll()) {
  .lb-scroll-fade {
    --lb-scroll-mask: linear-gradient(180deg, transparent, #000 var(--lb-scroll-top), #000 calc(100% - var(--lb-scroll-bottom)), transparent), linear-gradient(#000 0 0) right / var(--lb-scroll-gutter) 100% no-repeat;
    -webkit-mask: var(--lb-scroll-mask); mask: var(--lb-scroll-mask);
    animation: lb-scroll-top linear both, lb-scroll-bottom linear both;
    animation-timeline: scroll(self), scroll(self);
    animation-range: 0px var(--space-6), calc(100% - var(--space-6)) 100%;
  }
}

/* ---------- modal: the world steps back behind an open window ---------- */
.lb-modal { position: absolute; inset: 0; display: grid; place-items: center; background: var(--scrim); -webkit-backdrop-filter: blur(4px) saturate(0.8); backdrop-filter: blur(4px) saturate(0.8); opacity: 0; visibility: hidden; }
.lb-modal.is-open { visibility: visible; animation: lb-fade-in var(--lb-fade) linear both; }
.lb-modal.is-open .lb-modal__panel { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) both; --lb-from: 0.92; }
.lb-modal.is-closing { visibility: visible; animation: lb-fade-out 160ms linear both; }
.lb-modal.is-closing .lb-modal__panel { animation: lb-modal-out 160ms var(--lb-e-in) both; }
@keyframes lb-modal-out { to { transform: scale(0.96); } }

/* ---------- dialogue: a round portrait in gold light, a cream name tag, a parchment scroll ---------- */
.lb-dialogue { position: relative; width: 1320px; height: 270px; }
.lb-dialogue__halo { position: absolute; left: -70px; top: -90px; width: 440px; height: 440px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 200, 120, 0.38), rgba(255, 190, 100, 0.1) 60%, transparent); }
.lb-dialogue__portrait {
  position: absolute; z-index: 3; left: 0; top: -20px; width: 300px; height: 300px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--dusk-500), var(--dusk-850) 75%);
  box-shadow: none; transform: scale(0);
}
.lb-dialogue__portrait img { position: absolute; left: 50%; top: 56%; width: 128%; max-width: none; translate: -50% -50%; }
.lb-dialogue__portrait::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 -30px 40px rgba(0, 0, 0, 0.35); }
.lb-dialogue__scrollwrap { position: absolute; left: 150px; right: 0; top: 30px; bottom: 0; transform-origin: left center; transform: scaleX(0); }
.lb-dialogue__scroll { position: relative; height: 100%; padding: 54px 80px 0 196px; }
.lb-dialogue__scroll .lb-parchment__sheet::after {
  background: url('../../assets/ui/PROVIDED_dialogue-flourish.webp') center / 100% 100% no-repeat;
  -webkit-mask: none; mask: none; opacity: 1;
}
.lb-dialogue__name {
  position: absolute; z-index: 4; left: 330px; top: -6px; height: 66px; display: flex; align-items: center; gap: var(--space-3); padding: 0 34px;
  border-radius: 33px; background: var(--speaker-surface); color: var(--umber-900); font: italic 900 38px/44px var(--font-ui);
  box-shadow: var(--speaker-shadow, 0 6px 14px rgba(14, 7, 2, 0.3)); transform: scale(0);
}
.lb-dialogue__text { position: relative; margin: 0; min-height: 104px; font: 700 37px/52px var(--font-ui); color: var(--umber-900); }
.lb-dialogue__next { position: absolute; right: 60px; bottom: 34px; width: 26px; height: 20px; background: var(--gold-600);
  clip-path: polygon(0 0, 100% 0, 50% 100%); opacity: 0; animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; }
.lb-dialogue.is-done .lb-dialogue__next { opacity: 1; transition: opacity var(--lb-fade) linear; }
/* answers hang from the scroll's foot, the main one in amber */
.lb-dialogue__choices { position: absolute; z-index: 5; right: 56px; bottom: -40px; display: flex; gap: 22px; opacity: 0; transform: scale(0.9); pointer-events: none; }
.lb-dialogue.is-choices .lb-dialogue__choices { opacity: 1; transform: scale(1); pointer-events: auto; transition: opacity var(--lb-fade) linear, transform var(--lb-fade) var(--lb-e-out); }
.lb-dialogue.is-choices .lb-dialogue__next { opacity: 0; }
.lb-dialogue.is-open .lb-dialogue__portrait { animation: lb-land var(--lb-bounce) var(--lb-e-bounce) both; }
.lb-dialogue.is-open .lb-dialogue__scrollwrap { animation: lb-unfold-x var(--lb-unfold) var(--lb-e-out) 75ms both; }
.lb-dialogue.is-open .lb-dialogue__name { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) 220ms both; }
.lb-dialogue.is-closing .lb-dialogue__scrollwrap { transform: scaleX(1); animation: lb-fold-x calc(var(--lb-unfold) * 0.65) var(--lb-e-in) both; }
.lb-dialogue.is-closing .lb-dialogue__portrait { transform: scale(1); animation: lb-sink-out calc(var(--lb-bounce) * 0.55) var(--lb-e-sink) 80ms both; }
.lb-dialogue.is-closing .lb-dialogue__name { transform: scale(1); animation: lb-sink-out var(--lb-quick) var(--lb-e-sink) both; }
.lb-dialogue.is-static .lb-dialogue__portrait, .lb-dialogue.is-static .lb-dialogue__scrollwrap, .lb-dialogue.is-static .lb-dialogue__name { transform: none; }

/* ---------- toast: a dusk card that says what happened and where to look ---------- */
.lb-toast {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-5); min-width: 640px; padding: var(--space-4) var(--space-7) var(--space-4) var(--space-4);
  border-radius: var(--radius-lg); color: var(--cream);
  background: radial-gradient(120% 120% at 20% 0%, var(--dusk-600), var(--dusk-850) 70%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.5), var(--elev-3), var(--glow-soft);
}
.lb-toast__icon { flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--dusk-500), var(--dusk-850) 75%); box-shadow: inset 0 0 0 2.5px var(--gold-300), var(--glow-soft); }
.lb-toast__icon img { width: 60px; height: 60px; object-fit: contain; }
.lb-toast__title { font: 900 30px/36px var(--font-ui); }
.lb-toast__body { display: flex; align-items: center; gap: var(--space-2); margin-top: 4px; font: 700 23px/28px var(--font-ui); color: var(--cream-300); }
.lb-toast--bond .lb-toast__icon { box-shadow: var(--glow-bond); }
.lb-toast--bond .lb-toast__title { color: var(--bond-300); }
.lb-toast--reward .lb-toast__icon { box-shadow: inset 0 0 0 2.5px var(--gold-300), var(--glow-reward); }
.lb-toast.is-in { animation: lb-pop-in 300ms var(--lb-e-pop) both; --lb-from: 0.85; }
.lb-toast.is-out { animation: lb-fade-out 400ms linear both; }
.lb-motes { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.lb-motes > i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--bond-300); box-shadow: 0 0 12px var(--bond-300); animation: lb-mote 1200ms var(--lb-e-out) both; }
.lb-motes > i:nth-child(even) { background: var(--gold-300); box-shadow: 0 0 12px var(--gold-300); }

/* ---------- quest slip: a compact parchment (add .lb-parchment for its torn edge) ---------- */
.lb-quest {
  position: relative; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; column-gap: var(--space-4); row-gap: 6px;
  padding: 22px 30px 24px 26px; color: var(--ink); transition: transform var(--lb-pop) var(--lb-e-pop);
}
.lb-quest__marker { grid-row: span 2; width: 56px; height: 56px; object-fit: contain; align-self: start; margin-top: -4px; }
.lb-quest__title { margin: 0; grid-column: 2 / 4; font: 900 30px/36px var(--font-ui); }
.lb-quest__objective { margin: 0; font: 700 24px/30px var(--font-ui); color: var(--ink-muted); }
.lb-quest__count { font: 900 24px/30px var(--font-ui); color: var(--ink); }
.lb-quest.is-ready .lb-quest__objective { color: var(--ready-700); }
.lb-quest.is-ready .lb-quest__marker { animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; --lb-bob-distance: -6px; }
.lb-quest.is-tracked::after { content: ""; position: absolute; left: -18px; top: 30px; width: 18px; height: 18px; background: var(--gold-300); clip-path: var(--lb-star); filter: drop-shadow(0 0 4px var(--glow)); }

/* ---------- chips ---------- */
.lb-chip { display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); border-radius: 11px; white-space: nowrap;
  font: 900 20px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-200);
  background: linear-gradient(180deg, var(--dusk-600), var(--dusk-850)); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.5), var(--elev-1); }
.lb-chip--paper { color: var(--umber-900); background: linear-gradient(180deg, var(--parchment-100), var(--parchment-300)); box-shadow: inset 0 0 0 1.5px rgba(176, 122, 64, 0.6), inset 0 1px 0 #fff; }
.lb-chip--main { color: var(--dusk-800); background: linear-gradient(180deg, var(--gold-200), var(--quest-main)); box-shadow: inset 0 0 0 1.5px var(--gold-600); }
.lb-chip--side { color: var(--dusk-950); background: linear-gradient(180deg, #8cc0e6, var(--quest-side)); box-shadow: inset 0 0 0 1.5px var(--sky-700); }
.lb-chip--bond { color: var(--bond-900); background: linear-gradient(180deg, #9ffff3, var(--bond-500)); box-shadow: 0 0 0 2px var(--bond-700), 0 0 14px rgba(102, 255, 237, 0.45); }
.lb-chip--ready { color: var(--dusk-800); background: linear-gradient(180deg, #d4f2b6, var(--ready-300)); box-shadow: inset 0 0 0 1.5px var(--ready-500); }
.lb-level { display: inline-grid; place-items: center; height: 40px; padding: 0 var(--space-4); border-radius: 11px; font: 900 20px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold-200); background: linear-gradient(180deg, var(--dusk-600), var(--dusk-850)); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.5), var(--elev-1); }
.lb-level.is-up { animation: lb-punch 400ms both; --lb-punch: 1.18; }

/* ---------- party alcove (.lb-slot): a member stands on a lit parchment arch framed in gold; a free slot stays dark ---------- */
.lb-slot { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-3); width: 300px; font: inherit; border: 0; padding: 0; background: none; cursor: pointer; color: var(--ink); }
.lb-slot__well {
  position: relative; display: grid; place-items: end center; width: 300px; height: 250px; border-radius: 150px 150px 24px 24px; overflow: hidden;
  background: radial-gradient(70% 55% at 50% 30%, #fffdf6 0%, rgba(255, 250, 236, 0) 70%), var(--lb-washi),
    linear-gradient(180deg, var(--parchment-50) 0%, var(--parchment-100) 45%, var(--parchment-200) 78%, var(--parchment-300) 100%);
  box-shadow: inset 0 0 0 2px var(--gold-300), inset 0 0 0 7px rgba(255, 250, 236, 0.55), inset 0 0 0 8px rgba(168, 108, 38, 0.35),
    inset 0 -18px 30px rgba(176, 122, 64, 0.28), 0 0 0 3px rgba(14, 7, 2, 0.55), var(--glow-strong);
  transition: transform var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) linear;
}
/* the floor the character stands on */
.lb-slot__well::before { content: ""; position: absolute; left: 50%; bottom: 10px; width: 210px; height: 44px; translate: -50% 0; background: radial-gradient(closest-side, rgba(110, 66, 28, 0.38), rgba(110, 66, 28, 0.12) 60%, transparent); }
.lb-slot__art { position: relative; width: 224px; height: 224px; margin-bottom: 8px; object-fit: contain; filter: drop-shadow(0 6px 5px rgba(90, 50, 20, 0.32)); }
.lb-slot__name { display: flex; align-items: center; gap: var(--space-4); font: 900 36px/40px var(--font-ui); color: var(--ink); }
.lb-slot__level { position: static; }
.lb-slot__tag { position: absolute; top: -12px; right: -8px; z-index: 2; }
.lb-slot:hover .lb-slot__well { transform: translateY(-4px); }
.lb-slot.is-selected .lb-slot__well { box-shadow: inset 0 0 0 3px var(--gold-200), inset 0 0 0 7px rgba(255, 250, 236, 0.55), inset 0 -18px 30px rgba(176, 122, 64, 0.28), 0 0 0 3px rgba(14, 7, 2, 0.55), var(--glow-select), var(--glow-strong); transform: translateY(-4px); }
.lb-slot.is-following .lb-slot__well { box-shadow: inset 0 0 0 3px var(--bond-300), inset 0 0 0 7px rgba(255, 250, 236, 0.55), inset 0 -18px 30px rgba(176, 122, 64, 0.28), 0 0 0 3px rgba(14, 7, 2, 0.55), var(--glow-bond); }
.lb-slot.is-empty .lb-slot__well { place-items: center; background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.18)); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.28), inset 0 0 0 7px rgba(0, 0, 0, 0.1); }
.lb-slot.is-empty .lb-slot__well::before { display: none; }
.lb-slot.is-empty .lb-slot__name { color: var(--ink-hint); }
.lb-slot__add { position: relative; width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, var(--parchment-100), var(--parchment-400)); opacity: 0.7;
  box-shadow: var(--elev-1); animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; --lb-bob-distance: -6px; }
.lb-slot__add::before, .lb-slot__add::after { content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 11px; margin: -5.5px 0 0 -20px; border-radius: 6px; background: var(--umber-600); }
.lb-slot__add::after { transform: rotate(90deg); }
.lb-slot.is-landing .lb-slot__art { animation: lb-land 380ms var(--lb-e-bounce) both; }
.lb-slot.is-leaving .lb-slot__art { animation: lb-sink-out 240ms var(--lb-e-sink) both; }
.lb-slot:focus-visible { outline: none; }
.lb-slot:focus-visible .lb-slot__well { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 8px; }

/* ---------- item socket (.lb-item): a pocket set into dusk, or pressed into parchment ---------- */
.lb-tray { padding: 22px; border-radius: var(--radius-lg); background: rgba(0, 0, 0, 0.2); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 216, 137, 0.12); }
.lb-item {
  position: relative; display: grid; place-items: center; width: var(--size, 120px); height: var(--size, 120px); padding: 0; border: 0; cursor: pointer; border-radius: var(--radius-md);
  background: radial-gradient(70% 70% at 50% 40%, rgba(255, 210, 140, 0.12), transparent 70%), linear-gradient(180deg, var(--dusk-700), var(--dusk-900));
  box-shadow: inset 0 0 0 1px rgba(255, 216, 137, 0.2), inset 0 4px 10px rgba(0, 0, 0, 0.45);
  transition: transform var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) linear;
}
.lb-item__art { width: 76%; height: 76%; object-fit: contain; filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.55)); }
.lb-item__count { position: absolute; right: 7px; bottom: 7px; min-width: 32px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 9px;
  background: rgba(17, 9, 4, 0.88); box-shadow: inset 0 0 0 1px rgba(255, 216, 137, 0.3); color: var(--cream); font: 900 19px/1 var(--font-ui); }
.lb-item__new { position: absolute; right: 8px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--new-500);
  box-shadow: 0 0 0 3px var(--cream), 0 0 12px rgba(255, 120, 80, 0.7); animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; --lb-bob-distance: -4px; }
.lb-item:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(255, 216, 137, 0.45), inset 0 4px 10px rgba(0, 0, 0, 0.4), var(--glow-soft); }
/* empty: a dark pocket, showing what it takes as a faint silhouette */
.lb-item.is-empty { cursor: default; background: linear-gradient(180deg, var(--dusk-850), var(--dusk-950)); box-shadow: inset 0 0 0 1px rgba(255, 216, 137, 0.08), inset 0 3px 8px rgba(0, 0, 0, 0.35); }
.lb-item.is-empty:hover { transform: none; }
.lb-item.is-empty .lb-item__art { filter: brightness(0) invert(0.9) sepia(0.6); opacity: 0.12; }
.lb-item.is-locked { cursor: not-allowed; background: linear-gradient(180deg, var(--dusk-850), var(--dusk-950)); }
.lb-item.is-locked .lb-item__art { width: 48%; height: 48%; opacity: 0.5; filter: none; }
.lb-item__caption { position: absolute; left: 0; right: 0; bottom: 8px; font: 900 18px/1 var(--font-ui); color: var(--cream-500); text-align: center; }
/* chosen: a gold line with light in and around it, breathing corner marks, and the item lifts */
.lb-item.is-selected { transform: translateY(-4px) scale(1.04); box-shadow: var(--glow-select);
  background: radial-gradient(70% 70% at 50% 40%, rgba(255, 210, 140, 0.3), transparent 72%), linear-gradient(180deg, var(--dusk-600), var(--dusk-800)); }
.lb-item.is-selected::before {
  content: ""; position: absolute; inset: -12px; pointer-events: none; --c: var(--gold-200);
  background:
    linear-gradient(var(--c), var(--c)) top left / 18px 3px, linear-gradient(var(--c), var(--c)) top left / 3px 18px,
    linear-gradient(var(--c), var(--c)) top right / 18px 3px, linear-gradient(var(--c), var(--c)) top right / 3px 18px,
    linear-gradient(var(--c), var(--c)) bottom left / 18px 3px, linear-gradient(var(--c), var(--c)) bottom left / 3px 18px,
    linear-gradient(var(--c), var(--c)) bottom right / 18px 3px, linear-gradient(var(--c), var(--c)) bottom right / 3px 18px;
  background-repeat: no-repeat; filter: drop-shadow(0 0 5px rgba(255, 196, 110, 0.9)); animation: lb-breathe 1.4s var(--lb-e-sway) infinite alternate;
}
.lb-item.is-ready { box-shadow: var(--glow-bond); }
.lb-item.is-landing .lb-item__art { animation: lb-land 320ms var(--lb-e-bounce) both; }
.lb-item:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 6px; }
/* on parchment: a little well pressed into the paper */
.lb-parchment .lb-item { background: radial-gradient(70% 70% at 50% 40%, rgba(255, 255, 255, 0.35), transparent 70%), linear-gradient(180deg, var(--parchment-300), var(--parchment-200));
  box-shadow: inset 0 0 0 1px rgba(176, 122, 64, 0.45), inset 0 3px 6px rgba(125, 81, 36, 0.3); }
.lb-parchment .lb-item .lb-item__art { filter: drop-shadow(0 4px 3px rgba(90, 50, 20, 0.35)); }
.lb-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), max-content); gap: var(--space-4); }

/* ---------- list rows: what you browse; the chosen row is lit, with a gold star ---------- */
.lb-list { display: flex; flex-direction: column; gap: var(--space-1); }
.lb-row { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; min-height: 84px; padding: 8px 18px 8px 12px;
  border: 0; border-radius: 14px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: background-color var(--lb-quick) linear; }
.lb-row:hover { background: rgba(176, 122, 64, 0.12); }
.lb-row.is-selected { background: linear-gradient(90deg, rgba(255, 216, 137, 0.75), rgba(255, 230, 180, 0.25)); box-shadow: inset 0 0 0 1.5px rgba(168, 108, 38, 0.55); }
.lb-row.is-selected::before { content: ""; position: absolute; left: -28px; top: 50%; width: 20px; height: 20px; translate: 0 -50%; background: var(--gold-600); clip-path: var(--lb-star);
  animation: lb-point var(--lb-bob) var(--lb-e-sway) infinite alternate; }
.lb-row__title { display: block; font: 900 28px/32px var(--font-ui); }
.lb-row__sub { display: block; margin-top: 4px; font: 700 22px/26px var(--font-ui); color: var(--ink-muted); }
.lb-row__end { font: 900 26px/1 var(--font-ui); color: var(--ink-muted); }
.lb-row .lb-item { --size: 72px; cursor: inherit; border-radius: 14px; }
.lb-row .lb-item:hover { transform: none; }
.lb-row:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 2px; }

/* ---------- facts: a stat with its glyph, its value and what a choice would change ---------- */
.lb-stat { display: grid; grid-template-columns: 48px 1fr auto 64px; align-items: center; gap: var(--space-4); height: 60px; border-bottom: 1px solid var(--line); }
.lb-stat:last-child { border-bottom: 0; }
.lb-stat__name { font: 700 26px/1 var(--font-ui); color: var(--ink-muted); }
.lb-stat__value { font: 900 32px/1 var(--font-ui); color: var(--ink); text-align: right; }
.lb-stat__delta { font: 900 23px/1 var(--font-ui); color: var(--gain); text-align: right; }
.lb-stat__delta.is-down { color: var(--loss); }
.lb-glyph { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, var(--dusk-600), var(--dusk-900));
  box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.55), var(--elev-1); }
.lb-glyph img, .lb-glyph svg { width: 26px; height: 26px; object-fit: contain; }
.lb-coin { display: inline-flex; align-items: center; gap: var(--space-3); font: 900 32px/1 var(--font-ui); color: var(--cream); }
.lb-coin img { width: 50px; height: 50px; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.5)); }

/* ---------- medallion: a portrait in a disc of dusk, ringed in gold light ---------- */
.lb-medal { position: relative; display: block; flex: none; width: var(--d, 96px); height: var(--d, 96px); border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--dusk-500), var(--dusk-850) 75%);
  box-shadow: inset 0 0 0 calc(var(--d, 96px) * 0.02 + 1px) var(--gold-300), 0 0 0 calc(var(--d, 96px) * 0.035) rgba(14, 7, 2, 0.65), var(--glow-soft), var(--elev-2); }
.lb-medal img { position: absolute; left: 50%; top: 56%; width: 128%; max-width: none; translate: -50% -50%; }
.lb-medal--paper { background: radial-gradient(circle at 50% 38%, var(--parchment-50), var(--parchment-300)); }
/* the hero on a pool of light and a slow magic circle (lostbonds.js draws the circle) */
.lb-pedestal { position: relative; display: grid; place-items: center; }
.lb-pedestal::before { content: ""; position: absolute; inset: 4% -6% 6%; background: radial-gradient(closest-side, rgba(255, 214, 140, 0.42), rgba(255, 190, 100, 0.12) 55%, transparent); }
.lb-pedestal::after { content: ""; position: absolute; left: 24%; right: 24%; bottom: 9%; height: 12%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent); }
.lb-pedestal > img { position: relative; z-index: 1; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.35)); }
.lb-pedestal__circle { position: absolute; left: 50%; top: 50%; width: 96%; aspect-ratio: 1; translate: -50% -50%; color: var(--gold-300); opacity: 0.55;
  filter: drop-shadow(0 0 8px rgba(255, 190, 100, 0.6)); animation: lb-turn-slow 120s linear infinite; }
/* on parchment the light is paper-white and the shadow warm */
.lb-parchment .lb-pedestal::before { background: radial-gradient(closest-side, rgba(255, 255, 255, 0.85), rgba(255, 236, 200, 0.4) 50%, transparent); }
.lb-parchment .lb-pedestal::after { background: radial-gradient(closest-side, rgba(125, 81, 36, 0.35), transparent); }
/* a vermilion ribbon hanging from a book's spine */
.lb-ribbon { position: absolute; z-index: 6; width: 40px; height: 160px; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.45));
  background: linear-gradient(90deg, var(--vermilion-600), var(--vermilion-300) 40%, var(--vermilion-500) 70%, var(--vermilion-600));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); -webkit-mask: linear-gradient(transparent, #000 44px); mask: linear-gradient(transparent, #000 44px); }

/* ---------- part evolution node: a skill socket, teal when it can evolve ---------- */
.lb-part { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-3); width: 132px; color: var(--ink); }
.lb-part__token { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.5)); }
.lb-part__name { font: 900 18px/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }
.lb-part__node {
  position: relative; display: grid; place-items: center; width: 124px; height: 124px; border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--dusk-700), var(--dusk-900)); box-shadow: inset 0 0 0 1px rgba(255, 216, 137, 0.2), inset 0 4px 10px rgba(0, 0, 0, 0.45);
  transition: transform var(--lb-pop) var(--lb-e-pop);
}
.lb-part__node img { width: calc(100% - 20px); height: calc(100% - 20px); border-radius: 12px; object-fit: cover; }
.lb-part__node .lb-part__lock { position: absolute; width: 48%; height: 48%; border-radius: 0; object-fit: contain; opacity: 0.5; }
.lb-part__level { position: absolute; left: 0; right: 0; bottom: 8px; font: 900 18px/1 var(--font-ui); color: var(--cream-500); text-align: center; }
.lb-part__node::after { content: ""; position: absolute; inset: -6px; border-radius: inherit; border: 4px solid var(--bond-300); opacity: 0; pointer-events: none; }
.lb-part__tier { position: absolute; right: 6px; top: 6px; min-width: 36px; height: 28px; padding: 0 7px; border-radius: 9px; font: 400 26px/28px var(--font-display); color: var(--bond-900); text-align: center;
  background: linear-gradient(180deg, #a8fff4, var(--bond-500)); box-shadow: 0 0 0 2px var(--bond-700); }
/* the thread of light from a skill to its evolved form */
.lb-part__thread { display: flex; flex-direction: column; align-items: center; height: 64px; padding: 4px 0; color: rgba(255, 216, 137, 0.55); }
.lb-part__thread::before, .lb-part__thread::after { content: ""; flex: 1; width: 2px; background: currentColor; opacity: 0.6; }
.lb-part__thread > i { width: 18px; height: 18px; margin: 3px 0; background: currentColor; clip-path: var(--lb-star); }
.lb-part__thread.is-ready { color: var(--bond-300); }
.lb-part.is-locked .lb-part__node { background: linear-gradient(180deg, var(--dusk-850), var(--dusk-950)); }
.lb-part.is-available .lb-part__node { box-shadow: var(--glow-bond); }
.lb-part.is-evolved .lb-part__node { box-shadow: var(--glow-select); }
.lb-part.is-evolving .lb-part__node { animation: lb-punch 300ms both; --lb-punch: 1.07; }
.lb-part.is-evolving .lb-part__node::after { animation: lb-ring-burst var(--lb-reward) var(--lb-e-out) both; }
.lb-tick { position: absolute; right: 6px; bottom: 6px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--gold-200), var(--gold-500));
  box-shadow: 0 0 0 2px var(--dusk-900), 0 0 10px rgba(255, 196, 110, 0.6); }
.lb-tick::after { content: ""; position: absolute; left: 11px; top: 6px; width: 8px; height: 15px; border: solid var(--dusk-800); border-width: 0 4px 4px 0; transform: rotate(40deg); }

/* ---------- combat skill card ---------- */
.lb-skill {
  position: relative; display: grid; place-items: center; width: 168px; height: 168px; padding: 0; border: 0; cursor: pointer; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--dusk-700), var(--dusk-900)); box-shadow: inset 0 0 0 2px rgba(255, 216, 137, 0.35), inset 0 4px 10px rgba(0, 0, 0, 0.45), var(--elev-2);
  transition: transform var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) linear, filter var(--lb-quick) linear;
}
.lb-skill__art { width: 140px; height: 140px; border-radius: var(--radius-md); object-fit: cover; }
.lb-skill__cost {
  position: absolute; left: -14px; top: -14px; min-width: 60px; height: 60px; padding: 0 12px; display: grid; place-items: center; border-radius: 30px;
  background: radial-gradient(circle at 50% 35%, var(--spirit-500), var(--spirit-700)); color: var(--cream); font: 900 26px/1 var(--font-ui);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 0 3px var(--dusk-900), var(--elev-1);
}
.lb-skill__element { position: absolute; right: -14px; top: -14px; width: 56px; height: 56px; }
.lb-skill__key { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); }
.lb-skill:hover, .lb-skill.is-hover { transform: translateY(-8px); box-shadow: inset 0 0 0 2px var(--gold-300), inset 0 4px 10px rgba(0, 0, 0, 0.4), var(--elev-2), var(--glow-soft); }
.lb-skill.is-selected { transform: translateY(-8px) scale(1.06); box-shadow: var(--glow-select), var(--glow-reward), var(--elev-2); }
.lb-skill:active { transform: translateY(-2px) scale(0.96); transition-duration: var(--lb-tap); }
.lb-skill.is-unaffordable .lb-skill__art { filter: grayscale(1) brightness(0.75); }
.lb-skill.is-unaffordable .lb-skill__cost { background: radial-gradient(circle at 50% 35%, var(--vitality-500), var(--vitality-700)); }
.lb-skill.is-locked { cursor: not-allowed; }
.lb-skill.is-locked .lb-skill__art { filter: grayscale(1) brightness(0.3); }
.lb-skill.is-locked:hover { transform: none; box-shadow: inset 0 0 0 2px rgba(255, 216, 137, 0.35), var(--elev-2); animation: lb-shake var(--lb-pop) var(--lb-e-out); }
.lb-skill__lock { position: absolute; width: 72px; height: 72px; }
.lb-skill:focus-visible { outline: var(--stroke-focus) solid var(--focus-ring); outline-offset: 8px; }
.lb-skill.is-entering { animation: lb-pop-in 420ms var(--lb-e-pop) both; animation-delay: calc(var(--i, 0) * var(--lb-step)); }
.lb-skill.is-exiting { animation: lb-sink-out 220ms var(--lb-e-in) both; }
.lb-skillbar { position: relative; display: flex; gap: var(--space-5); padding: var(--space-5) var(--space-6) var(--space-6); border-radius: var(--radius-xl);
  background: radial-gradient(120% 120% at 50% 0%, var(--dusk-600), var(--dusk-850) 70%); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.45), var(--elev-3); }
.lb-details { width: 560px; padding: var(--space-6); border-radius: var(--radius-lg); color: var(--cream);
  background: radial-gradient(120% 120% at 20% 0%, var(--dusk-600), var(--dusk-850) 70%); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.5), var(--elev-3), var(--glow-soft); transform-origin: 50% 100%; }
.lb-details.is-in { animation: lb-details-in 200ms both; }
@keyframes lb-details-in {
  0% { transform: scale(0.9); opacity: 0; animation-timing-function: var(--lb-e-settle); }
  40% { transform: scale(1.035); opacity: 1; animation-timing-function: var(--lb-e-settle); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- stat bar: a track set into dusk, a fill that glows ---------- */
.lb-bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); color: var(--ink); --value: 1; --ghost: 1; --bar-fill: linear-gradient(180deg, #f07a5e, var(--vitality-700)); --bar-glow: rgba(240, 122, 94, 0.5); }
.lb-bar__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, var(--dusk-600), var(--dusk-900));
  box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.55), var(--elev-1); }
.lb-bar__icon img { width: 28px; height: 28px; object-fit: contain; }
.lb-bar__track { position: relative; height: 24px; padding: 3px; border-radius: var(--radius-pill); background: linear-gradient(180deg, var(--dusk-950), var(--dusk-850)); box-shadow: var(--inset); overflow: hidden; }
.lb-bar__fill, .lb-bar__ghost { position: absolute; left: 3px; top: 3px; bottom: 3px; border-radius: var(--radius-pill); }
.lb-bar__fill { width: calc((100% - 6px) * var(--value)); background: var(--bar-fill); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 0 10px var(--bar-glow); transition: width var(--lb-tap) var(--lb-e-out); }
.lb-bar__ghost { width: calc((100% - 6px) * var(--ghost)); background: var(--cream); opacity: 0.85; transition: width 500ms var(--lb-e-out) 150ms; }
.lb-bar.is-healing .lb-bar__fill { transition: width 450ms var(--lb-e-sway); }
.lb-bar.is-healing .lb-bar__ghost { transition: none; }
.lb-bar.is-draining .lb-bar__fill { transition: width var(--lb-drain) var(--lb-e-sway); }
.lb-bar__value { min-width: 120px; font: 700 22px/28px var(--font-ui); text-align: right; color: var(--ink-muted); }
.lb-bar__value b { font-weight: 900; font-size: 26px; color: var(--ink); }
.lb-bar--energy { --bar-fill: linear-gradient(180deg, #79a8e8, var(--spirit-700)); --bar-glow: rgba(121, 168, 232, 0.5); }
.lb-bar--xp { --bar-fill: linear-gradient(180deg, #c08ae0, var(--growth-500)); --bar-glow: rgba(192, 138, 224, 0.5); }
.lb-bar--axp { --bar-fill: linear-gradient(90deg, var(--axp-300), var(--axp-500)); --bar-glow: rgba(236, 119, 59, 0.5); }
.lb-bar--bond { --bar-fill: linear-gradient(90deg, var(--bond-500), var(--bond-300)); --bar-glow: rgba(102, 255, 237, 0.5); }
.lb-bar.is-low .lb-bar__track { overflow: visible; }
.lb-bar.is-low .lb-bar__track::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--vitality-500), 0 0 18px rgba(228, 90, 90, 0.6); opacity: 0;
  animation: lb-low-pulse var(--lb-bob) var(--lb-e-sway) infinite alternate;
}
@keyframes lb-low-pulse { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lb-glow::after, .lb-item.is-ready::after, .lb-part.is-available .lb-part__node::before, .lb-bar.is-low .lb-bar__track::after { animation: none !important; }
}
:root.lb-reduced .lb-glow::after, :root.lb-reduced .lb-item.is-ready::after, :root.lb-reduced .lb-part.is-available .lb-part__node::before, :root.lb-reduced .lb-bar.is-low .lb-bar__track::after { animation: none !important; }
.lb-bar.is-hit .lb-bar__track { animation: lb-shake var(--lb-pop) var(--lb-e-out); }

/* ---------- turn order ---------- */
.lb-turn { position: relative; display: inline-flex; align-items: center; gap: var(--space-4); height: 136px; padding: 0 var(--space-5); border-radius: var(--radius-pill);
  background: radial-gradient(120% 120% at 50% 0%, var(--dusk-600), var(--dusk-850) 70%); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.45), var(--elev-2); }
.lb-turn__unit {
  position: relative; flex: none; width: 88px; height: 88px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--dusk-500), var(--dusk-850) 75%); box-shadow: inset 0 0 0 3px var(--cream-300);
  transition: width var(--lb-pop) var(--lb-e-pop), height var(--lb-pop) var(--lb-e-pop), box-shadow var(--lb-quick) linear;
}
.lb-turn__unit img { width: 100%; height: 100%; object-fit: cover; }
.lb-turn__unit--enemy { box-shadow: inset 0 0 0 3px var(--vitality-500); }
.lb-turn__unit.is-active { width: 112px; height: 112px; box-shadow: inset 0 0 0 4px var(--gold-300), var(--glow-reward); }
.lb-turn__chevron { position: absolute; top: -30px; width: 40px; height: 30px; background: var(--gold-300); clip-path: polygon(50% 100%, 0 0, 100% 0); filter: drop-shadow(0 0 6px var(--glow));
  animation: lb-bob var(--lb-bob) var(--lb-e-sway) infinite alternate; --lb-bob-distance: 6px; transition: left var(--lb-unfold) var(--lb-e-out); }
.lb-turn__round { margin-left: var(--space-3); padding-left: var(--space-5); border-left: var(--stroke-hair) solid var(--line); color: var(--gold-200); font: 400 40px/44px var(--font-display); white-space: nowrap;
  text-shadow: 0 0 14px rgba(255, 190, 100, 0.45); }
.lb-turn__unit.is-leaving { animation: lb-sink-out 240ms var(--lb-e-sink) both; }
.lb-turn__unit.is-arriving { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) both; }

/* ---------- status medal ---------- */
.lb-status { position: relative; display: inline-block; width: 64px; height: 64px; }
.lb-status img { width: 64px; height: 64px; border-radius: var(--radius-sm); }
.lb-status__turns { position: absolute; right: -8px; bottom: -8px; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border-radius: 15px;
  background: var(--dusk-950); color: var(--cream); font: 900 18px/18px var(--font-ui); box-shadow: inset 0 0 0 1.5px rgba(255, 216, 137, 0.55); }
.lb-status::after { content: ""; position: absolute; inset: -4px; border-radius: 18px; border: 3px solid var(--gold-200); opacity: 0; pointer-events: none; }
.lb-status.is-applied { animation: lb-pop-in var(--lb-pop) var(--lb-e-pop) both; }
.lb-status.is-applied::after { animation: lb-ring-burst 500ms var(--lb-e-out) 120ms both; }
.lb-status.is-tick { animation: lb-punch 300ms both; --lb-punch: 1.15; }
.lb-status.is-expiring { animation: lb-sink-out var(--lb-fade) var(--lb-e-sink) both; }

/* ---------- floating combat number ---------- */
.lb-num {
  position: absolute; left: 50%; top: 0; display: grid; place-items: center; width: 150px; height: 102px;
  background: var(--burst, none) center / contain no-repeat; pointer-events: none;
  font: 400 60px/1 var(--font-display); color: var(--umber-900); -webkit-text-stroke: 9px #f9dcc0; paint-order: stroke fill;
  animation: lb-num-rise 950ms both;
}
.lb-num--heal { color: var(--cream); -webkit-text-stroke: 8px var(--vitality-700); text-shadow: none; }
.lb-num--energy { color: var(--cream); -webkit-text-stroke: 6px var(--dusk-900); text-shadow: none; width: 104px; height: 104px; font-size: 44px; }
.lb-num--crit { width: 184px; height: 152px; font-size: 72px; }
.lb-num--crit > span { display: inline-block; animation: lb-shake var(--lb-pop) var(--lb-e-out) 200ms; }
.lb-num--miss { background: none; color: var(--cream); font-family: var(--font-ui); font-weight: 900; font-size: 36px; text-shadow: 0 3px 0 var(--dusk-900); }
.lb-stage { position: relative; }
