/* ============================================================
   SAINT MACHINE
   A monastic instrument. Smoky black, parchment ivory, oxidized
   bronze, muted gold, wax red, dark green. Engraved borders.
   Three zones in a single, breathing chamber.
   ============================================================ */

:root {
  /* ground */
  --void:        #0a0907;
  --void-1:      #0e0c09;
  --void-2:      #15110c;
  --void-3:      #1d1812;

  /* parchment / ivory */
  --bone:        #ece4cc;
  --bone-2:      #d8cdb0;
  --bone-3:      #b9ad90;

  /* metal */
  --bronze:      #8a6a3a;
  --bronze-2:    #6e5128;
  --bronze-3:    #4d381a;
  --gold:        #c9a559;       /* used very sparingly */
  --gold-dim:    #8e7437;

  /* wax */
  --wax:         #7d1f1a;
  --wax-2:       #a83a2c;
  --wax-deep:    #4a0e0a;
  --wax-glow:    rgba(168, 58, 44, .25);

  /* moss */
  --moss:        #3a5040;
  --moss-2:      #5a7a64;

  /* tones */
  --ash:         #6a5f4a;
  --ash-2:       #8c7f63;
  --whisper:     #3d362a;

  /* lines */
  --line:        rgba(236, 228, 204, .12);
  --line-2:      rgba(236, 228, 204, .06);
  --line-3:      rgba(236, 228, 204, .22);
  --line-bronze: rgba(138, 106, 58, .35);

  /* type */
  --display:  "Cormorant Garamond", "Times New Roman", serif;
  --body:     "Newsreader", "Times New Roman", serif;
  --mono:     "JetBrains Mono", ui-monospace, monospace;

  /* motion */
  --ease:    cubic-bezier(.22, .62, .18, 1);
  --ease-in: cubic-bezier(.6, 0, .8, .2);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  font-variation-settings: "opsz" 16, "wght" 380;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body {
  background:
    radial-gradient(1200px 800px at 50% 10%, #15110c 0%, var(--void) 60%, #050402 100%);
  min-height: 100vh;
  cursor: default;
}

/* subtle parchment texture overlay — extremely faint, multiplies on dark */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .14;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch' seed='2'/><feColorMatrix values='0 0 0 0 .92  0 0 0 0 .85  0 0 0 0 .68  0 0 0 .35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

::selection { background: var(--wax); color: var(--bone); }
a { color: inherit; text-decoration: none; }
button, textarea, input { font-family: inherit; color: inherit; }

@media (max-width: 900px) {
  body { cursor: auto; }
  .cursor { display: none !important; }
}

/* ============== custom cursor ============== */
.cursor {
  position: fixed; top: 0; left: 0;
  z-index: 200; pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform;
}
.cursor-dot {
  position: absolute; left: 0; top: 0;
  width: 4px; height: 4px;
  margin: -2px 0 0 -2px;
  background: var(--bone);
  border-radius: 50%;
}
.cursor-ring {
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  border: 1px solid var(--bone-3);
  border-radius: 50%;
  opacity: .5;
  transition: width .35s var(--ease), height .35s var(--ease),
              margin .35s var(--ease), opacity .35s var(--ease),
              border-color .35s var(--ease);
}
.cursor.is-hover .cursor-ring {
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  border-color: var(--wax-2);
  opacity: 1;
}
.cursor.is-hover .cursor-dot { background: var(--wax-2); }
.cursor.is-grab .cursor-ring {
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  border-color: var(--gold);
  opacity: 1;
}

/* ============== chrome ============== */
.page-head {
  position: fixed;
  top: 22px; left: 28px; right: 28px;
  z-index: 80;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px;
  pointer-events: none;
}
.page-head > * { pointer-events: auto; }
.logomark {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  color: var(--bone);
}
.logomark-mark {
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--wax-2);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--wax-glow);
}

.head-state {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  color: var(--ash-2);
  letter-spacing: .01em;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.state-pill {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid var(--line-bronze);
  border-radius: 999px;
  color: var(--bone-2);
  font-size: 12px;
  font-style: normal;
  font-family: var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.state-sep { color: var(--whisper); }

/* audio toggle */
.audio-toggle {
  position: fixed; bottom: 24px; right: 28px;
  z-index: 80;
  width: 36px; height: 36px;
  background: transparent; border: 0;
  cursor: none;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 3px;
  padding: 8px 4px;
}
.audio-toggle .audio-bar {
  width: 2px; height: 6px;
  background: var(--ash);
  transition: height .35s var(--ease), background .35s var(--ease);
}
.audio-toggle:hover .audio-bar { background: var(--bone-2); }
.audio-toggle.is-on .audio-bar { background: var(--wax-2); }
.audio-toggle.is-on .audio-bar:nth-child(1) { animation: bar 1.4s ease-in-out infinite; }
.audio-toggle.is-on .audio-bar:nth-child(2) { animation: bar 1.1s ease-in-out infinite .2s; }
.audio-toggle.is-on .audio-bar:nth-child(3) { animation: bar 1.7s ease-in-out infinite .35s; }
@keyframes bar {
  0%, 100% { height: 6px; }
  50%      { height: 18px; }
}

/* ============== chamber: three-zone layout ============== */
.chamber {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(320px, 22%) minmax(0, 1fr) minmax(320px, 22%);
  gap: 0;
  min-height: 100vh;
  padding-top: 76px;
}

.zone {
  position: relative;
  padding: 28px 28px 64px;
  display: flex;
  flex-direction: column;
}
.zone--config,
.zone--ledger {
  border-right: 1px solid var(--line);
  height: calc(100vh - 76px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bronze-3) transparent;
}
.zone--ledger { border-right: 0; border-left: 1px solid var(--line); }
.zone--machine {
  align-items: center;
  padding: 28px 24px 80px;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
}

.zone-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.zone-head--center { justify-content: center; border-bottom: 0; padding-bottom: 0; }
.zone-num {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  color: var(--gold);
  letter-spacing: .02em;
}
.zone-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
  letter-spacing: .005em;
  margin: 0;
  color: var(--bone);
}
.zone-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ash-2);
}

/* ============== config zone ============== */
.conf-block {
  margin-bottom: 36px;
}
.conf-block + .conf-block {
  padding-top: 28px;
  border-top: 1px solid var(--line-2);
}
.conf-h {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 6px;
  font-weight: 400;
}
.conf-sub {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ash-2);
  margin: 0 0 16px;
}
.conf-fine {
  font-family: var(--display);
  font-style: italic;
  font-size: 12px;
  color: var(--whisper);
  margin: 12px 0 0;
}

.domain-list {
  display: flex; flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line-2);
}
.domain-card {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line-2);
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  text-align: left;
  cursor: none;
  font-family: var(--display);
  color: var(--bone);
  transition: background .35s var(--ease), color .35s var(--ease);
}
.domain-card:hover { background: rgba(236, 228, 204, .03); }
.domain-card .d-glyph {
  font-size: 22px;
  color: var(--bronze);
  line-height: 1;
}
.domain-card .d-name {
  font-size: 18px;
  font-style: italic;
}
.domain-card .d-blurb {
  grid-column: 2;
  font-family: var(--body);
  font-size: 13px;
  font-style: normal;
  color: var(--ash-2);
  margin-top: 4px;
}
.domain-card.is-chosen {
  background: rgba(168, 58, 44, .06);
}
.domain-card.is-chosen .d-glyph { color: var(--wax-2); }
.domain-card.is-chosen::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--wax-2);
}

/* directive */
.directive-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-3);
  padding: 8px 0 12px;
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  line-height: 1.35;
  color: var(--bone);
  resize: none;
  letter-spacing: -.005em;
  cursor: none;
}
.directive-input:focus {
  outline: 0;
  border-bottom-color: var(--bronze);
}
.directive-input::placeholder { color: var(--whisper); font-style: italic; }
.goal-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.goal-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--line-3);
  color: var(--bone-2);
  cursor: none;
  border-radius: 999px;
  transition: all .3s var(--ease);
}
.goal-pill:hover { border-color: var(--bronze); color: var(--gold); }
.goal-pill.is-chosen {
  border-color: var(--wax-2);
  color: var(--bone);
  background: rgba(168, 58, 44, .08);
}

/* context */
.context-card {
  border: 1px solid var(--line);
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(138, 106, 58, .04), transparent);
  font-family: var(--display);
  font-style: italic;
  font-size: 15px;
  line-height: 1.45;
  color: var(--bone-2);
  position: relative;
  min-height: 92px;
}
.context-card::before, .context-card::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  border: 1px solid var(--bronze);
}
.context-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.context-card::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.context-empty { color: var(--ash); margin: 0; }
.context-meta {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
  font-style: normal;
}

/* seal tray */
.seal-tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.seal {
  position: relative;
  display: flex; flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(236, 228, 204, .015);
  cursor: none;
  text-align: left;
  font-family: var(--display);
  color: var(--bone);
  transition: background .35s var(--ease), border-color .35s var(--ease),
              opacity .3s var(--ease), transform .25s var(--ease);
  user-select: none;
  touch-action: none;
}
.seal:hover { background: rgba(236, 228, 204, .04); border-color: var(--bronze); }
.seal.is-fastened {
  opacity: .35;
  pointer-events: none;
}
.seal.is-dragging {
  opacity: 0;
}
.seal-glyph {
  font-size: 18px;
  color: var(--bronze);
  line-height: 1;
  margin-bottom: 6px;
}
.seal-name {
  font-size: 13px;
  font-style: italic;
  letter-spacing: -.005em;
}

/* ============== machine zone ============== */
.machine-caption {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(20px, 2vw, 28px);
  color: var(--bone);
  margin: 0 0 20px;
  text-align: center;
  letter-spacing: -.005em;
}
.machine-stage {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.machine {
  width: 100%;
  height: 100%;
  max-width: min(82vh, 720px);
  max-height: min(82vh, 720px);
  display: block;
}
.slot-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.machine-status {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ash-2);
  margin: 18px 0 18px;
  text-align: center;
}
.machine-actions {
  display: flex; gap: 16px;
  justify-content: center;
  align-items: center;
}

/* ============== buttons ============== */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 14px 26px;
  border: 1px solid var(--bone);
  background: transparent;
  color: var(--bone);
  cursor: none;
  border-radius: 999px;
  transition: all .4s var(--ease);
  overflow: hidden;
}
.btn:disabled { opacity: .25; cursor: not-allowed; pointer-events: none; }
.btn-arrow {
  display: inline-block;
  width: 14px; height: 1px;
  background: currentColor;
  position: relative;
  transition: transform .35s var(--ease);
}
.btn-arrow::after {
  content: ""; position: absolute;
  right: 0; top: 50%;
  width: 6px; height: 6px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  transform-origin: top right;
}
.btn:hover .btn-arrow { transform: translateX(6px); }

.btn--primary {
  background: var(--bone);
  color: var(--void);
  border-color: var(--bone);
}
.btn--primary:hover {
  background: var(--wax-2);
  border-color: var(--wax-2);
  color: var(--bone);
}
.btn--text {
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--ash-2);
}
.btn--text:hover { color: var(--wax-2); border-bottom-color: var(--wax-2); }

/* ============== SVG machine styling ============== */
.ring {
  fill: none;
  stroke: var(--bone);
  stroke-width: 1;
  stroke-opacity: 0.18;
}
.ring--ornament {
  stroke: var(--bronze);
  stroke-opacity: 0.45;
  stroke-width: 1;
}
.ring--hairline {
  stroke: var(--bone);
  stroke-opacity: 0.10;
  stroke-width: 0.5;
}
.ring--slot {
  stroke: var(--bone);
  stroke-opacity: 0.16;
  stroke-width: 1;
}
.ring--inner {
  stroke: var(--bronze);
  stroke-opacity: 0.32;
  stroke-width: 1;
  stroke-dasharray: 1 5;
}

.tick-marks line { stroke: var(--bone); stroke-opacity: .25; stroke-width: 0.6; }
.tick-marks line.major { stroke-opacity: .55; stroke-width: 1; }
.numerals text {
  fill: var(--bronze);
  fill-opacity: 0.65;
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* slot circles */
.slot {
  fill: var(--void-2);
  stroke: var(--bone);
  stroke-opacity: 0.32;
  stroke-width: 1;
  stroke-dasharray: 2 3;
  transition: fill .4s var(--ease), stroke .4s var(--ease),
              stroke-dasharray .4s var(--ease), stroke-width .4s var(--ease);
}
.slot.is-target {
  stroke: var(--gold);
  stroke-opacity: 1;
  stroke-dasharray: 0;
  stroke-width: 1.5;
  fill: rgba(201, 165, 89, .08);
}
.slot.is-filled {
  fill: var(--wax-deep);
  stroke: var(--wax-2);
  stroke-opacity: 0.95;
  stroke-dasharray: 0;
}
.slot-glyph {
  fill: var(--bone);
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.slot.is-filled + .slot-glyph,
.slot-group.is-filled .slot-glyph { opacity: 1; }

/* slot group container */
.slot-group { cursor: none; transition: transform .4s var(--ease); }
.slot-group.is-filled { /* nothing visual on group, glyph shows */ }
.slot-group.is-filled:hover .slot { stroke-width: 2; }
.slot-priority-arc {
  fill: none;
  stroke: var(--gold);
  stroke-opacity: 0;
  stroke-width: 1.5;
  transition: stroke-opacity .4s var(--ease);
}
.slot-group.is-filled .slot-priority-arc { stroke-opacity: 0.7; }

/* day nodes */
.day-node {
  fill: var(--void-2);
  stroke: var(--bone);
  stroke-opacity: 0.4;
  stroke-width: 1;
  transition: fill .8s var(--ease), stroke .8s var(--ease), r .8s var(--ease);
  cursor: none;
}
.day-node.is-active {
  fill: var(--wax-2);
  stroke: var(--bone);
  stroke-opacity: 0.85;
}
.day-node.is-changed { stroke: var(--gold); stroke-opacity: 1; stroke-width: 1.5; }
.day-label {
  fill: var(--ash-2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.day-label.is-active { fill: var(--bone); }

/* connection lines */
.connections line {
  stroke: var(--bronze);
  stroke-opacity: 0.4;
  stroke-width: 0.8;
  transition: stroke-opacity .6s var(--ease);
}
.connections line.is-pulse {
  stroke: var(--wax-2);
  stroke-opacity: 1;
}

/* saint mark */
.saint-mark { transition: transform .8s var(--ease); }
.saint-halo {
  opacity: 0.4;
  transition: opacity .8s var(--ease);
}
.saint-half {
  fill: #18130c;
  stroke: var(--bronze);
  stroke-width: 0.8;
  stroke-opacity: 0.85;
  transition: transform .9s var(--ease);
}
.saint-core {
  filter: drop-shadow(0 0 12px rgba(168,58,44,.65));
  transition: transform .8s var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}

body[data-phase="running"] .saint-core   { animation: corePulse 1.6s ease-in-out infinite; }
body[data-phase="opened"]  .saint-core   { animation: corePulse 2.2s ease-in-out infinite; }
body[data-phase="opened"]  .saint-halo   { opacity: 0.95; }
body[data-phase="opened"]  .saint-half--top { transform: translateY(-26px); }
body[data-phase="opened"]  .saint-half--bot { transform: translateY( 26px); }

@keyframes corePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* particle dots */
.particle {
  fill: var(--bone);
  fill-opacity: 0.16;
}

/* slot priority dots (HTML overlay) */
.slot-overlay-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bone-2);
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  background: rgba(10, 9, 7, 0.7);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-bronze);
}

/* ============== ledger ============== */
.ledger-stream {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex; flex-direction: column;
  gap: 0;
}
.ledger-empty {
  padding: 40px 0;
  text-align: left;
}
.ledger-empty p {
  margin: 0 0 8px;
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  color: var(--ash-2);
}
.ledger-empty-sub { font-size: 13px !important; color: var(--ash) !important; }

.ledger-entry {
  position: relative;
  padding: 18px 0 22px 36px;
  border-bottom: 1px solid var(--line-2);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  cursor: none;
}
.ledger-entry.is-revealed { opacity: 1; transform: none; }
.ledger-entry::before {
  content: "";
  position: absolute;
  left: 0; top: 22px;
  width: 26px; height: 26px;
  border: 1px solid var(--bronze);
  border-radius: 50%;
  background: var(--void);
  transition: background .4s var(--ease), border-color .4s var(--ease);
}
.ledger-entry::after {
  content: attr(data-day);
  position: absolute;
  left: 0; top: 22px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-style: italic;
  font-size: 12px;
  color: var(--bronze);
  pointer-events: none;
}
.ledger-entry.is-triggered::before {
  background: var(--wax-deep);
  border-color: var(--wax-2);
}
.ledger-entry.is-triggered::after { color: var(--bone); }

.le-day {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 4px;
}
.le-action {
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
  line-height: 1.3;
  color: var(--bone);
  margin: 0 0 10px;
  letter-spacing: -.005em;
}
.le-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.le-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(236, 228, 204, .04);
  color: var(--ash-2);
  border: 1px solid var(--line);
}
.le-tag--seal { color: var(--wax-2); border-color: var(--wax-2); }
.le-tag--unchecked { color: var(--ash); border-color: var(--ash); }
.le-cost {
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  color: var(--ash-2);
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 1px solid var(--wax);
}
.le-cost b {
  font-weight: 400;
  font-style: normal;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--wax-2);
  display: block;
  margin-bottom: 2px;
}
.ledger-entry:hover { background: rgba(168, 58, 44, .03); }

/* ============== drag ghost ============== */
.drag-ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s var(--ease);
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--bone);
  padding: 8px 12px 8px 30px;
  background: rgba(15, 12, 9, 0.92);
  border: 1px solid var(--bronze);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 6px 30px rgba(0,0,0,.4);
}
.drag-ghost.is-active { opacity: 1; }
.drag-ghost::before {
  content: attr(data-glyph);
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--wax-2);
  font-size: 16px;
}

/* ============== seal tooltip ============== */
.seal-tooltip {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  max-width: 260px;
  padding: 14px 16px;
  background: rgba(10, 8, 6, 0.96);
  border: 1px solid var(--bronze);
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.45;
  color: var(--bone-2);
  opacity: 0;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  transform: translateY(6px);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.seal-tooltip.is-visible { opacity: 1; transform: none; }
.seal-tooltip h5 {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  color: var(--bone);
  margin: 0 0 4px;
}
.seal-tooltip .tip-oath {
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  color: var(--gold);
  margin: 0 0 12px;
}
.seal-tooltip dl { margin: 0; padding: 0; display: grid; gap: 6px; }
.seal-tooltip dt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ash);
  margin: 0;
}
.seal-tooltip dd { margin: 0; font-size: 13px; color: var(--bone-2); }

/* ============== modal ============== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 4, 2, 0.78);
  backdrop-filter: blur(6px);
  cursor: none;
}
.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--void-1);
  border: 1px solid var(--bronze);
  padding: 36px 40px 40px;
  animation: modalIn .5s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.modal-card .m-day {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
}
.modal-card h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--bone);
  letter-spacing: -.005em;
}
.modal-card .m-prompt {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  color: var(--ash-2);
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.modal-card .m-action {
  font-size: 18px;
  line-height: 1.5;
  color: var(--bone);
  margin: 0 0 8px;
}
.modal-card .m-reason {
  font-family: var(--display);
  font-style: italic;
  font-size: 15px;
  color: var(--ash-2);
  margin: 0 0 24px;
}
.modal-card dl {
  margin: 0; padding: 0;
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.modal-card dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 6px;
}
.modal-card dd {
  margin: 0; font-size: 15px; color: var(--bone-2);
  font-family: var(--body);
  line-height: 1.5;
}
.modal-card .m-trigger {
  display: inline-block;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--wax-2);
  color: var(--wax-2);
  border-radius: 999px;
}
.modal-card .m-trigger.is-unchecked { color: var(--ash); border-color: var(--ash); }
.modal-card .m-close {
  position: absolute;
  top: 16px; right: 18px;
  background: transparent;
  border: 0;
  color: var(--ash);
  font-family: var(--mono);
  font-size: 18px;
  cursor: none;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.modal-card .m-close:hover { color: var(--wax-2); }

/* ============== autopsy ============== */
.autopsy-section,
.compare-section,
.about-section {
  position: relative;
  z-index: 10;
  padding: 14vh 7vw;
  border-top: 1px solid var(--line);
}
.autopsy-section { animation: rise 1.4s var(--ease) both; }
.compare-section { animation: rise 1.4s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
.autopsy-inner, .compare-inner, .about-inner {
  max-width: 1280px;
  margin: 0 auto;
}
.autopsy-prelude, .compare-prelude {
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
  color: var(--ash-2);
  margin: 16px 0 56px;
}
.autopsy-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  align-items: stretch;
}
.autopsy-side, .autopsy-center {
  padding: 48px 36px;
  border-right: 1px solid var(--line);
}
.autopsy-side:last-child { border-right: 0; }
.autopsy-side h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 24px;
}
.autopsy-side p { margin: 0 0 14px; font-size: 16px; line-height: 1.55; color: var(--bone-2); }
.autopsy-side strong {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--bone);
  display: block;
}
.autopsy-seal {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line-bronze);
  border-radius: 999px;
  margin: 4px 6px 4px 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
}
.autopsy-seal-glyph { color: var(--wax-2); font-size: 16px; }
.autopsy-center {
  text-align: center;
  background: rgba(138, 106, 58, .03);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 360px;
}
.autopsy-action {
  margin-top: 32px;
}
.autopsy-add-prompt {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  margin: 0 0 16px;
  color: var(--bone);
}
.autopsy-add-options {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.autopsy-add-options .seal {
  background: transparent;
  flex-direction: row; align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  min-width: 0;
}
.autopsy-add-options .seal-glyph {
  margin: 0;
  font-size: 14px;
}
.autopsy-add-options .seal.is-chosen {
  border-color: var(--wax-2);
  background: rgba(168, 58, 44, .08);
}
.autopsy-add-options .seal-name { font-size: 13px; }
.autopsy-rerun {
  margin-top: 24px;
  display: flex; gap: 14px; justify-content: center;
}

.autopsy-missing {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 12px;
  padding-left: 16px;
  border-left: 1px solid var(--wax-2);
}
.autopsy-missing strong {
  display: inline; color: var(--wax-2); font-size: inherit; font-weight: 400;
}

/* ============== compare ============== */
.compare {
  border: 1px solid var(--line);
}
.compare-summary {
  padding: 36px 40px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 32px);
  color: var(--bone);
  letter-spacing: -.005em;
}
.compare-summary strong { color: var(--wax-2); font-weight: 400; font-style: italic; }
.compare-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
  color: var(--gold);
}
.compare-table-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
}
.compare-table th, .compare-table td {
  padding: 18px 20px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.compare-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  font-weight: 400;
  border-bottom: 1px solid var(--line-3);
}
.compare-table tr:last-child td { border-bottom: 0; }
.cmp-num {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ash-2);
  width: 56px;
}
.cmp-prompt {
  font-family: var(--display);
  font-style: italic;
  color: var(--bone-2);
  font-size: 15px;
  max-width: 26ch;
  line-height: 1.35;
}
.cmp-cell p {
  margin: 0 0 6px;
  color: var(--bone);
  line-height: 1.5;
}
.cmp-cell small {
  font-family: var(--display);
  font-style: italic;
  color: var(--ash-2);
  font-size: 13px;
}
.cmp-cell--after { background: rgba(168, 58, 44, .04); }
.cmp-row--changed .cmp-cell--after {
  background: rgba(168, 58, 44, .08);
  position: relative;
}
.cmp-row--changed .cmp-cell--after::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--wax-2);
}
.cmp-row--changed .cmp-num { color: var(--wax-2); }
.cmp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-left: 12px;
  padding: 3px 10px;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 999px;
}

.compare-deltas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}
.cmp-delta {
  padding: 28px 32px;
  border-right: 1px solid var(--line);
}
.cmp-delta:last-child { border-right: 0; }
.cmp-delta h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: 0 0 18px;
  color: var(--ash-2);
}
.cmp-delta--good h4 { color: var(--moss-2); }
.cmp-delta--cost h4 { color: var(--wax-2); }
.cmp-delta ul { margin: 0; padding: 0; list-style: none; }
.cmp-delta li {
  padding: 10px 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  color: var(--bone);
  border-bottom: 1px solid var(--line-2);
}
.cmp-delta li:last-child { border-bottom: 0; }
.compare-coda {
  padding: 56px 32px;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(20px, 2vw, 26px);
  color: var(--ash-2);
  border-top: 1px solid var(--line);
}

/* ============== about ============== */
.about-section { padding-bottom: 18vh; }
.about-pre {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ash-2);
  margin: 0 0 18px;
}
.about-h {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -.012em;
  margin: 0 0 36px;
  color: var(--bone);
  max-width: 18ch;
}
.about-h em { color: var(--wax-2); font-style: italic; }
.about-inner p {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--bone-2);
  margin: 0 0 22px;
  max-width: 56ch;
}
.about-inner em {
  font-style: italic;
  color: var(--wax-2);
  font-family: var(--display);
}

/* ============== responsive ============== */
@media (max-width: 1180px) {
  .chamber {
    grid-template-columns: 1fr;
  }
  .zone--config, .zone--ledger {
    height: auto;
    border-right: 0; border-left: 0;
    border-bottom: 1px solid var(--line);
    overflow-y: visible;
  }
  .zone--machine {
    position: relative;
    top: 0;
    height: auto;
    min-height: 80vh;
    padding: 32px 24px 64px;
    border-bottom: 1px solid var(--line);
  }
  .head-state { font-size: 11px; }
}
@media (max-width: 760px) {
  .page-head { top: 14px; left: 16px; right: 16px; flex-wrap: wrap; gap: 8px; }
  .head-state { font-size: 11px; }
  .zone { padding: 22px 18px 48px; }
  .machine { max-width: 92vw; max-height: 92vw; }
  .seal-tray { grid-template-columns: repeat(2, 1fr); }
  .autopsy-grid { grid-template-columns: 1fr; }
  .autopsy-side, .autopsy-center { border-right: 0; border-bottom: 1px solid var(--line); }
  .autopsy-grid > :last-child { border-bottom: 0; }
  .compare-table th, .compare-table td { padding: 12px 10px; font-size: 12px; }
  .cmp-prompt { max-width: 14ch; }
  .audio-toggle { right: 16px; bottom: 16px; }
  .modal-card { padding: 28px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .2s !important;
  }
  .ledger-entry { opacity: 1; transform: none; }
}
