/* lich.tools
 *
 * Art direction: 1930s occult noir, which is where Deadlock lives too. Warm
 * near-black rather than the usual blue-black, aged brass as the only real
 * accent, high-contrast display serif against an industrial grotesque, and
 * hairline rules doing the structural work instead of boxes everywhere.
 *
 * Geometry is deliberately sharp: 2px radii, 1px borders. Soft rounded cards
 * on a dark gradient is the house style of every template on earth.
 */

:root {
  /* Warm blacks. The hue matters: cool greys read as dashboard, warm as print. */
  --ink:        #0b0a08;
  --ink-raised: #15120e;
  --surface:    #1b1713;
  --surface-lit:#221d17;

  /* Panels that sit on top of page artwork. */
  --panel:      #0c0a07;

  --rule:       #2b251d;
  --rule-lit:   #3d3428;

  --paper:      #ece4d6;  /* bone, not white */
  --paper-dim:  #a39682;
  --paper-faint:#6f6554;

  /* Aged brass. One accent, used sparingly, never as a gradient. */
  --brass:      #d8a74e;
  --brass-lit:  #f0c475;
  --brass-deep: #8a6a2c;
  --brass-wash: rgba(216, 167, 78, 0.08);

  /* Sampled from the item type icons on the wiki, lifted where the original
     is too dark to read as text on this background. */
  --weapon:     #e2941f;  /* icon reads #9d620b */
  --vitality:   #9ed13f;  /* icon reads #7bb02a */
  --spirit:     #e1a0ff;
  --spirit-dim: #8a55b3;
  --souls:      #abffe3;

  --hit:  #8ab45c;
  --miss: #c2685c;

  --display: "Fraunces", "Hoefler Text", Georgia, serif;
  --sans: "Archivo", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 78rem;
  --r: 2px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

/* Any class that sets display beats the browser's [hidden] rule, so hiding an
   element by attribute silently stops working. This keeps the attribute
   authoritative wherever it is used. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  font-variation-settings: "wdth" 100;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Film grain. Flat dark surfaces look dead; this is the cheapest fix and
   reads as print rather than as a CSS effect. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-lit); text-decoration: underline; text-underline-offset: 3px; }

code, .mono { font-family: var(--mono); font-size: 0.875em; }

::selection { background: var(--brass-deep); color: var(--paper); }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: 1.5rem;
}

/* --- small caps label, used all over -------------------------------------- */

.label, .eyebrow, .section-title, .control label, th, .nav a, .btn, .env-banner {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* --- non-production marker ----------------------------------------------- */

.env-banner {
  background: var(--brass-deep);
  color: #140f06;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 0.35rem;
  border-bottom: 1px solid var(--brass);
}

/* --- masthead ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.masthead {
  border-bottom: 1px solid var(--rule);
  background: rgba(11, 10, 8, 0.92);
  backdrop-filter: blur(6px);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.wordmark {
  color: var(--paper);
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "SOFT" 0, "WONK" 1;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.wordmark:hover { text-decoration: none; color: var(--brass-lit); }
.wordmark-dim { color: var(--paper-faint); font-weight: 400; }

.nav { display: flex; gap: 0.25rem; }
.nav a {
  color: var(--paper-dim);
  font-size: 0.7rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--r);
}
.nav a:hover {
  color: var(--paper);
  border-color: var(--rule-lit);
  background: var(--ink-raised);
  text-decoration: none;
}

/* --- page furniture ------------------------------------------------------- */

main { flex: 1 0 auto; padding-block: 4rem 6rem; }

.hero { max-width: 46rem; margin-bottom: 4.5rem; }
.hero-compact { margin-bottom: 2.75rem; }

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.65rem;
  color: var(--brass);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
/* Deco rule trailing the label. */
.eyebrow::after {
  content: "";
  flex: 1;
  max-width: 5rem;
  height: 1px;
  background: linear-gradient(90deg, var(--brass-deep), transparent);
}
.eyebrow a { color: var(--brass); }

h1 {
  margin: 0 0 1.1rem;
  font-family: var(--display);
  font-variation-settings: "opsz" 120, "SOFT" 20, "WONK" 1;
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  color: var(--paper-dim);
  font-size: 1.0625rem;
  max-width: 38rem;
}

.section { margin-bottom: 4rem; }

.section-title {
  margin: 0 0 1.5rem;
  font-size: 0.65rem;
  color: var(--paper-faint);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* --- cards ---------------------------------------------------------------- */

.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;                      /* hairline seams, like a printed table */
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  overflow: hidden;
}

.card { background: var(--surface); position: relative; }
.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.card:hover { background: var(--surface-lit); }
.card:hover::after { transform: scaleX(1); }

.card-link { display: block; padding: 1.5rem; color: inherit; }
.card-link:hover { text-decoration: none; }
.card-link h3 {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-variation-settings: "opsz" 24, "WONK" 1;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.card-link p { margin: 0; color: var(--paper-dim); font-size: 0.9rem; }

/* --- empty states --------------------------------------------------------- */

.empty {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--brass-deep);
  border-radius: var(--r);
  background: var(--panel);
  padding: 1.75rem;
}
.empty p { margin: 0; }
.empty p:first-child { font-family: var(--display); font-size: 1.05rem; font-variation-settings: "opsz" 24; }
.empty-note { margin-top: 0.35rem !important; color: var(--paper-faint); font-size: 0.875rem; }

/* --- errors --------------------------------------------------------------- */

.error-code {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 4rem;
  line-height: 1;
  color: var(--brass-deep);
  letter-spacing: -0.04em;
}

/* --- footer --------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 1.75rem;
  color: var(--paper-faint);
  font-size: 0.8125rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.footer-meta { font-family: var(--mono); font-size: 0.75rem; }

/* --- slot badges, matching the game -------------------------------------- */

.slot {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.slot::before {
  content: "";
  width: 1.15em;
  height: 1.15em;
  flex: none;
  background: var(--slot-icon) center / contain no-repeat;
}
.slot-weapon   { --slot-icon: url("/static/img/deadlock/slots/weapon.webp"); }
.slot-vitality { --slot-icon: url("/static/img/deadlock/slots/vitality.webp"); }
.slot-spirit   { --slot-icon: url("/static/img/deadlock/slots/spirit.webp"); }

/* The souls mark, used wherever a price is shown. */
.souls-mark {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.3em;
  vertical-align: -0.12em;
  background: url("/static/img/deadlock/slots/souls.webp") center / contain no-repeat;
}
.slot-weapon   { color: var(--weapon); }
.slot-vitality { color: var(--vitality); }
.slot-spirit   { color: var(--spirit); }

/* --- controls ------------------------------------------------------------- */

.controls {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  margin-bottom: 1.5rem;
}

.control { display: flex; flex-direction: column; gap: 0.45rem; }
.control label { font-size: 0.6rem; color: var(--paper-faint); }

select {
  appearance: none;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.5rem 2rem 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  min-width: 11rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23a39682' stroke-width='1.4'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
select:hover { border-color: var(--brass-deep); }

.btn {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.6rem 1.15rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--brass); color: var(--brass-lit); background: var(--brass-wash); }

.btn-primary {
  background: var(--brass);
  border-color: var(--brass);
  color: #140f06;
  font-weight: 700;
}
.btn-primary:hover { background: var(--brass-lit); border-color: var(--brass-lit); color: #140f06; }

.btn-got  { border-color: color-mix(in srgb, var(--hit) 45%, var(--rule-lit)); }
.btn-got:hover  { border-color: var(--hit); color: var(--hit); background: rgba(138, 180, 92, 0.08); }
.btn-miss { border-color: color-mix(in srgb, var(--miss) 45%, var(--rule-lit)); }
.btn-miss:hover { border-color: var(--miss); color: var(--miss); background: rgba(194, 104, 92, 0.08); }

/* --- flashcards ----------------------------------------------------------- */

.deck-status {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--paper-faint);
  margin-bottom: 0.85rem;
  min-height: 1.25rem;
}

/* The card reads as a physical card: inset keyline, vignette, no rounding. */
.flashcard {
  position: relative;
  background:
    radial-gradient(28rem 18rem at 50% 32%, rgba(216, 167, 78, 0.05), transparent 70%),
    var(--surface);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 3rem 2rem;
  text-align: center;
  min-height: 19rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flashcard::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

.prompt-label {
  margin: 0 0 1.75rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.prompt { display: flex; justify-content: center; }

.prompt-name {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "SOFT" 20, "WONK" 1;
  font-weight: 600;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.prompt-effect {
  margin: 0;
  max-width: 34rem;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--paper);
}

.item-icon {
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
}
.item-icon-lg { width: 9.5rem; height: 9.5rem; }
.item-icon-md { width: 5.5rem; height: 5.5rem; }

.answer-rule {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-lit) 20%, var(--rule-lit) 80%, transparent);
  margin: 2rem 0 1.5rem;
}

.answer-headline {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "WONK" 1;
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--brass-lit);
}

.answer-meta {
  margin: 0.6rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.answer-meta .sep { color: var(--rule-lit); }

.answer-desc {
  margin: 1rem auto 0;
  max-width: 34rem;
  color: var(--paper-dim);
  font-size: 0.9375rem;
}

.answer-split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.card-actions { display: flex; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }
.grade { display: flex; gap: 0.75rem; }

.hint {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--paper-faint);
}
kbd {
  font-family: var(--mono);
  font-size: 0.7rem;
  border: 1px solid var(--rule-lit);
  border-bottom-width: 2px;
  border-radius: var(--r);
  padding: 0.1rem 0.35rem;
  color: var(--paper-dim);
  background: var(--ink);
}

/* --- tables, for the data to come ---------------------------------------- */

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--rule); }
th {
  color: var(--paper-faint);
  font-size: 0.62rem;
  white-space: nowrap;
  background: var(--ink-raised);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- narrow screens ------------------------------------------------------- */

@media (max-width: 36rem) {
  main { padding-block: 2.5rem 4rem; }
  .hero { margin-bottom: 3rem; }
  .controls { gap: 0.85rem; padding: 1rem; }
  .control, select, .controls .btn { width: 100%; min-width: 0; }
  .flashcard { padding: 2.25rem 1.1rem; min-height: 16rem; }
  .item-icon-lg { width: 7rem; height: 7rem; }
  .card-actions, .grade { width: 100%; }
  .grade .btn, .card-actions > .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::after { transition: none !important; }
}

/* --- game banners --------------------------------------------------------- */

.section-flush { margin-bottom: 2rem; }

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(27rem, 1fr));
}

.game-link {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 20rem;
  padding: 2rem;
  overflow: hidden;
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  isolation: isolate;
}
.game-link:hover { text-decoration: none; border-color: var(--brass); }

/* The artwork sits in a pseudo-element so it can scale on hover without
   dragging the logo with it. */
.game-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--art);
  background-size: cover;
  background-position: center 58%;
  transform: scale(1.02);
  transition: transform 0.5s ease, filter 0.4s ease;
  filter: saturate(0.9) brightness(0.78);
}
.game-link:hover::before {
  transform: scale(1.06);
  filter: saturate(1) brightness(0.85);
}

/* Weighted toward the bottom so the logo keeps contrast over busy art. */
.game-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 10, 8, 0.5) 0%, rgba(11, 10, 8, 0.18) 40%, rgba(11, 10, 8, 0.82) 100%),
    /* Pulls the middle down so a cream logo holds against a lit background. */
    radial-gradient(58% 48% at 50% 50%, rgba(11, 10, 8, 0.6) 0%, rgba(11, 10, 8, 0.25) 55%, transparent 100%);
}

.game-logo {
  width: min(17rem, 62%);
  height: auto;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.75));
  transition: transform 0.4s ease;
}
.game-link:hover .game-logo { transform: translateY(-3px); }

/* --- skyline, sitting behind the page ------------------------------------ */

.skyline {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16vh;
  min-height: 7rem;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background: url("/static/img/deadlock/cityscape.webp") repeat-x bottom center / auto 100%;
  /* Fades out upward so it sits in the page rather than on top of it. */
  mask-image: linear-gradient(180deg, transparent, #000 85%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 85%);
}

/* Content sits above the skyline. */
/* Content sits above the skyline. The masthead is excluded: it is already
   sticky, and position:relative here would cancel that. */
main, .footer { position: relative; z-index: 1; }

@media (max-width: 36rem) {
  .game-list { grid-template-columns: 1fr; }
  .game-link { min-height: 14rem; padding: 1.25rem; }
  .game-logo { width: min(13rem, 72%); }
  .skyline { height: 11vh; min-height: 5rem; opacity: 0.35; }
}

/* --- item gauntlet -------------------------------------------------------- */

.gauntlet {
  background:
    radial-gradient(30rem 20rem at 50% 0%, rgba(216, 167, 78, 0.05), transparent 70%),
    var(--panel);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 2.25rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.gauntlet-head { text-align: center; margin-bottom: 2rem; }
.gauntlet-head .item-icon { margin: 0 auto; }

.item-revealed {
  margin: 1rem 0 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "WONK" 1;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  /* Colour comes from the slot class, so the name carries its slot. */
}

.stages { list-style: none; margin: 0; padding: 0; }

.stage { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.stage:first-child { border-top: 0; padding-top: 0; }

.stage-q {
  margin: 0 0 0.9rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.stage-body { display: grid; gap: 0.5rem; }

.choice {
  text-align: left;
  background: var(--ink-raised);
  color: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.75rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.choice:hover:not(:disabled) { border-color: var(--brass); background: var(--brass-wash); }
.choice:disabled { cursor: default; opacity: 0.55; }

.choice.is-answer {
  opacity: 1;
  border-color: var(--hit);
  background: rgba(138, 180, 92, 0.1);
  color: var(--paper);
}
.choice.is-picked {
  opacity: 1;
  border-color: var(--miss);
  background: rgba(194, 104, 92, 0.1);
}
.choice.is-picked.is-answer { border-color: var(--hit); }

/* --- combo box ------------------------------------------------------------
 * A real dropdown: a trigger you click, a panel with its own search field and
 * the full item list. Options are names only - icons here would let you match
 * the prompt by sight and skip the question entirely.
 */

.combo { position: relative; }

.combo-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--ink);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.95rem 1.1rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.combo-trigger:hover:not(:disabled) { border-color: var(--brass); background: var(--brass-wash); }
.combo-trigger:disabled { cursor: default; }
.combo.is-open .combo-trigger { border-color: var(--brass); }

.combo-value { font-weight: 550; }
.combo-value.is-empty { color: var(--paper-faint); font-weight: 400; }
.combo-value.is-right { color: var(--hit); }
.combo-value.is-wrong { color: var(--miss); text-decoration: line-through; }

.combo-caret {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--paper-dim);
  border-bottom: 2px solid var(--paper-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease;
}
.combo.is-open .combo-caret { transform: rotate(225deg) translate(-2px, -2px); }
.combo-trigger:disabled .combo-caret { opacity: 0.3; }

.combo-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--ink-raised);
  border: 1px solid var(--brass-deep);
  border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.combo-search {
  width: 100%;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 0.95rem;
}
.combo-search::placeholder { color: var(--paper-faint); }
.combo-search:focus { outline: none; border-bottom-color: var(--brass-deep); }

.combo-list {
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 17rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-lit) transparent;
}

.combo-option {
  padding: 0.5rem 0.7rem;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 0.95rem;
}
.combo-option.is-active { background: var(--brass); color: #140f06; font-weight: 600; }

.combo-none { margin: 0; padding: 1rem; color: var(--paper-faint); font-size: 0.9rem; }

/* --- fill in the numbers -------------------------------------------------- */

.fill-rows { display: grid; gap: 0.45rem; }

.fill-row {
  display: grid;
  grid-template-columns: 5.5rem auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
}
.fill-row.is-right { border-left-color: var(--hit); }
.fill-row.is-wrong { border-left-color: var(--miss); }

.fill-input {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
  font-size: 1rem;
  text-align: right;
  width: 100%;
}
.fill-input::placeholder { color: var(--paper-faint); }
.fill-input:focus { border-color: var(--brass); outline: none; }
.fill-row.is-right .fill-input { border-color: var(--hit); color: var(--hit); }
.fill-row.is-wrong .fill-input { border-color: var(--miss); color: var(--miss); }

.fill-unit {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--paper-dim);
  margin-left: -0.3rem;
}
.fill-label { font-size: 0.9rem; color: var(--paper); }

.fill-truth {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hit);
  white-space: nowrap;
}

/* --- verdicts ------------------------------------------------------------- */

.verdict {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--paper-dim);
}
.verdict-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--r);
  border: 1px solid currentColor;
  flex: none;
}
.verdict.is-right .verdict-tag { color: var(--hit); }
.verdict.is-wrong .verdict-tag { color: var(--miss); }

@media (max-width: 36rem) {
  .gauntlet { padding: 1.5rem 1rem; }
}

/* --- stage progress ------------------------------------------------------- */

.pips { display: flex; justify-content: center; gap: 0.4rem; margin-top: 1.25rem; }
.pip {
  width: 1.6rem;
  height: 3px;
  border-radius: 2px;
  background: var(--rule-lit);
  transition: background 0.25s ease;
}
.pip.is-done { background: var(--brass-deep); }
.pip.is-current { background: var(--brass); }

.choice {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  align-items: start;
  gap: 0.75rem;
}
.choice-key {
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--paper-faint);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  text-align: center;
  padding: 0.05rem 0;
}
.choice:hover:not(:disabled) .choice-key { color: var(--brass); border-color: var(--brass-deep); }
.choice.is-answer .choice-key { color: var(--hit); border-color: var(--hit); }
.choice.is-picked .choice-key { color: var(--miss); border-color: var(--miss); }

.stage-right .stage-q { color: var(--hit); }
.stage-wrong .stage-q { color: var(--miss); }

.item-icon.is-fresh { animation: dealIn 0.35s ease both; }
@keyframes dealIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.run-streak {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

@media (max-width: 36rem) {
  .choice { grid-template-columns: 1.4rem 1fr; gap: 0.55rem; }
}

/* --- game page header ----------------------------------------------------- */

.game-head {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 15rem;
  margin-bottom: 3rem;
  padding: 2.5rem 1.5rem;
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
}
.game-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--art);
  background-size: cover;
  background-position: center 58%;
  filter: saturate(0.9) brightness(0.62);
}
.game-head::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 10, 8, 0.6), rgba(11, 10, 8, 0.25) 45%, rgba(11, 10, 8, 0.9)),
    radial-gradient(55% 50% at 50% 50%, rgba(11, 10, 8, 0.55), transparent 100%);
}

.game-head-logo {
  width: min(19rem, 70%);
  height: auto;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.8));
}

/* --- tool cards ----------------------------------------------------------- */

.tool-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
}

.tool {
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  /* Cards here sit on page artwork, so they go near-black rather than sharing
     the backdrop's hue, and cast a shadow to lift off it. */
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  transition: border-color 0.18s, background 0.18s;
}
.tool:hover { border-color: var(--brass); background: var(--surface); }

.tool-link { display: block; color: inherit; }
.tool-link:hover { text-decoration: none; }

/* Real item icons as the artwork: thematic, and already in the page budget. */
.tool-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.6rem 1rem;
  background:
    radial-gradient(18rem 8rem at 50% 120%, var(--brass-wash), transparent 70%),
    var(--ink-raised);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.tool-art img {
  width: 3.1rem;
  height: 3.1rem;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s ease;
}
/* A gentle arc, so it reads as a hand of cards rather than a row of buttons. */
.tool-art img:nth-child(odd) { transform: translateY(0.35rem); }
.tool-art img:nth-child(1), .tool-art img:nth-child(6) { opacity: 0.5; transform: translateY(0.7rem) scale(0.88); }
.tool:hover .tool-art img { transform: translateY(-0.15rem); }
.tool:hover .tool-art img:nth-child(1),
.tool:hover .tool-art img:nth-child(6) { opacity: 0.75; transform: translateY(0.2rem) scale(0.92); }

.tool-body { padding: 1.35rem 1.5rem 1.5rem; }
.tool-body h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-variation-settings: "opsz" 32, "WONK" 1;
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}
.tool-body p { margin: 0 0 1rem; color: var(--paper-dim); font-size: 0.925rem; }

.tool-go {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}
.tool-go::after {
  content: "\2192";
  transition: transform 0.2s ease;
}
.tool:hover .tool-go::after { transform: translateX(3px); }

/* --- emblem watermark ----------------------------------------------------- */

.empty-marked { position: relative; overflow: hidden; }
.empty-emblem {
  position: absolute;
  right: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8rem;
  opacity: 0.07;
  pointer-events: none;
}
.empty-marked p { position: relative; }

@media (max-width: 36rem) {
  .game-head { min-height: 11rem; padding: 1.75rem 1rem; margin-bottom: 2rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-art img { width: 2.5rem; height: 2.5rem; }
  .empty-emblem { width: 6rem; opacity: 0.05; }
}

/* --- guessing game -------------------------------------------------------- */

.guessgame {
  background: var(--panel);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.clues { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.75rem; }

.clue {
  scroll-margin-top: calc(var(--topbar-h, 6.5rem) + 1rem);
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--brass-deep);
  border-radius: var(--r);
  padding: 0.9rem 1.1rem;
  animation: clueIn 0.3s ease both;
}
@keyframes clueIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.clue-empty {
  border-left-color: var(--rule-lit);
  border-style: dashed;
  color: var(--paper-faint);
  text-align: center;
  font-size: 0.9rem;
}

.clue-label {
  margin: 0 0 0.55rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
}

.clue-headline {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--paper);
}
.clue-text { margin: 0; color: var(--paper); font-size: 0.95rem; }

.clue-icon { display: flex; justify-content: center; padding: 0.4rem 0; }
.clue-icon img { width: 7rem; height: 7rem; }
/* Shape and palette survive; the detail that names it does not. */
.clue-icon.is-blurred img { filter: blur(11px) saturate(1.2); }

/* --- guesses so far ------------------------------------------------------- */

.guess-list { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.35rem; }
.guess-list:empty { margin: 0; }

.guess-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper-dim);
  font-size: 0.9rem;
  text-decoration: line-through;
  text-decoration-color: var(--miss);
}
.guess-row.is-right {
  border-color: var(--hit);
  color: var(--paper);
  text-decoration: none;
  background: rgba(138, 180, 92, 0.08);
}
.guess-n {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-align: center;
  color: var(--paper-faint);
  text-decoration: none;
}

.guess-input { margin-bottom: 0.5rem; }

/* --- result --------------------------------------------------------------- */

.result {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  background: var(--ink-raised);
  text-align: center;
}
.result.is-win  { border-color: var(--hit); }
.result.is-loss { border-color: var(--miss); }

.result-head {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "WONK" 1;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.result.is-win .result-head  { color: var(--hit); }
.result.is-loss .result-head { color: var(--miss); }

.result-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: left;
  flex-wrap: wrap;
}
.result-item img { width: 4.5rem; height: 4.5rem; }
.result-name {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 36, "WONK" 1;
  font-weight: 600;
  font-size: 1.3rem;
}
.result-sub { margin: 0.2rem 0 0; color: var(--paper-dim); font-family: var(--mono); font-size: 0.8rem; }

.answer-headline.is-missed { color: var(--miss); }

/* The lead tool gets the artwork; the second is text only. */
.tool-feature { grid-column: span 2; }
@media (max-width: 50rem) { .tool-feature { grid-column: auto; } }

@media (max-width: 36rem) {
  .guessgame { padding: 1.1rem; }
  .clue-icon img { width: 5.5rem; height: 5.5rem; }
}

/* --- guess game columns --------------------------------------------------- */

.guess-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32rem;
  gap: 1.5rem;
  align-items: start;
}

.guess-col-clues { min-width: 0; }
/* The panel is capped to the space under the sticky header, with the picker
   pinned and the history scrolling inside it. Letting the whole panel grow
   pushed the picker off-screen once a few guesses had stacked up. */
.guess-col-play {
  min-width: 0;
  position: sticky;
  /* site.js measures the sticky header and publishes --topbar-h; the fallback
     only applies before that script runs. */
  top: calc(var(--topbar-h, 6.5rem) + 1rem);
  max-height: calc(100vh - var(--topbar-h, 6.5rem) - 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guess-col-play .guess-input { flex: none; margin: 0; }

.guess-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* Room below the last element, so a button sitting at the end is not
     clipped against the scroll container's edge. */
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-lit) transparent;
}

.guess-scroll .card-actions { margin-bottom: 0.25rem; }
.guess-cols .guess-scroll .guess-list { margin: 0; }

.guess-cols .clues { margin: 0; }
.guess-cols .guess-list { margin: 1rem 0 0; }
.guess-cols .result { margin-top: 1rem; }

@media (max-width: 64rem) {
  .guess-cols { grid-template-columns: 1fr; }
  .guess-col-play {
    position: static;
    order: -1;
    max-height: none;
    display: block;
  }
  .guess-scroll { overflow: visible; }
  .guess-cols .clues { margin-top: 1rem; }
}

/* --- per-page backdrop ---------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg) center 18% / cover no-repeat;
  /* The plate ships greyscale. Sepia lands the greys around amber, so the hue
     rotation carries them the rest of the way to teal. */
  filter: sepia(0.75) hue-rotate(150deg) saturate(1.7) brightness(0.95) contrast(1.05);
}

/* Colour and scrim ride above the image: warm street light low and left,
   a cold spectral cast high and right, then a dark wash so text holds. */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    /* Cool wash across the plate, with one warm lamp low and left so the
       amber accent has something to answer to. */
    radial-gradient(40rem 30rem at 14% 86%, rgba(216, 167, 78, 0.16), transparent 68%),
    radial-gradient(44rem 32rem at 82% 10%, rgba(0, 155, 178, 0.20), transparent 72%),
    linear-gradient(180deg, rgba(6, 10, 13, 0.34) 0%, rgba(6, 10, 13, 0.56) 50%, rgba(7, 11, 14, 0.80) 100%);
}

/* A page carrying its own art does not also need the shared skyline. */
.backdrop ~ .skyline { display: none; }

/* --- game title ----------------------------------------------------------- */

.game-title {
  display: grid;
  place-items: center;
  padding: 1.5rem 0 3rem;
}
.game-title-logo {
  width: min(22rem, 76%);
  height: auto;
  filter: drop-shadow(0 6px 26px rgba(0, 0, 0, 0.85));
}

@media (max-width: 36rem) {
  .game-title { padding: 0.5rem 0 2rem; }
  .game-title-logo { width: min(15rem, 76%); }
}

/* --- item stat block ------------------------------------------------------ */

.stat-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }

.stat {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--paper-dim);
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
}
/* Elevated properties are the boxed headline stats in the shop. */
.stat.is-key {
  border-left-color: var(--brass);
  color: var(--paper);
  background: var(--brass-wash);
}

.stat-value {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--paper);
  min-width: 3.25rem;
}
.stat.is-key .stat-value { color: var(--brass-lit); font-size: 1rem; }
.stat.is-key.stat-spirit .stat-value,
.stat.is-key.stat-weapon .stat-value,
.stat.is-key.stat-vitality .stat-value,
.stat.is-key.stat-souls .stat-value { color: var(--tint); }

/* The scaling badge the shop shows beside a stat, e.g. x0.19 Spirit. */
.stat-scale {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--paper-dim);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.05rem 0.3rem;
}
/* Only Spirit scaling is a Spirit thing. Boons scale with player level. */
.stat-scale.is-spirit {
  color: var(--spirit);
  border-color: color-mix(in srgb, var(--spirit) 40%, transparent);
}

/* No flex grow: the badge should sit next to the label, not at the edge. */
.stat-label { flex: 0 1 auto; }
.stat > .stat-scale { margin-left: 0.1rem; }

.result-links { margin: 1rem 0 0; }

.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-faint);
  border-bottom: 1px solid var(--rule-lit);
  padding-bottom: 0.1rem;
}
.wiki-link::after { content: "\2197"; font-size: 0.9em; }
.wiki-link:hover { color: var(--brass); border-bottom-color: var(--brass); text-decoration: none; }

/* --- stat colouring by what the stat affects ------------------------------ */

.stat-spirit   { --tint: var(--spirit); }
.stat-weapon   { --tint: var(--weapon); }
.stat-vitality { --tint: var(--vitality); }
.stat-souls    { --tint: var(--souls); }

.stat-spirit, .stat-weapon, .stat-vitality, .stat-souls {
  border-left-color: var(--tint);
  background: color-mix(in srgb, var(--tint) 7%, var(--ink-raised));
}
.stat-spirit .stat-value,
.stat-weapon .stat-value,
.stat-vitality .stat-value,
.stat-souls .stat-value { color: var(--tint); }

/* A headline stat keeps the family colour but gains weight. */
.stat.is-key.stat-spirit,
.stat.is-key.stat-weapon,
.stat.is-key.stat-vitality,
.stat.is-key.stat-souls {
  background: color-mix(in srgb, var(--tint) 13%, var(--ink-raised));
  border-color: color-mix(in srgb, var(--tint) 30%, var(--rule));
  border-left-color: var(--tint);
  color: var(--paper);
}

/* --- per-game theming -----------------------------------------------------
 * The site runs warm. A game that brings its own artwork can cool the
 * neutrals so that artwork reads as the room rather than a second accent.
 */

.theme-deadlock {
  --ink:        #0a0907;
  --ink-raised: #121010;
  --surface:    #191513;
  --surface-lit:#211b17;
  /* Warm, almost black. Against the cool backdrop this reads as a solid card
     rather than another patch of the same artwork. */
  --panel:      #0a0806;
  --rule:       #2a241d;
  --rule-lit:   #42382b;
  --paper-dim:  #a39682;
  --paper-faint:#6f6554;
}

/* --- deco lattice on pages with no artwork of their own ------------------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 17px, rgba(216, 167, 78, 0.030) 17px 18px),
    repeating-linear-gradient(-45deg, transparent 0 17px, rgba(216, 167, 78, 0.030) 17px 18px),
    radial-gradient(60rem 36rem at 50% -8rem, rgba(216, 167, 78, 0.07), transparent 70%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 92%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 92%);
}

/* A page with its own backdrop covers the lattice rather than stacking on it. */
body:has(.backdrop)::after { display: none; }

/* --- stat sections -------------------------------------------------------- */

.stat-groups { display: grid; gap: 1rem; }

.stat-group-label {
  margin: 0 0 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.stat-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
/* Conditional sections are the ones worth telling apart at a glance. The
   help panel reuses these classes so the two can never disagree. */
.stat-group-innate  .stat-group-label,
.stat-help-row.stat-group-innate b  { color: var(--paper-dim); }
.stat-group-passive .stat-group-label,
.stat-help-row.stat-group-passive b { color: var(--brass); }
.stat-group-active  .stat-group-label,
.stat-help-row.stat-group-active b  { color: var(--spirit); }

.stat-group-text {
  margin: 0 0 0.6rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--paper-dim);
}

.clue-sublabel {
  margin: 0 0 0.3rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.clue-sublabel + .clue-text { margin-bottom: 0.9rem; }
.clue-text:last-child { margin-bottom: 0; }

/* A slot clue is a headline and a badge at once. */
.clue-headline.slot { font-family: var(--sans); font-size: 1.1rem; letter-spacing: 0.18em; }
.clue-headline.slot::before { width: 1.5em; height: 1.5em; }

/* --- section help --------------------------------------------------------- */

/* Sits inline after a heading, so it never overlaps a stat row. */
.stat-help {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.45rem;
}

.stat-help-button {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid var(--rule-lit);
  background: var(--ink);
  color: var(--paper-faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1;
  cursor: help;
  padding: 0;
}
.stat-help-button:hover { color: var(--brass); border-color: var(--brass-deep); }

.stat-help-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  width: 17rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--ink-raised);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--paper-dim);
  text-align: left;
}
/* Hover or keyboard focus both open it; it is explanatory, not interactive. */
.stat-help:hover .stat-help-panel,
.stat-help-button:focus-visible + .stat-help-panel { display: flex; }

.stat-help-row { display: block; }
.stat-help-row b {
  display: block;
  color: var(--paper);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

@media (max-width: 36rem) {
  .stat-help-panel { width: 14rem; }
}

/* --- souls values --------------------------------------------------------- */

.souls-value { color: var(--souls); white-space: nowrap; }
.clue-headline.is-souls .souls-value { font-size: 1em; }
.result-sub .souls-value { font-family: var(--mono); }

/* The Spirit emblem inside a scaling badge. Plain inline with the glyph
   nudged onto the text baseline, rather than flex centring the two against
   each other, which left the number sitting high. */
.stat-scale { display: inline; white-space: nowrap; }
.scale-mark {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.25em;
  vertical-align: -0.16em;
  background: url("/static/img/deadlock/slots/spirit.webp") center / contain no-repeat;
}

/* --- breadcrumb bar ------------------------------------------------------- */

.subnav {
  background: rgba(11, 10, 8, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-dim);
}
.back-link::before {
  content: "\2190";
  font-size: 1.1em;
  letter-spacing: 0;
  transition: transform 0.15s ease;
}
.back-link:hover { color: var(--brass); text-decoration: none; }
.back-link:hover::before { transform: translateX(-3px); }

/* --- scoreboard ----------------------------------------------------------- */

.scoreboard { margin-top: 2.5rem; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.tile { background: var(--panel); padding: 0.9rem 1rem; }
.tile-value {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--paper);
}
.tile-label {
  margin: 0.25rem 0 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.dist { margin: 0; }
.dist-caption {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  margin-bottom: 0.6rem;
}

.dist-rows { display: grid; gap: 2px; }

.dist-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  align-items: center;
  gap: 0.6rem;
}

.dist-key {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--paper-faint);
  text-align: right;
}

.dist-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
}

/* Anchored to the baseline at the left, rounded only at the data end. */
.dist-bar {
  height: 1.5rem;
  border-radius: 0 4px 4px 0;
  background: var(--brass-deep);
  min-width: 0;
  transition: width 0.3s ease;
}
.dist-count {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--paper-dim);
}

/* The round just finished, marked by weight and a caret, not colour alone. */
.dist-row.is-latest .dist-bar { background: var(--brass); }
.dist-row.is-latest .dist-key,
.dist-row.is-latest .dist-count { color: var(--paper); font-weight: 700; }
.dist-row.is-latest .dist-count::after { content: " \25C0"; font-size: 0.7em; }

@media (max-width: 36rem) {
  .tile-value { font-size: 1.25rem; }
}

/* --- announcer quote ------------------------------------------------------ */

.quote {
  margin: 3.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.quote blockquote {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "SOFT" 30, "WONK" 1;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--paper-dim);
}
.quote blockquote::before { content: "\201C"; }
.quote blockquote::after { content: "\201D"; }

.quote figcaption {
  margin-top: 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.quote figcaption::before { content: "\2014 "; }

/* The revealed name doubles as the verdict on the name stage. */
.item-revealed.is-right { border-bottom: 2px solid var(--hit); padding-bottom: 0.2rem; }
.item-revealed.is-wrong { border-bottom: 2px solid var(--miss); padding-bottom: 0.2rem; }

.load-error {
  margin: 2rem auto;
  max-width: 28rem;
  text-align: center;
  color: var(--miss);
  font-size: 0.9rem;
}

/* --- account control ------------------------------------------------------ */

.account-slot { display: inline-flex; align-items: center; }
.account-slot:empty { display: none; }

.account { display: inline-flex; align-items: center; gap: 0.5rem; }

.account-avatar {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 1px solid var(--rule-lit);
}

.account-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-link {
  background: none;
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  padding: 0.4rem 0.7rem;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-dim);
  cursor: pointer;
}
.account-link:hover {
  color: var(--brass);
  border-color: var(--brass-deep);
  background: var(--brass-wash);
  text-decoration: none;
}

/* --- start gate ----------------------------------------------------------- */

.start-gate {
  display: grid;
  place-items: center;
  gap: 1.5rem;
  padding: 4rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--rule-lit);
  border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.btn-start {
  font-size: 0.8rem;
  padding: 0.9rem 2.25rem;
}

.start-text {
  margin: 0;
  max-width: 30rem;
  text-align: center;
  font-size: 1.0625rem;
  color: var(--paper-dim);
}

/* --- round and record controls -------------------------------------------- */

.round-actions { display: flex; justify-content: flex-end; }

.btn-quiet {
  border-color: transparent;
  color: var(--paper-faint);
  padding: 0.35rem 0.6rem;
  font-size: 0.6rem;
}
.btn-quiet:hover {
  border-color: var(--rule-lit);
  color: var(--paper-dim);
  background: none;
}

/* --- work in progress notice ---------------------------------------------- */

#root .wip,
.wip {
  margin: 0 0 1.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--brass-deep);
  border-left-width: 2px;
  border-radius: var(--r);
  background: var(--brass-wash);
  color: var(--brass-lit);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* --- item card -----------------------------------------------------------
 * A facsimile of the shop tooltip: a coloured header carrying the type, innate
 * stats listed plainly, and conditional sections putting their headline stat
 * in a box beside the rest.
 */

.item-card {
  --tint: var(--rule-lit);
  margin: 0 auto;
  max-width: 100%;
  text-align: left;
  background: var(--ink-raised);
  border: 1px solid color-mix(in srgb, var(--tint) 40%, var(--rule));
  border-radius: var(--r);
  overflow: hidden;
}
.item-card.slot-weapon   { --tint: var(--weapon); }
.item-card.slot-vitality { --tint: var(--vitality); }
.item-card.slot-spirit   { --tint: var(--spirit); }

.ic-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--tint) 26%, transparent),
    color-mix(in srgb, var(--tint) 12%, transparent)
  );
  border-bottom: 1px solid color-mix(in srgb, var(--tint) 30%, var(--rule));
}
.ic-icon { width: 3rem; height: 3rem; flex: none; border-radius: var(--r); }

.ic-name {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "opsz" 36, "WONK" 1;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.015em;
  color: #fff;
}
.ic-cost { margin: 0.15rem 0 0; font-family: var(--mono); font-size: 0.9rem; }

.ic-section { padding: 0.85rem 1rem; border-top: 1px solid var(--rule); }
.ic-section:first-of-type { border-top: 0; }

/* The shop sets its section headings on a bar, in italic. */
.ic-section-label {
  margin: -0.2rem -0.5rem 0.65rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--r);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--paper-dim);
}

.ic-text {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--paper);
}

.ic-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.28rem; }

.ic-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--paper-dim);
  min-width: 0;
}
.ic-value { font-weight: 700; color: var(--paper); font-variant-numeric: tabular-nums; flex: none; }
/* The label takes the remaining width and wraps rather than overflowing. */
.ic-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* A reduction and a bonus must not look the same. */
.ic-line.is-down .ic-value { color: var(--miss); }
.ic-line.is-key .ic-label { color: var(--paper); font-weight: 600; }

/* Headline stat beside the rest, as the shop lays it out. Both halves may
   wrap: with several boxes the list was being squeezed past the card edge and
   clipped. */
.ic-split { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: stretch; }
/* Several headline stats sit side by side and wrap, rather than stacking into
   a tall column beside the list. */
.ic-boxes { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: none; }
.ic-split .ic-list { flex: 1 1 11rem; min-width: 0; align-content: center; }

.ic-box {
  flex: 1 1 7.5rem;
  min-width: 6.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.5rem 0.65rem;
  text-align: center;
}
.ic-box-value {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--paper);
}
.ic-box.is-down .ic-box-value { color: var(--miss); }
.ic-box-label { margin: 0.1rem 0 0; font-size: 0.72rem; overflow-wrap: anywhere; color: var(--paper-dim); line-height: 1.3; }

@media (max-width: 30rem) {
  .ic-split { flex-direction: column; }
  .ic-box { min-width: 0; }
}

.ic-from {
  padding: 0.7rem 1rem 0.85rem;
  border-top: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.025);
}
.ic-from-label {
  margin: 0 0 0.4rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.ic-from-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--paper-dim);
}
.ic-from-item img { width: 1.6rem; height: 1.6rem; border-radius: var(--r); }

/* --- flashcard deck ------------------------------------------------------- */

/* Icons overlap like a stack of cards and fan apart on hover. */
.tool-art-deck img {
  margin-left: -1.1rem;
  transition: transform 0.3s ease, margin 0.3s ease;
}
.tool-art-deck img:first-child { margin-left: 0; }
.tool-art-deck img:nth-child(odd)  { transform: rotate(-6deg); }
.tool-art-deck img:nth-child(even) { transform: rotate(5deg) translateY(0.2rem); }

.tool:hover .tool-art-deck img { margin-left: -0.35rem; }
.tool:hover .tool-art-deck img:nth-child(odd)  { transform: rotate(-10deg) translateY(-0.2rem); }
.tool:hover .tool-art-deck img:nth-child(even) { transform: rotate(9deg) translateY(0.1rem); }

/* --- hero line-up --------------------------------------------------------- */

/* Customs is about drafting heroes, so it gets faces rather than items. */
.tool-art-heroes {
  gap: 0;
  align-items: flex-end;
  padding-bottom: 0;
}
.tool-art-heroes img {
  width: 3.9rem;
  height: auto;
  margin-left: -0.9rem;
  filter: grayscale(0.55) brightness(0.8) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.65));
  transition: transform 0.3s ease, filter 0.3s ease, margin 0.3s ease;
}
.tool-art-heroes img:first-child { margin-left: 0; }

.tool:hover .tool-art-heroes img {
  margin-left: -0.45rem;
  filter: grayscale(0) brightness(1) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.65));
}
/* A shallow arc, so the line-up reads as a team rather than a row. */
.tool:hover .tool-art-heroes img:nth-child(1),
.tool:hover .tool-art-heroes img:nth-child(6) { transform: translateY(0.25rem); }
.tool:hover .tool-art-heroes img:nth-child(2),
.tool:hover .tool-art-heroes img:nth-child(5) { transform: translateY(-0.1rem); }
.tool:hover .tool-art-heroes img:nth-child(3),
.tool:hover .tool-art-heroes img:nth-child(4) { transform: translateY(-0.35rem); }

@media (prefers-reduced-motion: reduce) {
  .tool-art-deck img, .tool-art-heroes img { transition: none; }
}

/* --- global distribution on the result card ------------------------------- */

.global-dist {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 2px;
  text-align: left;
}

.global-head {
  margin: 0 0 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.global-dist .dist-bar { background: var(--rule-lit); }
.global-dist .dist-row.is-latest .dist-bar { background: var(--brass); }

.global-foot {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--paper-faint);
}
