:root {
  /* Palette taken from the author's Fourth Wing page: storm black, cream-pink type, parchment tan */
  --bg: #0d0b0a;
  --surface: rgba(26, 20, 17, 0.72);
  --surface-2: rgba(243, 226, 221, 0.05);
  --line: rgba(217, 183, 126, 0.28);
  --line-strong: rgba(217, 183, 126, 0.6);
  --text: #f3e2dd;
  --muted: #bfa99b;
  --gold: #d9b77e;
  --gold-2: #e29e67;
  --parchment: #d8b98c;
  --parchment-2: #b8946a;
  --ink: #17100c;
  --accent: var(--gold);
  --display: 'Cormorant Unicase', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Raleway', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 50% -80px, rgba(226, 158, 103, 0.17), transparent 70%),
    radial-gradient(700px 420px at 12% 18%, rgba(120, 86, 56, 0.16), transparent 70%),
    radial-gradient(700px 420px at 88% 30%, rgba(120, 86, 56, 0.12), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 400 17px/1.7 var(--sans);
  position: relative;
  min-height: 100vh;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
header.site, main, footer.site { position: relative; z-index: 1; }

a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #f0d7a8; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.12; margin: 0; letter-spacing: 0.02em; }
h1 { font-size: clamp(2.4rem, 7.2vw, 4rem); text-wrap: balance; }
h2 { font-size: 1.9rem; margin: 2.4rem 0 0.6rem; }
p { margin: 0 0 1rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 720px; }

/* entrance motion */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes reveal { from { opacity: 0; transform: scale(0.55) rotate(-40deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 0 14px var(--accent)); } 50% { filter: drop-shadow(0 0 30px var(--accent)); } }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }
.rise { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* header */
header.site { border-bottom: 1px solid var(--line); background: rgba(13, 11, 10, 0.78); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font: 500 1.6rem/1 var(--display); color: var(--text); text-decoration: none; letter-spacing: 0.04em; }
.brand span { color: var(--gold); }
nav.site { display: flex; gap: 4px 20px; flex-wrap: wrap; }
nav.site a { color: var(--muted); text-decoration: none; font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; padding: 6px 0; border-bottom: 1px solid transparent; }
nav.site a:hover, nav.site a[aria-current='page'] { color: var(--text); border-bottom-color: var(--gold); }

/* hero + quiz */
.hero { padding: 52px 0 24px; text-align: center; }
.hero h1 { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero p.lede { max-width: 620px; margin: 16px auto 0; color: var(--muted); font-size: 1.05rem; animation: rise 0.8s 0.12s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.lede { color: var(--muted); font-size: 1.1rem; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.74rem; font-weight: 600; margin: 0 0 10px; }

.quiz {
  position: relative; max-width: 720px; margin: 32px auto 8px; padding: 26px 22px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; text-align: left;
  backdrop-filter: blur(8px); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 0 40px rgba(226, 158, 103, 0.05);
  animation: rise 0.9s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.quiz::before { content: ''; position: absolute; inset: -7px; border: 1px solid rgba(217, 183, 126, 0.16); border-radius: 26px; pointer-events: none; }
.q-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.q-count { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; font-weight: 600; }
.bar { flex: 1; height: 3px; background: rgba(243, 226, 221, 0.1); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 99px; transition: width 0.45s ease; box-shadow: 0 0 10px rgba(226, 158, 103, 0.7); }
.q-body { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.q-text { font-size: clamp(1.55rem, 4.6vw, 2.1rem); margin: 0 0 20px; outline: none; }
.answers { display: grid; gap: 10px; }
.answer {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface-2); color: var(--text); font: 500 1rem/1.45 var(--sans);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; min-height: 58px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.answer:hover { border-color: var(--gold); background: rgba(217, 183, 126, 0.09); box-shadow: 0 0 22px rgba(226, 158, 103, 0.18); }
.answer:active { transform: scale(0.985); }
.answer:focus-visible, .btn:focus-visible, .back:focus-visible, .emblem-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.answer kbd {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: var(--gold); font: 600 0.8rem var(--sans); border: 1px solid var(--line-strong);
}
.back { margin-top: 16px; background: none; border: 0; color: var(--muted); font: 500 0.8rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; padding: 6px 2px; }
.back:hover { color: var(--text); }
.reading { text-align: center; padding: 36px 0; }
.reading .emblem { margin: 0 auto 14px; width: 120px; animation: pulse 1.2s ease-in-out infinite; }
.noscript { color: var(--muted); }

/* buttons: gold pill with a thin outer ring */
.btn {
  display: inline-block; background: linear-gradient(90deg, var(--gold-2), #dcc08a); color: var(--ink);
  font: 700 0.82rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  padding: 16px 26px; border-radius: 999px; text-decoration: none; border: 0; cursor: pointer;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px rgba(226, 158, 103, 0.55); transition: filter 0.2s, transform 0.12s;
}
.btn:hover { color: var(--ink); filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.btn.ghost:hover { color: var(--text); box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(226, 158, 103, 0.2); filter: none; }
.btn[hidden] { display: none; }

/* parchment medallion emblems */
.emblem { display: block; width: 100%; height: auto; overflow: visible; }
.emblem .ring { transform-origin: 100px 100px; animation: turn 90s linear infinite; }
.emblem .halo { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0.85; }
.emblems { list-style: none; margin: 30px auto 8px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px 18px; max-width: 640px; }
.emblems li { text-align: center; }
.emblem-link { display: block; text-decoration: none; color: var(--text); border-radius: 18px; }
.emblem-link .emblem { width: 104px; margin: 0 auto 10px; transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.35s; filter: drop-shadow(0 0 0 transparent); }
.emblem-link:hover .emblem { transform: scale(1.07); filter: drop-shadow(0 0 18px var(--accent)); }
.emblem-link strong { display: block; font: 500 1.35rem/1.1 var(--display); letter-spacing: 0.03em; }
.emblem-link span { display: block; margin-top: 3px; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.emblem-link em { display: block; margin-top: 8px; font-style: normal; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }

/* content */
section.page, article.result, section.content { padding: 40px 0 60px; }
section.content .wrap { max-width: 760px; }
.result { text-align: center; }
.result .wrap { text-align: left; }
.result-emblem { width: 190px; margin: 0 auto 20px; animation: reveal 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both, glow 4.5s 1.2s ease-in-out infinite; }
.result .hero-block { text-align: center; }
.result .hero-block .lede { margin-top: 16px; }
.result h1 { color: var(--accent); text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 35%, transparent); }
.chip { display: inline-block; margin: 12px 0 0; padding: 5px 14px; border-radius: 99px; border: 1px solid var(--accent); color: var(--accent); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.result .narrow > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.result .narrow > :nth-child(1){ animation-delay: 0.30s; }
.result .narrow > :nth-child(2){ animation-delay: 0.35s; }
.result .narrow > :nth-child(3){ animation-delay: 0.40s; }
.result .narrow > :nth-child(4){ animation-delay: 0.45s; }
.result .narrow > :nth-child(5){ animation-delay: 0.50s; }
.result .narrow > :nth-child(6){ animation-delay: 0.55s; }
.result .narrow > :nth-child(7){ animation-delay: 0.60s; }
.result .narrow > :nth-child(8){ animation-delay: 0.65s; }
.result .narrow > :nth-child(9){ animation-delay: 0.70s; }
.result .narrow > :nth-child(10){ animation-delay: 0.75s; }
.result .narrow > :nth-child(11){ animation-delay: 0.80s; }
.result .narrow > :nth-child(12){ animation-delay: 0.85s; }
.result .narrow > :nth-child(13){ animation-delay: 0.90s; }
.result .narrow > :nth-child(14){ animation-delay: 0.95s; }
.result .narrow > :nth-child(15){ animation-delay: 1.00s; }
.result .narrow > :nth-child(16){ animation-delay: 1.05s; }
.result .narrow > :nth-child(17){ animation-delay: 1.10s; }
.traits, .link-list { padding-left: 1.2rem; margin: 0 0 1rem; }
.traits li { margin-bottom: 4px; }
.traits li::marker { color: var(--accent); }
.link-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.cta { display: flex; flex-wrap: wrap; gap: 16px; margin: 30px 0 8px; }
.share { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 30px 0 0; }
.share-note { color: var(--muted); font-size: 0.9rem; }
.fine { color: var(--muted); font-size: 0.85rem; margin-top: 28px; }

.prose h2 { margin-top: 2.6rem; }
.prose details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.prose summary { cursor: pointer; font-weight: 600; }
.prose details p { margin: 10px 0 0; color: var(--muted); }

/* footer */
footer.site { border-top: 1px solid var(--line); padding: 30px 0 44px; color: var(--muted); font-size: 0.82rem; background: rgba(13, 11, 10, 0.6); }
footer.site p { margin: 0 0 8px; }
footer.site a { color: var(--muted); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  header.site { position: static; }
  nav.site { gap: 2px 14px; }
  nav.site a { font-size: 0.72rem; letter-spacing: 0.06em; }
  .hero { padding-top: 32px; }
  .quiz { padding: 20px 14px 16px; margin-left: 12px; margin-right: 12px; }
  .emblems { grid-template-columns: repeat(2, 1fr); gap: 26px 10px; }
  .emblem-link .emblem { width: 84px; }
  .emblem-link .emblem { width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.dragon-table { width: 100%; border-collapse: collapse; margin: 16px 0 8px; font-size: 0.95rem; }
.dragon-table th, .dragon-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.dragon-table th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
@media (max-width: 520px) { .dragon-table { font-size: 0.85rem; } .dragon-table th:nth-child(3), .dragon-table td:nth-child(3) { display: none; } }
