:root {
  color-scheme: dark;
  --bg: #11110f;
  --panel: #191916;
  --panel-2: #20201c;
  --ink: #f0eadb;
  --muted: #b9b09f;
  --line: #49463e;
  --accent: #e3c76a;
  --accent-2: #9fc9b2;
  --danger: #ffb0a8;
  --max: 76rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(227,199,106,.08), transparent 28rem),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
code { overflow-wrap: anywhere; color: var(--accent-2); }

.skip-link {
  position: fixed;
  z-index: 20;
  top: .75rem;
  left: .75rem;
  transform: translateY(-200%);
  background: var(--ink);
  color: var(--bg);
  padding: .7rem 1rem;
}
.skip-link:focus { transform: translateY(0); }

.masthead, main, footer {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}
.masthead { padding: 5rem 0 3rem; }
.masthead h1 {
  max-width: 12ch;
  margin: .25rem 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .92;
}
.lede {
  max-width: 44rem;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  color: var(--muted);
}
blockquote {
  margin: 2.5rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem 1.2rem;
}
nav a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: .3em; }
nav a:hover, nav a:focus-visible { text-decoration-color: var(--accent); }

.phase-mark, .door-line {
  display: flex;
  gap: .55rem;
  align-items: center;
  height: 2rem;
}
.phase-mark span, .door-line > span, .door-trigger {
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: var(--muted);
  border: 0;
}
.phase-mark .displaced {
  transform: translateY(-.65rem);
  background: var(--accent);
}

.eyebrow, .mini-label {
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
}
.canon-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line);
  margin-bottom: 3rem;
}
.canon-strip p { padding: 1rem; margin: 0; color: var(--muted); }
.canon-strip p + p { border-left: 1px solid var(--line); }
.canon-strip strong { display: block; color: var(--ink); font-size: .72rem; letter-spacing: .13em; }

.panel {
  border-top: 1px solid var(--line);
  padding: 4rem 0;
}
.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 36rem);
  gap: 1.5rem 3rem;
  align-items: end;
  margin-bottom: 2rem;
}
.section-heading .eyebrow { grid-column: 1 / -1; margin: 0; }
.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -.035em;
}
.section-heading > p:last-child { margin: 0; color: var(--muted); }

.stack { display: grid; gap: 1rem; max-width: 54rem; }
label { display: grid; gap: .45rem; }
label > span { font-weight: 650; }
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0d0d0b;
  color: var(--ink);
  padding: .78rem .85rem;
  border-radius: .35rem;
}
textarea:focus, input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: .35rem;
  padding: .8rem;
}
.choice-row { display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
.choice-row label, .check {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
}
.choice-row input, .check input { width: auto; margin-top: .25rem; }
.check span { font-weight: 450; color: var(--muted); }

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: .35rem;
  padding: .72rem 1rem;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: #15130a; border-color: var(--accent); font-weight: 800; }
.notice { color: var(--muted); font-size: .9rem; }
.error {
  border-left: 3px solid var(--danger);
  padding: .7rem .9rem;
  color: var(--danger);
  background: rgba(255,176,168,.07);
}

.result {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .5rem;
}
.result h3 {
  margin: .1rem 0 .8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 500;
}
.instruction { max-width: 55rem; font-size: 1.08rem; }
.witness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
}
.witness-grid > div {
  border-top: 1px solid var(--line);
  padding-top: .6rem;
  min-width: 0;
}
dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
dd { margin: .25rem 0 0; }
.ritual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .75rem;
  margin: 1.5rem 0;
}
.ritual section {
  padding: 1rem;
  background: #12120f;
  border-left: 2px solid var(--line);
}
.ritual h4 { margin: 0 0 .35rem; color: var(--accent); }
.ritual p { margin: 0; color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }

.game-intro {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}
.game-intro p { margin: 0; padding: 1rem; }
.game-intro p + p { border-left: 1px solid var(--line); }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
}
.inline-form label { flex: 1 1 22rem; }
.game-status {
  display: grid;
  grid-template-columns: 8rem 8rem minmax(16rem,1fr);
  gap: 1rem;
  margin: 1.5rem 0 1rem;
  align-items: end;
}
.game-status strong { display: block; font-size: 2rem; }
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(10rem,1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.score-card {
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.score-card strong { display: block; font-size: 2rem; }
.player-actions {
  margin: .75rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
}
.player-actions h4 { margin: 0 0 .7rem; }
.action-row {
  display: grid;
  grid-template-columns: 8rem minmax(10rem,1fr) minmax(10rem,1fr);
  gap: .6rem;
  margin-top: .55rem;
  align-items: center;
}
.compact { padding: 1rem; }

.ledger-list { display: grid; gap: .7rem; margin-bottom: 1rem; }
.ledger-entry {
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
}
.ledger-entry header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.ledger-entry h3 { margin: 0; font-size: 1.1rem; }
.ledger-entry p { color: var(--muted); }
.ledger-entry code { font-size: .76rem; }

.door-panel { min-height: 30rem; }
.door-line {
  justify-content: center;
  gap: 1rem;
  margin: 3rem 0;
  min-height: 5rem;
}
.door-trigger {
  transform: translateY(-1.6rem);
  background: var(--accent);
  cursor: pointer;
  border: 2px solid transparent;
}
.door-trigger:hover { transform: translateY(-1.85rem); }
.door-interior {
  max-width: 50rem;
  margin: 0 auto;
  padding: 1.5rem;
  border: 1px solid var(--accent);
  background: rgba(227,199,106,.04);
}
.revelation {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}
.card-result {
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.card-result h3 { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; margin: .2rem 0; }
.card-result .suit { color: var(--accent); letter-spacing: .12em; font-size: .72rem; font-weight: 800; }

footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 4rem;
}
footer > p:first-child { font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; }

@media (max-width: 760px) {
  .masthead { padding-top: 3rem; }
  .canon-strip, .game-intro, .section-heading, .witness-grid, .ritual, .game-status {
    grid-template-columns: 1fr;
  }
  .canon-strip p + p, .game-intro p + p { border-left: 0; border-top: 1px solid var(--line); }
  .section-heading .eyebrow { grid-column: auto; }
  .action-row { grid-template-columns: 1fr; }
}

@media print {
  body { background: white; color: black; }
  nav, button, footer, .skip-link { display: none !important; }
  .panel, .canon-strip { border-color: #777; }
}
