/*
  Reliquary Crypt theme: engraved stone, candlelight, gothic serif headings.

  Rules this file keeps:
  - Text sits only on solid backgrounds. Decorative candles, moon, fog, grain
    and the ghost live in the header, in the page margins and in text-free
    slots, never under text. Fog and grain are drawn with CSS gradients only.
  - Status is never shown by color alone: each Status has its own icon,
    border style, border width and text label.
  - All motion (candle flicker, fog drift, reveals, hover easing) is declared
    inside the reduced motion guard near the end of this file.
  - System font stacks only. No external assets, no image files, no data URIs.
  - Measured contrast (WCAG) against --stone-bg: parchment text 14.8,
    muted text 9.5, protected 9.9, partial 9.4, out 5.3, unlit 5.2,
    focus ring 14.8, edge 5.2. Against --stone-slab the lowest is 4.8.
    Engraved text (--engraved-text) on --stone-slab 11.7, on --stone-bg 12.7,
    on its recess (--engraved-recess) 13.8. Grain adds at most 0.02 of white
    to a Grave card, which keeps every accent at 4.5 or better there.
  - Task 13 colors: --blood-red (#ff6b5e, the NOT_PROTECTED border, crack, alarm
    figure and red text) measures 6.4 on --stone-bg, 5.87 on --stone-slab, 6.8 on
    --stone-well and 5.9 on --stone-slab-red (#2a1b1e, the cracked stone). Parchment
    text on --stone-slab-red 13.65, muted text 8.74. The plaque, the vault and the
    file rows use only the surfaces above.
*/

:root {
  --stone-bg: #17171b;
  --stone-slab: #1f1f25;
  --stone-raised: #26262d;
  --stone-well: #101013;
  --stone-edge: #8f8a7d;
  --stone-edge-dim: #4a4a52;

  --parchment-text: #f1e9d8;
  --parchment-muted: #c4bcab;

  --candle-protected: #7fd48a;
  --candle-partial: #e8b44d;
  --candle-out: #e2655b;
  --candle-unlit: #9a9aa3;
  /* Task 13: the red of a NOT_PROTECTED headstone (border, crack, alarm figure, red text) and its stone. */
  --blood-red: #ff6b5e;
  --stone-slab-red: #2a1b1e;

  --focus-ring: #f1e9d8;
  --on-accent: #17171b;

  /* Requirement 30: the lightest night sky color the hero wordmark and tagline can sit on. It is
     the 72 percent stop of the banner gradient. Text on it is --engraved-text and --parchment-muted. */
  --sky-night: #1f2a4f;

  /* Engraved text: the command and the epitaph carved into a Grave card. */
  --engraved-text: #e2d9c3;
  --engraved-recess: #0d0d10;
  /* Grain: white at this alpha per layer, two layers, so 0.02 at most. */
  --grain-alpha: 0.01;

  --font-display: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", "URW Palladio L", "Noto Serif", "DejaVu Serif", "Liberation Serif", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "DejaVu Sans", "Liberation Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --accent: var(--candle-unlit);
  --status-border-style: dotted;
  --status-border-width: 3px;
}

/* Base */

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--parchment-text);
  background-color: #121215;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(232, 180, 77, 0.10), rgba(0, 0, 0, 0) 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, rgba(0, 0, 0, 0) 1px 46px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0 2px, rgba(0, 0, 0, 0) 2px 92px),
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 1px 2px / 7px 7px;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin: 0 0 0.6em;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.07);
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 0.9em; }

a { color: var(--candle-partial); text-underline-offset: 0.2em; }

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

ul { margin: 0; padding: 0; }

.plain-list { list-style: none; }

.plain-term { font-family: var(--font-body); font-weight: 400; font-size: 0.8em; color: var(--parchment-muted); letter-spacing: 0; text-shadow: none; }

.muted { color: var(--parchment-muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  color: currentColor;
}

.icon-cut { stroke: var(--on-accent); }
.icon-cut-fill { fill: var(--on-accent); }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--parchment-text);
  color: var(--on-accent);
  font-weight: 700;
}

.skip-link:focus { top: 0.5rem; }

/* Focus: every focusable element gets a visible ring (3 to 1 or better) */

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Fog: decorative, behind the page, no text and no pointer events. It shows in
   the margins beside the page and through the moonlit header. Every block that
   carries text (header, main, footer, banner, cards) has its own solid surface. */

.fog {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.fog-layer {
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-size: 200% 100%;
}

.fog-a {
  opacity: 0.8;
  background-image:
    radial-gradient(ellipse 22% 16% at 12% 78%, rgba(176, 186, 208, 0.20), rgba(176, 186, 208, 0) 100%),
    radial-gradient(ellipse 26% 14% at 58% 90%, rgba(176, 186, 208, 0.16), rgba(176, 186, 208, 0) 100%);
}

.fog-b {
  opacity: 0.7;
  background-image:
    radial-gradient(ellipse 20% 12% at 30% 45%, rgba(160, 170, 196, 0.14), rgba(160, 170, 196, 0) 100%),
    radial-gradient(ellipse 24% 13% at 82% 62%, rgba(160, 170, 196, 0.12), rgba(160, 170, 196, 0) 100%);
}

.fog-c {
  opacity: 0.6;
  background-image:
    radial-gradient(ellipse 30% 10% at 45% 20%, rgba(196, 188, 171, 0.10), rgba(196, 188, 171, 0) 100%),
    radial-gradient(ellipse 18% 12% at 90% 30%, rgba(196, 188, 171, 0.09), rgba(196, 188, 171, 0) 100%);
}

/* Page shell: the shell itself is see-through, every child that holds text has a solid surface */

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: 0 0 2rem;
  background: transparent;
  border-left: 2px solid var(--stone-edge-dim);
  border-right: 2px solid var(--stone-edge-dim);
  min-height: 100vh;
}

/* Hero: a moonlit night sky with stars, a large moon, a wrought-iron gate drawn as inline SVG,
   distant trees and tombstones, and drifting fog. All of it is decorative and holds no text. The
   figures live on the plaque below it, a solid stone surface hung on the gate. */

.hero {
  position: relative;
  z-index: 1;
  background: #07080c;
  /* Requirement 30: the art is as tall as --art-h. Under 56rem a sky strip of --sky-h sits above it. */
  --art-h: clamp(230px, 33vw, 345px);
  --sky-h: 0px;
}

.hero-scene { position: relative; }

.crypt-banner {
  position: relative;
  height: calc(var(--art-h) + var(--sky-h));
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 76% 18%, rgba(160, 178, 230, 0.30), rgba(0, 0, 0, 0) 70%),
    radial-gradient(ellipse 90% 40% at 50% 100%, rgba(92, 108, 160, 0.55), rgba(0, 0, 0, 0) 80%),
    linear-gradient(180deg, #070a14 0%, #0f1630 38%, var(--sky-night) 72%, #35466f 100%);
  border-bottom: 4px double var(--stone-edge-dim);
}

.hero-art {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: auto;
  height: var(--art-h);
  aspect-ratio: 1200 / 340;
  transform: translateX(-50%);
  display: block;
}

/* Stars: small dots from radial gradients, in the upper sky only */

.hero-stars {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 62%;
  background-image:
    radial-gradient(circle 1.2px at 6% 14%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 12% 42%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.5px at 19% 22%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 26% 8%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.2px at 33% 36%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 41% 16%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.4px at 47% 6%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 54% 30%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.2px at 61% 12%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 66% 46%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.3px at 72% 5%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 83% 38%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1.2px at 90% 10%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 95% 28%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 3% 60%, #dfe6ff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 37% 56%, #fff 98%, rgba(255, 255, 255, 0)),
    radial-gradient(circle 1px at 78% 58%, #dfe6ff 98%, rgba(255, 255, 255, 0));
  background-repeat: no-repeat;
  pointer-events: none;
}

/* The moon: a large disc with a wide glow, drawn with gradients. Decorative, no text. */

.banner-moon {
  position: absolute;
  top: 1.5rem;
  right: 9%;
  width: clamp(4.4rem, 7vw, 6.5rem);
  height: clamp(4.4rem, 7vw, 6.5rem);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffdf2 0%, #efebd6 42%, #cfcab2 100%);
  box-shadow:
    0 0 1.2rem 0.5rem rgba(226, 230, 255, 0.40),
    0 0 4.5rem 2rem rgba(190, 204, 255, 0.22),
    0 0 9rem 5rem rgba(150, 170, 235, 0.12);
  pointer-events: none;
}

.banner-moon::before {
  content: "";
  position: absolute;
  left: 52%;
  top: 46%;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: rgba(150, 146, 125, 0.45);
  box-shadow: -2.2rem -1.1rem 0 -0.25rem rgba(150, 146, 125, 0.35), -0.9rem 1.7rem 0 -0.4rem rgba(150, 146, 125, 0.30);
}

/* Fog over the sky and the foot of the gate. It sits under the plaque, never over text. */

.hero-fog {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  background-repeat: repeat-x;
  background-size: 200% 100%;
}

.hero-fog-top {
  top: 0;
  height: 48%;
  opacity: 0.8;
  background-image:
    radial-gradient(ellipse 18% 24% at 14% 56%, rgba(190, 200, 232, 0.20), rgba(190, 200, 232, 0) 100%),
    radial-gradient(ellipse 22% 20% at 52% 40%, rgba(190, 200, 232, 0.16), rgba(190, 200, 232, 0) 100%),
    radial-gradient(ellipse 16% 22% at 86% 62%, rgba(190, 200, 232, 0.18), rgba(190, 200, 232, 0) 100%);
}

.hero-fog-mid {
  bottom: 12%;
  height: 46%;
  opacity: 0.85;
  background-image:
    radial-gradient(ellipse 26% 30% at 20% 60%, rgba(176, 188, 220, 0.30), rgba(176, 188, 220, 0) 100%),
    radial-gradient(ellipse 24% 26% at 64% 50%, rgba(176, 188, 220, 0.26), rgba(176, 188, 220, 0) 100%),
    radial-gradient(ellipse 20% 28% at 92% 64%, rgba(176, 188, 220, 0.28), rgba(176, 188, 220, 0) 100%);
}

.hero-fog-low {
  bottom: 0;
  height: 34%;
  opacity: 0.9;
  background-image:
    radial-gradient(ellipse 30% 40% at 10% 70%, rgba(170, 182, 214, 0.34), rgba(170, 182, 214, 0) 100%),
    radial-gradient(ellipse 28% 36% at 48% 80%, rgba(170, 182, 214, 0.30), rgba(170, 182, 214, 0) 100%),
    radial-gradient(ellipse 26% 38% at 84% 74%, rgba(170, 182, 214, 0.32), rgba(170, 182, 214, 0) 100%);
}

/* The plaque: engraved stone on a solid surface, hung on the gate by two chains. All its text
   is parchment on --stone-slab. The NOT PROTECTED figure is red text with its label, and shows
   the alarm look only when the number is above zero. */

.hero-plaque {
  position: relative;
  z-index: 2;
  width: min(42rem, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0.9rem 1rem 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0) 45%),
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    var(--stone-slab);
  border: 4px double var(--stone-edge);
  border-radius: 0.5rem;
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.55), 0 10px 22px rgba(0, 0, 0, 0.7);
}

.hero-plaque::before,
.hero-plaque::after {
  content: "";
  position: absolute;
  top: -2.1rem;
  width: 0.45rem;
  height: 2.1rem;
  background: repeating-linear-gradient(180deg, #6b6f7d 0 0.35rem, #2b2d36 0.35rem 0.55rem);
  border-radius: 0.2rem;
}

.hero-plaque::before { left: 12%; }
.hero-plaque::after { right: 12%; }

.hero-figures {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
}

.hero-figure {
  min-width: 0;
  padding: 0.35rem 0.6rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7);
  color: var(--engraved-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 -1px 0 rgba(0, 0, 0, 0.9);
}

.fig-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.fig-label { display: block; font-size: 0.95rem; font-weight: 600; letter-spacing: 0.03em; }

.hero-figure.fig-alarm {
  color: var(--blood-red);
  border: 3px double var(--blood-red);
  background: var(--stone-slab-red);
}

.hero-figure.fig-calm { color: var(--parchment-muted); }

.site-header {
  padding: 0.9rem 1rem 0.3rem;
  background: var(--stone-bg);
}

.site-header h1 { margin-bottom: 0.25em; }

.title-crypt { color: var(--candle-partial); }

.intro { max-width: 52rem; margin-bottom: 0.5em; font-size: 0.95rem; }

.legend {
  margin: 0 0 0.6rem;
  padding: 0.1rem 0.75rem;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge);
  border-radius: 0.4rem;
}

.legend summary { cursor: pointer; font-weight: 700; padding: 0.45rem 0; min-height: 2.75rem; }
.legend[open] { padding-bottom: 0.6rem; }

.legend-list { list-style: none; display: grid; gap: 0.6rem; margin-top: 0.5rem; }

.legend-item { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--accent); }
.legend-item span { color: var(--parchment-text); }
.legend-item .status-icon { margin-top: 0.1rem; }

.main { padding: 0.4rem 1rem 1.5rem; background: var(--stone-bg); }

.site-footer {
  padding: 1rem;
  border-top: 4px double var(--stone-edge-dim);
  background: var(--stone-bg);
}

.honest {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.3rem;
  color: var(--parchment-text);
  font-weight: 600;
}

.export-banner {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--stone-raised);
  border-top: 3px solid var(--candle-partial);
  border-bottom: 3px solid var(--candle-partial);
  font-size: 1rem;
  font-weight: 400;
}

.export-banner p { margin: 0; }
.export-banner-text { font-weight: 400; }

/* Time: the local time is the text, the raw UTC value is one hover or one read away */

.local-time { font-variant-numeric: tabular-nums; }
time.local-time[title] { text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; }
.local-time-raw { font-family: var(--font-mono); font-size: 0.92em; }

/* Controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 700;
  color: var(--parchment-text);
  background: var(--stone-raised);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 rgba(0, 0, 0, 0.6);
}

.btn-primary {
  color: var(--on-accent);
  background: var(--candle-partial);
  border-color: var(--parchment-text);
}

.btn[disabled], .btn[aria-disabled="true"] {
  color: var(--parchment-muted);
  background: var(--stone-well);
  border-style: dashed;
  border-color: var(--stone-edge);
  box-shadow: none;
  cursor: not-allowed;
}

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 1rem; }
.filter label { font-weight: 700; }

select {
  min-height: 2.75rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.4rem 0.6rem;
  font: inherit;
  color: var(--parchment-text);
  background: var(--stone-raised);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
}

input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  accent-color: var(--candle-partial);
}

.list-count { color: var(--parchment-muted); }
.empty { padding: 1rem; background: var(--stone-slab); border: 2px dashed var(--stone-edge); border-radius: 0.4rem; }

/* Status treatments: color, icon, border style and label all differ */

.status-protected       { --accent: var(--candle-protected); --status-border-style: solid;  --status-border-width: 2px; }
.status-partial         { --accent: var(--candle-partial);   --status-border-style: dashed; --status-border-width: 3px; }
.status-not-protected   { --accent: var(--candle-out);       --status-border-style: double; --status-border-width: 6px; }
.status-nothing-at-risk { --accent: var(--candle-unlit);     --status-border-style: dotted; --status-border-width: 3px; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.25rem 0.7rem;
  color: var(--accent);
  background: var(--stone-well);
  border: var(--status-border-width) var(--status-border-style) var(--accent);
  border-radius: 0.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-protected.status-chip { border-radius: 999px; }
.status-nothing-at-risk.status-chip { border-radius: 0; }

.status-not-protected.status-chip {
  color: var(--on-accent);
  background: var(--candle-out);
  border-color: var(--candle-out);
  outline: 2px solid var(--on-accent);
  outline-offset: -5px;
  padding: 0.4rem 0.9rem;
  font-size: 1.1em;
  text-transform: uppercase;
}

/* Graveyard: a grid of headstones on a ground line. Each row stands on the same baseline
   (align-items: end), the height of a stone varies by a class chosen from its Event_Id, and a
   strip of grass is drawn under every stone. The yard itself carries no text: every stone is a
   solid slab. */

.list-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin: 0 0 0.6rem; }
.list-bar h2 { margin: 0; }
.list-bar .filter { max-width: 100%; margin: 0; padding: 0.25rem 0.7rem; background: var(--stone-slab); border: 2px solid var(--stone-edge-dim); border-radius: 0.4rem; }

.grave-list {
  isolation: isolate;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  align-items: end;
  gap: 3.8rem 1.25rem;
  padding: 1.5rem 1rem 3.6rem;
  background:
    radial-gradient(ellipse 60% 30% at 80% 0%, rgba(160, 178, 230, 0.10), rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, #101421 0%, #0c0f16 55%, #0a110d 100%);
  border: 2px solid var(--stone-edge-dim);
  border-radius: 0.5rem;
}

.grave {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 4.2rem 1rem 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0) 40%),
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 1px 2px / 7px 7px,
    var(--stone-slab);
  border: var(--status-border-width) var(--status-border-style) var(--accent);
  border-radius: 50% 50% 0.4rem 0.4rem / 4rem 4rem 0.4rem 0.4rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -3px 8px rgba(0, 0, 0, 0.55),
    0 8px 16px rgba(0, 0, 0, 0.55);
}

/* Height variation: the class comes from a hash of the Event_Id (render.js), so the yard looks
   the same on every load. Extra height is added at the top of the stone. */

.grave.stone-h1 { padding-top: 4.2rem; }
.grave.stone-h2 { padding-top: 5rem; }
.grave.stone-h3 { padding-top: 5.8rem; }
.grave.stone-h4 { padding-top: 6.6rem; }
.grave.stone-h5 { padding-top: 7.4rem; }

/* Ground: grass under every stone, wider than the stone so the strips of a row meet. */

.grave::after {
  content: "";
  position: absolute;
  left: -0.7rem;
  right: -0.7rem;
  bottom: -1.2rem;
  height: 1.2rem;
  z-index: -1;
  background:
    repeating-linear-gradient(90deg, rgba(22, 40, 26, 0) 0 5px, #1e3a27 5px 6px, rgba(22, 40, 26, 0) 6px 11px),
    linear-gradient(180deg, #243f2b 0%, #101c14 100%);
  border-radius: 0.2rem 0.2rem 0.6rem 0.6rem;
  clip-path: polygon(0 35%, 4% 5%, 8% 35%, 14% 0, 19% 35%, 26% 8%, 31% 35%, 38% 0, 44% 35%, 51% 6%, 57% 35%, 64% 0, 70% 35%, 77% 8%, 83% 35%, 90% 0, 95% 35%, 100% 10%, 100% 100%, 0 100%);
  pointer-events: none;
}

/* Decorative weeds at the foot of a stone and fog between the rows. They sit in the gap below
   the stone, never over its text. */

.grave-weeds {
  position: absolute;
  left: 0.2rem;
  bottom: -1.2rem;
  width: 2.4rem;
  height: 1.7rem;
  background: linear-gradient(180deg, #355a3d, #162a1c);
  clip-path: polygon(0 100%, 6% 35%, 14% 100%, 24% 10%, 34% 100%, 48% 45%, 58% 100%, 72% 0, 82% 100%, 92% 40%, 100% 100%);
  pointer-events: none;
}

.grave-fog {
  position: absolute;
  left: -1.5rem;
  right: -1.5rem;
  bottom: -3.6rem;
  height: 2.8rem;
  z-index: -1;
  background-repeat: repeat-x;
  background-size: 200% 100%;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0), #000 18%, #000 82%, rgba(0, 0, 0, 0));
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0), #000 18%, #000 82%, rgba(0, 0, 0, 0));
  background-image:
    radial-gradient(ellipse 30% 50% at 18% 60%, rgba(176, 188, 220, 0.20), rgba(176, 188, 220, 0) 100%),
    radial-gradient(ellipse 34% 46% at 62% 50%, rgba(176, 188, 220, 0.17), rgba(176, 188, 220, 0) 100%),
    radial-gradient(ellipse 22% 50% at 94% 64%, rgba(176, 188, 220, 0.19), rgba(176, 188, 220, 0) 100%);
  pointer-events: none;
}

/* NOT_PROTECTED: a cracked, unlit headstone in red, in addition to its icon, heavy double
   border, label and notice. The crack is a CSS clip-path in the arch zone, above every line of
   text. The red border and crack measure 5.9 to 1 on the slab. */

.grave.status-not-protected {
  --accent: var(--blood-red);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0) 40%),
    var(--stone-slab-red);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -3px 8px rgba(0, 0, 0, 0.6),
    0 8px 16px rgba(0, 0, 0, 0.55),
    0 0 1.2rem rgba(255, 107, 94, 0.18);
}

.grave.status-not-protected::before,
.status-panel.status-not-protected::before {
  content: "";
  display: block;
  height: 0.6rem;
  margin: 0 0 0.8rem;
  background: repeating-linear-gradient(135deg, var(--blood-red) 0 10px, var(--stone-well) 10px 20px);
  border-radius: 2px;
}

.grave-crack {
  position: absolute;
  top: 0.1rem;
  right: 15%;
  width: 26%;
  height: 4.05rem;
  background: var(--blood-red);
  clip-path: polygon(34% 0, 44% 0, 40% 14%, 54% 24%, 46% 36%, 62% 47%, 52% 60%, 70% 72%, 60% 84%, 74% 100%, 62% 100%, 52% 88%, 58% 78%, 42% 66%, 52% 54%, 36% 43%, 44% 32%, 30% 21%, 38% 11%);
  pointer-events: none;
}

.grave-crack::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  clip-path: polygon(38% 2%, 41% 2%, 37% 14%, 51% 25%, 43% 36%, 59% 47%, 49% 60%, 67% 72%, 57% 84%, 66% 96%, 62% 96%, 54% 86%, 60% 77%, 43% 66%, 53% 54%, 37% 43%, 45% 32%, 33% 21%, 40% 11%);
}

.grave-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }

.grave-title { margin: 0 0 0.3rem; font-size: 1.05rem; min-width: 0; text-shadow: none; }

.grave-open { color: var(--engraved-text); text-decoration: none; }

/* The short command is the engraving: light text cut into a dark recess, serif face, one plate
   that is also the link that opens the detail. The inset look comes from shadows only, so the
   text keeps its contrast. */

.grave-command {
  display: block;
  margin: 0;
  padding: 0.55rem 0.7rem;
  color: var(--engraved-text);
  background: var(--engraved-recess);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.14), 0 -1px 0 rgba(0, 0, 0, 0.9);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.engraved-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

a.grave-command:hover { background: #151519; }

.grave-event { margin: 0 0 0.5rem; font-family: var(--font-mono); }

.grave .grave-meta { margin: 0 0 0.5rem; gap: 0.2rem; grid-template-columns: minmax(0, 1fr); font-size: 0.9rem; }
.grave .grave-meta .meta-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; }
.grave .grave-meta dt { font-size: 0.75rem; }
.grave .pattern-id { font-size: 0.78rem; }

.grave .grave-counts { flex-wrap: nowrap; justify-content: space-between; gap: 0.3rem; padding: 0.3rem 0.5rem; background: var(--stone-well); border: 1px solid var(--stone-edge-dim); border-radius: 0.3rem; }
.grave .count { flex-direction: column; align-items: center; text-align: center; }
.grave .count-label { font-size: 0.75rem; line-height: 1.2; overflow-wrap: normal; letter-spacing: 0; }
.grave .count-value { font-size: 1.05rem; line-height: 1.2; }

.grave .candle-text { font-size: 0.82rem; color: var(--parchment-muted); }

.grave .epitaph { margin-top: auto; }
.grave .candle-text + .epitaph { margin-top: 0.75rem; }

/* Epitaph: one engraved italic line on a solid surface */

.epitaph {
  margin: 0.75rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--stone-edge-dim);
  color: var(--engraved-text);
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 -1px 0 rgba(0, 0, 0, 0.9);
}

.epitaph-detail {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge-dim);
  border-radius: 0.4rem;
  font-size: 1.1rem;
}

/* Candle: decorative, its state also stated as text. Lit and steady for
   PROTECTED, small and leaning for PARTIAL, a dark wick with smoke for
   NOT_PROTECTED, a plain unlit stick with no marker for NOTHING_AT_RISK. */

.grave-candle {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  width: 1.2rem;
  height: 2.6rem;
  margin-left: -0.6rem;
  pointer-events: none;
}

.candle-wax {
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: 0;
  height: 1.3rem;
  background: linear-gradient(90deg, #b9b09a, #f1e9d8 45%, #9a917b);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.candle-wick {
  position: absolute;
  left: 50%;
  bottom: 1.3rem;
  width: 2px;
  height: 0.3rem;
  margin-left: -1px;
  background: #2a2a2e;
}

.candle-flame {
  position: absolute;
  left: 50%;
  bottom: 1.55rem;
  width: 0.5rem;
  height: 0.9rem;
  margin-left: -0.25rem;
  background: radial-gradient(ellipse at 50% 70%, #fff6cf 0%, #e8b44d 55%, rgba(232, 180, 77, 0) 100%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  box-shadow: 0 0 0.8rem 0.3rem rgba(232, 180, 77, 0.42);
  transform-origin: 50% 100%;
}

.candle-smoke {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 1.7rem;
  width: 3px;
  height: 1.1rem;
  margin-left: -1px;
  background: linear-gradient(0deg, rgba(200, 200, 214, 0.85), rgba(200, 200, 214, 0));
  border-radius: 3px;
  transform-origin: 50% 100%;
  transform: rotate(6deg);
}

.status-partial .candle-flame {
  width: 0.34rem;
  height: 0.55rem;
  margin-left: -0.17rem;
  bottom: 1.5rem;
  box-shadow: 0 0 0.45rem 0.1rem rgba(232, 180, 77, 0.30);
  transform: rotate(-9deg);
}

.status-not-protected .candle-flame { display: none; }
.status-not-protected .candle-smoke { display: block; }
.status-not-protected .candle-wick { height: 0.45rem; width: 3px; margin-left: -1.5px; background: #000; }
.status-not-protected .candle-wax { background: linear-gradient(90deg, #4a3836, #7a524d 45%, #3c2d2b); }

.status-nothing-at-risk .candle-flame,
.status-nothing-at-risk .candle-smoke,
.status-nothing-at-risk .candle-wick { display: none; }
.status-nothing-at-risk .candle-wax { background: linear-gradient(90deg, #5c5c63, #7d7d86 45%, #4b4b52); }

/* Ghost: a decorative glyph in a text-free slot. The slot clips it, so it
   never passes over text. The base style is a static glyph, motion is added
   only inside the reduced motion guard. */

.ghost-slot {
  position: relative;
  height: 6rem;
  margin: 0 0 1rem;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(190, 200, 240, 0.18), rgba(0, 0, 0, 0) 70%),
    var(--stone-well);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.4rem;
  pointer-events: none;
}

.ghost {
  position: relative;
  display: block;
  width: 3.2rem;
  height: 4rem;
  margin-bottom: 0.4rem;
  background: linear-gradient(180deg, #f3f5ff, #c9cfe6);
  border-radius: 50% 50% 0 0 / 55% 55% 0 0;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 87% 100%, 75% 86%, 62% 100%, 50% 86%, 37% 100%, 25% 86%, 12% 100%, 0 86%);
  opacity: 0.9;
}

.ghost::before {
  content: "";
  position: absolute;
  top: 32%;
  left: 27%;
  width: 0.42rem;
  height: 0.55rem;
  background: #17171b;
  border-radius: 50%;
  box-shadow: 1.2rem 0 0 #17171b;
}

/* Comparison with the last commit and replaced files */

.head-block {
  margin: 0.75rem 0;
  padding: 0.7rem 0.9rem;
  background: var(--stone-raised);
  border: 3px double var(--candle-partial);
  border-radius: 0.3rem;
}

.head-block-title { margin: 0 0 0.3rem; font-weight: 700; }
.head-explanation { margin: 0; }
.head-label { color: var(--parchment-muted); font-size: 0.9rem; }

.replaced-label {
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  color: var(--parchment-text);
  font-weight: 700;
  background: var(--stone-slab);
  border: 2px dashed var(--candle-partial);
  border-radius: 0.3rem;
}

.grave-meta, .meta-list { margin: 0 0 0.7rem; display: grid; gap: 0.5rem; }

.meta-item, .meta-list > div { min-width: 0; }

.grave-meta dt, .meta-list dt, .count-label {
  color: var(--parchment-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grave-meta dd, .meta-list dd { margin: 0; overflow-wrap: anywhere; }

.pattern-ids { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pattern-id {
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge);
  border-radius: 0.25rem;
}

.grave-counts { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0; }
.count { display: flex; flex-direction: column; min-width: 0; }
.count-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }

.candle-text { margin: 0.6rem 0 0; color: var(--parchment-text); }

/* Detail view */

.detail-nav { margin: 0 0 1rem; }

.detail-section {
  margin: 0 0 1.5rem;
  padding: 1rem;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge-dim);
  border-radius: 0.4rem;
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.45);
}

.status-panel {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 3.4rem 1rem 1rem;
  background: var(--stone-slab);
  border: var(--status-border-width) var(--status-border-style) var(--accent);
  border-radius: 50% 50% 0.4rem 0.4rem / 3.2rem 3.2rem 0.4rem 0.4rem;
}

.reason-list { list-style: none; display: grid; gap: 0.5rem; margin: 0.75rem 0 0; }
.reason-item { padding: 0.4rem 0.6rem; background: var(--stone-well); border-left: 4px solid var(--accent); border-radius: 0.2rem; }
.reason-code { font-family: var(--font-mono); font-weight: 700; margin-right: 0.5rem; }

.not-protected-notice {
  margin: 0.9rem 0 0;
  padding: 0.9rem 1rem;
  color: var(--on-accent);
  background: var(--candle-out);
  border: 4px double var(--on-accent);
  border-radius: 0.3rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.count-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 0.75rem; margin: 0; }
.count-grid > div { padding: 0.5rem 0.7rem; background: var(--stone-well); border: 1px solid var(--stone-edge-dim); border-radius: 0.3rem; min-width: 0; }
.count-grid dt { color: var(--parchment-muted); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; }
.count-grid dd { margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }

.file-list { list-style: none; display: grid; gap: 0.6rem; margin: 0; }

.file-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
}

.file-path { overflow-wrap: anywhere; word-break: break-word; }
.file-meta { color: var(--parchment-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.digest { font-size: 0.8rem; color: var(--parchment-muted); overflow-wrap: anywhere; word-break: break-all; }
.skip-label, .file-note, .outcome-reason { color: var(--parchment-text); }

.statement { margin: 0.75rem 0 0; padding: 0.5rem 0.75rem; background: var(--stone-well); border-left: 4px solid var(--stone-edge); border-radius: 0.2rem; }

.recover-label {
  display: inline-block;
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  font-weight: 700;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge);
  border-radius: 0.3rem;
}

.recover-can     { color: var(--candle-protected); border: 2px solid var(--candle-protected); }
.recover-refused { color: var(--candle-partial);   border: 2px dashed var(--candle-partial); }
.recover-blocked { color: var(--candle-unlit);     border: 2px dotted var(--candle-unlit); }

/* Verified badges: distinct icon, border and label */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  font-weight: 700;
  background: var(--stone-well);
  border-radius: 0.3rem;
}

.badge .icon { width: 1.25rem; height: 1.25rem; }

.badge-verified     { color: var(--candle-protected); border: 2px solid var(--candle-protected); border-radius: 999px; }
.badge-not-verified { color: var(--on-accent); background: var(--candle-out); border: 4px double var(--on-accent); }
.badge-not-restored { color: var(--candle-unlit); border: 2px dotted var(--candle-unlit); }

.badge-note { margin: 0.25rem 0 0; color: var(--parchment-muted); font-size: 0.9rem; }

.restore-record { margin: 0 0 1rem; padding: 0.75rem; background: var(--stone-well); border: 1px solid var(--stone-edge); border-radius: 0.3rem; }
.restore-entry { padding: 0.5rem 0; border-top: 1px solid var(--stone-edge-dim); display: flex; flex-direction: column; gap: 0.25rem; }

.alert, .warning-box, .warning {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--stone-raised);
  border-radius: 0.3rem;
}

.alert { border: 3px double var(--candle-out); }
.alert-title { margin: 0 0 0.4rem; font-weight: 700; }
.warning-box, .warning { border: 3px dashed var(--candle-partial); }
.warning-box ul { list-style: none; display: grid; gap: 0.4rem; }
.warning-box .warning { margin: 0; border: 0; padding: 0; background: transparent; }

.unreadable { padding: 0.3rem 0; }
.unreadable-path { font-family: var(--font-mono); }

/* The opened crypt: a stone vault with an arched opening, candles beside it, steps below.
   The title, status and file list stand on solid dark stone inside the arch. The keystone, the
   side candles and the steps are decorative and hold no text. */

.vault { position: relative; margin: 0 0 1.5rem; padding: 0 2.4rem; }

.vault-frame {
  position: relative;
  padding: 5.2rem 1.1rem 1.1rem;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(232, 180, 77, 0.10), rgba(0, 0, 0, 0) 100%),
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    var(--stone-well);
  border: 1.1rem solid var(--stone-raised);
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 7rem 7rem 0 0;
  box-shadow:
    inset 0 0 2.6rem rgba(0, 0, 0, 0.9),
    0 0 0 2px #000,
    0 0 0 5px var(--stone-edge-dim),
    0 0 2.6rem rgba(232, 180, 77, 0.10);
}

.vault-keystone {
  position: absolute;
  top: -1.4rem;
  left: 50%;
  width: 3.2rem;
  height: 1.7rem;
  margin-left: -1.6rem;
  background: linear-gradient(180deg, #4a4a54, #34343c);
  border: 2px solid #000;
  border-radius: 0.3rem 0.3rem 0 0;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  pointer-events: none;
}

.vault-title {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.9rem;
  color: var(--engraved-text);
  background: var(--engraved-recess);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.14), 0 -1px 0 rgba(0, 0, 0, 0.9);
  text-align: center;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.vault-title .engraving { display: block; font-family: var(--font-mono); font-size: 1.35rem; }
.vault-title .plain-term { display: block; margin-top: 0.2rem; }

.vault .epitaph-detail { background: var(--stone-slab); }

.vault .status-panel { padding-top: 1rem; border-radius: 0.4rem; background: var(--stone-slab); }
.vault .status-panel .grave-candle { display: none; }
.vault .status-panel.status-not-protected { --accent: var(--blood-red); }

.vault-files-section { margin: 1rem 0 0; }
.vault-files-section h3 { margin-bottom: 0.5rem; }

.vault-steps {
  height: 2.4rem;
  margin: 0 -1.2rem;
  background:
    linear-gradient(180deg, #5a5a64, #5a5a64) center 0 / 94% 34% no-repeat,
    linear-gradient(180deg, #484852, #484852) center 50% / 97% 34% no-repeat,
    linear-gradient(180deg, #373740, #373740) center 100% / 100% 34% no-repeat;
  border-bottom: 3px solid #000;
  pointer-events: none;
}

.vault-candles { position: absolute; inset: 0; pointer-events: none; }

.vault-candle {
  position: absolute;
  bottom: 2.4rem;
  width: 1.2rem;
  height: 2.6rem;
}

.vault-candle-left { left: 0.6rem; }
.vault-candle-right { right: 0.6rem; }
.vault-candle .grave-candle { top: 0; left: 0; margin: 0; }

.vault-candle::before {
  content: "";
  position: absolute;
  left: -0.9rem;
  right: -0.9rem;
  bottom: -0.3rem;
  height: 0.4rem;
  background: #373740;
  border-radius: 0.2rem;
}

/* File rows: outcome glyph, path with size and short digest, outcome text. The glyph shape is
   different for every outcome, the color only adds to it. */

.file-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.2rem 0.7rem;
  align-items: start;
}

.file-row .glyph { grid-row: 1 / span 2; width: 2rem; height: 2rem; color: var(--candle-unlit); }
.file-row .glyph-can-raise,
.file-row .glyph-restored-verified { color: var(--candle-protected); }
.file-row .glyph-refused-exists { color: var(--candle-partial); }
.file-row .glyph-restored-not-verified,
.file-row .glyph-failed { color: var(--blood-red); }
.file-row .glyph-not-captured,
.file-row .glyph-unknown { color: var(--candle-unlit); }

.file-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.7rem; min-width: 0; }
.file-main .file-path { flex: 1 1 14rem; min-width: 0; }

.file-row .file-note { grid-column: 2; }

.glyph-text {
  grid-column: 2;
  align-self: start;
  justify-self: start;
  padding: 0.1rem 0.55rem;
  font-weight: 700;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge);
  border-radius: 0.3rem;
}

.glyph-text.glyph-can-raise,
.glyph-text.glyph-restored-verified { color: var(--candle-protected); border-color: var(--candle-protected); border-style: solid; }
.glyph-text.glyph-refused-exists { color: var(--candle-partial); border-color: var(--candle-partial); border-style: dashed; }
.glyph-text.glyph-restored-not-verified,
.glyph-text.glyph-failed { color: var(--blood-red); border-color: var(--blood-red); border-style: double; border-width: 4px; }
.glyph-text.glyph-not-captured,
.glyph-text.glyph-unknown { color: var(--candle-unlit); border-color: var(--candle-unlit); border-style: dotted; }

/* Raise dialog: the same stone as the headstones (grain tokens and slab), an arched top, a candle
   that follows the Status of the Grave, and an engraved title. Text sits on the solid slab, the
   grain is at most 0.02 of white. The ghost has its own text-free slot inside the dialog. */

.raise-dialog {
  width: min(42rem, calc(100% - 1rem));
  max-height: calc(100vh - 1rem);
  padding: 0;
  overflow: auto;
  color: var(--parchment-text);
  background:
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 1px 2px / 7px 7px,
    var(--stone-slab);
  border: 4px double var(--stone-edge);
  border-radius: 50% 50% 0.4rem 0.4rem / 3.2rem 3.2rem 0.4rem 0.4rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -3px 8px rgba(0, 0, 0, 0.55),
    0 0 0 2px #000,
    0 16px 40px rgba(0, 0, 0, 0.8);
}

.raise-dialog.status-protected,
.raise-dialog.status-partial { border-color: var(--accent); }
.raise-dialog.status-not-protected { border-color: var(--blood-red); }

.raise-dialog::backdrop { background: rgba(5, 5, 7, 0.88); }

.dialog-body { padding: 1rem; }

.dialog-head { padding-top: 2.4rem; }

.dialog-title {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.9rem;
  color: var(--engraved-text);
  background: var(--engraved-recess);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.14), 0 -1px 0 rgba(0, 0, 0, 0.9);
  text-align: center;
  font-size: 1.4rem;
}

.dialog-title .engraving { font-family: var(--font-display); }

.dialog-status { display: flex; justify-content: center; margin: 0 0 0.75rem; }

.raise-counts { font-weight: 700; }

.raise-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.4rem 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
}

.raise-entry label { display: flex; gap: 0.6rem; align-items: flex-start; flex: 1 1 12rem; min-width: 0; }

/* A Raise result entry: the path on its own line, then a second line with the Outcome, its
   reason and the badge, each label its own element with a gap between them, then the note. */

.raise-result {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge-dim);
  border-radius: 0.3rem;
}

.result-path { display: block; min-width: 0; }

.result-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.9rem; min-width: 0; }
.result-detail .badge { align-self: center; }
.raise-result .badge-note { margin: 0; }

.dialog-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }

/* The detail page wears the same stone as the list: grain and slab on every text panel, engraved
   headings, and a candle in the arch above the engraved title. The panels keep their solid slab
   and add at most two grain layers of 0.02 white, so the checked contrast holds. */

.detail-section,
.vault .status-panel,
.vault .epitaph-detail {
  background:
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 1px 2px / 7px 7px,
    var(--stone-slab);
}

.detail-section { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -3px 8px rgba(0, 0, 0, 0.55); }

.detail-section h3 {
  color: var(--engraved-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 -1px 0 rgba(0, 0, 0, 0.9);
}

.vault-arch-candle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.vault-arch-candle::before {
  content: "";
  position: absolute;
  left: -1.1rem;
  width: 2.2rem;
  top: 3.1rem;
  height: 0.4rem;
  background: #373740;
  border-radius: 0.2rem;
}


/* First-time visitor guide (task 15, Requirement 27). Everything below reuses the tokens above, so
   no new color pair exists: plaque text and muted text sit on --stone-slab, term underline and
   focus ring are --candle-partial, the popover is --stone-raised, boundaries are --stone-edge.
   Every animation, transition and smooth scroll for these rules is in the reduced motion guard. */

/* The Intro_Plaque: solid stone below the gate art in normal flow (Requirement 30.4), no text over the art */

.site-header.plaque {
  position: relative;
  z-index: 2;
  width: min(62rem, calc(100% - 1.5rem));
  margin: 1rem auto;
  padding: 1rem 1.25rem 0.6rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0) 45%),
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    var(--stone-slab);
  border: 4px double var(--stone-edge);
  border-radius: 0.5rem;
  color: var(--parchment-text);
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.55), 0 10px 22px rgba(0, 0, 0, 0.7);
}

.site-header.plaque > * { min-width: 0; overflow-wrap: anywhere; }

.site-header.plaque h1 { font-size: 1.75rem; margin: 0 0 0.4rem; max-width: 58rem; }
.site-header.plaque .intro { font-size: 1rem; }

.intro-subline { margin: 0 0 0.3rem; max-width: 58rem; font-size: 1.05rem; color: var(--parchment-text); }
.intro-recorded { margin: 0 0 0.5rem; font-size: 1rem; color: var(--parchment-muted); }
.intro-actions { margin: 0 0 0.7rem; }
.try-walk { margin: 0.35rem 0 0; font-size: 0.875rem; color: var(--parchment-muted); }

#try-demo {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 1.6rem;
  font-size: 1.1rem;
}

.how-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.8rem;
  padding: 0;
}

.how-step {
  min-width: 0;
  padding: 0.55rem 0.75rem;
  background: var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
  overflow-wrap: anywhere;
}

.how-title {
  display: block;
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--parchment-text);
}

.how-body { margin: 0; font-size: 1rem; line-height: 1.4; color: var(--parchment-muted); }
.run-code { padding: 0 0.25em; background: var(--stone-slab); border-radius: 0.2rem; overflow-wrap: anywhere; }

/* The four figures now sit inside the plaque, below the strip */

.site-header .hero-plaque {
  width: auto;
  margin: 0 0 0.8rem;
  padding: 0.5rem 0.6rem 0.6rem;
  background: var(--stone-bg);
  border-width: 3px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.55);
}

.site-header .hero-plaque::before,
.site-header .hero-plaque::after { display: none; }

.site-header .legend { margin-bottom: 0.7rem; background: var(--stone-well); }

/* Story panel */

.story {
  position: relative;
  isolation: isolate;
  max-width: 46rem;
  margin: 0 auto 1.4rem;
  padding: 5.6rem 2.2rem 1.4rem;
  border-radius: 14rem 14rem 0.6rem 0.6rem / 7rem 7rem 0.6rem 0.6rem;
  background:
    repeating-conic-gradient(rgb(255 255 255 / var(--grain-alpha)) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 3px 3px,
    var(--stone-slab);
  border: 4px double var(--stone-edge);
  box-shadow:
    inset 0 0 0 7px var(--stone-slab),
    inset 0 0 0 9px rgba(0, 0, 0, 0.55),
    inset 0 -3px 8px rgba(0, 0, 0, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.6);
}

.story > *, .story-body > * { min-width: 0; overflow-wrap: anywhere; }

.story-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 0 0 0.5rem; }
.story-counter { margin: 0; font-weight: 700; color: var(--parchment-muted); }
.story-heading { margin: 0 0 0.6rem; font-size: 1.35rem; }
.story-text { margin: 0 0 0.7rem; font-size: 1rem; }

.story-code {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.8rem;
  background: var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.3rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}

.story-card, .story-block {
  min-width: 0;
  margin: 0 0 0.8rem;
}

.story-card {
  padding: 0.7rem 0.9rem;
  background: var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
}

.story-parts, .story-facts { display: grid; gap: 0.4rem; margin: 0 0 0.6rem; }
.story-part, .story-fact { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; min-width: 0; }
.story-part dt, .story-fact dt { font-weight: 700; min-width: 0; }
.story-part dd, .story-fact dd { margin: 0; min-width: 0; }
.story-part-note { color: var(--parchment-muted); }

.story-files { display: grid; gap: 0.5rem; margin: 0; }
.story-file { min-width: 0; padding: 0.4rem 0; border-top: 1px solid var(--stone-edge); overflow-wrap: anywhere; }
.story-file .file-path, .story-file .digest { overflow-wrap: anywhere; word-break: break-all; }
.story-file .file-meta { color: var(--parchment-muted); }

.story-replay-actions { margin: 0 0 0.5rem; }
.story-notice { margin: 0 0 0.6rem; color: var(--parchment-muted); }

/* Before the replay runs, the result box is a quiet prompt, not a result */
.story-result.story-result-idle {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--parchment-muted);
}

/* The recorded restore options as small monospace flags */
.story-facts { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; }

.story-fact {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: baseline;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge);
  border-radius: 0.25rem;
}

.story-fact dt { font-weight: 400; }
.story-fact dd { font-weight: 700; }

.story-ghost-slot {
  position: relative;
  height: 6rem;
  margin: 0 0 0.8rem;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(190, 200, 240, 0.18), rgba(0, 0, 0, 0) 70%),
    var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.4rem;
  pointer-events: none;
}

.story-replay-list { display: grid; gap: 0.5rem; margin: 0 0 0.6rem; padding: 0; }

.replay-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: var(--stone-well);
  border: 2px solid var(--stone-edge);
  border-radius: 0.3rem;
  overflow-wrap: anywhere;
}

.replay-row .file-path { overflow-wrap: anywhere; word-break: break-all; }

/* A swapped-in row is a recorded fact, not a warning: neutral border, muted text, no amber */
.replay-row .replaced-label {
  align-self: flex-start;
  padding: 0.1rem 0.5rem;
  color: var(--parchment-muted);
  font-size: 0.9rem;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--stone-edge);
  border-radius: 0.25rem;
}

.story-result { margin: 0 0 0.6rem; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }

.story-nav { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0 0; }
.story .btn, #scope-toggle { min-height: 44px; min-width: 44px; }

.story-highlight {
  outline: 3px solid var(--candle-partial);
  outline-offset: 4px;
}

.story-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  background: var(--candle-partial);
  color: var(--on-accent);
  border-radius: 0.2rem;
  font-size: 1rem;
  font-weight: 700;
}

/* Scope row */

.list-count-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin: 0 0 0.6rem; }
.list-count-row .list-count { margin: 0; min-width: 0; }

/* Term_Control and Term_Popover: a dotted underline, no ring glyph. A heading, figure or chip term is a
   .gloss-term: a title and an aria-describedby only, with no visible marker. */

.term-btn {
  position: relative;
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  border-bottom: 2px dotted var(--candle-partial);
  border-radius: 0;
  cursor: help;
  overflow-wrap: anywhere;
}

/* The focus ring sits 2px away from the text, so it does not cover the letters */
.term-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* The hit area is a positioned pseudo-element of the button, so it takes the tap */
.term-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 44px;
  min-height: 44px;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
}

.term-popover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  box-sizing: border-box;
  max-width: min(20rem, calc(100vw - 1rem));
  min-width: 0;
  padding: 0.6rem 0.8rem;
  background: var(--stone-raised);
  color: var(--parchment-text);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
}

/* Words in plain English */

.words {
  padding: 1rem;
  background: var(--stone-bg);
  border-top: 4px double var(--stone-edge-dim);
  min-width: 0;
}

.words h2 { margin: 0 0 0.7rem; }
.words-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 0.7rem; margin: 0; }

.gloss-item {
  min-width: 0;
  padding: 0.6rem 0.8rem;
  background: var(--stone-slab);
  border: 2px solid var(--stone-edge);
  border-radius: 0.35rem;
  overflow-wrap: anywhere;
}

.gloss-item dt { font-weight: 700; }
.gloss-item .plain-term { font-size: 0.95rem; }
.gloss-item dd { margin: 0.25rem 0 0; }

/* Footer lines and install steps */

.footer-line { margin: 0 0 0.5rem; color: var(--parchment-muted); overflow-wrap: anywhere; }
.footer-install { margin: 0.6rem 0 1rem; }
.footer-install h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }
.footer-install-list { display: grid; gap: 0.7rem; margin: 0; padding: 0; }
.install-step { min-width: 0; overflow-wrap: anywhere; }

.cmd {
  display: inline-block;
  max-width: 100%;
  padding: 0.2rem 0.55rem;
  background: var(--stone-well);
  border: 1px solid var(--stone-edge);
  border-radius: 0.25rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cmd-note { display: block; margin-top: 0.25rem; color: var(--parchment-muted); overflow-wrap: anywhere; }

/* Narrow screens: the strip, figures, story nav and scope row stack in one column */

@media (max-width: 40rem) {
  .site-header.plaque { padding: 0.8rem 0.8rem 0.5rem; }
  .site-header.plaque h1 { font-size: clamp(1.25rem, 5.4vw, 1.5rem); line-height: 1.25; }
  .how-strip { grid-template-columns: minmax(0, 1fr); }
  .site-header .hero-figures { grid-template-columns: minmax(0, 1fr); }
  #try-demo { width: 100%; }
  .story { padding: 4.8rem 0.9rem 1rem; border-radius: 8rem 8rem 0.5rem 0.5rem / 4.5rem 4.5rem 0.5rem 0.5rem; }
  .list-count-row { flex-direction: column; align-items: stretch; }
  #scope-toggle { width: 100%; }
  .words-list { grid-template-columns: minmax(0, 1fr); }
}

/* Phones: Back and Next (or Finish) side by side, half the row each, Next on the right */

@media (max-width: 600px) {
  .story-nav { flex-wrap: nowrap; justify-content: flex-end; gap: 0.75rem; }
  .story-nav .btn { flex: 0 0 calc(50% - 0.375rem); width: calc(50% - 0.375rem); min-height: 44px; }
}

/* Narrow screens and large text: single column, no horizontal scroll */

@media (min-width: 40rem) {
  .grave-meta, .meta-list { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
  .shell { padding-bottom: 3rem; }
  h1 { font-size: 2.2rem; }
  .hero-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* One stone per row on narrow screens. No horizontal scroll at 320 px or at 200 percent text. */

@media (max-width: 34rem) {
  .grave-list { grid-template-columns: minmax(0, 1fr); padding-left: 0.6rem; padding-right: 0.6rem; }
  .banner-moon { width: 4.2rem; height: 4.2rem; right: 6%; top: 0.9rem; }
  .fig-num { font-size: 1.6rem; }
  .fig-label { font-size: 0.85rem; }
  .vault { padding-left: 0.4rem; padding-right: 0.4rem; }
  .vault-frame { border-width: 0.7rem; padding-left: 0.6rem; padding-right: 0.6rem; border-radius: 40% 40% 0 0 / 5rem 5rem 0 0; }
  .vault-title { font-size: 1.15rem; }
  .vault-title .engraving { font-size: 1.1rem; }
  .vault-candle { display: none; }
  .vault-steps { margin: 0 -0.5rem; }
}

@media (max-width: 24rem) {
  h1 { font-size: 1.5rem; }
  .main, .site-header, .site-footer { padding-left: 0.6rem; padding-right: 0.6rem; }
}

/* Requirement 30: hero costume, the sky wordmark, the figures caption and the haunted story.
   The plaque stays below the art in normal flow. The only text over the art is the wordmark and the
   tagline, in the empty sky beside the gate and never over the gate or the moon. Every color is a
   :root token. The wordmark and tagline sit on --sky-night at worst (engraved text 10.9, muted 7.4). */

.hero-title {
  position: absolute;
  z-index: 3;
  top: 1.25rem;
  left: 1.25rem;
  max-width: min(24rem, 29vw);
  pointer-events: none;
}

.hero-title .brand-line {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 4.4vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--engraved-text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.9), 0 -1px 0 rgba(255, 255, 255, 0.22), 0 0 1.4rem rgba(0, 0, 0, 0.7);
}

.hero-tagline {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--parchment-muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 0.8rem rgba(0, 0, 0, 0.7);
}

@media (max-width: 56rem) {
  .hero { --sky-h: 7.5rem; }
  .hero-title { top: 0.9rem; left: 1rem; max-width: calc(100% - 7rem); }
  .hero-title .brand-line { font-size: clamp(2rem, 9vw, 2.8rem); }
}

/* Headstones and candles along the bottom of the art: inline SVG, decorative, tokens only */

.hero-stone { fill: var(--stone-slab); stroke: var(--stone-edge); stroke-opacity: 0.6; stroke-width: 1.2; }
.hero-engrave { fill: none; stroke: var(--stone-edge-dim); stroke-width: 1.6; stroke-linecap: round; }
.hero-wax { fill: var(--parchment-text); fill-opacity: 0.92; }
.hero-wick { fill: none; stroke: var(--stone-bg); stroke-width: 1.4; stroke-linecap: round; }
.hero-flame { fill: var(--candle-partial); transform-box: fill-box; transform-origin: 50% 100%; }
.hero-glow-in { stop-color: var(--candle-partial); }
.hero-glow { pointer-events: none; }

/* Where the four figures come from, directly under them */

.hero-caption {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--parchment-muted);
}

/* The story as a crypt scene: arched tablet (see .story), fog behind its text, a candle row and a motif */

.story::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background-repeat: repeat-x;
  background-size: 200% 100%;
  background-image:
    radial-gradient(ellipse 30% 22% at 12% 92%, rgba(190, 200, 232, 0.16), rgba(190, 200, 232, 0) 100%),
    radial-gradient(ellipse 34% 20% at 58% 98%, rgba(190, 200, 232, 0.15), rgba(190, 200, 232, 0) 100%),
    radial-gradient(ellipse 26% 24% at 90% 88%, rgba(190, 200, 232, 0.16), rgba(190, 200, 232, 0) 100%),
    radial-gradient(ellipse 40% 16% at 50% 6%, rgba(190, 200, 232, 0.07), rgba(190, 200, 232, 0) 100%);
}

.story-candles {
  position: absolute;
  top: 1.6rem;
  left: 50%;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.story-candle { position: relative; display: block; width: 0.8rem; height: 2.7rem; }

.story-wax {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5rem;
  background: var(--parchment-text);
  border-radius: 0.2rem 0.2rem 0 0;
  opacity: 0.3;
}

.story-wax::before {
  content: "";
  position: absolute;
  top: -0.3rem;
  left: 50%;
  width: 2px;
  height: 0.3rem;
  margin-left: -1px;
  background: var(--stone-edge);
}

.story-flame {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  width: 0.6rem;
  height: 1rem;
  margin-left: -0.3rem;
  background: var(--candle-partial);
  border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
  box-shadow: 0 0 0.9rem 0.35rem rgba(232, 180, 77, 0.5);
  transform-origin: 50% 100%;
}

.story-candle.candle-current .story-wax { opacity: 1; }
.story-candle.candle-past .story-wax { opacity: 0.65; }
.story-candle.candle-past .story-flame { height: 0.65rem; opacity: 0.55; box-shadow: 0 0 0.5rem 0.15rem rgba(232, 180, 77, 0.28); }
.story-candle.candle-next .story-flame { display: none; }

.story-replay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }

.story-motif {
  position: relative;
  display: inline-block;
  width: 5rem;
  height: 3.2rem;
  pointer-events: none;
}

.motif-ghost {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.1rem;
  height: 2.7rem;
  background: linear-gradient(180deg, #f3f5ff, #c9cfe6);
  border-radius: 50% 50% 0 0 / 55% 55% 0 0;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 87% 100%, 75% 86%, 62% 100%, 50% 86%, 37% 100%, 25% 86%, 12% 100%, 0 86%);
  opacity: 0.85;
}

.motif-ghost::before {
  content: "";
  position: absolute;
  top: 32%;
  left: 27%;
  width: 0.3rem;
  height: 0.42rem;
  background: var(--stone-bg);
  border-radius: 50%;
  box-shadow: 0.8rem 0 0 var(--stone-bg);
}

.motif-candle {
  position: absolute;
  left: 3.1rem;
  bottom: 0;
  width: 0.7rem;
  height: 1.3rem;
  background: var(--parchment-text);
  border-radius: 0.15rem 0.15rem 0 0;
}

.motif-candle::before {
  content: "";
  position: absolute;
  bottom: 1.45rem;
  left: 50%;
  width: 0.5rem;
  height: 0.85rem;
  margin-left: -0.25rem;
  background: var(--candle-partial);
  border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
  box-shadow: 0 0 0.8rem 0.3rem rgba(232, 180, 77, 0.5);
}

@media (max-width: 600px) {
  .story-candles { top: 1.2rem; gap: 0.7rem; }
  .story-motif { display: none; }
}

/* High contrast and forced colors: fall back to system colors */

@media (forced-colors: active) {
  .btn, select, .badge, .status-chip, .recover-label, .grave, .status-panel, .glyph-text, .hero-plaque { border-color: CanvasText; }
  :focus-visible { outline-color: Highlight; }
  .crypt-banner { forced-color-adjust: none; }
}

/* Motion: the only place any motion is declared. Users who ask for reduced
   motion get no flicker, no drift, no reveal and no easing at all. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @keyframes candle-flicker {
    0%   { transform: scale(1, 1) rotate(0deg); opacity: 1; }
    18%  { transform: scale(0.94, 1.06) rotate(-2deg); opacity: 0.92; }
    37%  { transform: scale(1.04, 0.96) rotate(1.5deg); opacity: 1; }
    58%  { transform: scale(0.96, 1.04) rotate(-1deg); opacity: 0.88; }
    80%  { transform: scale(1.02, 0.98) rotate(2deg); opacity: 1; }
    100% { transform: scale(1, 1) rotate(0deg); opacity: 1; }
  }

  @keyframes candle-gutter {
    0%   { transform: scale(1, 1) translateX(0); opacity: 1; }
    12%  { transform: scale(0.7, 0.75) translateX(-1px); opacity: 0.7; }
    25%  { transform: scale(1, 1) translateX(1px); opacity: 1; }
    44%  { transform: scale(0.6, 0.7) translateX(0); opacity: 0.65; }
    70%  { transform: scale(0.9, 0.95) translateX(1px); opacity: 0.9; }
    100% { transform: scale(1, 1) translateX(0); opacity: 1; }
  }

  @keyframes moon-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.86; }
  }

  @keyframes hero-flame-flicker {
    0%, 100% { transform: scale(1, 1); }
    30% { transform: scale(0.88, 1.1); }
    62% { transform: scale(1.06, 0.92); }
  }

  @keyframes hero-glow-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
  }

  @keyframes star-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }

  @keyframes grave-reveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .hero-fog-top { animation: fog-drift-left 120s linear infinite alternate; }
  .hero-fog-mid { animation: fog-drift-right 90s linear infinite alternate; }
  .hero-fog-low { animation: fog-drift-left 70s linear infinite alternate; }
  .grave-fog { animation: fog-drift-right 60s linear infinite alternate; }
  .banner-moon { animation: moon-glow 9s ease-in-out infinite; }
  .hero-stars { animation: star-twinkle 6s ease-in-out infinite; }
  .hero-flame { animation: hero-flame-flicker 1.9s ease-in-out infinite; }
  .hero-flame-1 { animation-delay: -0.5s; }
  .hero-flame-2 { animation-delay: -1.1s; }
  .hero-flame-3 { animation-delay: -1.5s; }
  .hero-glow { animation: hero-glow-pulse 3.4s ease-in-out infinite; }
  .story-candle.candle-current .story-flame { animation: candle-flicker 1.8s ease-in-out infinite; }
  .motif-candle::before { animation: candle-flicker 2s ease-in-out infinite; }
  .story::before { animation: fog-drift-left 90s linear infinite alternate; }
  .vault-candle .candle-flame { animation: candle-flicker 2s ease-in-out infinite; }

  @keyframes fog-drift-left {
    from { background-position: 0% 0%; }
    to   { background-position: 100% 0%; }
  }

  @keyframes fog-drift-right {
    from { background-position: 100% 0%; }
    to   { background-position: 0% 0%; }
  }

  @keyframes smoke-sway {
    0%   { transform: rotate(7deg); opacity: 0.85; }
    50%  { transform: rotate(-7deg) translateY(-4px); opacity: 0.45; }
    100% { transform: rotate(7deg); opacity: 0.85; }
  }

  @keyframes ghost-rise {
    0%   { transform: translateY(70%); opacity: 0; }
    12%  { opacity: 0.9; }
    70%  { opacity: 0.8; }
    100% { transform: translateY(-110%); opacity: 0; }
  }

  .fog-a { animation: fog-drift-left 110s ease-in-out infinite alternate; }
  .fog-b { animation: fog-drift-right 150s ease-in-out infinite alternate; }
  .fog-c { animation: fog-drift-left 200s ease-in-out infinite alternate; }

  .status-protected .candle-flame { animation: candle-flicker 2.2s ease-in-out infinite; }
  .status-partial .candle-flame { animation: candle-gutter 1.3s ease-in-out infinite; }
  .status-not-protected .candle-smoke { animation: smoke-sway 3.4s ease-in-out infinite; }

  .ghost { animation: ghost-rise 5s ease-out forwards; }

  .status-protected .status-icon { animation: candle-flicker 2.4s ease-in-out infinite; }
  .status-partial .status-icon { animation: candle-gutter 1.3s ease-in-out infinite; }

  .grave { animation: grave-reveal 0.5s ease-out both; }
  .grave:nth-child(2) { animation-delay: 0.06s; }
  .grave:nth-child(3) { animation-delay: 0.12s; }
  .grave:nth-child(4) { animation-delay: 0.18s; }
  .grave:nth-child(n+5) { animation-delay: 0.24s; }

  @keyframes row-reveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  @keyframes popover-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .replay-row { animation: row-reveal 0.35s ease-out both; }
  .story-ghost-slot .ghost { animation: ghost-rise 2.4s ease-out forwards; }
  .term-popover { animation: popover-fade 0.12s ease-out both; }
  .term-btn { transition: border-color 0.15s ease-out; }

  .btn { transition: background-color 0.15s ease-out, transform 0.1s ease-out; }
  .btn:not([disabled]):hover { transform: translateY(-1px); }
  .grave-open { transition: color 0.15s ease-out; }
}
