:root {
  /* Book paper: cream page, near-black ink */
  --bg: #f5eedc;
  --fg: #2b2520;
  --muted: #6b604f;
  --line: #dcd1b9;
  --accent: #2b2520;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Warm night: dark brown page, cream ink */
    --bg: #1e1a15;
    --fg: #e2d7c3;
    --muted: #a3947c;
    --line: #3a332a;
    --accent: #e2d7c3;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  /* Book typefaces that ship with common systems, so nothing is downloaded:
     Apple Books' default, then Palatino (Mac and Windows), Charter, Georgia. */
  font: 18px/1.6 "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Charter, "Bitstream Charter", Georgia, serif;
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 12vh 24px 48px;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  line-height: 1.1;
  font-weight: 700;
  margin: 0 0 1.2em;
}
h2 { font-size: 1.3rem; margin: 2em 0 0.5em; }
.prose h2:first-child { margin-top: 0; }

a { color: inherit; text-underline-offset: 3px; }
.muted { color: var(--muted); }

textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  resize: vertical;
  min-height: 200px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  margin-top: 20px;
  font: inherit;
  font-weight: 700;
  padding: 12px 32px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}
button:hover { opacity: 0.85; }

.note { color: var(--muted); font-size: 0.85rem; margin-top: 24px; }

.answer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  white-space: pre-wrap;
}
.answer .meta { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 8px; }

footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sr-only, .trap {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.trap { left: -9999px; }
