:root {
  --paper: #e6e8e3;
  --paper-2: #d9dcd5;
  --ink: #16181a;
  --muted: #555b57;
  --red: #c4321f;
  --stone: #9aa09a;
  --line: rgba(22, 24, 26, .18);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Archivo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --paper: #15171a; --paper-2: #1e2125; --ink: #e4e6e1; --muted: #9ba19c; --red: #e0533d; --stone: #3d423f; --line: rgba(228, 230, 225, .16); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 500 16px/1.55 var(--mono); }
body::after { /* paper grain on a fixed layer only */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 30; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .bar, .foot { max-width: 1240px; margin: 0 auto; padding-inline: 24px; }
h1, h2, h3 { text-wrap: balance; font-family: var(--sans); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }
.muted { color: var(--muted); }

/* bar */
.bar { display: flex; align-items: center; gap: 16px; height: 68px; border-bottom: 2px solid var(--ink); }
.mark { font-family: var(--sans); font-weight: 800; font-size: 1.2rem; color: inherit; text-decoration: none; text-transform: uppercase; }
.ca { margin: 0 0 0 auto; font-size: .82rem; color: var(--muted); }
.ca code { color: var(--ink); }
.ca button { font: inherit; background: none; border: 1px solid var(--ink); color: var(--ink); padding: 2px 8px; cursor: pointer; }

/* buttons: all sharp corners */
.btn { font: 700 .95rem var(--mono); background: var(--ink); color: var(--paper); border: 2px solid var(--ink); padding: 12px 20px; cursor: pointer; white-space: nowrap; transition: transform .15s; }
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 40; background: var(--ink); color: var(--paper); padding: 8px 12px; }
.stats dd, .tally strong, .md, .living span { font-variant-numeric: tabular-nums; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn:focus-visible, input:focus-visible, .link:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding: 64px 0 56px; }
.sub { max-width: 46ch; color: var(--muted); margin: 0 0 28px; }
.form label { display: block; font-weight: 700; margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; font: 500 .95rem var(--mono); padding: 12px 14px; background: var(--paper-2); color: var(--ink); border: 2px solid var(--ink); }
.row input::placeholder { color: var(--muted); }
.error { color: var(--red); min-height: 1.4em; margin: 8px 0 0; font-weight: 700; }
.hint { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.hero-card { margin: 0; transform: rotate(1.2deg); }
.hero-card canvas, .share canvas { width: 100%; height: auto; display: block; box-shadow: 0 18px 40px rgba(22, 24, 26, .22); }
.hero-card.swap canvas { animation: swap .5s cubic-bezier(.16,1,.3,1) backwards; }
@keyframes swap { from { opacity: 0; transform: translateY(10px) rotate(-1deg); } }
.sound { font-size: .82rem; white-space: nowrap; }
.hero-card figcaption { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* report */
.report { border-top: 2px solid var(--ink); padding: 40px 0; }
.log { list-style: none; margin: 0 0 32px; padding: 16px; background: #16181a; color: #e6e8e3; border: 2px solid var(--ink); font-size: .85rem; max-height: 220px; overflow: auto; }
.log li { padding: 2px 0; animation: in .25s ease-out both; }
.log .t { opacity: .55; }
.log .dead { color: #ff8a73; }
.log .done { color: #b6e3a8; }
.log .error { color: #ffb4a6; font-weight: 700; }
.loading .log::after { content: "_"; animation: blink 1s steps(1) infinite; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }
@keyframes blink { 50% { opacity: 0; } }

.verdict { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: start; margin-bottom: 32px; }
.grade { font: 800 9rem/0.9 var(--sans); color: var(--red); border: 6px solid var(--red); padding: 8px 28px 16px; transform: rotate(-4deg); }
.grade.slam { animation: slam .5s cubic-bezier(.2,1.6,.4,1) backwards; }
@keyframes slam { 0% { opacity: 0; transform: rotate(-4deg) scale(2.4); } 100% { opacity: 1; transform: rotate(-4deg) scale(1); } }
.roasts { margin: 12px 0 0; padding-left: 1.2em; }
.roasts li { margin-bottom: 6px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 40px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.stats div { padding: 16px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.stats dd { margin: 4px 0 0; font: 800 1.6rem var(--sans); overflow-wrap: anywhere; }

.split { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; margin-bottom: 40px; }
.graveyard { padding-top: 16px; background: radial-gradient(120% 60% at 50% 100%, var(--paper-2), transparent 70%);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.stone { font: inherit; border: 0; cursor: pointer; animation: rise .45s cubic-bezier(.16,1,.3,1) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.stone:hover { transform: translateY(-3px); }
.stone:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.stone { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 6px 12px; background: var(--stone); color: var(--ink); border-radius: 52px 52px 0 0; text-decoration: none; min-height: 126px; transition: transform .2s; }
.stone .rip { font-size: .72rem; font-weight: 800; letter-spacing: .1em; }
.stone strong { font-size: .85rem; margin: 6px 0 4px; overflow-wrap: anywhere; }
.stone .cause { font-size: .66rem; opacity: .8; }
.empty { color: var(--muted); }
.living { list-style: none; margin: 0; padding: 0; }
.living li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.living li .muted { grid-column: 1 / -1; font-size: .78rem; }
.living li.dying strong::after { content: " (dying)"; font-weight: 500; color: var(--muted); }

.share { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* live morgue board */
.morgue { border-top: 2px solid var(--ink); padding: 48px 0; }
.morgue-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 24px; }
.morgue-head h2 { margin: 0; }
.tally { margin: 0; color: var(--muted); }
.tally strong { color: var(--red); font: 800 1.5rem var(--sans); }
.morgue-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; }
.cases { list-style: none; margin: 0; padding: 0; }
.cases a { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.cases a:hover .mt { text-decoration: underline; }
.cases a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.mg { font: 800 1.4rem var(--sans); width: 2.2rem; text-align: center; border: 2px solid currentColor; }
.mg[data-grade="F"], .mg[data-grade="D"] { color: var(--red); }
.mt { display: flex; flex-direction: column; font-weight: 700; min-width: 0; }
.mt small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.md { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.ranked { counter-reset: r; }
.ranked a::before { counter-increment: r; content: counter(r); font: 800 1rem var(--sans); color: var(--muted); }
.ranked a { grid-template-columns: 1.2rem auto 1fr auto; }

/* death certificate */
.cert, .wallets { overscroll-behavior: contain; }
.cert { border: 2px solid var(--ink); background: var(--paper); color: var(--ink); padding: 32px; width: min(520px, calc(100vw - 32px)); }
.cert::backdrop { background: rgba(22, 24, 26, .6); }
.cert .close { position: absolute; top: 12px; right: 12px; font: 700 .8rem var(--mono); background: none; border: 1px solid var(--ink); color: var(--ink); padding: 4px 10px; cursor: pointer; }
.cert-kicker { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--red); margin: 0 0 8px; }
.cert h3 { font-size: 2.4rem; margin: 0; }
.epitaph { font-style: italic; margin: 16px 0; }
.cert dl { margin: 0 0 24px; border-top: 2px solid var(--ink); }
.cert dl div { display: grid; grid-template-columns: 9rem 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cert dt { color: var(--muted); font-size: .85rem; }
.cert dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-actions a { text-decoration: none; }

/* heart monitor: a hospital screen, dark in both themes */
.monitor { margin-bottom: 8px; padding: 20px 24px 16px; background: #0e1110; color: #d9e6dc; border: 2px solid var(--ink); }
.mon-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.mon-head h2 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin: 0; }
.mon-bpm { margin: 0; font: 800 2.4rem/1 var(--sans); color: #6fe39a; font-variant-numeric: tabular-nums; }
.mon-bpm small { font: 700 .8rem var(--mono); color: #8a9a8e; }
#ekg { display: block; width: 100%; height: 140px; margin: 12px 0; }
.mon-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; align-items: baseline; }
.mon-status { margin: 0; font-weight: 700; color: #6fe39a; }
.monitor.flat .mon-status, .monitor.flat .mon-bpm { color: #ff6b57; }
.monitor.flat { animation: alarm 1.2s steps(1) infinite; }
@keyframes alarm { 50% { border-color: #ff6b57; } }
.mon-log { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; font-size: .78rem; font-variant-numeric: tabular-nums; }
.mon-log .buy { color: #6fe39a; }
.mon-log .sell { color: #ff6b57; }
.mon-rules { margin: 12px 0 0; font-size: .78rem; color: #8a9a8e; }
@media (prefers-reduced-motion: reduce) { #ekg { display: none; } }

/* fund entry inside the report */
.enter { margin-top: 40px; padding: 24px; border: 2px dashed var(--ink); }
.enter h3 { margin-bottom: 8px; }
.enter label { display: block; font-weight: 700; margin: 12px 0 8px; font-size: .9rem; }
.enter-msg { margin: 12px 0 0; font-weight: 700; }
.enter-msg:empty { display: none; }

/* funeral fund + holders' cemetery */
.fund, .cemetery { border-top: 2px solid var(--ink); padding: 48px 0; }
.fund-rules { margin: 0 0 32px; padding-left: 1.2em; max-width: 80ch; color: var(--muted); }
.fund-rules li { margin-bottom: 4px; }
.sub-h { margin-top: 28px; font-size: 1rem; }
.cases li.plain { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cases li.plain a.md { color: var(--ink); }
.cases li.muted { padding: 10px 0; }
.ranked li.muted::before { content: none; }
.small { font-size: .82rem; }
.small a { color: inherit; }
.tomb { cursor: default; }
.tomb.t1 { min-height: 126px; }
.tomb.t2 { min-height: 150px; }
.tomb.t3 { min-height: 178px; border-top: 4px solid var(--ink); }
.tomb.s1 { background: #a7aca3; }
.tomb.s2 { background: #8d948f; }
@media (prefers-color-scheme: dark) { .tomb.s1 { background: #474d49; } .tomb.s2 { background: #343936; } }
.tomb .cause { font-style: italic; overflow-wrap: anywhere; }
.tomb:hover { transform: none; }

.rules { border-top: 2px solid var(--ink); padding: 40px 0 56px; max-width: 72ch; }
.rules p { color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding-block: 24px; font-size: .8rem; color: var(--muted); }

.wallets { border: 2px solid var(--ink); background: var(--paper); color: var(--ink); padding: 24px; min-width: 280px; }
.wallets::backdrop { background: rgba(22, 24, 26, .5); }
.wallets ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.wallets li button { width: 100%; display: flex; gap: 10px; align-items: center; font: 700 1rem var(--mono); padding: 10px; background: var(--paper-2); color: var(--ink); border: 2px solid var(--ink); cursor: pointer; }

@media (max-width: 860px) {
  .hero, .split, .share, .morgue-cols { grid-template-columns: 1fr; }
  .mon-log { display: none; }
  .hero { padding-top: 40px; gap: 32px; }
  .hero-card { transform: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(3) { border-left: 0; }
  .verdict { grid-template-columns: 1fr; }
  .grade { justify-self: start; font-size: 6rem; }
  .ca { display: none; }
}
@media (max-width: 520px) {
  main, .bar, .foot { padding-inline: 16px; }
  .row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
#f-entries a { grid-template-columns: 1.2rem 1fr auto; }
#tombs { align-items: end; }
.mon-stats { margin: 6px 0 0; font-size: .8rem; color: #8a9a8e; font-variant-numeric: tabular-nums; }
.ulog { margin: 0; max-height: 260px; }
.control { margin-top: 32px; padding: 20px 24px; border: 2px solid var(--ink); max-width: 80ch; }
.control h3 { margin-bottom: 8px; }
.control ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.control li { margin-bottom: 4px; }
.graveyard .empty { grid-column: 1 / -1; }

/* ---------- v11 look: engraving window, serif display, slow reveals (after humaninternetproject) ---------- */
:root { --serif: "Instrument Serif", Georgia, serif; --ease: cubic-bezier(.16, 1, .3, 1); }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.025em; line-height: .95; }
h1 { font-size: clamp(3.2rem, 7.4vw, 6.6rem); }
h2 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); }
h1 em, h2 em { font-style: italic; }
.monitor h2, .verdict h2 { font-family: var(--sans); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }

/* header: mono label row with a live clock */
.bar { border-bottom: 1px solid var(--ink); }
.mark { font-family: var(--mono); font-weight: 700; font-size: .9rem; letter-spacing: .08em; }
.star { display: inline-block; animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.clock { margin: 0 0 0 auto; font-size: .78rem; letter-spacing: .12em; color: var(--muted); font-variant-numeric: tabular-nums; }
.ca { margin-left: 0; }

/* headline lines rise out of a mask, one after another */
.rise > span { display: block; overflow: hidden; padding-bottom: .06em; }
.rise > span > span { display: inline-block; animation: rise-in 1.1s var(--ease) backwards; }
.rise > span:nth-child(2) > span { animation-delay: .12s; }
.rise > span:nth-child(3) > span { animation-delay: .24s; }
@keyframes rise-in { from { transform: translateY(105%); } }
.hero-copy .sub, .hero-copy .form { animation: fade-up .9s var(--ease) .45s backwards; }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } }

/* the arched window */
.hero-art { position: relative; padding-bottom: 30%; }
.arch { width: min(72%, 400px); aspect-ratio: 3 / 4; margin: 0 4% 0 auto; padding: 7px; border: 1.5px solid var(--ink); border-radius: 999px 999px 2px 2px; position: relative; animation: fade-up 1.2s var(--ease) .1s backwards; }
.arch::before, .arch::after { content: "✦"; position: absolute; left: 50%; transform: translateX(-50%); font-size: 1.6rem; line-height: 1; background: var(--paper); padding: 0 6px; }
.arch::before { top: -.9rem; }
.arch::after { bottom: -.9rem; }
#stipple { display: block; width: 100%; height: 100%; border-radius: 999px 999px 0 0; border: 1px solid var(--ink); }
.hero-art .hero-card { position: absolute; left: 0; bottom: 0; width: 66%; transform: rotate(-2.2deg); animation: card-in 1.2s var(--ease) .55s backwards; }
@keyframes card-in { from { opacity: 0; transform: translateY(40px) rotate(-6deg); } }
.hero-art .hero-card.swap canvas { animation: swap .5s var(--ease) backwards; }

/* sections ease in as they scroll into view */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* calmer, smoother interactions */
.btn { transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.cases a, .living li { transition: padding-left .3s var(--ease); }
.cases a:hover { padding-left: 6px; }
.stone { transition: transform .35s var(--ease); }
.row input { transition: border-color .2s, box-shadow .2s; }
.row input:focus { outline: none; box-shadow: 0 0 0 4px rgba(196, 50, 31, .18); }

@media (max-width: 860px) {
  .clock { display: none; }
  .hero-art { padding-bottom: 30%; }
  .arch { width: 70%; margin: 0 auto; }
  .hero-art .hero-card { width: 92%; left: 4%; }
}
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } .star { animation: none; } }
.mark { white-space: nowrap; }
@media (max-width: 520px) { .xlink { display: none; } }
@media (max-width: 520px) { .mark { font-size: .78rem; letter-spacing: .04em; } .bar { gap: 12px; } }
@media (max-width: 520px) { .bar .btn { padding: 8px 10px; font-size: .78rem; } .bar .sound { font-size: .74rem; } .bar { gap: 10px; } }
