/* oma-solorpg: the page is an Omarchy desktop. Square windows with 2px borders and 10px
   gaps, the way Hyprland tiles them on Omarchy; the border lights up under the mouse
   (focus follows the mouse there too). Windows are for things that run: screens, terminals,
   the dice. What the page has to say sits on the wallpaper in the Book's own lettering, a
   serif for the story and small caps for scene names, with the monospace for everything
   else. */

/* Themes ------------------------------------------------------------------------------ */

:root,
[data-oma-theme="tokyo-night"] {
  --wall: #13141c; --bg: #1a1b26; --bar: #16161e; --surface: #1f2335;
  --text: #c0caf5; --dim: #7a82a8; --accent: #7aa2f7; --urgent: #f7768e; --gold: #e0af68;
  --idle: #2a2e44; --green: #9ece6a;
  /* Every theme's terminal: the window's colour, darker. Light themes set their own. */
  --term: color-mix(in srgb, var(--bg) 82%, black);
  color-scheme: dark;
}
[data-oma-theme="catppuccin"] {
  --wall: #151522; --bg: #1e1e2e; --bar: #181825; --surface: #262637;
  --text: #cdd6f4; --dim: #8c90a8; --accent: #89b4fa; --urgent: #f38ba8; --gold: #f9e2af;
  --idle: #36374b; --green: #a6e3a1;
  color-scheme: dark;
}
[data-oma-theme="catppuccin-latte"] {
  --wall: #dce0e8; --bg: #eff1f5; --bar: #e6e9ef; --surface: #e6e9ef;
  --text: #4c4f69; --dim: #5c5f77; --accent: #1e66f5; --urgent: #d20f39; --gold: #9a5f07;
  --idle: #bcc0cc; --green: #40a02b;
  --term: #e6e9ef;
  color-scheme: light;
}
[data-oma-theme="gruvbox"] {
  --wall: #1d2021; --bg: #282828; --bar: #1d2021; --surface: #32302f;
  --text: #ebdbb2; --dim: #a89984; --accent: #83a598; --urgent: #fb4934; --gold: #fabd2f;
  --idle: #45403d; --green: #b8bb26;
  color-scheme: dark;
}
[data-oma-theme="nord"] {
  --wall: #242933; --bg: #2e3440; --bar: #272c36; --surface: #3b4252;
  --text: #e5e9f0; --dim: #96a0b3; --accent: #88c0d0; --urgent: #bf616a; --gold: #ebcb8b;
  --idle: #434c5e; --green: #a3be8c;
  color-scheme: dark;
}
[data-oma-theme="everforest"] {
  --wall: #232a2e; --bg: #2d353b; --bar: #232a2e; --surface: #343f44;
  --text: #d3c6aa; --dim: #929d94; --accent: #a7c080; --urgent: #e67e80; --gold: #dbbc7f;
  --idle: #475258; --green: #a7c080;
  color-scheme: dark;
}
[data-oma-theme="kanagawa"] {
  --wall: #16161d; --bg: #1f1f28; --bar: #16161d; --surface: #2a2a37;
  --text: #dcd7ba; --dim: #8f8c7c; --accent: #7e9cd8; --urgent: #ff5d62; --gold: #e6c384;
  --idle: #363646; --green: #98bb6c;
  color-scheme: dark;
}
[data-oma-theme="rose-pine"] {
  --wall: #13111d; --bg: #191724; --bar: #13111d; --surface: #1f1d2e;
  --text: #e0def4; --dim: #908caa; --accent: #c4a7e7; --urgent: #eb6f92; --gold: #f6c177;
  --idle: #2a2740; --green: #9ccfd8;
  color-scheme: dark;
}
[data-oma-theme="matte-black"] {
  --wall: #080808; --bg: #121212; --bar: #0b0b0b; --surface: #1a1a1a;
  --text: #cfcfcf; --dim: #8a8a8a; --accent: #e68e0d; --urgent: #d35f5f; --gold: #f0b429;
  --idle: #262626; --green: #8aa66b;
  color-scheme: dark;
}

:root {
  --faint: color-mix(in srgb, var(--text) 20%, transparent);
  --hair: color-mix(in srgb, var(--text) 70%, var(--gold));
  --steel: color-mix(in srgb, var(--dim) 70%, var(--accent));
  --mono: "JetBrains Mono", "JetBrainsMono Nerd Font", ui-monospace, "DejaVu Sans Mono", monospace;
  --serif: "EB Garamond", "Liberation Serif", Georgia, "Times New Roman", serif;
  --gap: 10px;
  --border: 2px;
  --page: 1440px;
  --bar-h: calc(28px + env(safe-area-inset-top, 0px));
}

/* Base -------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 44px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--text);
  font: 14px/1.65 var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .4s, color .4s;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .92em; color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
p { margin: 0 0 .9em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--bg); padding: 6px 10px; }
.skip:focus { left: 10px; top: 34px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.label { font-size: 12px; color: var(--dim); margin: 0 0 .5em; }
.icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.icon .fill { fill: currentColor; stroke: none; }

/* The bar ----------------------------------------------------------------------------- */

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--bar-h);
  padding-top: env(safe-area-inset-top, 0px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-inline: 10px;
  background: var(--bar);
  font-size: 12px;
  color: var(--text);
  transition: background-color .4s;
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.bar-right { justify-content: flex-end; }
.bar-mark { display: grid; place-items: center; width: 26px; height: 26px; color: var(--accent); }
.workspaces { display: flex; }
.workspaces a {
  display: grid; place-items: center;
  min-width: 22px; height: 26px; padding: 0 5px;
  color: var(--dim); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.workspaces a:hover { color: var(--text); }
.workspaces a.active { color: var(--text); border-bottom-color: var(--accent); }
.workspaces a.secret { color: var(--gold); border-bottom-color: var(--gold); }
/* Waybar's window title: the name of the workspace in view. */
.bar-title {
  margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--faint);
  color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s;
}
.bar-title.swap { opacity: 0; }
.clock { color: var(--text); letter-spacing: .02em; white-space: nowrap; }
.bar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 7px;
  background: none; border: 0; cursor: pointer;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.bar-btn:hover { color: var(--accent); text-decoration: none; }
#sound-btn .off { display: none; }
#sound-btn[aria-pressed="false"] .on { display: none; }
#sound-btn[aria-pressed="false"] .off { display: inline; color: var(--dim); }
.bar-d20 { color: var(--gold); }
.bar-d20 .icon { width: 17px; height: 17px; transition: transform .2s; }
.bar-d20.spin .icon { animation: spin .7s cubic-bezier(.2, .8, .3, 1); }
.bar-d20.lit .icon { filter: drop-shadow(0 0 5px var(--gold)); }
.bar-d20.demon { color: var(--urgent); }
.bar-roll { min-width: 0; font-variant-numeric: tabular-nums; }
@keyframes spin { from { transform: rotate(0) scale(1.25); } to { transform: rotate(720deg) scale(1); } }

/* Workspaces, windows and the wallpaper between them ---------------------------------- */

main { padding-top: var(--bar-h); }
.ws { max-width: var(--page); margin-inline: auto; padding: var(--gap) 16px; }
.ws + .ws { margin-top: clamp(64px, 7.5vw, 112px); }
.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.tiles > * { grid-column: span 12; }

.win {
  position: relative;
  min-width: 0;
  background: var(--bg);
  border: var(--border) solid var(--idle);
  padding: 20px 22px;
  transition: border-color .15s, background-color .4s, box-shadow .4s;
}
.win:hover, .win:focus-within { border-color: var(--accent); }
.win > p:last-child { margin-bottom: 0; }
.win-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: -4px 0 16px;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.win-title { color: var(--dim); }
.win:hover .win-title { color: var(--text); }
.win-head .dim { letter-spacing: 0; text-transform: none; }
.win-tag {
  position: absolute; left: 8px; bottom: 8px; z-index: 1;
  padding: 1px 8px;
  background: color-mix(in srgb, var(--bar) 88%, transparent);
  color: var(--dim); font-size: 12px; letter-spacing: .04em;
  pointer-events: none;
}
.win:hover .win-tag { color: var(--text); }
.note { color: var(--dim); font-size: 13px; margin: 12px 2px 0; max-width: 92ch; }
.note code { color: var(--dim); }
.note b { color: var(--text); font-weight: 500; }

/* Section openings: a scene's title card, then the GM's paragraph -------------------- */

.card-head { text-align: center; margin: 0 auto clamp(20px, 2.6vw, 32px); max-width: 980px; padding: 0 10px; }
.card-head.sub { margin-top: clamp(56px, 7vw, 96px); }
.rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto; }
.rule span { height: 1px; background: var(--faint); width: 0; transition: width 1.3s cubic-bezier(.2, .7, .2, 1); }
.rule i { font-style: normal; color: var(--gold); font-size: 11px; opacity: 0; transition: opacity .5s .2s; }
.revealed .rule span { width: min(26vw, 240px); }
.revealed .rule i { opacity: 1; }
.card-head h2, .card-head h3, .hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-variant-caps: small-caps;
  letter-spacing: .04em;
  line-height: 1.1;
  margin: .32em 0 .18em;
  color: var(--text);
}
.card-head h2 { font-size: clamp(34px, 5vw, 58px); }
.card-head h3 { font-size: clamp(28px, 3.6vw, 42px); }
.card-sub { font-family: var(--serif); font-style: italic; color: var(--dim); font-size: clamp(17px, 1.8vw, 21px); margin: 0 0 .7em; text-wrap: balance; }

/* The GM's paragraph: a column of the Book's prose, left-aligned, in the middle. */
.lede {
  font-family: var(--serif); font-size: clamp(18px, 1.45vw, 21px); line-height: 1.6;
  max-width: 36em; margin: 0 auto clamp(30px, 4vw, 52px);
  color: var(--text); text-wrap: pretty;
}
.lede code { font-size: .78em; }
.drop::first-letter {
  float: left; font-family: var(--serif); color: var(--gold);
  font-size: 3.35em; line-height: .86; padding: .07em .1em 0 0;
}

/* A title while it decrypts: the monospace, noise settling into letters. Settled: the
   book's lettering, with a breath of gold behind it. */
.decrypt { display: grid; }
.decrypt > * { grid-area: 1 / 1; text-wrap: balance; }
.decrypt .noise {
  font-family: var(--mono); font-variant-caps: normal; font-weight: 400;
  color: var(--accent); letter-spacing: .12em; font-size: .62em; align-self: center;
  opacity: 0; transition: opacity .45s;
}
.decrypt .final { transition: opacity .6s, letter-spacing .9s cubic-bezier(.2, .7, .2, 1), text-shadow 1.2s; }
.decrypt.running .noise { opacity: 1; }
.decrypt.running:not(.settled) .final { opacity: 0; letter-spacing: .3em; transition: none; }
.decrypt.settled .noise { opacity: 0; }
.decrypt.settled .final { opacity: 1; letter-spacing: .04em; text-shadow: 0 0 28px color-mix(in srgb, var(--gold) 45%, transparent); }
.decrypt.settled.cooled .final { text-shadow: 0 0 18px color-mix(in srgb, var(--gold) 12%, transparent); }

/* Lists of what it does: gold diamonds, two columns where there's room. */
.beats { padding-left: 1.1em; margin: 1em 0 0; }
.beats li { margin: 0 0 .7em; padding-left: .3em; }
.beats li::marker { content: "◆ "; color: var(--gold); font-size: .7em; }
.beats.spread { columns: 2 32ch; column-gap: 56px; max-width: 1120px; margin: 0 auto clamp(36px, 5vw, 64px); }
.beats.spread li { break-inside: avoid; }
.voice-inline { color: var(--accent); letter-spacing: .08em; font-size: .92em; white-space: nowrap; }

/* Buttons that look like the Book's links ------------------------------------------- */

.acts { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 1.6em; }
.act {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border: 1px solid var(--faint); background: none; cursor: pointer;
  color: var(--text); text-decoration: none; font-size: 14px;
  transition: border-color .15s, color .15s, background-color .15s;
}
.act::before { content: "→"; color: var(--dim); }
.act:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.act.primary { border-color: var(--accent); color: var(--bg); background: var(--accent); font-weight: 500; }
.act.primary::before { color: inherit; }
.act.primary:hover { color: var(--bg); background: color-mix(in srgb, var(--accent) 85%, var(--text)); }
.act.small { font-size: 12.5px; padding: 5px 11px; }

/* Portraits in text, coloured stroke by stroke ---------------------------------------- */

.portrait {
  margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.02; white-space: pre;
  color: var(--text); --line: var(--text); --eyes: var(--line);
  animation: breathe 5s ease-in-out infinite; transform-origin: 50% 90%;
}
.portrait.big { font-size: clamp(11px, 1.2vw, 15px); }
.portrait .i-dot, .portrait .i-b, .portrait .i-m, .portrait .i-a { color: var(--line); }
.portrait .i-e { color: var(--eyes); }
.portrait .i-h { color: color-mix(in srgb, var(--line) 70%, var(--gold)); opacity: .8; }
.portrait .i-g { color: var(--steel); }
.portrait .i-o { color: var(--gold); }
.portrait .i-w { color: var(--urgent); }
.portrait[data-tint="hurt"] { --line: color-mix(in srgb, var(--text) 65%, var(--urgent)); }
.portrait[data-tint="grave"] { --line: var(--urgent); }
.portrait[data-mood="triumph"] { --eyes: var(--gold); }
.portrait[data-mood="triumph"] .i-e { text-shadow: 0 0 8px var(--gold); }
.portrait[data-mood="angry"] { --eyes: var(--urgent); }
.portrait[data-mood="dead"] { --eyes: var(--dim); animation: none; }
.portrait[data-mood="dying"] { animation: weak 1.6s ease-in-out infinite; }
.portrait[data-wounds="2"] .i-w { animation: throb 1.6s ease-in-out infinite; }
.portrait.flicker { animation: flicker .32s steps(2) 1; }
@keyframes breathe { 50% { transform: scaleY(1.012); } }
@keyframes weak { 50% { opacity: .55; } }
@keyframes throb { 50% { opacity: .4; } }
@keyframes flicker { 0% { opacity: .2; } 40% { opacity: 1; } 60% { opacity: .35; } 100% { opacity: 1; } }

.sheet { font-size: 13px; min-width: 180px; }
.sheet p { margin: 0 0 .35em; }
.sheet-name { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.sheet-info { color: var(--dim); }
.sheet-conds { color: var(--dim); min-height: 1.6em; }
.sheet-conds.held { color: var(--urgent); }
.meter { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.bar-blocks { color: var(--accent); letter-spacing: -.5px; }
.bar-blocks .empty { color: var(--faint); }
.bar-blocks.low { color: var(--urgent); }
.meter .num { color: var(--dim); }

/* Screenshots ------------------------------------------------------------------------- */

.shot { margin: 0; padding: 0; overflow: hidden; cursor: zoom-in; background: var(--bg); }
.shot img { width: 100%; }
/* A tall screen is cut at the bottom, never at the sides, and fades out where it's cut. */
.shot.tall { position: relative; height: clamp(420px, 130vw, 560px); }
.shot.tall img { position: absolute; top: 0; left: 0; width: 100%; height: auto; }
.shot.tall::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 110px; pointer-events: none;
  background: linear-gradient(transparent, var(--bg));
}
@media (min-width: 1000px) { .shot.tall { height: auto; min-height: 420px; } }

/* Terminals --------------------------------------------------------------------------- */

.term { background: var(--term); font-size: 13px; }
.term-body p, .term-body pre { margin: 0 0 .25em; white-space: pre-wrap; word-break: break-word; font: inherit; }
.term-body [data-cmd]::before { content: attr(data-prompt); color: var(--green); }
.term-body [data-cmd] { color: var(--text); }
.term-body [data-cmd] .cwd { color: var(--accent); }
.term-body .caret { display: inline-block; width: .6em; height: 1.1em; vertical-align: -2px; background: var(--text); animation: caret 1s steps(1) infinite; }
.term-body .out { color: var(--dim); }
.term-body .ok, .term-body b.ok { color: var(--green); font-weight: 500; }
/* Lines not typed yet keep their room, so the window doesn't grow while it types. */
.term-body .pending { visibility: hidden; }
.term-body .rest { color: transparent; }
.term-note { color: var(--dim); font-size: 12px; margin: 14px 0 0; border-top: 1px dashed var(--faint); padding-top: 8px; }
@keyframes caret { 50% { opacity: 0; } }
.toml, .cmd-block { margin: 0 0 14px; padding: 10px 12px; background: var(--term); border: 1px solid var(--faint); overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.toml .k { color: var(--accent); } .toml .s { color: var(--green); }
.cmd-block code { color: var(--text); font-size: 12.5px; white-space: pre; }
.cmd-block.big code { font-size: 13.5px; line-height: 1.7; }

/* 1 · Start --------------------------------------------------------------------------- */

#start { padding-block: clamp(28px, 6vh, 80px) var(--gap); }
.hero { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); align-items: center; }
.eyebrow { font-size: 12.5px; color: var(--dim); letter-spacing: .04em; margin: 0; }
.hero h1 { font-size: clamp(40px, 4.7vw, 72px); line-height: 1.02; margin: .22em 0 .32em; }
.rule.start { justify-content: flex-start; margin: 0 0 1.4em; }
.rule.start span:first-child { display: none; }
.revealed .rule.start span { width: min(40%, 180px); }
.hero .lede { margin: 0 0 1em; max-width: 34em; }
.player {
  display: block; text-align: left; cursor: pointer;
  background: none; border: 0; border-left: 2px solid var(--faint);
  padding: 0 0 0 14px; margin: 0 0 1.6em;
  font: italic clamp(17px, 1.35vw, 19px)/1.5 var(--serif); color: var(--dim);
  transition: color .15s, border-color .15s;
}
.player:hover { color: var(--text); border-left-color: var(--gold); }
.facts { font-size: 12.5px; margin: 0 0 .4em; max-width: 64ch; }
.facts span { white-space: nowrap; }
/* The Book's window has wide margins of its own; the sides go so the story reads larger. */
.hero-shot { box-shadow: 0 40px 90px -40px rgb(0 0 0 / .65); }
.hero-shot img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 0; }
@media (min-width: 1000px) {
  .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

/* 2 · The trailer --------------------------------------------------------------------- */

.player-win { padding: 0; max-width: 1180px; margin: 0 auto; width: 100%; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--faint); }
.tabs button {
  background: none; border: 0; padding: 8px 16px; cursor: pointer; color: var(--dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 12.5px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video video { width: 100%; height: 100%; display: block; background: #000; }
.video .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: var(--bg); padding: 20px;
}
.placeholder .ph-title { font-family: var(--serif); font-variant-caps: small-caps; font-size: clamp(26px, 4vw, 46px); letter-spacing: .06em; margin: .3em 0 .2em; }
.placeholder .ph-file { color: var(--dim); font-size: 12.5px; }
@media (max-width: 640px) { .placeholder .ph-die { display: none !important; } .placeholder .ph-title { font-size: 24px; } }
.placeholder .ph-die { color: var(--gold); white-space: pre; line-height: .95; font-size: 12px; margin: 0 auto 10px; display: inline-block; animation: tumble 2.8s ease-in-out infinite; }
@keyframes tumble { 0%, 100% { transform: rotate(-8deg) translateY(0); } 25% { transform: rotate(10deg) translateY(-6px); } 50% { transform: rotate(-4deg) translateY(0); } 75% { transform: rotate(6deg) translateY(-3px); } }

/* 3 · The Book ------------------------------------------------------------------------ */

.gallery { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery .g-big { grid-column: span 2; }
.gallery .shot img, .shelf-shots .shot img { aspect-ratio: 1920 / 1290; object-fit: cover; }
@media (min-width: 900px) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gallery .g-big { grid-row: span 2; }
  .gallery .g-big img { height: 100%; }
}
/* On a phone the screens go sideways, one at a time, instead of a column of thumbnails. */
@media (max-width: 640px) {
  .gallery {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin-inline: -16px; padding: 0 16px 6px; scroll-padding-inline: 16px; scrollbar-width: none;
  }
  .gallery::-webkit-scrollbar { display: none; }
  .gallery > .shot { flex: 0 0 86%; scroll-snap-align: start; }
}

.play-tiles { margin-top: clamp(36px, 5vw, 64px); }
.dice-win, .face-lab { container-type: inline-size; }
.dice-win { display: flex; flex-direction: column; }
.dice-win .roller { flex: 1; }
@media (min-width: 1100px) {
  .dice-win { grid-column: span 8; }
  .face-lab { grid-column: span 4; }
}

/* The roller mirrors the Book: the hero on the left, the dice in the middle. */
.roller { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.roll-hero { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; }
.roll-hero .portrait { font-size: 11px; }
@container (min-width: 640px) {
  .roller { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-rows: auto 1fr; grid-template-areas: "hero stage" "controls stage"; column-gap: 26px; }
  .roll-hero { grid-area: hero; }
  .roller-controls { grid-area: controls; }
  .dice-stage { grid-area: stage; }
}
.chips, .skills, .push-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chip {
  padding: 4px 10px; border: 1px solid var(--faint); background: none; cursor: pointer;
  font-size: 12.5px; color: var(--text);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.push-chips .chip { border-color: color-mix(in srgb, var(--urgent) 45%, transparent); }
.push-chips .chip:hover { border-color: var(--urgent); color: var(--urgent); }
.steppers { display: flex; align-items: center; gap: 6px; margin: 0 0 16px; font-size: 13px; flex-wrap: wrap; }
.steppers span:not(:first-child) { margin-left: 10px; }
.step { width: 28px; height: 28px; border: 1px solid var(--faint); background: none; cursor: pointer; }
.step:hover { border-color: var(--accent); }
.steppers output { min-width: 1.4em; text-align: center; }
.roll-btn { min-width: 150px; justify-content: center; }
.roll-btn::before { content: none; }
.push { margin-top: 14px; }
.push p { margin-bottom: 6px; font-size: 13px; }
.roll-log { color: var(--dim); font-size: 12.5px; margin: 12px 0 0; min-height: 1.6em; }
#rest-btn { margin-top: 8px; }

.dice-stage { position: relative; display: grid; place-items: center; min-height: 300px; overflow: hidden; background: color-mix(in srgb, var(--wall) 55%, var(--bg)); }
.dice-card {
  position: relative; text-align: center; background: var(--surface);
  border: 1px solid var(--faint); padding: 16px 26px 12px; min-width: 250px;
  transition: border-color .2s, box-shadow .6s;
}
.dice-card.dragon { border: 2px solid var(--gold); box-shadow: 0 0 44px color-mix(in srgb, var(--gold) 40%, transparent); }
.dice-card.demon { border: 2px solid var(--urgent); box-shadow: 0 0 44px color-mix(in srgb, var(--urgent) 40%, transparent); }
.dice-card.fail { border-color: var(--urgent); }
.dice-card.ok { border-color: var(--accent); }
.dice-card.pop { animation: pop .42s cubic-bezier(.3, 1.6, .5, 1); }
.dice-card.shake { animation: shake .14s linear 4; }
.dice-label { color: var(--dim); font-size: 12px; letter-spacing: .25em; margin: 0 0 6px; }
.dice-row { display: flex; gap: 18px; justify-content: center; }
.d20 { margin: 0; font-family: var(--mono); white-space: pre; line-height: .98; font-size: clamp(11px, 1.1vw, 14px); color: var(--text); }
.d20.counts { color: var(--verdict, var(--text)); }
.d20.dim { color: var(--faint); }
.dice-row.tumbling { animation: rock .21s ease-in-out infinite alternate; }
.dice-need { color: var(--dim); margin: 8px 0 0; font-size: 12.5px; }
.verdict { font-family: var(--serif); font-size: 30px; letter-spacing: 0; color: var(--verdict, var(--text)); margin: 0; min-height: 1.3em; opacity: 0; transition: opacity .22s, letter-spacing .5s cubic-bezier(.2, .7, .2, 1); }
.verdict.on { opacity: 1; letter-spacing: .22em; }
.ring { position: absolute; left: 50%; top: 50%; width: 60%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--verdict, var(--accent)); transform: translate(-50%, -50%) scale(.3); opacity: 0; pointer-events: none; }
.ring.go { animation: ring .7s cubic-bezier(.2, .7, .3, 1); }
.sparks { position: absolute; inset: 0; pointer-events: none; }
.sparks i { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--c, var(--gold)); box-shadow: 0 0 6px var(--c, var(--gold)); animation: fly var(--t, 1s) cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes rock { from { transform: rotate(-12deg) translateY(-6px); } to { transform: rotate(14deg) translateY(2px); } }
@keyframes pop { 0% { transform: scale(.9); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-9px); } 75% { transform: translateX(9px); } }
@keyframes ring { 0% { opacity: .8; transform: translate(-50%, -50%) scale(.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); } }
@keyframes fly { 0% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))); } }

.face-lab-body { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: center; }
.face-lab-body .portrait { justify-self: center; }
@container (min-width: 560px) { .face-lab-body { grid-template-columns: auto minmax(0, 1fr); gap: 28px; } }

/* 4 · The desktop --------------------------------------------------------------------- */

@media (min-width: 1000px) { .mock { grid-column: span 8; } .fx-panel { grid-column: span 4; } }
.mock { padding: 0; overflow: hidden; background: var(--wall); display: flex; flex-direction: column; min-height: 300px; }
.mock-bar { display: flex; justify-content: space-between; padding: 3px 10px; background: var(--bar); font-size: 11px; color: var(--dim); }
.mock-bar b { color: var(--text); font-weight: 400; border-bottom: 1px solid var(--accent); }
.mock-d20 { color: var(--gold); }
.mock-tiles { flex: 1; display: grid; grid-template-columns: minmax(0, 3.2fr) minmax(0, 1fr); gap: 6px; padding: 6px; min-height: 0; }
.mock-win { border: 2px solid var(--idle); overflow: hidden; background: var(--bg); transition: border-color .25s; position: relative; }
.mock-book { border-color: var(--accent); }
.mock-win img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.mock-table img { object-position: top; }
.mock-fx, .page-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.page-fx { position: fixed; z-index: 60; }
.fx-flood, .fx-tear, .fx-rim, .fx-ripple, .fx-candle { position: absolute; inset: 0; opacity: 0; }
.fx-flood { background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--gold) 70%, white) 0%, color-mix(in srgb, var(--gold) 55%, transparent) 38%, transparent 78%); mix-blend-mode: screen; }
.fx-rim { box-shadow: inset 0 0 var(--rim, 60px) var(--rim-spread, 10px) color-mix(in srgb, var(--urgent) 85%, black); }
.fx-candle { background: radial-gradient(ellipse at 50% 40%, rgba(255, 176, 90, .08), rgba(255, 120, 40, .22)); mix-blend-mode: multiply; transition: opacity 1.4s; }
.fx-ripple { border-radius: 50%; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; inset: auto; transform: translate(-50%, -50%) scale(.2); border: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 50%, transparent), inset 0 0 40px color-mix(in srgb, var(--accent) 30%, transparent); }
.fx-tear {
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, color-mix(in srgb, var(--urgent) 55%, transparent) 7px 9px, transparent 9px 23px),
    linear-gradient(90deg, color-mix(in srgb, var(--urgent) 40%, transparent), transparent 14%, transparent 86%, color-mix(in srgb, var(--urgent) 40%, transparent));
  -webkit-mask-image: linear-gradient(90deg, #000 0 12%, transparent 22% 78%, #000 88%);
  mask-image: linear-gradient(90deg, #000 0 12%, transparent 22% 78%, #000 88%);
}
.flood .fx-flood { animation: flood 1.9s ease-out; }
.torn .fx-tear { animation: tear 1.3s steps(8) 1; }
.dying .fx-rim { opacity: 1; animation: heartbeat 1.1s ease-in-out infinite; }
.rippling .fx-ripple { animation: ripple 1.6s ease-out; }
.candle .fx-candle { opacity: 1; }
.candle .mock-tiles, html.candle main { filter: sepia(.18) saturate(1.05); }
.fx-gold .mock-win, html.fx-gold .win { border-color: var(--gold) !important; box-shadow: 0 0 22px color-mix(in srgb, var(--gold) 35%, transparent); }
.fx-red .mock-win, html.fx-red .win { border-color: var(--urgent) !important; }
.fx-drain .mock-tiles, html.fx-drain main { filter: saturate(.15) contrast(1.1); transition: filter .15s; }
.fx-dark-red .mock-win, html.fx-dark-red .win { border-color: color-mix(in srgb, var(--urgent) 55%, black) !important; }
.fx-dead .mock-tiles, html.fx-dead main { filter: grayscale(1) brightness(.8) hue-rotate(180deg) saturate(.4); transition: filter 1.2s; }
.jolt .mock-tiles, html.jolt main { animation: jolt .32s linear; }
.mock-tiles, main { transition: filter 1.4s; }
@keyframes flood { 0% { opacity: 0; } 18% { opacity: .75; } 100% { opacity: 0; } }
@keyframes tear { 0% { opacity: .9; transform: translateX(-6px); } 30% { transform: translateX(8px) skewX(-4deg); } 60% { opacity: .7; transform: translateX(-4px); } 100% { opacity: 0; transform: none; } }
@keyframes heartbeat { 0%, 100% { opacity: .75; } 12% { opacity: 1; } 24% { opacity: .8; } 36% { opacity: 1; } }
@keyframes ripple { 0% { opacity: .9; transform: translate(-50%, -50%) scale(.2); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(5); } }
@keyframes jolt { 20% { transform: translate(-7px, 3px); } 40% { transform: translate(6px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }

.fx-list { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.fx-btn {
  display: grid; gap: 1px; align-content: start; text-align: left; padding: 9px 12px; cursor: pointer;
  background: none; border: 1px solid var(--faint); color: var(--text);
}
.fx-btn b { font-weight: 500; font-size: 13px; }
.fx-btn span { color: var(--dim); font-size: 12px; line-height: 1.45; }
.fx-btn:hover { border-color: var(--accent); }
.fx-btn.gold:hover { border-color: var(--gold); } .fx-btn.gold b { color: var(--gold); }
.fx-btn.red:hover { border-color: var(--urgent); } .fx-btn.red b { color: var(--urgent); }
.fx-btn.quiet b { color: var(--green); }
.fx-btn.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.notify { position: fixed; top: 38px; right: 12px; z-index: 70; display: grid; gap: 8px; width: min(340px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  background: var(--surface); border: 2px solid var(--accent); padding: 10px 14px; font-size: 13px;
  animation: toast-in .3s cubic-bezier(.2, .8, .3, 1); pointer-events: auto;
}
.toast b { display: block; font-weight: 500; margin-bottom: 2px; }
.toast.out { animation: toast-out .4s ease-in forwards; }
.toast.gold { border-color: var(--gold); } .toast.red { border-color: var(--urgent); }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }

/* 5 · The rules ----------------------------------------------------------------------- */

@media (min-width: 1000px) {
  .turn-win { grid-column: span 5; }
  .rules-tiles .term { grid-column: span 7; }
  .solo-win { grid-column: span 8; }
  .rules-table { grid-column: span 4; }
}
.turn { list-style: none; padding: 0; margin: 0 0 18px; }
.turn li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 7px 0; position: relative; }
.turn li + li::before { content: ""; position: absolute; left: 30px; top: -6px; height: 12px; border-left: 1px dashed var(--faint); }
.who { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; text-align: right; padding-top: 1px; }
.who.eng { color: var(--gold); }

/* 6 · Your books ---------------------------------------------------------------------- */

@media (min-width: 1000px) {
  .steps-win { grid-column: span 5; }
  .books-tiles .term { grid-column: span 7; }
  .capture-win { grid-column: span 5; }
  .adv-win { grid-column: span 7; }
}
.steps { padding-left: 1.4em; margin: 0 0 1em; }
.steps li { margin: 0 0 .7em; padding-left: .3em; }
.steps li::marker { color: var(--gold); }
.capture { display: grid; gap: 12px; }
.capture img { border: 1px solid var(--faint); background: #fff; }

.shelf { display: grid; gap: var(--gap); }
.shelf-card { display: grid; gap: 26px; grid-template-columns: minmax(0, 1fr); padding: clamp(18px, 2.6vw, 32px); }
@media (min-width: 1100px) {
  .shelf-card { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .shelf-card.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .shelf-card.flip .shelf-text { order: 2; }
}
.shelf-kicker { color: var(--dim); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.shelf-card h4 { font-family: var(--serif); font-weight: 500; font-variant-caps: small-caps; letter-spacing: .04em; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.1; margin: .15em 0 .35em; }
.shelf-blurb { font-family: var(--serif); font-size: clamp(18px, 1.4vw, 20px); line-height: 1.5; }
.shelf-shots { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.shelf-shots .shot { border: 2px solid var(--idle); transition: border-color .15s; }
.shelf-shots .shot:hover { border-color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 18px 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { color: var(--dim); font-size: 12px; letter-spacing: .04em; }
.stats dd { margin: 0; font-family: var(--serif); font-size: 32px; line-height: 1; color: var(--gold); }
.playtest { border-left: 2px solid var(--gold); padding-left: 14px; font-size: 13px; margin: 0; }
.playtest b { color: var(--gold); font-weight: 500; letter-spacing: .1em; }
.credit { margin-top: 6px; max-width: 110ch; }

/* 7 · Campaigns ----------------------------------------------------------------------- */

@media (min-width: 1000px) {
  .gen-win { grid-column: span 7; }
  .heir-win { grid-column: span 5; }
}

/* 8 · Install ------------------------------------------------------------------------- */

@media (min-width: 1000px) {
  .install-term { grid-column: 1 / span 8; grid-row: 1; }
  .need-win { grid-column: 1 / span 4; grid-row: 2; }
  .road-win { grid-column: 5 / span 4; grid-row: 2; }
  .install-table { grid-column: 9 / span 4; grid-row: 1 / span 2; }
}
@media (min-width: 640px) and (max-width: 999px) {
  .need-win, .road-win { grid-column: span 6; }
}
.install-term { border-color: color-mix(in srgb, var(--accent) 55%, var(--idle)); }
.copy { background: none; border: 1px solid var(--faint); padding: 2px 12px; cursor: pointer; font-size: 12px; color: var(--dim); text-transform: none; letter-spacing: 0; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.need, .road { padding-left: 1.1em; margin: 0 0 1em; }
.need li, .road li { margin: 0 0 .7em; }
.need li::marker { content: "◆ "; color: var(--gold); font-size: .7em; }
.road { list-style: none; padding: 0; }
.tag { display: inline-block; min-width: 62px; margin-right: 8px; padding: 0 6px; font-size: 12px; text-align: center; border: 1px solid var(--faint); color: var(--dim); }
.tag.shipped { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.tag.next { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }

/* Footer ------------------------------------------------------------------------------ */

.foot { margin-top: clamp(64px, 7.5vw, 112px); padding: 30px 16px 44px; background: var(--bar); font-size: 13px; color: var(--dim); }
.foot-grid { display: grid; gap: 30px; max-width: 1280px; margin: 0 auto; grid-template-columns: 1fr; }
@media (min-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 56px; } }
.license-logo { display: inline-block; background: #f4f1ea; padding: 10px 14px; margin-bottom: 14px; }
.license-logo img { width: 230px; }
.foot b { color: var(--text); font-weight: 500; }
.foot-last { display: flex; justify-content: space-between; align-items: center; }
.foot-d20 { color: var(--gold); opacity: .5; cursor: help; }

/* Dialogs ----------------------------------------------------------------------------- */

dialog { color: var(--text); }
dialog::backdrop { background: color-mix(in srgb, var(--wall) 70%, transparent); backdrop-filter: blur(3px); }
.walker { padding: 0; border: 2px solid var(--accent); background: var(--bg); width: min(460px, calc(100vw - 30px)); margin-top: 16vh; }
.walker-box { margin: 0; }
.walker input { width: 100%; padding: 14px 16px; background: none; border: 0; border-bottom: 1px solid var(--faint); color: var(--text); font: 15px var(--mono); outline: none; }
.walker ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.walker li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; cursor: pointer; }
.walker li[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.walker li .sw { display: inline-flex; gap: 2px; }
.walker li .sw i { width: 10px; height: 14px; display: inline-block; }
.walker li .cur { margin-left: auto; color: var(--dim); font-size: 12px; }
.walker-hint { margin: 0; padding: 6px 16px 10px; color: var(--dim); font-size: 12px; }
.lightbox { padding: 0; border: 2px solid var(--accent); background: var(--bg); max-width: min(1500px, 96vw); width: 96vw; max-height: 94vh; }
.lightbox figure { margin: 0; display: grid; }
.lightbox img { max-height: calc(94vh - 60px); width: 100%; object-fit: contain; background: var(--bg); }
.lightbox figcaption { padding: 10px 50px 12px 14px; font-size: 13px; color: var(--dim); }
.lb-close { position: absolute; right: 6px; top: 4px; z-index: 2; background: var(--bg); border: 1px solid var(--faint); width: 32px; height: 32px; cursor: pointer; font-size: 18px; }
.lb-nav { position: absolute; top: 45%; z-index: 2; width: 40px; height: 56px; background: color-mix(in srgb, var(--bg) 80%, transparent); border: 1px solid var(--faint); cursor: pointer; font-size: 26px; }
.lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }

/* Narrow screens: one column of windows, the bar trimmed ------------------------------ */

@media (max-width: 899px) { .bar-title { display: none; } }
@media (max-width: 640px) {
  .hide-sm, .bar-center, #theme-name { display: none; }
  .bar { grid-template-columns: 1fr auto; }
  .workspaces a { min-width: 19px; padding: 0 3px; }
  .ws + .ws { margin-top: 56px; }
  .win { padding: 16px 14px; }
  .rule span { max-width: 22vw; }
  .acts .act { flex: 1 1 auto; justify-content: center; }
  .mock-tiles { grid-template-columns: 1fr; }
  .mock-table { display: none; }
  .d20 { font-size: 10.5px; }
  .dice-row { gap: 8px; }
  .dice-card { min-width: 0; padding: 14px 16px 10px; }
  .turn li { grid-template-columns: 56px 1fr; }
  .turn li + li::before { left: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
