:root {
  --ink: #141311;
  --muted: #6f6a62;
  --paper: #f3efe6;
  --paper-2: #e7e1d4;
  --line: #ddd6c8;
  --night: #0c0c0c;
  --night-2: #171717;
  --fog: #b9b6ae;
  --danger: #ffb4ae;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  background: var(--night);
  color: #f5f4f1;
}

button, input { font: inherit; }

a { color: inherit; }

#app { min-height: 100vh; }

.lobby, .gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 48px;
}

.lobby { justify-content: flex-start; }

.lobby-inner, .gate-inner {
  width: min(760px, 100%);
  margin: 28px auto 72px;
}

.gate-inner { margin: auto; }

.brand, .topbar-brand img {
  display: block;
  height: 26px;
  width: auto;
  aspect-ratio: 1407 / 284;
  filter: invert(1);
}

.lobby h1, .gate h1, .paper h1 {
  font-family: Fraunces, "Iowan Old Style", Palatino, serif;
  font-weight: 520;
  font-optical-sizing: auto;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lobby h1 {
  margin: 28px 0 12px;
  font-size: clamp(40px, 6vw, 64px);
  max-width: 11ch;
}

.lede {
  margin: 0 0 36px;
  max-width: 38ch;
  color: var(--fog);
  font-size: 18px;
  line-height: 1.45;
}

.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #2c2c2c;
}

.section-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid #2c2c2c;
  text-decoration: none;
}

.section-list a:hover .section-title { color: white; }

.index {
  font-variant-numeric: tabular-nums;
  color: var(--fog);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.section-title {
  font-size: 22px;
  font-weight: 500;
}

.section-note, .open-label {
  color: var(--fog);
  font-size: 14px;
}

.gate h1 {
  margin: 22px 0 8px;
  font-size: clamp(36px, 5vw, 52px);
}

.gate p {
  margin: 0 0 28px;
  color: var(--fog);
}

form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 420px;
}

label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

input[type="password"] {
  width: 100%;
  background: transparent;
  color: white;
  border: 0;
  border-bottom: 1px solid #3a3a3a;
  border-radius: 0;
  padding: 12px 0;
  outline: none;
}

input[type="password"]:focus { border-bottom-color: white; }

button {
  align-self: flex-start;
  background: #f5f4f1;
  color: var(--night);
  border: 0;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}

button:disabled { opacity: 0.55; cursor: wait; }

button.ghost, a.ghost {
  background: transparent;
  color: #f5f4f1;
  border: 1px solid #3a3a3a;
  text-decoration: none;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
}

.part { scroll-margin-top: 76px; }

.error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--night);
  position: sticky;
  top: 0;
  z-index: 2;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-brand img { height: 20px; }

.doc-label {
  color: var(--fog);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; gap: 8px; }

.paper {
  background: var(--paper);
  color: var(--ink);
  min-height: calc(100vh - 64px);
  color-scheme: light;
}

.paper-inner {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 96px;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.subnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.subnav a:hover { color: var(--ink); }

.part + .part {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.paper h1, .paper h2, .paper h3, .paper h4 {
  color: var(--ink);
  line-height: 1.15;
}

.paper h1 { font-size: clamp(34px, 5vw, 48px); margin: 0 0 20px; }

.paper h2 { font-family: Fraunces, Palatino, serif; font-size: 28px; margin: 36px 0 12px; font-weight: 560; }

.paper h3 { font-size: 18px; margin: 28px 0 8px; }

.paper p, .paper li { font-size: 17px; line-height: 1.6; }

.paper p { margin: 0 0 14px; }

.paper ul, .paper ol { margin: 0 0 16px; padding-left: 1.2em; }

.paper li + li { margin-top: 6px; }

.paper li.check { list-style: none; margin-left: -1.2em; }

.paper a { color: #3d4a34; }

.paper code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
}

.table-wrap { overflow-x: auto; margin: 0 0 18px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.4;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.chapter { padding: 8px 0 12px; }

.chapter .section-list a { grid-template-columns: 1fr auto; }

.chapter-kicker {
  margin: 28px 0 0;
  color: var(--fog);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chapter h2 {
  margin: 8px 0 8px;
  font-family: Fraunces, Palatino, serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 520;
  letter-spacing: -0.03em;
}

.chapter-note {
  margin: 0 0 8px;
  max-width: 52ch;
  color: var(--fog);
  line-height: 1.45;
}

.chapter-actions { display: flex; gap: 8px; margin: 16px 0 8px; }

.evidence {
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  margin: 12px 0 28px;
  padding: 22px 22px 8px;
}

.evidence-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.evidence h3 {
  margin: 0;
  font-family: Fraunces, Palatino, serif;
  font-size: 28px;
  font-weight: 520;
}

.evidence-note { color: var(--muted); margin: 8px 0 18px; }

.criteria { list-style: none; margin: 0; padding: 0; }

.criterion {
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
}

.criterion-label { margin: 0 0 10px; line-height: 1.45; }

.criterion-label span {
  display: inline-block;
  min-width: 2ch;
  margin-right: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.criterion .written { white-space: pre-wrap; margin: 0; }
.criterion .written.empty { color: var(--muted); }

.criterion textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  resize: vertical;
  border-radius: 0;
}

.criterion textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

.shot { display: block; max-width: min(100%, 420px); margin: 12px 0; }

.criterion-files { position: relative; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paper button:not(.ghost) {
  background: var(--ink);
  color: #f5f4f1;
}

button.ghost.dark {
  color: var(--ink);
  border-color: var(--line);
  background: transparent;
}

.page-evidence { margin-top: 48px; padding-top: 8px; border-top: 1px solid var(--line); }

.page-evidence .evidence {
  margin: 8px 0 0;
  padding: 8px 0 0;
  background: transparent;
}

@media (max-width: 640px) {
  .section-list a { grid-template-columns: auto 1fr; }
  .open-label { display: none; }
  .topbar { align-items: flex-start; }
  .doc-label { display: none; }
}
