/* Rugyard v2 — layout: a moonlit cemetery that doubles as a coroner's office.
   Single dark theme by design: night ground, weathered stone, bone text,
   candle amber for the ritual, spirit teal for anything that rises, blood for deaths. */
:root {
  --night: #0c0e14;
  --night-2: #12151d;
  --night-3: #181c26;
  --stone: #2c313b;
  --stone-hi: #3e4450;
  --stone-lo: #1c2028;
  --line: #242833;
  --line-2: #323845;
  --bone: #ece6d9;
  --bone-2: #d3ccbd;
  --ash: #8e929c;
  --dust: #5e636e;
  --candle: #eaa53e;
  --candle-hi: #f7c56c;
  --spirit: #78d6c2;
  --spirit-dim: rgba(120, 214, 194, .16);
  --blood: #d0493f;
  --moss: #4f6a43;
  --font-display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --font-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 6px;
  --wrap: 1280px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--bone); background: var(--night); font-family: var(--font-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--candle); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); font-weight: 400; text-wrap: balance; margin: 0; }
.muted { color: var(--ash); }
.small { font-size: 13px; }
.up { color: var(--spirit); }
.down { color: var(--blood); }
.eyebrow { font-family: var(--font-sc); color: var(--candle); letter-spacing: .14em; font-size: 14px; margin: 0; }
.lede { color: var(--ash); max-width: 62ch; margin: 10px 0 0; font-size: 16px; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 3.4vw, 36px); margin: 2px 0 0; line-height: 1.1; }
.page-title { font-size: clamp(44px, 7vw, 84px); line-height: .95; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-xl { display: flex; flex-direction: column; gap: 44px; padding-block: 36px 56px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }

/* ---------- header ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: rgba(12,14,20,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: var(--wrap); margin-inline: auto; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.brand-mark { width: 28px; height: 28px; color: var(--bone); }
.brand-name { font-family: var(--font-display); font-size: 25px; letter-spacing: .01em; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; padding: 7px 11px; color: var(--ash); white-space: nowrap; border-radius: var(--r); font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--bone); }
.tab[aria-selected="true"] { color: var(--bone); background: var(--night-3); box-shadow: inset 0 -2px 0 var(--candle); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dust); }
.live-dot[data-on="1"] { background: var(--spirit); box-shadow: 0 0 0 3px rgba(120,214,194,.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(120,214,194,0); } }
.search { display: flex; align-items: center; gap: 6px; background: var(--night-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; width: 230px; flex: none; color: var(--ash); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { background: none; border: 0; outline: none; width: 100%; font-size: 13px; color: var(--bone); padding: 3px 0; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--night-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--ash); flex: none; }
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dust); }
.status-chip[data-state="live"] .dot { background: var(--spirit); }
.status-chip[data-state="demo"] .dot { background: var(--candle); }
.status-chip[data-state="error"] .dot { background: var(--blood); }

.ticker { border-top: 1px solid var(--line); overflow: hidden; height: 30px; position: relative; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: inline-flex; gap: 38px; white-space: nowrap; align-items: center; height: 30px; animation: tick 160s linear infinite; padding-left: 24px; font-size: 12px; color: var(--ash); }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }
.tk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; background: none; border: 0; padding: 0; color: inherit; font-size: 12px; }
.tk b { color: var(--bone); font-weight: 600; }
.tk i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.tk .rip { font-family: var(--font-sc); color: var(--dust); letter-spacing: .12em; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: radial-gradient(ellipse 70% 80% at 75% 0%, #1d2230 0%, var(--night) 70%); }
.hero-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px; align-items: center; padding-block: 56px 72px; }
.hero-copy { display: flex; flex-direction: column; gap: 18px; min-width: 0; z-index: 2; }
.hero-title { font-size: clamp(46px, 6.6vw, 96px); line-height: .94; letter-spacing: -.01em; }
.hero-title em { color: var(--spirit); text-shadow: 0 0 32px rgba(120,214,194,.35); }
.hero-mascot { margin: 0; position: relative; justify-self: end; width: min(440px, 100%); aspect-ratio: 1; z-index: 1; }
.hero-mascot img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%); -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%); animation: bob 6s ease-in-out infinite; }
.hero-mascot::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; box-shadow: 0 0 120px 30px rgba(120,214,194,.13); pointer-events: none; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.hero-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(180deg, transparent, var(--night)); }
.death-clock { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-left: 2px solid var(--blood); background: linear-gradient(90deg, rgba(208,73,63,.08), transparent); max-width: 520px; }
.dc-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dc-n { font-family: var(--font-display); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.dc-k { color: var(--bone-2); font-size: 14px; }
.dc-sub { color: var(--ash); font-size: 13px; }
.dc-last { color: var(--ash); font-size: 13px; min-height: 1.4em; }
.dc-last b { color: var(--bone); }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.ghost-btn, .candle-btn, .spirit-btn { border-radius: var(--r); padding: 9px 15px; font-weight: 600; font-size: 14px; border: 1px solid var(--stone-hi); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.ghost-btn { background: transparent; color: var(--bone-2); }
.ghost-btn:hover { color: var(--bone); border-color: var(--ash); }
.candle-btn { background: var(--candle); border-color: var(--candle); color: #1a1206; }
.candle-btn:hover { background: var(--candle-hi); }
.spirit-btn { background: transparent; border-color: rgba(120,214,194,.5); color: var(--spirit); }
.spirit-btn:hover { background: var(--spirit-dim); }
.spirit-btn[aria-pressed="true"] { background: var(--spirit); color: #0b1a17; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- counters ---------- */
.counters { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: -8px; }
.counter { background: var(--night-2); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.counter-v { font-family: var(--font-display); font-size: clamp(30px, 3.6vw, 44px); line-height: 1; font-variant-numeric: tabular-nums; }
.counter-k { color: var(--ash); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.counter-s { color: var(--dust); font-size: 12px; }
.counter.alive .counter-v { color: var(--spirit); }
.counter.dead .counter-v { color: var(--bone); }

/* ---------- obituaries ---------- */
.obits { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.obit { background: linear-gradient(180deg, var(--night-3), var(--night-2)); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; overflow: hidden; }
.obit-label { font-family: var(--font-sc); font-size: 12px; letter-spacing: .14em; }
.obit-top { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 12px; align-items: center; }
.obit-top img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; filter: grayscale(1) contrast(1.05); border: 2px solid var(--stone); }
.obit-name { font-family: var(--font-display); font-size: 26px; line-height: 1.05; overflow-wrap: anywhere; }
.obit-story { color: var(--bone-2); font-size: 14px; margin: 0; }
.obit-epitaph { font-family: var(--font-display); font-style: italic; font-size: 18px; color: var(--bone); margin: 0; }
.obit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.obit-actions button { padding: 7px 12px; font-size: 13px; }

.ritual-banner { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 18px 22px; border: 1px solid rgba(234,165,62,.35); border-radius: 10px; background: radial-gradient(ellipse at 0% 50%, rgba(234,165,62,.13), transparent 60%), var(--night-2); }
.rb-flame { width: 30px; height: 44px; }
.rb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rb-title { font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.rb-sub { color: var(--ash); font-size: 14px; }
.flame { transform-origin: 50% 100%; animation: flicker 2.6s ease-in-out infinite; }
@keyframes flicker { 25% { transform: scale(1, .94) skewX(2deg); } 50% { transform: scale(.96, 1.04) skewX(-2deg); } 75% { transform: scale(1.02, .97); } }

/* ---------- yard ---------- */
.sort { display: inline-flex; align-items: center; gap: 8px; color: var(--ash); font-size: 13px; }
.sort select, .field input, .field select, .field textarea, .tool-form input { background: var(--stone-lo); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 10px; color: var(--bone); }
.cause-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cause-chip { background: transparent; border: 1px solid var(--line-2); color: var(--ash); border-radius: 999px; padding: 4px 11px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.cause-chip:hover { color: var(--bone); }
.cause-chip[aria-pressed="true"] { color: var(--bone); border-color: var(--bone); background: var(--night-3); }
.cause-chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.yard { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 30px 16px; align-items: end; padding: 10px 4px 26px; background: linear-gradient(180deg, transparent calc(100% - 26px), rgba(79,106,67,.12) calc(100% - 26px)); }
.plot { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.grave {
  position: relative; text-align: center; cursor: pointer; border: 0; color: var(--bone); font: inherit;
  padding: 30px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  background: linear-gradient(170deg, var(--stone-hi) 0%, var(--stone) 42%, var(--stone-lo) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -14px 22px rgba(0,0,0,.28), 0 14px 22px -6px rgba(0,0,0,.6);
  transition: transform .2s ease, box-shadow .2s ease;
  isolation: isolate;
}
.grave::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); pointer-events: none; z-index: -1; clip-path: inherit; }
.grave:hover { transform: translateY(-4px); box-shadow: inset 0 1px 0 rgba(255,255,255,.09), inset 0 -14px 22px rgba(0,0,0,.28), 0 20px 30px -8px rgba(0,0,0,.7), 0 0 0 1px rgba(120,214,194,.25); }
.shape-arch { border-radius: 48% 48% 6px 6px / 24% 24% 6px 6px; }
.shape-slab { border-radius: 10px 10px 4px 4px; padding-top: 22px; }
.shape-gothic { clip-path: polygon(0 18%, 50% 0, 100% 18%, 100% 100%, 0 100%); padding-top: 40px; border-radius: 0 0 6px 6px; }
.shape-cross { border-radius: 48% 48% 6px 6px / 24% 24% 6px 6px; margin-top: 30px; }
.shape-cross::after { content: ""; position: absolute; left: 50%; top: -34px; width: 10px; height: 40px; transform: translateX(-50%); background: linear-gradient(90deg, var(--stone-hi), var(--stone)); border-radius: 2px; box-shadow: -14px 12px 0 -1px transparent; }
.cross-bar { position: absolute; left: 50%; top: -24px; width: 32px; height: 9px; transform: translateX(-50%); background: linear-gradient(180deg, var(--stone-hi), var(--stone)); border-radius: 2px; }
.tier-2 { min-height: 300px; }
.tier-3 { min-height: 336px; }
.tier-3 .g-name { font-size: 24px; }
.grave .rip { font-family: var(--font-sc); letter-spacing: .32em; font-size: 12px; color: var(--ash); }
.grave img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; filter: grayscale(1) contrast(1.05) brightness(.88); border: 2px solid var(--stone-lo); box-shadow: 0 0 0 1px rgba(255,255,255,.05); }
.g-name { font-family: var(--font-display); font-size: 21px; line-height: 1.1; text-shadow: 0 1px 0 rgba(0,0,0,.65), 0 -1px 0 rgba(255,255,255,.05); max-width: 100%; overflow-wrap: anywhere; }
.g-tick, .g-dates, .g-peak { font-family: var(--font-mono); font-size: 11px; color: var(--ash); }
.g-cause { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 5px; }
.g-cause i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.g-epitaph { font-family: var(--font-display); font-style: italic; font-size: 15px; color: var(--bone-2); line-height: 1.3; min-height: 2.6em; }
.plot-base { height: 12px; margin: 0 -6px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(79,106,67,.45), transparent 70%); }
.candle-row { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--ash); }
.candle-btn-sm { background: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px 2px 6px; display: inline-flex; align-items: center; gap: 5px; color: var(--ash); font-size: 12px; }
.candle-btn-sm:hover { color: var(--candle); border-color: rgba(234,165,62,.5); }
.candle-btn-sm[data-lit="1"] { color: var(--candle); border-color: rgba(234,165,62,.5); }
.candle-btn-sm svg { width: 10px; height: 16px; }
.candle-glow { position: absolute; left: 50%; bottom: 8px; width: 120px; height: 60px; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(234,165,62,.22), transparent 70%); pointer-events: none; }
.more-row { display: flex; justify-content: center; }
.empty { color: var(--dust); text-align: center; padding: 28px 12px; font-size: 14px; }

/* ---------- ritual ---------- */
.ritual-head { display: grid; grid-template-columns: 150px minmax(0,1fr) auto; gap: 26px; align-items: center; }
.ritual-circle { color: var(--candle); opacity: .75; animation: spin 80s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.countdown { display: flex; gap: 8px; }
.cd-cell { display: flex; flex-direction: column; align-items: center; min-width: 66px; padding: 10px 8px; border: 1px solid rgba(234,165,62,.35); border-radius: var(--r); background: rgba(234,165,62,.06); }
.cd-v { font-family: var(--font-display); font-size: 36px; line-height: 1; color: var(--candle-hi); font-variant-numeric: tabular-nums; }
.cd-k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ash); }
.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cand { background: linear-gradient(180deg, var(--night-3), var(--night-2)); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; }
.cand.leading { border-color: rgba(234,165,62,.55); box-shadow: 0 0 0 1px rgba(234,165,62,.18), 0 0 40px rgba(234,165,62,.07); }
.cand-top { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 12px; align-items: center; }
.cand-top img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; filter: grayscale(.85); }
.cand-name { font-family: var(--font-display); font-size: 26px; line-height: 1.05; overflow-wrap: anywhere; }
.cand-sub { color: var(--ash); font-family: var(--font-mono); font-size: 12px; }
.cand-rank { position: absolute; top: 14px; right: 16px; font-family: var(--font-sc); color: var(--dust); font-size: 13px; }
.life { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: var(--line); border-radius: 4px; overflow: hidden; }
.life div { background: var(--stone-lo); padding: 7px 9px; min-width: 0; }
.life .k, .gc-stats .k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ash); }
.life .v, .gc-stats .v { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.why { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--bone-2); }
.why li::before { content: "✦ "; color: var(--candle); }
.vote-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.spark { width: 100%; height: 46px; display: block; }
.ritual-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.risen-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid rgba(120,214,194,.25); border-radius: var(--r); background: rgba(120,214,194,.04); }
.risen-row img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.how { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.how-step { background: var(--night-2); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.how-n { font-family: var(--font-sc); color: var(--candle); font-size: 18px; }
.how-step h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0; line-height: 1.1; }
.how-step p { margin: 0; color: var(--ash); font-size: 14px; }

/* ---------- morgue ---------- */
.vitals { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vital { background: var(--night-2); padding: 14px 16px; }
.vital .counter-v { font-size: 30px; }
.morgue-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.panel { background: var(--night-2); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0; }
.hint { color: var(--dust); font-size: 12px; }
.intake, .tod { display: flex; flex-direction: column; max-height: 680px; overflow-y: auto; }
.patient { display: grid; grid-template-columns: 38px minmax(0,1fr) 120px 96px; gap: 12px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.patient:last-child { border-bottom: 0; }
.patient img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; }
.p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ash); display: flex; gap: 8px; flex-wrap: wrap; }
.ecg { width: 120px; height: 34px; display: block; }
.prog { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.prog-v { font-family: var(--font-mono); font-size: 14px; }
.prog-k { white-space: nowrap; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ash); }
.tod-row { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tod-row:hover { background: var(--night-3); }
.tod-row .t { font-family: var(--font-mono); font-size: 12px; color: var(--blood); }
.tod-row .e { font-family: var(--font-display); font-style: italic; color: var(--bone-2); font-size: 14px; }
.tod-row.fresh { animation: arrive 1.2s ease-out; }
@keyframes arrive { from { background: rgba(208,73,63,.18); } }

/* ---------- autopsy tools ---------- */
.tools-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; align-items: start; }
.tool-form { display: flex; gap: 8px; padding: 14px 16px; }
.tool-form input { flex: 1; min-width: 0; font-size: 14px; }
.find-results { display: flex; flex-direction: column; max-height: 520px; overflow-y: auto; }
.res-row { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; color: inherit; font: inherit; width: 100%; }
.res-row:hover { background: var(--night-3); }
.res-row img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; filter: grayscale(1); }
.dev-result { padding: 0 16px 16px; }
.report { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 18px; align-items: center; padding: 16px; border-radius: 8px; background: var(--stone-lo); border: 1px solid var(--line-2); }
.grade { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 70px; line-height: 1; border: 3px double currentColor; transform: rotate(-8deg); }
.grade[data-g="A"] { color: var(--spirit); } .grade[data-g="B"] { color: #a8c97f; } .grade[data-g="C"] { color: var(--candle); } .grade[data-g="D"] { color: #e07a3a; } .grade[data-g="F"] { color: var(--blood); } .grade[data-g="?"] { color: var(--ash); }
.report h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0 0 4px; }
.report p { margin: 0; color: var(--ash); font-size: 14px; }
.report-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-family: var(--font-mono); font-size: 13px; }
.records { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.record { background: var(--night-2); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.record h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0; }
.record ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.record li { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; align-items: baseline; }
.record li:hover .rn { color: var(--bone); }
.record .ri { font-family: var(--font-sc); color: var(--dust); }
.record .rn { color: var(--bone-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record .rv { font-family: var(--font-mono); color: var(--ash); }

/* ---------- bury your bag ---------- */
.bury-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.bury-form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.bury-out { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bury-canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--night-2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.epi-row { display: flex; gap: 8px; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.c-card { background: var(--night-2); border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.c-card.wide { grid-column: 1 / -1; }
.c-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 0; line-height: 1.1; }
.c-card p { margin: 0; color: var(--ash); max-width: 66ch; }
.hb { display: flex; flex-direction: column; gap: 7px; }
.hb-row { display: grid; grid-template-columns: 210px minmax(0,1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.hb-k { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-k i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hb-t { height: 14px; background: var(--stone-lo); border-radius: 2px; overflow: hidden; }
.hb-t i { display: block; height: 100%; }
.hb-v { font-family: var(--font-mono); text-align: right; font-size: 12px; }
.chart-box { overflow-x: auto; }
.chart-box svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-box text { fill: var(--ash); font-family: var(--font-mono); font-size: 10px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--dust); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.t td.n { text-align: right; font-family: var(--font-mono); }
table.t tr[data-grave] { cursor: pointer; }
table.t tr[data-grave]:hover td { background: var(--night-3); }

/* ---------- modal / grave detail ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(5,6,10,.76); display: flex; padding: max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.modal-card { margin: auto; background: var(--night-2); border: 1px solid var(--stone-hi); border-radius: 12px; padding: 24px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.grave-card { width: min(760px, 100%); }
.gc-top { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: start; }
.gc-name { font-family: var(--font-display); font-size: 44px; line-height: 1; overflow-wrap: anywhere; }
.gc-epitaph { font-family: var(--font-display); font-style: italic; font-size: 23px; color: var(--bone-2); line-height: 1.3; margin: 0; }
.gc-cause { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--r); background: var(--stone-lo); }
.gc-cause i { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.gc-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border-radius: 4px; overflow: hidden; }
.gc-stats div { background: var(--stone-lo); padding: 8px 10px; min-width: 0; }
.gc-life { width: 100%; height: 130px; display: block; background: var(--stone-lo); border-radius: 4px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { font-size: 13px; color: var(--candle); text-decoration: none; border: 1px solid rgba(234,165,62,.4); border-radius: 4px; padding: 3px 9px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.close-x { background: none; border: 1px solid var(--stone-hi); border-radius: var(--r); width: 36px; height: 36px; color: var(--ash); font-size: 20px; line-height: 1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ash); min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- resurrection kit (v1 styles kept) ---------- */
.res-card { width: min(1000px, 100%); }
.res-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.res-form { display: flex; flex-direction: column; gap: 10px; }
.res-form textarea { resize: vertical; }
.res-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; }
.img-row { display: flex; gap: 8px; flex-wrap: wrap; }
.res-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rs-omen { background: var(--stone-lo); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.rs-omen-top { display: flex; align-items: baseline; gap: 12px; }
.rs-big { font-family: var(--font-display); font-size: 48px; line-height: 1; color: var(--spirit); }
.rs-word { font-family: var(--font-display); font-size: 22px; }
.rs-why { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.rs-why-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.rs-h { font-family: var(--font-display); font-weight: 400; font-size: 20px; margin: 0 0 6px; }
.rs-tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--bone-2); }
.rs-tips .ok { color: var(--spirit); list-style: none; margin-left: -18px; }
.rs-preview { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 12px; align-items: center; background: var(--stone-lo); border-radius: var(--r); padding: 10px; }
.rs-preview img { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.rs-pv-name { font-weight: 600; overflow-wrap: anywhere; }
.rs-pv-desc { overflow-wrap: anywhere; }
.rs-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--bone-2); font-size: 14px; }
label.ghost-btn { cursor: pointer; }

/* ---------- footer, toasts ---------- */
.foot { border-top: 1px solid var(--line); background: var(--night); }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding-block: 20px 26px; color: var(--dust); font-size: 12px; }
.foot-brand { font-family: var(--font-display); font-size: 20px; color: var(--bone-2); }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 6px; z-index: 80; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--night-3); border: 1px solid var(--stone-hi); border-left: 3px solid var(--candle); border-radius: var(--r); padding: 10px 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.toast.good { border-left-color: var(--spirit); }
.toast.bad { border-left-color: var(--blood); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .search { width: 170px; }
  .obits, .records { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .obits > :last-child, .records > :last-child { grid-column: 1 / -1; }
  .how { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; }
  .search { flex: 1; width: auto; }
  .hero-inner { grid-template-columns: minmax(0,1fr); padding-block: 36px 52px; }
  .hero-mascot { justify-self: center; width: min(300px, 80%); order: -1; }
  .counters, .vitals { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .morgue-grid, .tools-grid, .stats-grid, .bury-grid, .res-grid { grid-template-columns: minmax(0,1fr); }
  .ritual-head { grid-template-columns: minmax(0,1fr); }
  .ritual-circle { display: none; }
  .ritual-banner { grid-template-columns: auto minmax(0,1fr); }
  .ritual-banner .candle-btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 600px) {
  .search { display: none; }
  .obits, .records, .how { grid-template-columns: minmax(0,1fr); }
  .obits > :last-child, .records > :last-child { grid-column: auto; }
  .yard { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 26px 10px; }
  .grave { padding: 24px 8px 12px; }
  .g-name { font-size: 18px; }
  .tier-3 .g-name { font-size: 19px; }
  .g-epitaph { font-size: 13px; }
  .tier-2, .tier-3 { min-height: 0; }
  .gc-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .gc-name { font-size: 34px; }
  .hb-row { grid-template-columns: 120px minmax(0,1fr) 52px; }
  .patient { grid-template-columns: 34px minmax(0,1fr) 70px; }
  .patient .ecg { display: none; }
  .cd-cell { min-width: 54px; }
  .cd-v { font-size: 28px; }
  .report { grid-template-columns: minmax(0,1fr); justify-items: start; }
  .grade { width: 96px; height: 96px; font-size: 56px; }
  .two, .res-form .two { grid-template-columns: minmax(0,1fr); }
  .dc-n { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .ticker-track { padding-left: 0; } }

/* ritual wallet + official resurrections */
.ritual-wallet { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; background: var(--night-2); display: grid; gap: 8px; }
.rw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.rw-addr { color: var(--spirit); font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.locked-note { font-size: 12px; color: var(--candle); border: 1px dashed var(--candle); border-radius: var(--r); padding: 7px 10px; }
.official-tag { font-family: var(--font-body, inherit); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--spirit); border: 1px solid var(--spirit); border-radius: 999px; padding: 1px 7px; vertical-align: middle; }
.official-tag.mig { color: var(--candle); border-color: var(--candle); }

/* real chart in the grave modal */
.gc-chart { display: grid; gap: 8px; }
.chart-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-tabs a { margin-left: auto; }
.cause-chip[aria-pressed="true"] { border-color: var(--candle); color: var(--bone); }
.chart-real { position: relative; width: 100%; height: clamp(300px, 48vw, 440px); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #0b0d12; }
.chart-real iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* prelaunch */
.prelaunch-note { border: 1px dashed var(--candle); border-radius: 8px; padding: 12px 16px; color: var(--bone-2); font-size: 14px; background: rgba(234,165,62,.06); }
.prelaunch-note b { color: var(--candle); }
.soon { display: grid; justify-items: end; gap: 2px; border: 1px solid var(--candle); border-radius: 8px; padding: 12px 18px; }
.soon-k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ash); }
.soon-v { font-family: var(--font-display); font-size: 30px; color: var(--candle); line-height: 1.1; }

/* copies spotted */
.copies { margin-top: 6px; font-size: 12px; color: var(--blood); }
.copies summary { cursor: pointer; }
.copies ul { margin: 6px 0 0; padding-left: 16px; color: var(--ash); }
