/* Ghost Watcher dashboard. Each app sets --accent, --accent-2, --sky and --moon on :root. */

@font-face {
  font-family: 'Pirata One';
  src: url('/ui/fonts/pirata-one-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/ui/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/ui/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/ui/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/ui/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --accent: #7ef0d0;
  --accent-2: #b9a4ff;
  --sky: #120f22;
  --moon: #f3ecd2;
  --shriek: #ff7a6b;
  --ink: #f1ecff;
  --ink-dim: #bdb5da;
  --ink-faint: #b0a9cc;
  --stone-top: #3b3558;
  --stone-bottom: #221e37;
  --stone-edge: rgba(255, 255, 255, 0.09);
  --panel: rgba(20, 16, 36, 0.78);
  --panel-edge: rgba(185, 164, 255, 0.16);
  --display: 'Pirata One', 'UnifrakturCook', 'Old English Text MT', Georgia, serif;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--sky);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-underline-offset: 3px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

.muted {
  color: var(--ink-faint);
}
.small {
  font-size: 0.82rem;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: var(--sky);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 50;
}
.skip:focus {
  left: 16px;
}

/* ---------- night sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 50% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 80% at 80% -10%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--sky) 70%, #000) 0%, var(--sky) 55%, color-mix(in srgb, var(--sky) 80%, #000) 100%);
}

.stars {
  position: absolute;
  inset: -50%;
  background-image:
    radial-gradient(1.2px 1.2px at 20px 30px, #fff9, transparent),
    radial-gradient(1px 1px at 120px 80px, #fff7, transparent),
    radial-gradient(1.4px 1.4px at 200px 160px, #fffb, transparent),
    radial-gradient(1px 1px at 260px 40px, #fff6, transparent),
    radial-gradient(1.1px 1.1px at 330px 210px, #fff8, transparent);
  background-size: 360px 260px;
  animation: drift 240s linear infinite;
  opacity: 0.7;
}

.moon {
  position: absolute;
  top: 30px;
  right: max(24vw, 300px);
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, rgba(0, 0, 0, 0.08) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 64%, rgba(0, 0, 0, 0.07) 0 7%, transparent 8%),
    radial-gradient(circle at 70% 30%, rgba(0, 0, 0, 0.06) 0 5%, transparent 6%),
    radial-gradient(circle at 40% 40%, var(--moon), color-mix(in srgb, var(--moon) 70%, #8a7f60));
  box-shadow:
    0 0 60px 10px color-mix(in srgb, var(--moon) 35%, transparent),
    0 0 180px 40px color-mix(in srgb, var(--moon) 10%, transparent);
  transition: box-shadow 1.2s ease;
}

body[data-restless='true'] .moon {
  box-shadow:
    0 0 70px 14px color-mix(in srgb, var(--accent) 40%, transparent),
    0 0 220px 60px color-mix(in srgb, var(--accent) 14%, transparent);
}

.fog {
  position: absolute;
  left: -50%;
  width: 200%;
  height: 46vh;
  bottom: -8vh;
  background:
    radial-gradient(ellipse 22% 40% at 15% 60%, rgba(220, 214, 255, 0.07), transparent 70%),
    radial-gradient(ellipse 25% 45% at 45% 70%, rgba(220, 214, 255, 0.06), transparent 70%),
    radial-gradient(ellipse 20% 35% at 75% 55%, rgba(220, 214, 255, 0.07), transparent 70%);
  filter: blur(8px);
}
.fog--far {
  animation: fog 70s linear infinite alternate;
  opacity: 0.8;
}
.fog--near {
  bottom: -14vh;
  animation: fog 46s linear infinite alternate-reverse;
}

@keyframes drift {
  to {
    transform: translate3d(-360px, 0, 0);
  }
}
@keyframes fog {
  from {
    transform: translateX(-8%);
  }
  to {
    transform: translateX(8%);
  }
}

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

.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  max-width: 1420px;
  margin: 0 auto;
  padding: 34px 28px 12px;
}

.masthead__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.masthead__crest {
  width: 84px;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 60%, transparent));
  animation: bob 3.6s ease-in-out infinite alternate;
}
.masthead__crest .g-body {
  fill: #f6f2ff;
}
.masthead__crest-word {
  display: block;
  margin-top: 2px;
  text-align: center;
  font: 400 0.95rem/1 var(--display);
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}

/* ---------- motif: a gabled haunted house instead of a tombstone ---------- */

[data-motif='house'] .ghost__stone {
  margin-top: 26px;
  padding-top: 30px;
  border-radius: 4px 4px 10px 10px;
  border-top: 0;
}
/* The roof, as wide as the house, with a lit attic window. */
[data-motif='house'] .ghost__stone::before {
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  top: -44px;
  height: 46px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    radial-gradient(circle at 50% 62%, var(--house-window, rgba(255, 255, 255, 0.08)) 0 7px, transparent 8px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #4a3f68, #2d2645);
  z-index: 0;
}
/* Two windows on the facade. They stay dark until a listing the filters care about appears. */
[data-motif='house'] .ghost__stone::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 14px;
  right: 14px;
  height: 14px;
  background:
    linear-gradient(var(--house-window, rgba(255, 255, 255, 0.07)), var(--house-window, rgba(255, 255, 255, 0.07))) left / 22px 14px no-repeat,
    linear-gradient(var(--house-window, rgba(255, 255, 255, 0.07)), var(--house-window, rgba(255, 255, 255, 0.07))) right / 22px 14px no-repeat;
  border-radius: 2px;
}
[data-motif='house'] .ghost[data-state='restless'] .ghost__stone {
  --house-window: color-mix(in srgb, var(--accent) 85%, #fff3c4);
}
[data-motif='house'] .ghost[data-state='restless'] .ghost__stone::after {
  filter: drop-shadow(0 0 6px var(--accent));
}
[data-motif='house'] .ghost__spirit {
  margin-bottom: -18px;
}

.eyebrow {
  margin: 0;
  font: 500 0.74rem/1.2 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 4px 0 2px;
  font: 400 clamp(2.4rem, 5vw, 3.7rem) / 1 var(--display);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow: 0 0 28px color-mix(in srgb, var(--accent-2) 45%, transparent);
}

.tagline {
  margin: 4px 0 10px;
  color: var(--ink-dim);
  max-width: 62ch;
}

.stats {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font: 400 0.8rem/1.4 var(--mono);
  color: var(--ink-faint);
}
.stats b {
  color: var(--ink);
  font-weight: 500;
}
.stats .sep {
  color: color-mix(in srgb, var(--accent-2) 60%, transparent);
}
.stat-restless:not([data-count='0']) b {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 600 0.9rem/1 var(--sans);
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.08s ease;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.09);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible,
.ghost__hit:focus-visible,
.feed__watch:focus-visible,
.seance__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn[disabled] {
  opacity: 0.45;
  cursor: progress;
}
.btn--glow {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #0c0a16;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn--glow:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent));
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 60%, transparent);
}
body[data-busy='true'] .masthead .btn--glow {
  cursor: progress;
}
/* Demo mode: the first thing to click glows and beckons a few times, then stops. */
.btn--beckon {
  animation: beckon 1.4s ease-in-out 0.4s 8;
}
@keyframes beckon {
  0%,
  100% {
    transform: none;
    box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 0 10px color-mix(in srgb, var(--accent) 24%, transparent),
      0 0 0 20px color-mix(in srgb, var(--accent) 8%, transparent),
      0 0 60px color-mix(in srgb, var(--accent) 85%, transparent);
  }
}
kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--ink-dim) 60%, transparent);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 600 0.72rem/1.4 var(--mono);
  text-align: center;
  color: var(--ink);
}
.night-hint {
  margin: 0;
  max-width: 24ch;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ink-dim);
}
/* A brief dusk sweeps over the sky while the fixture site moves on a night. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, transparent 20%, rgba(2, 1, 8, 0.75));
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: 50;
}
body[data-night='true']::after {
  opacity: 1;
}
/* While night falls, the moon flares in the app's accent color. */
body[data-night='true'] .moon {
  box-shadow:
    0 0 60px 10px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 140px 30px color-mix(in srgb, var(--accent) 25%, transparent);
  transition: box-shadow 0.4s ease;
}
/* After the night, the ghosts that woke rise out of their stones with a burst of aura. */
.ghost[data-rising='true'] .ghost__spirit {
  animation: rise 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.15) 1 both;
}
.ghost[data-rising='true'] .ghost__aura {
  animation: aura-burst 1.4s ease-out 1;
}
@keyframes rise {
  from {
    transform: translateY(46px) scale(0.82);
    opacity: 0.25;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes aura-burst {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  35% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
/* Spirit mail deals the night's letters in one by one. */
#feed[data-arriving='true'] .feed__item {
  animation: letter-in 0.5s ease-out both;
}
#feed[data-arriving='true'] .feed__item:nth-child(2) {
  animation-delay: 0.12s;
}
#feed[data-arriving='true'] .feed__item:nth-child(3) {
  animation-delay: 0.24s;
}
#feed[data-arriving='true'] .feed__item:nth-child(4) {
  animation-delay: 0.36s;
}
#feed[data-arriving='true'] .feed__item:nth-child(n + 5) {
  animation-delay: 0.48s;
}
@keyframes letter-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  body::after {
    transition: none;
  }
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  max-width: 1420px;
  margin: 0 auto;
  padding: 18px 28px 40px;
  align-items: start;
}

.graveyard {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 26px 22px;
  padding: 6px 0 22px;
}
/* The ground every stone stands on: a strip of grass under the last row. */
.graveyard::after {
  content: '';
  position: absolute;
  left: -12px;
  right: -12px;
  bottom: 0;
  height: 26px;
  border-radius: 50% 50% 0 0 / 12px 12px 0 0;
  background:
    repeating-linear-gradient(100deg, rgba(126, 190, 110, 0.18) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, rgba(64, 104, 62, 0.55), rgba(20, 30, 24, 0.2));
  pointer-events: none;
  z-index: -1;
}

/* ---------- a ghost and its tombstone ---------- */

.ghost {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
}

.ghost__hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  background: transparent;
  border-radius: 90px 90px 14px 14px;
  cursor: pointer;
}

.ghost__spirit {
  position: relative;
  width: 132px;
  height: 150px;
  margin-bottom: -26px;
  z-index: 2;
}

.ghost__float {
  position: absolute;
  inset: 0 6px 10px;
  animation: bob 4.2s ease-in-out infinite alternate;
  transform-origin: 50% 80%;
}

.ghost__aura {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 66%);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.ghost__shadow {
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 18px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  filter: blur(4px);
  animation: shadow 4.2s ease-in-out infinite alternate;
}

.g-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.g-body {
  fill: #ebe6fb;
  opacity: 0.9;
  transition:
    fill 0.4s ease,
    opacity 0.4s ease;
}
.g-sheen {
  fill: none;
  stroke: #fff;
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.55;
}
.g-eye ellipse,
.g-eye circle:not(.g-glint) {
  fill: #18132b;
}
.g-glint {
  fill: #fff;
}
.g-eye-closed,
.g-mouth-line {
  fill: none;
  stroke: #2a2343;
  stroke-width: 3.4;
  stroke-linecap: round;
}
.g-mouth {
  fill: #2a1830;
}
.g-cheek {
  fill: #ff9fb8;
  opacity: 0.35;
}
.g-zzz text {
  font: 700 15px var(--mono);
  fill: var(--ink-dim);
  animation: zzz 3s ease-in-out infinite;
}
.g-zzz text:nth-child(2) {
  animation-delay: 0.8s;
  font-size: 11px;
}
.g-gate path {
  fill: none;
  stroke: #57507a;
  stroke-width: 3.2;
  stroke-linecap: round;
}

.ghost__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 0.85rem/1 var(--mono);
  color: #0c0a16;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  z-index: 4;
}
.ghost__badge[data-severity='shriek'] {
  background: var(--shriek);
  box-shadow: 0 0 18px var(--shriek);
}

.ghost__stone {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 248px;
  padding: 38px 18px 18px;
  text-align: center;
  border-radius: 110px 110px 14px 14px / 70px 70px 14px 14px;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.012) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, var(--stone-top), var(--stone-bottom));
  border: 1px solid var(--stone-edge);
  box-shadow:
    inset 0 -18px 24px -16px rgba(105, 160, 90, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 30px -18px rgba(0, 0, 0, 0.8);
  transition:
    box-shadow 0.5s ease,
    border-color 0.5s ease;
}

.ghost__state {
  margin: 0 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.ghost__state .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.ghost__name {
  margin: 0;
  font: 400 1.5rem/1.1 var(--display);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.ghost__sub {
  margin: 4px 0 12px;
  color: var(--ink-faint);
  font-size: 0.82rem;
}

.readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 0 0 12px;
  text-align: left;
}
.reading {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 0;
}
.reading dt {
  font: 500 0.7rem/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
.reading dd {
  margin: 2px 0 0;
  font: 500 0.92rem/1.25 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* A changed value gets the whole row, so "$300 → $400" never breaks across lines. */
.reading[data-changed='true'] {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, rgba(0, 0, 0, 0.2));
  animation: reading-flip 0.9s ease-out 1;
}
/* Every struck-through old value looks the same, so colour is left to the news itself. */
.reading del,
.textblock del,
.values tr[data-changed='true'] td.before {
  color: var(--ink-dim);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in srgb, var(--ink-dim) 80%, transparent);
}
.reading del {
  font-size: 0.8em;
}
.reading ins {
  text-decoration: none;
  color: var(--accent);
}
.reading[data-changed='true'] dd {
  white-space: nowrap;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Tone: bad news is red, good news glows in the accent, and a vanished value reads "gone". */
.reading[data-tone='bad'] {
  border-color: color-mix(in srgb, var(--shriek) 70%, transparent);
  background: color-mix(in srgb, var(--shriek) 12%, rgba(0, 0, 0, 0.2));
}
.reading[data-tone='bad'] ins {
  color: var(--shriek);
}
.reading ins[data-gone='true'] {
  font-style: italic;
  letter-spacing: 0.04em;
}
@keyframes reading-flip {
  from {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
  }
  to {
    box-shadow: 0 0 0 10px transparent;
  }
}

.ghost__msg {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ghost__ignored {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--ink-dim) 45%, transparent);
  font: 400 0.8125rem/1.3 var(--sans);
  color: var(--ink-dim);
}
.ghost__when {
  margin: 8px 0 0;
  font: 400 0.8125rem/1.2 var(--mono);
  color: var(--ink-faint);
}

/* states */

.ghost[data-state='restless'] .ghost__aura {
  opacity: 0.9;
  animation: pulse 1.8s ease-in-out infinite;
}
.ghost[data-state='restless'] .g-body {
  fill: #ffffff;
  opacity: 1;
}
.ghost[data-state='restless'] .ghost__float {
  animation:
    bob 1.7s ease-in-out infinite alternate,
    sway 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 14px var(--accent)) drop-shadow(0 0 32px color-mix(in srgb, var(--accent) 50%, transparent));
}
.ghost[data-state='restless'] .ghost__stone {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow:
    inset 0 -18px 24px -16px rgba(105, 160, 90, 0.35),
    0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
    0 0 36px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.ghost[data-state='restless'] .ghost__state {
  color: var(--accent);
}
.ghost[data-state='restless'] .ghost__state .dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.ghost[data-state='restless'][data-severity='shriek'] .ghost__aura {
  background: radial-gradient(circle, color-mix(in srgb, var(--shriek) 55%, transparent) 0%, transparent 66%);
}
.ghost[data-state='restless'][data-severity='shriek'] .ghost__float {
  animation:
    bob 1.2s ease-in-out infinite alternate,
    shake 3.4s ease-in-out infinite;
}

.ghost[data-state='dormant'] .ghost__state .dot {
  background: #8fd18f;
}

.ghost[data-state='unborn'] .g-body {
  fill: rgba(235, 230, 251, 0.08);
  stroke: var(--ink-faint);
  stroke-width: 2.4;
  stroke-dasharray: 6 6;
}
.ghost[data-state='unborn'] .g-sheen,
.ghost[data-state='unborn'] .g-cheek {
  display: none;
}
.ghost[data-state='unborn'] .g-eye-closed {
  stroke: var(--ink-faint);
}

.ghost[data-state='blocked'] .g-body {
  fill: #c9c2e4;
  opacity: 0.55;
}
.ghost[data-state='blocked'] .ghost__float {
  animation-duration: 6s;
}
.ghost[data-state='blocked'] .ghost__state .dot {
  background: #d6b25e;
}

.ghost[data-state='lost'] .ghost__float {
  opacity: 0.4;
  filter: blur(0.6px);
  animation:
    bob 5s ease-in-out infinite alternate,
    flicker 3.2s steps(1) infinite;
}
.ghost[data-state='lost'] .ghost__state .dot {
  background: var(--shriek);
}

.ghost[data-checking='true'] .ghost__spirit::after {
  content: 'visiting…';
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  border-radius: 999px;
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.1em;
  background: rgba(12, 10, 22, 0.8);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  z-index: 5;
}
.ghost[data-checking='true'] .ghost__float {
  animation: bob 0.6s ease-in-out infinite alternate;
}

.ghost:hover .ghost__stone {
  border-color: color-mix(in srgb, var(--accent-2) 50%, transparent);
}

@keyframes bob {
  from {
    transform: translateY(4px);
  }
  to {
    transform: translateY(-9px);
  }
}
@keyframes sway {
  0%,
  100% {
    rotate: -3deg;
  }
  50% {
    rotate: 3deg;
  }
}
@keyframes shake {
  0%,
  86%,
  100% {
    translate: 0 0;
  }
  88% {
    translate: -3px 0;
  }
  90% {
    translate: 3px 0;
  }
  92% {
    translate: -2px 0;
  }
  94% {
    translate: 2px 0;
  }
}
@keyframes shadow {
  from {
    transform: scaleX(1);
    opacity: 0.55;
  }
  to {
    transform: scaleX(0.7);
    opacity: 0.3;
  }
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}
@keyframes flicker {
  0%,
  100% {
    opacity: 0.4;
  }
  40% {
    opacity: 0.15;
  }
  42% {
    opacity: 0.45;
  }
  70% {
    opacity: 0.25;
  }
}
@keyframes zzz {
  0% {
    opacity: 0;
    transform: translate(0, 4px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(6px, -8px);
  }
}

/* ---------- spirit mail feed ---------- */

.feed {
  position: sticky;
  top: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  padding: 20px 18px 10px;
  backdrop-filter: blur(10px);
  max-height: calc(100vh - 36px);
  overflow: auto;
}
.feed h2 {
  margin: 0;
  font: 400 1.7rem/1 var(--display);
}
.feed__list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.feed__empty {
  color: var(--ink-faint);
  font-style: italic;
  padding: 14px 4px;
}
.feed__item {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent);
}
.feed__item[data-severity='shriek'] {
  border-left-color: var(--shriek);
}
.feed__item[data-severity='whisper'] {
  border-left-color: var(--ink-faint);
}
.feed__item[data-stealth='true'] {
  background: linear-gradient(100deg, color-mix(in srgb, var(--shriek) 16%, transparent), rgba(255, 255, 255, 0.03) 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shriek) 45%, transparent);
}
.stealth {
  margin: 6px 0 2px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink);
}
.stealth__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--shriek);
  color: #1a0d10;
  font: 700 0.68rem/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.receipt {
  margin: 6px 0 2px;
  font: 400 0.72rem/1.5 var(--mono);
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}
.receipt code {
  color: var(--ink);
}
.receipt__tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 7px;
  border: 1px dashed color-mix(in srgb, var(--accent-2) 70%, transparent);
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.64rem/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.feed__item[data-acknowledged='true'] {
  /* Read letters go quiet without fading their text below readable contrast. */
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-left-color: color-mix(in srgb, var(--ink-faint) 45%, transparent);
}
.feed__item[data-acknowledged='true'] .feed__summary {
  color: var(--ink-dim);
}
.feed__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 0.72rem/1.2 var(--mono);
  color: var(--ink-faint);
}
.feed__meta time {
  margin-left: auto;
  white-space: nowrap;
}
.feed__watch {
  min-width: 0;
  flex: 1 1 auto;
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-dim);
  font: inherit;
  cursor: pointer;
  text-align: left;
  /* Long ghost names wrap to two lines rather than vanishing behind an ellipsis. */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.feed__watch:hover {
  color: var(--ink);
  text-decoration: underline;
}
.feed__summary {
  overflow-wrap: anywhere;
  margin: 6px 0 4px;
  font-size: 0.9rem;
}
.feed__letter {
  font-size: 0.78rem;
}

.sev {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font: 600 0.62rem/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0c0a16;
  background: var(--accent);
  flex: none;
}
.sev[data-severity='shriek'] {
  background: var(--shriek);
}
.sev[data-severity='whisper'] {
  background: var(--ink-faint);
}

/* ---------- séance drawer ---------- */

.seance {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(600px, 100vw);
  height: 100dvh;
  max-height: none;
  max-width: 100vw;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--panel-edge);
  background:
    radial-gradient(ellipse 90% 30% at 50% 0%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 70%),
    #130f24;
  color: var(--ink);
  overflow: auto;
}
.seance[open] {
  animation: slide-in 0.28s ease-out;
}
.seance::backdrop {
  background: rgba(6, 4, 14, 0.62);
  backdrop-filter: blur(3px);
}
.seance__body {
  padding: 26px 26px 40px;
}
.seance__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--panel-edge);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.seance__head {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: start;
  padding-right: 40px;
}
.seance__head h2 {
  margin: 2px 0 4px;
  font: 400 2rem/1.05 var(--display);
}
.seance__head p {
  margin: 2px 0;
  overflow-wrap: anywhere;
}
.seance__ghost {
  width: 88px;
}
.seance__head[data-state='restless'] .seance__ghost {
  filter: drop-shadow(0 0 14px var(--accent));
}
.seance__head[data-state='restless'] .g-body {
  fill: #fff;
}
.seance__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 8px;
}
.seance h3 {
  margin: 24px 0 8px;
  font: 500 0.72rem/1.2 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.values {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-size: 0.9rem;
}
.values th,
.values td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}
.values thead th {
  font: 500 0.66rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.values tbody th {
  font-weight: 600;
  color: var(--ink-dim);
  width: 28%;
}
.values td {
  font-family: var(--mono);
  font-size: 0.84rem;
}
.values tr[data-changed='true'] td.now {
  color: var(--accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}


.seance__list ul,
.rules,
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.seance__list li {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
}
/* Ghost of Terms Past: a vertical timeline of archived copies */
.past__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0 0 0 4px;
  display: grid;
  gap: 0;
}
.past__entry {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 0 0 14px;
}
.past__entry::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 14px;
  bottom: 0;
  border-left: 2px dotted color-mix(in srgb, var(--accent-2) 40%, transparent);
}
.past__entry:last-child::before {
  display: none;
}
.past__dot {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  background: var(--sky);
}
.past__entry[data-severity='moan'] .past__dot,
.past__entry[data-severity='whisper'] .past__dot {
  background: var(--accent-2);
}
.past__entry[data-severity='shriek'] .past__dot {
  border-color: var(--shriek);
  background: var(--shriek);
  box-shadow: 0 0 10px var(--shriek);
}
.past__entry[data-kind='now'] .past__dot {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.past__entry[data-tone='good'] .past__dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.past__entry[data-tone='bad'] .past__dot {
  border-color: var(--shriek);
  background: var(--shriek);
  box-shadow: 0 0 10px var(--shriek);
}
.past__fickle {
  margin: 4px 0 6px;
  font-size: 0.88rem;
  color: var(--ink);
}
.past__score {
  display: inline-block;
  margin-right: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
  font: 600 0.82rem/1.6 var(--mono);
}
.past__fickle[data-label='very fickle'] .past__score {
  background: var(--shriek);
  color: #1a0d10;
}
.past__when {
  margin: 0;
  font: 400 0.74rem/1.4 var(--mono);
  color: var(--ink-dim);
}
.past__line {
  margin: 2px 0 0;
  font-size: 0.9rem;
}
.seance__list li[data-new='true'] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.new-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  font: 600 0.62rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent);
  color: #0c0a16;
}
.rules li {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-edge);
  font: 400 0.8rem/1.3 var(--mono);
  color: var(--ink-dim);
}
.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.log__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.log__item p {
  margin: 0;
}
.log__item[data-acknowledged='true'] p:first-child {
  color: var(--ink-dim);
}

.textblock p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-dim);
}
.textblock ins {
  text-decoration: none;
  color: #0c0a16;
  background: var(--accent);
  border-radius: 4px;
  padding: 0 3px;
}


/* ---------- footer and toast ---------- */

.foot {
  max-width: 1420px;
  margin: 0 auto;
  padding: 10px 28px 40px;
  color: var(--ink-faint);
  font-size: 0.8rem;
}
.foot p {
  margin: 4px 0;
}

/* The toast rises from the bottom, so it never covers the app's name or the stones' headlines. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 30px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(16, 12, 30, 0.94);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 30px -6px color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  z-index: 60;
}
.toast[data-show='true'] {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes slide-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- the Ghost of Terms Past on the stone ---------- */

/* Past news is a muted, outlined parchment tag; only live changes get full colour. */
.ghost__ribbon {
  position: relative;
  z-index: 2;
  margin: -6px auto 10px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 11px;
  border-radius: 6px;
  border: 1px dashed color-mix(in srgb, #e9dcb4 55%, transparent);
  font: 600 0.8rem/1.3 var(--sans);
  color: var(--ink);
  background: rgba(10, 8, 20, 0.55);
  text-wrap: balance;
}
.ghost__ribbon-tag {
  display: block;
  font: 600 0.62rem/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e9dcb4;
}
.ghost__ribbon[data-tone='bad'] .ghost__ribbon-tag::before,
.ghost__ribbon[data-tone='good'] .ghost__ribbon-tag::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--shriek);
}
.ghost__ribbon[data-tone='good'] .ghost__ribbon-tag::before {
  background: var(--accent);
}
.ghost__fickle {
  margin: 8px 0 0;
  font: 400 0.8125rem/1.35 var(--sans);
  color: var(--ink-dim);
}
.ghost__fickle[data-label='very fickle'] {
  color: var(--ink);
}

/* ---------- Spirit mail from the archive, and tone ---------- */

/* Unread letters take the color of their news: good glows in the accent, bad is red. */
.feed__item[data-tone='good']:not([data-acknowledged='true']) {
  border-left-color: var(--accent);
}
.feed__item[data-tone='bad']:not([data-acknowledged='true']) {
  border-left-color: var(--shriek);
}
.feed__item--archive {
  background: transparent;
  border-left-style: dashed;
  border-left-color: color-mix(in srgb, var(--accent-2) 60%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.feed__item--archive[data-tone='bad'] {
  border-left-color: color-mix(in srgb, var(--shriek) 70%, transparent);
}
.feed__item--archive .feed__summary {
  color: var(--ink-dim);
}
.sev--archive {
  background: color-mix(in srgb, var(--accent-2) 30%, transparent);
  color: var(--ink);
}

/* ---------- a shriek gets its own scene ---------- */

.lightning {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 0%, rgba(255, 245, 255, 0.9), rgba(255, 220, 230, 0.2) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
body[data-shriek='true'] .lightning {
  animation: lightning 1.2s ease-out 1;
}
body[data-shriek='true'] .moon {
  background:
    radial-gradient(circle at 34% 38%, rgba(0, 0, 0, 0.1) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 64%, rgba(0, 0, 0, 0.08) 0 7%, transparent 8%),
    radial-gradient(circle at 40% 40%, #ffb3a8, color-mix(in srgb, var(--shriek) 80%, #3a0d10));
  box-shadow:
    0 0 80px 18px color-mix(in srgb, var(--shriek) 60%, transparent),
    0 0 220px 60px color-mix(in srgb, var(--shriek) 22%, transparent);
  transition:
    box-shadow 0.3s ease,
    background 0.3s ease;
}
.ghost[data-state='restless'][data-severity='shriek'] .g-body {
  fill: color-mix(in srgb, var(--shriek) 32%, #ffffff);
}
.ghost[data-state='restless'][data-severity='shriek'] .ghost__float {
  filter: drop-shadow(0 0 14px var(--shriek)) drop-shadow(0 0 32px color-mix(in srgb, var(--shriek) 50%, transparent));
}
body[data-shriek='true'] .ghost[data-severity='shriek'][data-rising='true'] .ghost__spirit {
  animation:
    rise 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.15) 1 both,
    jolt 0.42s ease-in-out 1.05s 2;
}
.ghost__crack {
  position: absolute;
  top: 6px;
  right: 22%;
  width: 34px;
  height: 52px;
  z-index: 1;
  pointer-events: none;
}
.ghost__crack path {
  fill: none;
  stroke: color-mix(in srgb, var(--shriek) 75%, #000);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 0;
}
.ghost[data-rising='true'] .ghost__crack path {
  animation: crack 0.7s ease-out 0.9s 1 both;
}
@keyframes lightning {
  0%,
  100% {
    opacity: 0;
  }
  8% {
    opacity: 0.85;
  }
  16% {
    opacity: 0.1;
  }
  24% {
    opacity: 0.6;
  }
  40% {
    opacity: 0;
  }
}
@keyframes jolt {
  0%,
  100% {
    translate: 0 0;
  }
  20% {
    translate: -6px 0;
  }
  40% {
    translate: 6px 0;
  }
  60% {
    translate: -4px 0;
  }
  80% {
    translate: 4px 0;
  }
}
@keyframes crack {
  from {
    stroke-dashoffset: 120;
  }
  to {
    stroke-dashoffset: 0;
  }
}

[hidden] {
  display: none !important;
}

/* ---------- Haunted Listings: a dusk street, and the unit that lit up ---------- */

[data-motif='house'] .sky {
  background:
    radial-gradient(ellipse 140% 45% at 50% 105%, rgba(255, 140, 70, 0.32), transparent 70%),
    radial-gradient(ellipse 90% 35% at 20% 100%, rgba(214, 92, 120, 0.22), transparent 70%),
    radial-gradient(ellipse 120% 80% at 80% -10%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 60%),
    linear-gradient(180deg, #0f0b1d 0%, #1e1433 48%, #3a1f3c 78%, #5a2c35 100%);
}
.reading--match {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, rgba(0, 0, 0, 0.25));
}
.reading--match dd {
  font-size: 0.9rem;
  color: var(--ink);
}
.reading--match[data-tone='good'] dd::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 11px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  vertical-align: -1px;
}

/* ---------- Tonight's tally, under the graveyard ---------- */

.crypt {
  min-width: 0;
}
.tally {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 22px;
  margin: 18px 0 0;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.tally b {
  color: var(--ink);
  font: 600 1.1rem/1 var(--mono);
}
.tally__title {
  font: 400 1.25rem/1 var(--display);
  color: var(--accent);
}
.btn--rewind {
  border-style: dashed;
}

/* ---------- Raise the dead: the dispute pack ---------- */

.feed__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.btn--small {
  padding: 7px 12px;
  font-size: 0.8rem;
}
.btn--raise {
  border-color: color-mix(in srgb, var(--shriek) 60%, transparent);
  background: color-mix(in srgb, var(--shriek) 14%, transparent);
}
.btn--raise:hover {
  background: color-mix(in srgb, var(--shriek) 26%, transparent);
}
.log .btn--raise {
  margin: 4px 0;
}
.dispute__head {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: start;
  padding-right: 40px;
}
.dispute__head h2 {
  margin: 2px 0 4px;
  font: 400 2rem/1.05 var(--display);
}
.dispute__head .g-body {
  fill: #fff;
}
.dispute__terms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.dispute__side {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.dispute__side[data-side='after'] {
  border-color: color-mix(in srgb, var(--shriek) 50%, transparent);
}
.dispute__side ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.dispute__side h3 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
}
.dispute__block label {
  display: block;
  margin: 8px 0 4px;
  font-size: 0.82rem;
  color: var(--ink-dim);
}
.dispute__text {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font: 400 0.8rem/1.5 var(--mono);
  resize: vertical;
}
.dispute__text:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dispute__evidence code {
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .dispute__terms {
    grid-template-columns: 1fr;
  }
  .dispute__head {
    grid-template-columns: 60px 1fr;
  }
}

/* ---------- phones: a sticky way to the letters ---------- */

.feed-pill {
  display: none;
}

/* ---------- small screens ---------- */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .feed {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .masthead {
    grid-template-columns: 1fr;
    padding: 22px 16px 8px;
    gap: 10px;
  }
  .masthead__crest {
    width: 58px;
  }
  .masthead__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .masthead__actions .btn {
    width: 100%;
    padding: 12px 10px;
  }
  .masthead__actions .night-hint {
    grid-column: 1 / -1;
    max-width: none;
  }
  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    transform: translateY(30px);
  }
  .toast[data-show='true'] {
    transform: none;
  }
  .masthead__crest {
    display: none;
  }
  .feed-pill[data-hidden='true'] {
    opacity: 0;
    pointer-events: none;
  }
  .layout {
    padding: 12px 16px 30px;
  }
  .graveyard {
    grid-template-columns: 1fr;
  }
  .moon {
    width: 72px;
    top: 18px;
    right: 18px;
  }
  .foot {
    padding: 10px 16px 30px;
  }
  .seance__body {
    padding: 22px 16px 32px;
  }
  .seance__head {
    grid-template-columns: 60px 1fr;
  }
  .seance__ghost {
    width: 60px;
  }
  .values tbody th {
    width: auto;
  }
  .feed-pill {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(16, 12, 30, 0.94);
    border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
    box-shadow: 0 6px 24px -6px rgba(0, 0, 0, 0.8);
    color: var(--ink);
    font: 600 0.85rem/1 var(--sans);
    text-decoration: none;
  }
  .feed-pill span {
    min-width: 22px;
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #0c0a16;
    font: 600 0.75rem/1 var(--mono);
    text-align: center;
  }
}

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

/* ---------- Seal the pact ---------- */

.ghost__pact {
  position: relative;
  /* Above the whole-stone `.ghost__hit` overlay (z-index 3), so the button can be clicked. */
  z-index: 4;
  margin: 10px 0 0;
  font: 400 0.8125rem/1.45 var(--sans);
  color: var(--ink-dim);
}
.ghost__pact[data-pact='sealed'] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 8px;
}
.ghost__pact[data-pact='sealed'] code,
.ghost__pact[data-pact='sealed'] time,
.ghost__pact[data-pact='sealed'] .pact-demo {
  white-space: nowrap;
}
.ghost__pact[data-pact='sealed'] {
  /* The chip is information only: let a click fall through to the stone. */
  pointer-events: none;
}
.ghost__pact code {
  font: 400 0.78rem/1.4 var(--mono);
  color: var(--ink);
}
.ghost__pact-tag {
  display: inline-block;
  padding: 1px 9px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 70%, transparent);
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.72rem/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ghost__pact-tag--warn,
.pact__warn {
  border-color: var(--shriek);
  color: var(--shriek);
}
.pact__warn {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--shriek);
  border-radius: 999px;
  font: 600 0.72rem/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ghost__pact-why {
  display: block;
  margin-top: 4px;
  color: var(--ink-dim);
}
.btn--seal {
  border-color: color-mix(in srgb, var(--accent-2) 65%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}
.btn--seal:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-2) 24%, transparent);
}
.btn--seal:disabled {
  cursor: not-allowed;
}
.pact-demo {
  display: inline-block;
  padding: 0 7px;
  border: 1px dashed color-mix(in srgb, var(--ink-dim) 60%, transparent);
  border-radius: 999px;
  color: var(--ink-dim);
  font: 600 0.64rem/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pact {
  margin-top: 22px;
}
.pact__facts {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}
.pact__facts div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 10px;
}
.pact__facts dt {
  font: 500 0.66rem/1.8 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pact__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.pact__hash {
  font: 400 0.78rem/1.5 var(--mono);
  color: var(--ink);
}
.pact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.pact__confirm {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--shriek) 60%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--shriek) 10%, transparent);
}
.pact__confirm p {
  margin: 0 0 10px;
}
.values td.pact-value {
  color: var(--ink-dim);
}
.values tr[data-pact-differs='true'] td.pact-value {
  color: var(--ink);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.pact-note {
  margin: 6px 0 2px;
  font: 400 0.85rem/1.5 var(--sans);
  color: var(--ink-dim);
}
.pact-note__tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 70%, transparent);
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.64rem/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .pact__facts div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
