:root {
  color-scheme: dark;
  --bg: #0d0d0b;
  --paper: #171611;
  --paper-2: #1c1a13;
  --ink: #ede4d0;
  --ink-2: #d6ccb4;
  --muted: #a49a88;
  --muted-2: #8b8270;
  --line: #3d372b;
  --line-2: #2a2620;
  --stamp: #d2a24a;
  --stamp-2: #b08032;
  --red: #b94b43;
  --closed: #a87a2a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -4%, #2a2418 0, var(--bg) 40rem),
    radial-gradient(circle at 92% 92%, #1a1812 0, var(--bg) 30rem),
    var(--bg);
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-feature-settings: "onum" 1, "kern" 1;
  -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }
button {
  border: 1px solid var(--stamp);
  background: #2a2112;
  color: var(--ink);
  padding: .75rem 1rem;
  border-radius: 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
button:hover { background: #322617; }
button:disabled { opacity: .38; cursor: not-allowed; border-color: var(--line); background: #1a1610; }
button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }

.shell {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.hero {
  min-height: 84vh;
  display: grid;
  align-content: center;
  gap: 1rem;
  max-width: 760px;
}
.eyebrow {
  color: var(--stamp);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .75rem;
  margin: 0 0 .25rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
h1 {
  font-size: clamp(3rem, 11vw, 7.5rem);
  line-height: .88;
  margin: 0;
  font-weight: 500;
  letter-spacing: -.01em;
}
h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -.005em;
}
h2 em { font-style: italic; color: var(--ink-2); }
h3 {
  margin: 0 0 .75rem;
  font-weight: 500;
  color: #fff3d5;
  font-size: 1.05rem;
  letter-spacing: -.002em;
}
.section-head {
  font-size: .85rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stamp);
  margin: 0 0 .5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.section-note {
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.45;
  font-size: .9rem;
  max-width: 60rem;
}
.promise {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 42rem;
}
.meta {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
  max-width: 42rem;
  margin: 0;
}
.note {
  color: var(--muted-2);
  font-size: .8rem;
  margin: 1rem 0 0;
  max-width: 42rem;
}

.hidden { display: none !important; }
.game { display: grid; gap: 1.5rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}
.topbar > div:first-child { display: grid; gap: .35rem; }
.subhead {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .04em;
}
.subhead span { color: var(--stamp); }
.topbar-actions { flex-shrink: 0; }

.documents-wrap { display: grid; gap: .25rem; }
.documents {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.documents article {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper), transparent 5%);
  padding: 1.1rem 1.1rem 1rem;
  display: grid;
  gap: .55rem;
  align-content: start;
  position: relative;
}
.documents article.administrative {
  background: color-mix(in srgb, var(--paper-2), transparent 0%);
  border-color: var(--line-2);
}
.documents article.administrative::before {
  content: "ADMINISTRATIVE";
  position: absolute;
  top: .55rem;
  right: .8rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .62rem;
  letter-spacing: .18em;
  color: var(--closed);
}
.documents article.hidden-doc { display: none; }
.doc-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .7rem;
  letter-spacing: .08em;
  color: var(--stamp-2);
  margin: 0;
  text-transform: uppercase;
}
.doc-title {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  color: #fff3d5;
  font-weight: 500;
  letter-spacing: -.002em;
}
.doc-body {
  color: var(--ink-2);
  line-height: 1.55;
  font-size: .95rem;
  margin: 0;
  white-space: pre-wrap;
  display: none;
}
.doc-body.open { display: block; }
.doc-summary {
  color: var(--muted);
  line-height: 1.45;
  font-size: .9rem;
  margin: 0;
}
.doc-summary.hidden { display: none; }
.doc-button { width: 100%; margin-top: .5rem; }
.doc-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .7rem;
  color: var(--muted-2);
  letter-spacing: .04em;
  margin: 0;
}

.card, .ending {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper), transparent 5%);
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.card .rule, .gate-status, .status {
  color: var(--muted);
  line-height: 1.5;
  font-size: .85rem;
}
.gate-status {
  border-left: 2px solid var(--line);
  padding: .35rem 0 .35rem .7rem;
  margin: .25rem 0 0;
}
.gate-status.unlocked {
  border-left-color: var(--stamp);
  color: var(--ink-2);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 1rem;
  align-items: start;
}
form { display: grid; gap: .65rem; }
label {
  display: grid;
  gap: .3rem;
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
input {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  background: #0c0b08;
  color: var(--ink);
  font-family: ui-serif, Georgia, serif;
  font-size: .95rem;
}
input:focus { outline: 1px solid var(--stamp); }

.record ol {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  gap: .55rem;
  max-height: 26rem;
  overflow-y: auto;
}
.record li {
  line-height: 1.4;
  color: var(--ink-2);
  font-size: .85rem;
}
.record code {
  color: var(--stamp);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .75rem;
}
.record .behavior-note {
  display: block;
  margin-top: .1rem;
  color: var(--muted);
  font-size: .78rem;
}

.ending {
  border-color: var(--red);
  display: grid;
  gap: .85rem;
}
.ending h3 { color: #ffd3cd; }
.ending strong { color: #fff; }
.ending p { color: var(--ink-2); line-height: 1.55; }
.ending .stamp-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--stamp);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ending dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem .9rem;
  margin: 0;
  font-size: .9rem;
}
.ending dt {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  align-self: baseline;
}
.ending dd {
  color: var(--ink);
  margin: 0;
}
.ending .new-accession {
  border-top: 1px solid var(--line);
  padding-top: .85rem;
  margin-top: .25rem;
}

@media (max-width: 820px) {
  .documents { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .topbar { align-items: start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .topbar-actions .ghost { width: 100%; }
  h1 { font-size: clamp(2.4rem, 14vw, 4rem); }
  .ending dl { grid-template-columns: 1fr; gap: .15rem; }
  .ending dt { margin-top: .35rem; }
}

@media (max-width: 540px) {
  .shell { width: calc(100% - 1.25rem); padding: 1.25rem 0 3rem; }
  .card, .documents article, .ending { padding: 1rem; }
}
