:root {
  --green:   #14302a;   /* deep bottle green */
  --green-2: #1c403708;
  --panel:   #f5edda;   /* warm ivory */
  --panel-2: #efe4cc;
  --ink:     #20281f;    /* near-black text on ivory */
  --gold:    #b08d57;    /* thin decorative rule / accents */
  --gold-dk: #8a6d3f;
  --muted:   #6c6453;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--green);
  background-image:
    radial-gradient(ellipse at top, #1b4036 0%, var(--green) 60%);
  color: var(--panel);
  font-family: "Spectral", Georgia, serif;
  font-size: 18px;
  line-height: 1.65;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 6rem;
}

.hidden { display: none !important; }

/* ---------- Masthead ---------- */
.masthead { text-align: center; margin-bottom: 4rem; }
.kicker {
  font-size: 0.82rem; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 0.4rem;
}
.masthead h1 {
  font-family: "Playfair Display", serif;
  font-weight: 700; font-size: clamp(3rem, 9vw, 5rem);
  margin: 0; line-height: 1.02; color: var(--panel);
}
.subtitle {
  font-style: italic; font-size: 1.25rem; color: #d8cdb0;
  margin: 0.6rem 0 2.4rem;
}
.epigraph {
  margin: 0 auto; max-width: 600px; padding: 1.6rem 0;
  border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
}
.epigraph p {
  font-family: "Playfair Display", serif; font-style: italic;
  font-size: 1.18rem; line-height: 1.6; margin: 0 0 0.8rem; color: #ece2c8;
}
.epigraph cite { font-style: normal; font-size: 0.86rem; letter-spacing: 0.06em; color: var(--gold); }
.provenance { font-size: 0.9rem; color: #b9b193; margin-top: 1.8rem; }

/* ---------- Sections ---------- */
section { margin: 3.5rem 0; }
.section-h {
  font-family: "Playfair Display", serif; font-weight: 500;
  font-size: 1.7rem; color: var(--panel); margin: 0 0 0.4rem;
}
.section-lede { color: #c5bc9f; margin: 0 0 2rem; font-size: 1rem; }

/* ---------- Quiz ---------- */
.q-block { margin-bottom: 2.2rem; }
.q-text { font-size: 1.12rem; margin: 0 0 0.9rem; color: #ece2c8; }
.q-num { color: var(--gold); font-family: "Playfair Display", serif; margin-right: 0.3rem; }
.q-opts { display: grid; gap: 0.55rem; }
.q-opt {
  text-align: left; font-family: inherit; font-size: 1rem; color: var(--ink);
  background: var(--panel); border: 1px solid transparent; border-radius: 3px;
  padding: 0.8rem 1rem; cursor: pointer; transition: all 0.15s ease; line-height: 1.45;
}
.q-opt:hover { background: #fff7e6; transform: translateX(2px); }
.q-opt.sel { background: var(--panel); border-color: var(--gold-dk);
  box-shadow: inset 4px 0 0 var(--gold-dk); font-weight: 500; }

.quiz-actions { display: flex; align-items: center; gap: 1.4rem; margin-top: 2.4rem; }

/* ---------- Buttons ---------- */
.primary {
  font-family: "Playfair Display", serif; font-size: 1.05rem;
  background: var(--gold); color: #1c1208; border: none; border-radius: 3px;
  padding: 0.75rem 1.6rem; cursor: pointer; letter-spacing: 0.02em; transition: background 0.15s;
}
.primary:hover { background: #c79f64; }
.primary:disabled { opacity: 0.35; cursor: not-allowed; }
.ghost {
  background: none; border: none; color: var(--gold); cursor: pointer;
  font-family: inherit; font-size: 0.98rem; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Calling card (quiz result) ---------- */
.calling-card {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--gold-dk); border-radius: 4px;
  padding: 2.6rem 2.4rem; box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  position: relative;
}
.calling-card::after {
  content: ""; position: absolute; inset: 8px; border: 1px solid #d9c39a;
  border-radius: 2px; pointer-events: none;
}
.card-eyebrow { text-align: center; letter-spacing: 0.3em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--gold-dk); margin: 0; }
.card-name { text-align: center; font-family: "Playfair Display", serif;
  font-size: 2.4rem; font-weight: 700; margin: 0.3rem 0 0.2rem; color: #1c2a22; }
.card-novel { text-align: center; font-style: italic; color: var(--muted); margin: 0 0 1.6rem; }
.card-novel span { font-style: normal; }
.card-portrait { font-size: 1.06rem; line-height: 1.7; }
.card-traits { margin: 1.6rem 0; display: grid; gap: 0.8rem; }
.card-traits p { margin: 0; }
.trait-label { display: block; font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--gold-dk); margin-bottom: 0.15rem; }
.card-quote {
  margin: 1.8rem 0 1.4rem; padding: 1rem 1.3rem; background: #ece0c4;
  border-left: 3px solid var(--gold-dk); font-family: "Playfair Display", serif;
  font-style: italic; font-size: 1.12rem; border-radius: 2px;
}
.card-quote cite { display: block; margin-top: 0.7rem; font-style: normal;
  font-size: 0.82rem; letter-spacing: 0.04em; color: var(--gold-dk); }
.card-quote cite a, .src-link, .src-cite a { color: var(--gold-dk); }
#to-challenge { display: block; width: 100%; margin-top: 0.6rem; }

/* ---------- Challenge ---------- */
#challenge-input {
  width: 100%; font-family: inherit; font-size: 1.08rem; line-height: 1.6;
  background: var(--panel); color: var(--ink); border: 1px solid var(--gold-dk);
  border-radius: 3px; padding: 1rem 1.1rem; resize: vertical;
}
#challenge-input::placeholder { color: #9a917b; font-style: italic; }
#challenge-section .primary { margin-top: 1.1rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 0; }

/* ---------- Response ---------- */
#response { background: var(--panel); color: var(--ink); border-radius: 4px;
  padding: 2.2rem 2.2rem 1.6rem; box-shadow: 0 14px 40px rgba(0,0,0,0.3); }
.prose p { margin: 0 0 1.1rem; font-size: 1.08rem; line-height: 1.75; }
.thinking { font-style: italic; color: var(--muted); margin: 0; }
.err { color: #8a2d2d; margin: 0; }
.lowconf { background: #ece0c4; border-left: 3px solid var(--gold-dk);
  padding: 0.7rem 1rem; font-style: italic; font-size: 0.96rem; margin: 0 0 1.4rem; }
.fallback-note { background: #ece0c4; border-left: 3px solid var(--gold-dk);
  padding: 0.7rem 1rem; font-size: 0.9rem; color: var(--muted); margin: 0 0 1.2rem; }

/* ---------- Sources ---------- */
#sources { margin-top: 1.8rem; }
.sources-h { font-family: "Playfair Display", serif; font-weight: 500; font-size: 1.1rem;
  color: var(--gold); letter-spacing: 0.04em; margin: 0 0 1rem; }
.source { background: #1b3a31; border: 1px solid #2c5247; border-radius: 3px;
  padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.source blockquote { margin: 0 0 0.7rem; font-family: "Playfair Display", serif;
  font-style: italic; font-size: 1.04rem; color: #ece2c8; line-height: 1.55; }
.src-cite { margin: 0 0 0.5rem; font-size: 0.84rem; color: var(--gold); letter-spacing: 0.03em; }
.src-link { font-size: 0.84rem; color: var(--gold); text-decoration: underline;
  text-underline-offset: 3px; }

/* ---------- Footer ---------- */
footer { margin-top: 4rem; padding-top: 1.6rem; border-top: 1px solid #2c5247;
  font-size: 0.84rem; color: #9a9379; }
footer a { color: var(--gold); }

a { color: var(--gold); }
@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding: 3rem 1.1rem 4rem; }
  .calling-card, #response { padding: 1.6rem 1.3rem; }
}
