:root {
  --ink: #2a1f14;
  --brown: #4a2f1c;
  --gold: #b58a3c;
  --gold-hi: #e2bd6a;
  --cream: #fff8e8;
  --card: rgba(255, 251, 240, 0.86);
  --line: rgba(74, 47, 28, 0.18);
  --accent: #3b5a24;
  --ok: #3d6b22;
  --bad: #b3362b;
  --easy: #3d6b22;
  --medium: #9a5f12;
  --hard: #9e2b22;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
  --label: "Cinzel", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: #e9dfc8;
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  display: flex;
  flex-direction: column;
}
/* Background: a Bible page drawn in code, so it looks the same at any screen size.
   Phones get one page; wide screens get an open Bible with a centre fold. */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(175deg, #f4ebd5 0%, #ece0c3 55%, #e2d3b0 100%);
}
.bg::before { /* paper grain */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .33 0 0 0 0 .2 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
.scripture {
  position: absolute;
  inset: 96px 34px 0 44px;
  columns: 1;
  column-gap: 120px;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
  color: var(--brown);
  opacity: 0;
  filter: blur(1.1px);
  transition: opacity 1.2s ease;
  user-select: none;
}
.scripture.on { opacity: 0.16; }
.scripture sup { font-size: 0.6em; margin-right: 3px; }
.scripture h3 { margin: 0 0 6px; font-family: var(--label); font-size: 15px; letter-spacing: 0.2em; text-align: center; break-after: avoid; }
.scripture h3:not(:first-child) { margin-top: 18px; }
.gutter { display: none; }
.edge { /* stacked page edges */
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  background: repeating-linear-gradient(90deg, #cdb98f 0 1px, #f1e6c9 1px 3px);
  box-shadow: 0 0 18px rgba(74, 47, 28, 0.25);
}
.edge.left { left: 0; }
.edge.right { display: none; right: 0; }
.glow { /* warm light drifting slowly across the page */
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 250, 235, 0.75), rgba(255, 250, 235, 0) 40%);
  animation: drift 38s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(-14%, -10%); }
  to { transform: translate(14%, 10%); }
}
.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, rgba(90, 60, 30, 0) 55%, rgba(90, 60, 30, 0.22) 100%);
}
@media (min-width: 900px) {
  .scripture { inset: 100px 70px 0; columns: 2; column-gap: 170px; font-size: 18px; }
  .gutter {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 240px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(74, 47, 28, 0) 0%, rgba(74, 47, 28, 0.1) 38%, rgba(74, 47, 28, 0.3) 50%, rgba(74, 47, 28, 0.1) 62%, rgba(74, 47, 28, 0) 100%);
  }
  .edge { width: 14px; }
  .edge.right { display: block; }
}

/* header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--label);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mark {
  width: 44px;
  height: 44px;
  background: var(--accent);
  -webkit-mask: url("img/logo-mark.png") center / 150% no-repeat;
  mask: url("img/logo-mark.png") center / 150% no-repeat;
}
.pill {
  font-family: var(--label);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--cream);
  background: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill[data-d="Easy"] { background: var(--easy); }
.pill[data-d="Medium"] { background: var(--medium); }
.pill[data-d="Hard"] { background: var(--hard); }

/* card */
main { flex: 1; width: min(720px, 100%); margin: 0 auto; padding: 8px 16px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(22px, 5vw, 40px);
  box-shadow: 0 18px 50px rgba(74, 47, 28, 0.14);
  backdrop-filter: blur(2px);
}
.kicker {
  margin: 0 0 10px;
  font-family: var(--label);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
h1, h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  text-wrap: balance;
}
h1 { font-size: clamp(36px, 7vw, 54px); }
h2 { font-size: clamp(28px, 5.4vw, 40px); }
.lede { margin: 12px 0 0; font-size: 20px; color: var(--brown); }
.muted { color: rgba(74, 47, 28, 0.7); }
.note { min-height: 1.5em; margin: 12px 0 0; font-size: 16px; color: var(--brown); text-align: center; }

/* start choices */
fieldset { border: 0; padding: 0; margin: 26px 0 0; min-width: 0; }
legend {
  padding: 0;
  margin-bottom: 10px;
  font-family: var(--label);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brown);
}
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.choices.themes { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 244, 0.9);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.choice b { font-family: var(--display); font-size: 22px; line-height: 1.1; }
.choice small { font-size: 14px; color: rgba(74, 47, 28, 0.75); }
.choice:hover { border-color: var(--gold); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: #f1ecd6; box-shadow: inset 0 0 0 1px var(--accent); }
.choice:disabled { opacity: 0.45; cursor: not-allowed; }

/* timer setting */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 8px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.9);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: #f1ecd6; box-shadow: inset 0 0 0 1px var(--accent); }
.custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 17px; color: var(--brown); }
.custom input {
  width: 96px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: #fffdf6;
  color: var(--ink);
  font: 600 20px var(--body);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* countdown during a question */
.timer { display: flex; align-items: center; gap: 12px; margin: -8px 0 20px; }
.clock {
  min-width: 64px;
  font-family: var(--label);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.track { flex: 1; height: 10px; border-radius: 999px; background: rgba(74, 47, 28, 0.12); overflow: hidden; }
.track span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; }
.timer.low .clock { color: var(--bad); }
.timer.low .track span { background: var(--bad); }
.timer.low { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }

/* buttons */
button { font: inherit; }
.primary, .secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 12px 28px;
  border-radius: 999px;
  font-family: var(--label);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.primary {
  border: 0;
  color: #2a1a0e;
  background: linear-gradient(160deg, #f0d48f, #c99c48);
  box-shadow: 0 6px 16px rgba(138, 101, 38, 0.3);
}
.primary:hover { filter: brightness(1.05); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary { border: 1.5px solid var(--gold); background: transparent; color: var(--brown); }
#startBtn { width: 100%; margin-top: 28px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* quiz */
.progress { display: flex; justify-content: space-between; font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.bar { height: 6px; margin: 10px 0 24px; border-radius: 999px; background: rgba(74, 47, 28, 0.12); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.3s; }
.options { display: grid; gap: 12px; margin-top: 24px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 244, 0.95);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 23px;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover:not(:disabled) { border-color: var(--gold); }
.option .letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brown);
  color: var(--cream);
  font-family: var(--label);
  font-size: 16px;
}
.option:disabled { cursor: default; }
.option.correct { border-color: var(--ok); background: #e8efd9; }
.option.correct .letter { background: var(--ok); }
.option.wrong { border-color: var(--bad); background: #f6e1dc; }
.option.wrong .letter { background: var(--bad); }
.option.dim { opacity: 0.55; }

.reveal { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.verdict { margin: 0; font-family: var(--label); font-weight: 700; font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--bad); }
blockquote {
  margin: 14px 0 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.3;
  color: var(--brown);
}
.ref { margin: 8px 0 0; font-family: var(--label); font-weight: 700; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
#nextBtn { width: 100%; margin-top: 22px; }

/* results */
#results { text-align: center; }
.big { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(80px, 22vw, 120px); line-height: 1; color: var(--accent); }
.big .of { font-size: 0.4em; color: var(--brown); }
#results h2 { margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.row > * { flex: 1 1 200px; }
details { margin-top: 26px; text-align: left; border-top: 1px solid var(--line); padding-top: 16px; }
summary { cursor: pointer; font-family: var(--label); font-weight: 700; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brown); }
#review { padding-left: 22px; margin: 14px 0 0; }
#review li { margin-bottom: 14px; }
#review .q { font-weight: 600; }
#review .a { font-size: 17px; }
#review .a .yes { color: var(--ok); font-weight: 600; }
#review .a .no { color: var(--bad); text-decoration: line-through; }

/* footer */
.foot { width: min(720px, 100%); margin: 0 auto; padding: 8px 16px max(28px, env(safe-area-inset-bottom)); text-align: center; font-size: 16px; color: var(--brown); }
.foot p { margin: 4px 0; }
.links { display: flex; justify-content: center; gap: 20px; }
.links a { color: var(--accent); font-family: var(--label); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 480px) {
  body { font-size: 18px; }
  .option { font-size: 21px; min-height: 56px; }
  .brand { font-size: 14px; }
  .mark { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .glow, .timer.low { animation: none; }
}
