:root {
  color-scheme: dark;
  --bg: #070707;
  --ink: #f4f4f4;
  --muted: #a3a3a3;
  --red: #e11d2e;
  --red-deep: #8e1020;
  --card: #121212;
  --line: rgba(255, 255, 255, 0.14);
  --paper: #f4efe4;
  --paper-ink: #1a1a1a;
  --paper-red: #9f1d2a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.45;
}

main {
  width: min(100%, 28rem);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(1.25rem + env(safe-area-inset-top))
    1.25rem
    calc(1.5rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-top: 4px solid var(--red);
}

.mark {
  margin: 0;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 600;
}

body.welcome h1 {
  margin-top: 12vh;
  font-size: 3rem;
}

body.journey h1 {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

p { margin: 0; }

section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
}

section[hidden] { display: none !important; }

button {
  appearance: none;
  width: 100%;
  min-height: 3.25rem;
  margin-top: auto;
  border: 0;
  border-radius: 2px;
  background: var(--red);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  cursor: pointer;
}

button:disabled {
  background: #2a2a2a;
  color: #6e6e6e;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
h1:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.quotes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.quotes li {
  margin: 0;
  padding: 0.95rem 1rem;
  background: var(--card);
  border-left: 3px solid var(--red);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.75rem;
}

legend {
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.choices { display: grid; gap: 0.6rem; }

.choice {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.75rem;
  align-items: center;
  min-height: 3.25rem;
  padding: 0.8rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--red);
  background: #1a0709;
  box-shadow: inset 3px 0 0 var(--red);
}

.choice input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--red);
}

.choice-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.badge {
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.hint[hidden] { display: none !important; }

body.legal {
  color-scheme: light;
  background: #111;
}

body.legal main {
  background: var(--paper);
  color: var(--paper-ink);
  border-top-color: var(--paper-red);
}

body.legal .mark { color: var(--paper-red); text-align: center; }

body.legal h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: 0;
  text-align: center;
  padding-bottom: 0.85rem;
  border-bottom: 3px double var(--paper-red);
}

.paper {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.25rem 0.15rem 0.5rem;
  font-family: var(--serif);
  line-height: 1.55;
}

#deed {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.paper p { margin: 0; }

.terms {
  display: grid;
  gap: 0.45rem;
}

.terms label {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 1px solid var(--paper-ink);
  border-radius: 0;
  background: transparent;
  color: var(--paper-ink);
  font: 1rem/1.45 var(--serif);
  resize: vertical;
}

#extra-line {
  padding-top: 0.35rem;
  border-top: 1px solid rgba(26, 26, 26, 0.25);
  white-space: pre-wrap;
}

.sign-rule {
  margin-top: 0.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--paper-ink);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body.legal #send-status {
  min-height: 1.3rem;
  font-family: var(--font);
  font-size: 0.95rem;
}

body.legal main {
  height: 100dvh;
  overflow: hidden;
}

body.legal #screen-sign {
  min-height: 0;
  overflow: hidden;
}

body.legal .paper {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

body.legal #sign,
body.legal #send-status {
  flex: 0 0 auto;
}

body.legal #sign {
  margin-top: 0.75rem;
  background: var(--paper-ink);
  color: var(--paper);
}

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

body.again main { justify-content: center; }

.again {
  margin-top: 0;
  background: transparent;
  color: var(--ink);
  border-bottom: 2px solid var(--red);
  border-radius: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

#send-status:empty { display: none; }

@media (min-width: 48rem) {
  body { background: #050505; }
  main {
    min-height: calc(100dvh - 3rem);
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #222;
    border-top: 4px solid var(--red);
  }
  body.legal main {
    height: calc(100dvh - 3rem);
    margin-bottom: 0;
  }
}
