:root {
  --bg: #000; --grouped: #1c1c1e; --grouped2: #2c2c2e; --sep: rgba(84, 84, 88, .45);
  --text: #f5f5f7; --muted: #98989f; --link: #0a84ff; --red: #ff453a; --gold: #ffd60a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
[lang="en"] [lang="ru"], [lang="ru"] [lang="en"] { display: none; }
a { color: var(--link); text-decoration: none; }
h1, h2 { font-family: "Source Serif 4", Georgia, serif; font-weight: 700; letter-spacing: -.01em; }
/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 20px;
  background: rgba(0, 0, 0, .72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.top .brand { font-weight: 600; font-size: 15px; margin-right: auto; color: var(--text); }
.seg { display: inline-flex; background: var(--grouped2); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--text); font: 600 13px Inter, sans-serif; padding: 5px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: #636366; }
/* page layout: contents on the left, the article in the middle */
.page { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 32px 20px 80px; }
.toc { position: sticky; top: 80px; align-self: start; font-size: 14px; }
.toc .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.toc a { display: block; color: var(--muted); padding: 4px 0; }
.toc a:hover { color: var(--text); }
.toc a.sub { padding-left: 14px; font-size: 13px; }
article.main h1 { font-size: clamp(36px, 6vw, 52px); margin: 0 0 4px; line-height: 1.1; }
.from { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
/* the infobox, like an encyclopedia's */
.infobox { float: right; width: 300px; margin: 0 0 24px 32px; background: var(--grouped); border-radius: 18px; overflow: hidden; }
.infobox .pic { background: radial-gradient(circle at 50% 60%, #2b2416, #1c1c1e 70%); display: grid; place-items: center; padding: 26px; }
.infobox .pic img { width: 150px; height: 150px; object-fit: contain; }
.infobox .cap { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 16px 0; }
.infobox dl { margin: 0; padding: 8px 18px 14px; display: grid; grid-template-columns: auto 1fr; gap: 0 14px; font-size: 14px; }
.infobox dt { color: var(--muted); padding: 7px 0; }
.infobox dd { margin: 0; padding: 7px 0; text-align: right; }
.infobox dt, .infobox dd { border-top: .5px solid var(--sep); }
.infobox dt:first-of-type, .infobox dd:first-of-type { border-top: 0; }
p { margin: 0 0 14px; }
.lead { font-size: 18px; color: #d8d8dc; }
h2 { font-size: 30px; margin: 56px 0 14px; clear: both; }
h3 { margin: 0 0 6px; font-size: 19px; font-weight: 600; }
.muted { color: var(--muted); }
/* grouped lists and tables, iOS style */
.list { background: var(--grouped); border-radius: 16px; overflow: hidden; margin: 14px 0 20px; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; }
.list td { padding: 12px 16px; vertical-align: middle; border-top: .5px solid var(--sep); }
.list tr:first-child td { border-top: 0; }
.list td.ic { width: 56px; padding-right: 0; }
.list td.ic img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; display: block; }
.list td.src { color: var(--muted); font-size: 13px; white-space: nowrap; }
.list code, code { font: 14px ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
/* night outcomes */
.odds { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 16px 0 6px; }
.odds div { background: var(--grouped); border-radius: 16px; padding: 18px; }
.odds b { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; }
.odds span { color: var(--muted); font-size: 14px; }
.odds .r b { color: var(--red); }
/* walkthrough */
ol.walk { list-style: none; padding: 0; margin: 16px 0; counter-reset: w; }
ol.walk li { counter-increment: w; display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 12px 0; }
ol.walk li::before { content: counter(w); width: 30px; height: 30px; border-radius: 50%; background: var(--grouped2); display: grid; place-items: center; font-weight: 600; font-size: 14px; }
/* worlds: alternating picture left / right */
.world { display: grid; grid-template-columns: 170px 1fr; gap: 26px; align-items: center; padding: 26px 0; border-top: .5px solid var(--sep); }
.world:nth-of-type(even) { grid-template-columns: 1fr 170px; }
.world:nth-of-type(even) figure { order: 2; }
.world figure { margin: 0; background: var(--grouped); border-radius: 22px; aspect-ratio: 1; display: grid; place-items: center; }
.world figure img { width: 72%; height: 72%; object-fit: contain; image-rendering: pixelated; }
.world .n { color: var(--muted); font-weight: 500; margin-right: 10px; font-variant-numeric: tabular-nums; }
.world dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 14px; margin: 10px 0; }
.world dt { color: var(--muted); }
.world dd { margin: 0; }
.tp { display: inline-block; color: var(--muted); font-size: 13px; background: var(--grouped); border-radius: 8px; padding: 2px 9px; }
/* monsters: a gallery of silhouettes, the hunter of the corridor biggest */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 250px; grid-auto-flow: dense; gap: 12px; margin-top: 16px; }
.beast { margin: 0; background: var(--grouped); border-radius: 22px; padding: 12px; display: flex; flex-direction: column; min-height: 0; }
.beast.big { grid-column: span 2; grid-row: span 2; }
.beast.wide { grid-column: span 2; }
.beast .frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #dcd9e1; border-radius: 16px; padding: 14px; overflow: hidden; }
.beast img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.beast figcaption { padding-top: 10px; font-size: 14px; line-height: 1.35; }
.beast figcaption span { display: block; color: var(--muted); font-size: 12px; }
/* crafting: recipes laid out like a shelf */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.rcp { margin: 0; background: var(--grouped); border-radius: 18px; padding: 16px; }
.rcp figcaption { margin-top: 10px; font-size: 14px; font-weight: 500; }
.recipe { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; }
.slot { width: 34px; height: 34px; background: var(--grouped2); border-radius: 8px; display: grid; place-items: center; }
.slot img { width: 24px; height: 24px; image-rendering: pixelated; }
.to { color: var(--muted); }
.hero-rcp { display: flex; gap: 24px; align-items: center; background: linear-gradient(135deg, #2a2312, #1c1c1e 60%); border-radius: 22px; padding: 22px; margin: 16px 0; }
.hero-rcp .grid { grid-template-columns: repeat(3, 44px); }
.hero-rcp .slot { width: 44px; height: 44px; background: rgba(255, 255, 255, .07); }
.hero-rcp .slot img { width: 32px; height: 32px; }
.foot { color: var(--muted); font-size: 13px; border-top: .5px solid var(--sep); margin-top: 60px; padding-top: 20px; }
/* monsters looking in from the edges */
.peek { position: fixed; z-index: 9; pointer-events: none; image-rendering: pixelated; height: 170px; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.peek.left { left: 0; transform: translateX(-100%) rotate(10deg); transform-origin: left bottom; }
.peek.right { right: 0; transform: translateX(100%) rotate(-10deg) scaleX(-1); transform-origin: right bottom; }
.peek.bottom { bottom: 0; transform: translateY(100%); }
.peek.left.in { transform: translateX(-40%) rotate(10deg); }
.peek.right.in { transform: translateX(40%) rotate(-10deg) scaleX(-1); }
.peek.bottom.in { transform: translateY(40%); }
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .infobox { float: none; width: 100%; margin: 0 0 24px; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; }
  .beast.big { grid-column: span 2; grid-row: span 1; }
  .beast.wide { grid-column: span 2; }
  .world, .world:nth-of-type(even) { grid-template-columns: 1fr; }
  .world:nth-of-type(even) figure { order: 0; }
  .world figure { max-width: 220px; }
  .odds { grid-template-columns: 1fr; }
  .hero-rcp { flex-direction: column; align-items: flex-start; }
  .list td.src { display: none; }
}
@media (prefers-reduced-motion: reduce) { .peek { display: none; } html { scroll-behavior: auto; } }
