/* (C) 2026 Stoneshift Games  Marietta, GA  All Rights Reserved */

/*
 * The King's Descent wiki. It shares the brochure's field and its gold, and
 * borrows the game's own furniture for the parts that are the game talking:
 * the report panel's deep blue, the arena's gray floor inside its checkered
 * frame, the threat bands' colors. Like the brochure it makes no request
 * outside its own folder: system faces, no font service, no analytics.
 */

:root {
  --bg: #050607;
  --bg-2: #0b0e14;
  --bg-3: #12161e;
  --card: #151a22;
  --card-hi: #1c222c;
  --line: #232833;
  --line-2: #2e3542;
  --ink: #d6d9dd;
  --ink-strong: #f2f4f6;
  --muted: #8b939c;
  --gold: #d9a441;
  --gold-2: #f0c56a;
  --ember: #e2702a;
  /* The game's own: the report panel, its ink, the arena floor and frame. */
  --panel: #193f56;
  --panel-2: #12324a;
  --panel-line: #2c5a76;
  --panel-ink: #e6e5d0;
  --panel-gold: #e9c06e;
  --hp: #7ed56a;
  --arena: #bcbcbc;
  --frame-a: #382916;
  --frame-b: #0f0904;
  /* Threat bands, lowest to highest. */
  --band-1: #4d6b4a;
  --band-2: #7ea35a;
  --band-3: #d9b44a;
  --band-4: #5fb8e8;
  --band-5: #e04a3a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --top: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 16px); }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: #ffd98a; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink-strong); margin: 0; font-weight: 600; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.08; letter-spacing: .005em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); line-height: 1.15; margin: 0 0 1rem; }
h3 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
.wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 50rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--ink-strong); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The small gold capitals above a heading, as on the brochure. */
.eyebrow {
  font: 600 .72rem/1 var(--mono);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .9rem;
}

/* The game's own voice: its capitals, spaced, in the reader's monospace. */
.caps {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ------------------------------------------------------------------ */
/* The bar across the top                                              */
/* ------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 6, 7, .9);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--top);
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  flex: none;
}
.brand img.logo { height: 34px; width: auto; }
.brand .tag {
  font: 700 .66rem/1 var(--mono);
  letter-spacing: .3em;
  color: var(--bg);
  background: var(--gold);
  padding: .3rem .4rem .3rem .5rem;
  border-radius: 2px;
}

/* The torch: the game's three flame frames, turned over like the game does. */
.torch { position: relative; width: 26px; height: 26px; flex: none; }
.torch img { position: absolute; inset: 0; width: 26px; height: 26px; opacity: 0; animation: torch 0.45s steps(1) infinite; }
.torch img:nth-child(2) { animation-delay: .15s; }
.torch img:nth-child(3) { animation-delay: .3s; }
@keyframes torch { 0% { opacity: 1; } 33.34% { opacity: 0; } }

.nav { display: flex; gap: .15rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font: 600 .74rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: .55rem .6rem;
  border-radius: 3px;
  white-space: nowrap;
}
.nav a:hover { background: var(--bg-3); color: var(--gold-2); }
.nav a[aria-current="page"] { color: var(--gold-2); box-shadow: inset 0 -2px 0 var(--gold); }

.tools { display: flex; align-items: center; gap: .5rem; flex: none; }

/* The search box and its list of answers. */
.search { position: relative; }
.search input {
  width: 15rem;
  font: 500 .9rem/1 var(--sans);
  color: var(--ink-strong);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: .6rem 2rem .6rem .7rem;
}
.search input::placeholder { color: var(--muted); }
.search kbd {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  font: 600 .7rem/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: .2rem .35rem;
  pointer-events: none;
}
.results {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(26rem, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  padding: .3rem;
  display: none;
}
.results.open { display: block; }
.results a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .4rem .5rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
}
.results a img { width: 40px; height: 40px; flex: none; }
.results a b { display: block; color: var(--ink-strong); font-weight: 600; }
.results a small { color: var(--muted); font: 600 .66rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.results a.sel, .results a:hover { background: var(--card-hi); }
.results .none { padding: .8rem; color: var(--muted); }

/* The spoiler switch. */
.spoil-toggle {
  font: 600 .68rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: .55rem .6rem;
  cursor: pointer;
  white-space: nowrap;
}
.spoil-toggle:hover { color: var(--gold-2); border-color: var(--gold); }
.spoil-toggle[aria-pressed="true"] { color: var(--gold-2); border-color: var(--gold); }

.menu-btn { display: none; }

/* ------------------------------------------------------------------ */
/* Breadcrumbs, headers, sections                                      */
/* ------------------------------------------------------------------ */

.crumbs {
  font: 600 .7rem/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1.4rem;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold-2); }
.crumbs span { margin: 0 .5rem; color: var(--line-2); }

.page-head { padding-top: 1.6rem; padding-bottom: 1.4rem; }
.page-head p.lead { max-width: 46rem; margin-top: .9rem; }
.page-head .count {
  font: 700 .72rem/1 var(--mono);
  letter-spacing: .2em;
  color: var(--gold);
}

section.block { padding: 2.4rem 0; }
section.block + section.block { border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ */
/* The front page                                                      */
/* ------------------------------------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  min-height: min(78vh, 46rem);
  display: flex;
  align-items: flex-end;
}
.hero .art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  image-rendering: pixelated;
  filter: saturate(1.05);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 7, .1) 0%, rgba(5, 6, 7, .35) 45%, rgba(5, 6, 7, .96) 100%),
    radial-gradient(ellipse at 50% 20%, transparent 40%, rgba(5, 6, 7, .5) 100%);
}
.hero .wrap { position: relative; z-index: 1; padding-bottom: 3.2rem; width: 100%; }
.hero h1 { max-width: 52rem; text-shadow: 0 2px 24px rgba(0, 0, 0, .7); }
.hero .lead { max-width: 44rem; margin: 1.1rem 0 1.6rem; text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.hero .search-big { max-width: 34rem; }
.search-big input { width: 100%; font-size: 1.05rem; padding: .95rem 1rem; background: rgba(11, 14, 20, .88); }

/* The numbers band. */
.numbers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.numbers a {
  background: var(--bg-2);
  padding: 1.2rem 1rem 1.1rem;
  text-decoration: none;
  display: block;
  transition: background-color .15s ease;
}
.numbers a:hover { background: var(--card-hi); }
.numbers b {
  display: block;
  font: 700 clamp(1.9rem, 3.4vw, 2.6rem)/1 var(--serif);
  color: var(--gold-2);
}
.numbers span {
  display: block;
  margin-top: .45rem;
  font: 600 .66rem/1.3 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
}

/* The parade: every monster in the game, marching across in two rows. */
.parade { overflow: hidden; padding: 1rem 0; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.parade .row { display: flex; gap: .4rem; width: max-content; animation: march 160s linear infinite; }
.parade .row.rev { animation-direction: reverse; animation-duration: 190s; margin-top: .4rem; }
.parade:hover .row { animation-play-state: paused; }
.parade a { display: block; width: 84px; height: 84px; flex: none; border-radius: 4px; background: radial-gradient(circle at 50% 60%, #222834 0%, #12161e 70%); position: relative; }
.parade a img { width: 84px; height: 84px; }
.parade a:hover { background: radial-gradient(circle at 50% 60%, #3a3220 0%, #12161e 75%); }
@keyframes march { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .parade .row { animation: none; flex-wrap: wrap; width: auto; }
  .torch img { animation: none; }
  .torch img:first-child { opacity: 1; }
}

/* Category cards on the front page. */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.cat {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.cat:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.cat .strip { display: flex; gap: .1rem; margin: -.2rem 0 .7rem; height: 64px; }
.cat .strip img { width: 64px; height: 64px; }
.cat h3 { color: var(--ink-strong); font-size: 1.3rem; margin-bottom: .3rem; }
.cat p { font-size: .94rem; color: var(--muted); margin: 0; }
.cat .n { font: 700 .7rem/1 var(--mono); letter-spacing: .18em; color: var(--gold); margin-top: auto; padding-top: .9rem; text-transform: uppercase; }

/* A feature: art on one side, words on the other. */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.4rem; align-items: center; }
.feature.flip > :first-child { order: 2; }
.feature .pic { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.feature .pic img { width: 100%; image-rendering: pixelated; }

.spot { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: center; }

/* ------------------------------------------------------------------ */
/* Tiles: the shelves of pictures                                      */
/* ------------------------------------------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  align-items: center;
  padding: .8rem;
  margin: 0 0 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: sticky;
  top: calc(var(--top) + 8px);
  z-index: 20;
}
.toolbar label { font: 600 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: .45rem; }
.toolbar select, .toolbar input[type="search"] {
  font: 500 .88rem/1 var(--sans);
  color: var(--ink-strong);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: .45rem .5rem;
}
.toolbar input[type="search"] { width: 11rem; }
.toolbar .shown { margin-left: auto; font: 600 .7rem/1 var(--mono); letter-spacing: .14em; color: var(--gold); text-transform: uppercase; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  font: 600 .66rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: .42rem .65rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.chip:hover { border-color: var(--gold); color: var(--gold-2); }
.chip[aria-pressed="true"] { background: var(--gold); color: #1a1206; border-color: var(--gold); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.2rem, 1fr)); gap: .7rem; }
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr)); }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: .7rem .5rem .8rem;
  background: radial-gradient(circle at 50% 38%, #232a36 0%, var(--card) 62%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .12s ease, transform .12s ease, background-color .12s ease;
}
.tile:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.tile .pic { position: relative; width: 112px; height: 112px; }
.tiles.small .tile .pic { width: 88px; height: 88px; }
.tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; }
.tile .pic img.alt { opacity: 0; }
.tile:hover .pic img.alt, .tile:focus-visible .pic img.alt { opacity: 1; }
.tile:hover .pic img.alt + img, .tile:focus-visible .pic img.alt + img { opacity: 0; }
.tile .name { font: 700 .74rem/1.25 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-strong); margin-top: .45rem; }
.tile .meta { font: 500 .72rem/1.3 var(--sans); color: var(--muted); margin-top: .25rem; }
.tile .rung {
  position: absolute;
  top: .45rem;
  left: .5rem;
  font: 700 .62rem/1 var(--mono);
  color: var(--muted);
  letter-spacing: .06em;
}
.tile .flag {
  position: absolute;
  top: .4rem;
  right: .45rem;
  font: 700 .56rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .22rem .32rem;
  border-radius: 2px;
  background: var(--panel);
  color: var(--panel-gold);
}
.tile[hidden] { display: none; }

/* ------------------------------------------------------------------ */
/* An entry: monster, item, class                                      */
/* ------------------------------------------------------------------ */

.entry { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 2.4rem; padding-top: 1rem; padding-bottom: 2.4rem; align-items: start; }
.entry .side { position: sticky; top: calc(var(--top) + 16px); }

/* The arena: the gray floor in its checkered frame, as in a battle. */
.arena {
  position: relative;
  aspect-ratio: 1;
  padding: 18px;
  border-radius: 4px;
  background:
    conic-gradient(var(--frame-a) 25%, var(--frame-b) 0 50%, var(--frame-a) 0 75%, var(--frame-b) 0) 0 0 / 36px 36px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
.arena .floor {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--arena);
  overflow: hidden;
}
.arena .floor img {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
}
.arena.dark .floor { background: radial-gradient(circle at 50% 55%, #2a3140 0%, #10141b 75%); }

/* Idle and attack frames, taking turns. */
/* Each frame holds for its share of the beat and hands over at the same
   instant, so the floor is never empty between them. */
.frames img.f1 { animation: stand 1.6s step-end infinite; }
.frames img.f2 { animation: strike 1.6s step-end infinite; opacity: 0; }
@keyframes stand { 0% { opacity: 1; } 62% { opacity: 0; } 100% { opacity: 0; } }
@keyframes strike { 0% { opacity: 0; } 62% { opacity: 1; } 100% { opacity: 1; } }
.frames.still img.f2 { animation: none; opacity: 0; }
.frames.still img.f1 { animation: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .frames img.f2 { animation: none; opacity: 0; }
  .frames img.f1 { animation: none; opacity: 1; }
}
.frame-btns { display: flex; gap: .4rem; justify-content: center; margin-top: .9rem; }

.title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; }
.title-row h1 { font-size: clamp(2rem, 4vw, 3rem); }
.aka { font: 600 .74rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 1.2rem; }
.badge {
  font: 700 .64rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .4rem .55rem;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--ink);
  text-decoration: none;
}
.badge.gold { background: rgba(217, 164, 65, .14); border-color: rgba(217, 164, 65, .5); color: var(--gold-2); }
.badge.red { background: rgba(224, 74, 58, .14); border-color: rgba(224, 74, 58, .5); color: #ff8f80; }
.badge.sky { background: rgba(95, 184, 232, .12); border-color: rgba(95, 184, 232, .45); color: #9fd8f7; }
.badge.green { background: rgba(126, 213, 106, .1); border-color: rgba(126, 213, 106, .4); color: #a9e79a; }

/* The game's report panel: deep blue, cream capitals, gold for the live bit. */
.gpanel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 2px solid var(--panel-line);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  color: var(--panel-ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
  margin: 0 0 1.2rem;
}
.gpanel h3, .gpanel .ghead {
  font: 700 .8rem/1.2 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--panel-gold);
  margin: 0 0 .65rem;
}
.gpanel p { margin: 0 0 .7rem; }
.gpanel p:last-child { margin-bottom: 0; }
.gpanel .voice { font: 500 .9rem/1.6 var(--mono); letter-spacing: .04em; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.2rem; margin: 0; }
.facts dt { font: 700 .7rem/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--panel-gold); }
.facts dd { margin: 0; font: 600 .82rem/1.5 var(--mono); letter-spacing: .05em; text-transform: uppercase; }

/* The threat meter: one reading, five lamps, the band's color lit. */
.meters { display: grid; gap: .55rem; }
.meter { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) 6.5rem; gap: .8rem; align-items: center; }
.meter .k { font: 700 .68rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--panel-gold); }
.meter .v { font: 600 .78rem/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--panel-ink); text-align: right; white-space: nowrap; }
.lamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.lamps i { height: 10px; background: rgba(0, 0, 0, .35); border-radius: 1px; }
.lamps[data-b="1"] i:nth-child(-n+1),
.lamps[data-b="2"] i:nth-child(-n+2),
.lamps[data-b="3"] i:nth-child(-n+3),
.lamps[data-b="4"] i:nth-child(-n+4),
.lamps[data-b="5"] i:nth-child(-n+5) { background: var(--lc); }
.lamps[data-b="1"] { --lc: var(--band-1); }
.lamps[data-b="2"] { --lc: var(--band-2); }
.lamps[data-b="3"] { --lc: var(--band-3); }
.lamps[data-b="4"] { --lc: var(--band-4); }
.lamps[data-b="5"] { --lc: var(--band-5); }
.band-word { font: 700 .62rem/1 var(--mono); letter-spacing: .12em; }

.prevnext { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.prevnext a { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); max-width: 48%; }
.prevnext a:hover { color: var(--gold-2); }
.prevnext a img { width: 56px; height: 56px; flex: none; }
.prevnext small { display: block; font: 600 .62rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.prevnext .next { margin-left: auto; text-align: right; flex-direction: row-reverse; }

.mini-tiles { display: flex; flex-wrap: wrap; gap: .45rem; }
.mini {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .6rem .3rem .3rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  font: 700 .7rem/1.2 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.mini img { width: 40px; height: 40px; }
.mini:hover { border-color: var(--gold); color: var(--gold-2); }

/* The floors ruler: ten floors, the lit ones are where it walks. */
.floors { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin: .3rem 0 .2rem; }
.floors i { height: 22px; border-radius: 2px; background: rgba(255, 255, 255, .06); font: 700 .62rem/22px var(--mono); text-align: center; font-style: normal; color: rgba(255, 255, 255, .25); }
.floors i.on { background: var(--gold); color: #1a1206; }

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.4rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th {
  font: 700 .64rem/1.2 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:hover { color: var(--gold-2); }
table.data th[aria-sort="ascending"]::after { content: " \25B4"; }
table.data th[aria-sort="descending"]::after { content: " \25BE"; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, .025); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.pic { width: 52px; padding: .25rem .4rem; }
table.data td.pic img { width: 44px; height: 44px; }
table.data td .nm { font: 700 .76rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
table.data td a { text-decoration: none; }
table.data td a:hover { text-decoration: underline; }
table.data td.words { color: var(--muted); font-size: .86rem; min-width: 16rem; }

/* ------------------------------------------------------------------ */
/* Spoilers                                                            */
/* ------------------------------------------------------------------ */

.spoiler { position: relative; }
html.hide-spoilers .spoiler { filter: blur(7px); user-select: none; cursor: pointer; }
html.hide-spoilers .spoiler::after {
  content: "SPOILER \00B7  CLICK TO REVEAL";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 .7rem/1 var(--mono);
  letter-spacing: .18em;
  color: var(--gold-2);
  filter: blur(0);
}
html.hide-spoilers .spoiler.shown { filter: none; user-select: auto; cursor: auto; }
html.hide-spoilers .spoiler.shown::after { display: none; }
html.hide-spoilers .spoiler-wrap { position: relative; }
html.hide-spoilers .spoiler-wrap > .veil {
  display: grid;
}
.spoiler-wrap > .veil { display: none; }

/* ------------------------------------------------------------------ */
/* The guide: a column of reading with its chapters beside it          */
/* ------------------------------------------------------------------ */

.book { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.6rem; padding-top: 1rem; padding-bottom: 3rem; align-items: start; }
.book nav.toc { position: sticky; top: calc(var(--top) + 16px); font-size: .9rem; }
.book nav.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.book nav.toc li { counter-increment: ch; }
.book nav.toc a {
  display: block;
  padding: .38rem .6rem;
  border-left: 2px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.book nav.toc a::before { content: counter(ch, decimal-leading-zero) "  "; font: 700 .7rem/1 var(--mono); color: var(--muted); }
.book nav.toc a:hover { color: var(--gold-2); border-left-color: var(--gold); }
.book nav.toc a[aria-current="page"] { color: var(--gold-2); border-left-color: var(--gold); background: var(--bg-2); }
.prose { max-width: 44rem; font-size: 1.04rem; }
.prose h2 { margin-top: 2.2rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.6rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin: .25rem 0; }
.prose figure { margin: 1.4rem 0; }
.prose figure img { border-radius: 4px; border: 1px solid var(--line); }
.prose figcaption { font-size: .85rem; color: var(--muted); margin-top: .45rem; }
.prose .float { float: right; width: 128px; margin: 0 0 1rem 1.4rem; }
.prose .float.left { float: left; margin: 0 1.4rem 1rem 0; }
.prose::after { content: ""; display: table; clear: both; }
.callout {
  border-left: 3px solid var(--gold);
  background: var(--bg-2);
  padding: .9rem 1.1rem;
  border-radius: 0 4px 4px 0;
  margin: 1.2rem 0;
}
.callout p:last-child { margin: 0; }
kbd.k {
  font: 700 .74rem/1 var(--mono);
  color: var(--ink-strong);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: .18rem .4rem;
  white-space: nowrap;
}

/* Quotes in the game's voice: who said it, beside his picture. */
.said { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 1rem; align-items: start; margin: 1rem 0; }
.said img { width: 96px; height: 96px; }

/* ------------------------------------------------------------------ */
/* The foot of the page                                                */
/* ------------------------------------------------------------------ */

footer.foot {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 2rem 0 2.6rem;
  color: var(--muted);
  font-size: .88rem;
}
footer.foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
footer.foot img { height: 40px; width: auto; }
footer.foot a { color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Narrow screens                                                      */
/* ------------------------------------------------------------------ */

@media (max-width: 960px) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .entry .side { position: static; max-width: 22rem; margin: 0 auto; width: 100%; }
  .book { grid-template-columns: minmax(0, 1fr); }
  .book nav.toc { position: static; }
  .feature, .spot { grid-template-columns: minmax(0, 1fr); }
  .feature.flip > :first-child { order: 0; }
  .search input { width: 11rem; }
}
@media (max-width: 720px) {
  :root { --top: 56px; }
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: .5rem; padding-bottom: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
  .brand img.logo { height: 28px; }
  .search input { width: 8.5rem; }
  .meter { grid-template-columns: 8.5rem minmax(0, 1fr); }
  .meter .v { grid-column: 1 / -1; text-align: left; margin-top: -.3rem; }
  .toolbar { position: static; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(7.6rem, 1fr)); }
  .tile .pic { width: 88px; height: 88px; }
  .hero { min-height: 70vh; }
  .spoil-toggle .long { display: none; }
}

/* ------------------------------------------------------------------ */
/* Page parts the builder names                                        */
/* ------------------------------------------------------------------ */

/* Lamps take the bestiary's callout colors: gold for an ordinary reading,
   sky for a notable one, red for the worst in the dungeon. */
.lamps[data-c="plain"] { --lc: var(--gold); }
.lamps[data-c="notable"] { --lc: var(--band-4); }
.lamps[data-c="worst"] { --lc: var(--band-5); }
.meter .v small { display: block; font-size: .58rem; opacity: .7; margin-top: .15rem; }
.meter .v.wide { grid-column: 2 / -1; text-align: left; }
.howto { margin-top: 1rem; font-size: .88rem; }
.howto summary { cursor: pointer; font: 700 .68rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--panel-gold); }
.howto dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; margin: .8rem 0 0; }
.howto dt { font: 700 .66rem/1.5 var(--mono); letter-spacing: .1em; color: var(--panel-gold); }
.howto dd { margin: 0; }

.voice { font-size: 1rem; line-height: 1.65; }
.lead-voice { font: 600 1.1rem/1.4 var(--serif); color: var(--ink-strong); margin: 0 0 .8rem; }
.voice-plain { color: var(--muted); max-width: 44rem; }
.small { font-size: .82rem; opacity: .85; }
.btn-link { font-weight: 600; }

/* The home page's wall of every monster. */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
.wall a { position: relative; display: block; aspect-ratio: 1; border-radius: 3px; background: radial-gradient(circle at 50% 45%, #232a36 0%, #12161e 75%); }
.wall a::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; border-radius: 2px; background: hsl(var(--h) 70% 45%); }
.wall a img { position: absolute; inset: 4%; width: 92%; height: 92%; }
.wall a img.alt { opacity: 0; }
.wall a:hover img.alt { opacity: 1; }
.wall a:hover img.alt + img { opacity: 0; }
.wall a:hover { background: radial-gradient(circle at 50% 45%, #3d3420 0%, #12161e 80%); z-index: 1; }

.claims { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.claim { background: var(--bg-2); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: 1.2rem 1.2rem 1rem; }
.claim h3 { font-size: 1.25rem; margin-bottom: .55rem; }
.claim p { color: var(--ink); font-size: .95rem; }
.claim a { font: 700 .68rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }

/* Magic. */
.group-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.2rem; }
.group-head img { width: 72px; height: 72px; flex: none; }
.group-head h2 { margin-bottom: .3rem; }
.untried { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 1rem; align-items: start; }
.untried img { width: 72px; height: 72px; }
html.hide-spoilers .spoiler-names .tile .name, html.hide-spoilers .spoiler-names .tile .pic { filter: blur(6px); }
html.hide-spoilers .spoiler-names .tile:hover .name, html.hide-spoilers .spoiler-names .tile:hover .pic { filter: none; }

/* The spellbook. */
.book-art { display: flex; align-items: flex-end; gap: 1rem; justify-content: center; }
.spells { display: grid; gap: .8rem; padding-bottom: 2rem; }
.spell { display: grid; grid-template-columns: 88px minmax(0, 1fr) 10rem; gap: 1.2rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.spell img { width: 88px; height: 88px; }
.spell h3 { margin-bottom: .35rem; }
.spell p { margin: 0; color: var(--ink); }
.spell .mana { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: baseline; }
.spell .mana b { font: 700 1.6rem/1 var(--serif); color: #8fc7ff; text-align: right; }
.spell .mana span { font: 600 .62rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.spell:target, .special:target .gpanel, tr:target td { box-shadow: 0 0 0 2px var(--gold) inset; }

/* Specials. */
.specials { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 1rem; padding-bottom: 2rem; align-items: start; }
.special .gpanel { margin: 0; height: 100%; }

/* Arms. */
h2 .count { font: 700 .8rem/1 var(--mono); color: var(--gold); letter-spacing: .1em; margin-left: .4rem; vertical-align: middle; }
b.rule { color: var(--gold-2); font-weight: 600; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.cards3 .gpanel { margin: 0; }
.cards2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.cards2 .gpanel { margin: 0; }
.big-numbers .gpanel b { display: block; font: 700 2.4rem/1 var(--serif); color: var(--panel-gold); }
.big-numbers .gpanel span { display: block; font: 700 .66rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; margin: .4rem 0 .7rem; }

/* The party. */
.classes { display: grid; gap: 2.4rem; padding-bottom: 1rem; }
.class-card { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2rem; align-items: start; scroll-margin-top: calc(var(--top) + 16px); }
.class-card h2 { margin-bottom: .3rem; }
.perks { margin: .8rem 0 0; padding-left: 1.1rem; }
.perks li { margin: .2rem 0; }
.swatch { display: inline-block; width: .9em; height: .9em; border-radius: 2px; margin: 0 .12em; vertical-align: -.1em; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }

/* Floors. */
.floors-list { display: grid; gap: 1.6rem; }
.floor-card { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 1.4rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--top) + 16px); }
.floor-num { font: 700 4rem/1 var(--serif); color: var(--gold); text-align: center; }
.floor-card h2 { margin-bottom: .2rem; }
.floor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; margin: .9rem 0; }
.floor-grid .gpanel { margin: 0; }
.ghead-plain { font: 700 .68rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: .4rem 0 .6rem; }
.floor-mons { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 3px; }
.floor-mons a { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--card); }
.floor-mons a:hover { background: var(--card-hi); outline: 1px solid var(--gold); }
.floor-mons img { width: 100%; height: 100%; }

/* Hazards. */
.pair { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; justify-content: center; }
.pair img { max-width: 46%; }
.asks { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .3rem; }
.asks li { background: var(--panel); color: var(--panel-ink); padding: .45rem .7rem; border-radius: 2px; font-size: .78rem; }
img.inline { display: inline-block; vertical-align: middle; margin-right: .4rem; }

/* People. */
.dark-pic { background: radial-gradient(circle at 50% 60%, #232a36 0%, #0b0e14 75%); }
.poses { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .5rem; margin-top: 1.6rem; }
.poses figure { margin: 0; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .3rem .4rem; }
.poses img { width: 100%; height: auto; }
.poses figcaption { font: 700 .6rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .25rem; }
.occasions { display: grid; gap: .4rem; }
.occasion { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .1rem 1rem; }
.occasion summary { cursor: pointer; padding: .7rem 0; font: 700 .76rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-strong); }
.occasion[open] summary { color: var(--gold-2); }
.occasion .q { color: var(--gold-2); font-size: .72rem; margin: .8rem 0 .2rem; }
.occasion .gift { font-weight: 600; color: var(--hp); }
.ending h3 { font-size: .9rem; }

/* The guide. */
.chapter-art { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.2rem; }
.chapter-art img { width: 96px; height: 96px; background: var(--card); border-radius: 4px; }
ol.chapters { list-style: none; padding: 0; display: grid; gap: .4rem; }
ol.chapters a { display: grid; grid-template-columns: 2.6rem minmax(0, 14rem) minmax(0, 1fr); gap: .8rem; align-items: baseline; padding: .7rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
ol.chapters a:hover { border-color: var(--gold); }
ol.chapters .n { font: 700 .8rem/1 var(--mono); color: var(--gold); }
ol.chapters b { color: var(--ink-strong); }
ol.chapters span:last-child { color: var(--muted); font-size: .9rem; }
ol.tips li { margin: .5rem 0; }

@media (max-width: 960px) {
  .class-card { grid-template-columns: minmax(0, 1fr); }
  .class-card .arena { max-width: 17rem; }
  .spell { grid-template-columns: 64px minmax(0, 1fr); }
  .spell img { width: 64px; height: 64px; }
  .spell .mana { grid-column: 2; }
  ol.chapters a { grid-template-columns: 2.2rem minmax(0, 1fr); }
  ol.chapters span:last-child { grid-column: 2; }
}
@media (max-width: 720px) {
  .floor-card { grid-template-columns: minmax(0, 1fr); }
  .floor-num { text-align: left; font-size: 2.6rem; }
  .cards2 { grid-template-columns: minmax(0, 1fr); }
  .specials { grid-template-columns: minmax(0, 1fr); }
}

/* The front page's hero: the key art behind, the game's title screen beside. */
.hero .art { image-rendering: auto; background-position: center 40%; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); gap: 3rem; align-items: end; }
.title-art img {
  width: 100%;
  image-rendering: pixelated;
  border-radius: 4px;
  border: 1px solid rgba(240, 197, 106, .35);
  box-shadow: 0 0 0 6px rgba(5, 6, 7, .6), 0 30px 80px rgba(0, 0, 0, .7), 0 0 120px rgba(226, 112, 42, .18);
}
.numbers { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav a { letter-spacing: .1em; padding: .55rem .5rem; }
.search input { width: 12rem; }
@media (max-width: 1100px) {
  .numbers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 16rem); }
}
@media (max-width: 720px) {
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .title-art { display: none; }
}
.wrap { width: 100%; }
.hero .search-big input { width: 100%; }

@media (max-width: 720px) {
  .nav { flex-wrap: wrap; overflow: visible; }
  .spoil-toggle .long { display: inline; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .tools { flex: 1; }
}
.book nav.toc .eyebrow a::before { content: none; }
.pair { flex-wrap: nowrap; }
.pair img { min-width: 0; flex: 0 1 auto; max-width: 34%; }
.pair img:only-child { max-width: 70%; }
.pair:has(img:nth-child(2):last-child) img { max-width: 48%; }
table.data td.num, table.data td[data-v] { white-space: nowrap; }
.dark-pic img { max-width: 360px; margin: 0 auto; }
.feature .pic.dark-pic { display: flex; justify-content: center; padding: 1.5rem; }

/* Spoilers, drawn as a frosted pane over the words so the pane's own label
   stays sharp; a picture or a small badge is simply blurred. */
html.hide-spoilers .spoiler { filter: none; }
html.hide-spoilers .spoiler::after {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(11, 14, 20, .35);
  border-radius: 3px;
  min-height: 1.4em;
}
html.hide-spoilers img.spoiler, html.hide-spoilers .badge.spoiler, html.hide-spoilers .prevnext .spoiler { filter: blur(7px); }
html.hide-spoilers .badge.spoiler::after, html.hide-spoilers .prevnext .spoiler::after { content: none; }
html.hide-spoilers h1.spoiler::after { content: "SPOILER"; justify-items: start; }
html.hide-spoilers .spoiler.shown, html.hide-spoilers img.spoiler.shown { filter: none; }
.search input:not(:placeholder-shown) + kbd { display: none; }
table.data { min-width: 640px; }
table.data td.pic img { max-width: none; }
.occasions { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); align-items: start; }
.occasion[open] { grid-column: 1 / -1; }
.feature > .arena { width: 100%; max-width: 22rem; justify-self: center; }
