:root {
  --night-1: #0b1030;
  --night-2: #1d1642;
  --night-3: #3a2450;
  --gold: #ffd76a;
  --gold-2: #e0a12a;
  --gold-ink: #3a1e00;
  --parchment: #f4e4bc;
  --parchment-hi: #fbf1d3;
  --parchment-edge: #a0702a;
  --ink: #4a240a;
  --ink-soft: #6b4a2a;
  --text-on-night: #f6ecd6;
  --muted-on-night: #c9b6e8;
  --ok: #2f8a4f;
  --no: #b8382c;
  --title-font: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  --head-font: "Cinzel", "Trajan Pro", Georgia, serif;
  --body-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 16px/1.5 var(--body-font);
  color: var(--text-on-night);
  background: linear-gradient(to bottom, var(--night-1), var(--night-2) 45%, var(--night-3)) fixed;
}
a { color: var(--gold); }
img { max-width: 100%; }

/* ---------- Header / footer ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(11, 8, 30, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 215, 106, 0.2);
}
.logo {
  font: 700 1.25rem var(--title-font);
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}
.logo-mark { font-family: var(--body-font); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.nav a, .nav .linklike {
  font: 600 0.9rem var(--head-font);
  color: var(--text-on-night);
  text-decoration: none;
}
.nav a:hover, .nav .linklike:hover { color: var(--gold); }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; }
.view { flex: 1; width: 100%; outline: none; }
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  font-size: 0.8rem;
  color: var(--muted-on-night);
  border-top: 1px solid rgba(255, 215, 106, 0.15);
}
.site-footer a { color: var(--muted-on-night); }
.art-legal { position: absolute; left: 0; right: 0; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; padding: 0 12px; font-size: .78rem; z-index: 5; }
.art-legal a, .art-legal span { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); text-decoration: none; opacity: .9; }
.art-legal a:hover { text-decoration: underline; opacity: 1; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.policy { line-height: 1.6; }
.policy h2 { font-size: 1.15rem; margin: 22px 0 6px; color: #6b4a1f; }
.policy ul { padding-left: 22px; }
.policy li { margin: 4px 0; }
.policy .contact-email { font-size: 1.2rem; font-weight: 700; }
.policy-links { margin-top: 26px; font-size: .9rem; text-align: center; }
.form-foot.agree { font-size: .85rem; }
.renew-note { font-size: .9rem; text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 700 0.95rem var(--head-font);
  letter-spacing: 0.03em;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.65em 1.4em;
  cursor: pointer;
  border: 2px solid transparent;
  transition: filter 0.15s, background 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold { color: var(--gold-ink); background: linear-gradient(#ffe08a, var(--gold-2)); border-color: #8a5a12; }
.btn-gold:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { color: var(--gold); background: rgba(20, 12, 40, 0.5); border-color: rgba(255, 215, 106, 0.55); }
.btn-ghost:hover:not(:disabled) { background: rgba(60, 40, 90, 0.7); }
.btn-ink { color: #fff6da; background: linear-gradient(#b5651d, #7a3a0c); border-color: #7a4a12; }
.btn-ink:hover:not(:disabled) { filter: brightness(1.1); }
.btn-outline-ink { color: #7a3a0c; background: transparent; border-color: #7a4a12; }
.btn-outline-ink:hover:not(:disabled) { background: rgba(122, 58, 12, 0.08); }
.btn-danger { color: #fff; background: #9b2c22; border-color: #6e1b14; }
.btn-sm { font-size: 0.8rem; padding: 0.45em 1em; }
.btn-lg { font-size: 1.05rem; padding: 0.8em 1.8em; }

/* ---------- Layout helpers ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 16px 48px; }
.wrap-narrow { max-width: 520px; margin: 0 auto; padding: 40px 16px 56px; }
.eyebrow {
  margin: 0 0 4px;
  font: 700 0.75rem var(--head-font);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-on-night);
}
.page-title { margin: 0 0 6px; font: 700 clamp(1.6rem, 4vw, 2.2rem) var(--head-font); color: var(--gold); }
.page-sub { margin: 0 0 24px; color: var(--muted-on-night); }
.parchment {
  color: var(--ink);
  background: linear-gradient(var(--parchment-hi), var(--parchment));
  border: 3px double var(--parchment-edge);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.parchment h2, .parchment h3 { font-family: var(--head-font); color: #6b2f0a; }
.parchment a:not(.btn) { color: #8a440f; } /* text links only; buttons keep their own colors */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: min(78vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 140px;
  text-align: center;
}
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 80px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 160px 20px, #ffe9b0, transparent),
    radial-gradient(1px 1px at 130px 150px, #fff, transparent),
    radial-gradient(1px 1px at 40px 170px, #cfd8ff, transparent),
    radial-gradient(1.5px 1.5px at 190px 120px, #fff, transparent);
  background-size: 210px 200px;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.5; } to { opacity: 1; } }
.moon {
  position: absolute;
  top: 10%;
  right: 10%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe6, #f1dfa6 60%, #d9c27f);
  box-shadow: 0 0 50px 14px rgba(255, 240, 190, 0.22);
}
.castle-silhouette { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42%; pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 680px; }
.hero h1 {
  margin: 4px 0 12px;
  font: 700 clamp(2.6rem, 9vw, 4.8rem)/1.05 var(--title-font);
  color: var(--gold);
  text-shadow: 0 4px 24px rgba(255, 190, 70, 0.4);
}
.hero .lead { margin: 0 auto 24px; max-width: 46ch; font-size: clamp(1rem, 2.4vw, 1.2rem); color: #e8dcf5; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.hero-note { margin: 14px 0 0; font-size: 0.85rem; color: var(--muted-on-night); }

.section { max-width: 1080px; margin: 0 auto; padding: 48px 16px; }
.section-title { margin: 0 0 6px; text-align: center; font: 700 clamp(1.5rem, 4vw, 2rem) var(--head-font); color: var(--gold); }
.section-sub { margin: 0 auto 28px; max-width: 56ch; text-align: center; color: var(--muted-on-night); }

/* ---------- Level cards ---------- */
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  color: var(--ink);
  background: linear-gradient(var(--parchment-hi), var(--parchment));
  border: 3px double var(--parchment-edge);
  border-top: 8px solid var(--lc, #c98a1b);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.level-card.is-rec { box-shadow: 0 0 0 3px var(--gold), 0 14px 34px rgba(0, 0, 0, 0.35); }
.lc-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  font-size: 2rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lc, #c98a1b) 18%, #fff8e6);
  border: 2px solid var(--lc, #c98a1b);
}
.lc-code { margin: 0; font: 700 0.75rem var(--head-font); letter-spacing: 0.18em; text-transform: uppercase; color: var(--lc, #8b5a1f); }
.level-card h3 { margin: 2px 0 4px; font: 700 1.35rem var(--head-font); color: #4a1f05; }
.lc-grades { margin: 0 0 8px; font-weight: 700; color: var(--ink-soft); }
.lc-tag { margin: 0 0 16px; flex: 1; color: #5b3a1c; }
.rec-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 10px;
  font: 700 0.7rem var(--head-font);
  letter-spacing: 0.06em;
  color: var(--gold-ink);
  background: var(--gold);
  border-radius: 999px;
}
.soon-badge { color: #fff; background: #7b6f8f; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.step {
  padding: 22px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 106, 0.2);
}
.step-num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  font: 700 1.1rem var(--head-font);
  color: var(--gold-ink);
  background: var(--gold);
  border-radius: 50%;
}
.step h3 { margin: 0 0 6px; font: 700 1.1rem var(--head-font); color: var(--gold); }
.step p { margin: 0; color: #e0d4ef; }

/* ---------- Forms ---------- */
.form-card { padding: 28px clamp(18px, 5vw, 32px); }
.form-card h1 { margin: 0 0 4px; font: 700 1.7rem var(--head-font); color: #6b2f0a; }
.form-card .sub { margin: 0 0 20px; color: var(--ink-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field .label { font-weight: 700; font-size: 0.9rem; color: #4a240a; }
.field input, .field select, .field textarea {
  font: inherit;
  color: #2a1606;
  padding: 0.65em 0.8em;
  border: 2px solid #c9a46a;
  border-radius: 10px;
  background: #fffaf0;
  color-scheme: light;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(201, 138, 27, 0.4); border-color: #a0702a; }
.field .help { font-size: 0.8rem; color: var(--ink-soft); }
.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #7a1d14;
  background: #fbe0dc;
  border: 1px solid #e3a59c;
}
.form-ok {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #1e5a33;
  background: #dff3e5;
  border: 1px solid #9fd1ae;
}
.form-foot { margin: 16px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.rec-hint { padding: 10px 12px; border-radius: 8px; background: rgba(201, 138, 27, 0.12); color: #5b3a1c; font-size: 0.9rem; }

/* ---------- Heroes (children) ---------- */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.kid-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.kid-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font: 700 1.4rem var(--head-font);
  color: #fff6da;
  background: radial-gradient(circle at 40% 35%, #c9532f, #7a1d14);
}
.kid-card h3 { margin: 0; font-size: 1.25rem; }
.kid-meta { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.kid-last { margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 0.85rem; background: rgba(160, 112, 42, 0.12); }
.add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 20px;
  text-decoration: none;
  color: var(--gold);
  border: 2px dashed rgba(255, 215, 106, 0.5);
  border-radius: 14px;
  font: 700 1.05rem var(--head-font);
}
.add-card:hover { background: rgba(255, 215, 106, 0.06); }
.add-card span { font-size: 2.2rem; line-height: 1; }

/* ---------- Quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
.quiz-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; margin-bottom: 14px; }
.quiz-head h1 { margin: 0; font: 700 clamp(1.3rem, 3.5vw, 1.7rem) var(--head-font); color: var(--gold); }
.q-count { font: 700 0.95rem var(--head-font); color: var(--muted-on-night); }
.q-dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-bottom: 18px; }
.q-dot {
  height: 30px;
  font: 600 0.75rem var(--body-font);
  color: var(--muted-on-night);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 182, 232, 0.35);
  border-radius: 6px;
  cursor: pointer;
}
.q-dot.done { color: var(--gold-ink); background: #e9c56a; border-color: #e9c56a; }
.q-dot.cur { outline: 2px solid var(--gold); outline-offset: 2px; }
.q-card { padding: 26px clamp(18px, 5vw, 32px); }
.sample-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b3a1c;
  background: rgba(160, 112, 42, 0.18);
  border-radius: 999px;
}
.q-title { margin: 0 0 6px; font: 700 0.85rem var(--head-font); letter-spacing: 0.12em; text-transform: uppercase; color: #8b5a1f; }
.speak-btn { float: left; margin: 0 12px 6px 0; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #c98a1b; background: #fff4d6; font-size: 1.4rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.speak-btn:hover, .speak-btn:focus-visible { background: #ffe7a8; }
.q-prompt { margin: 0 0 20px; max-width: 40em; font: 600 clamp(1.15rem, 3vw, 1.45rem)/1.5 var(--body-font); color: #2a1606; }
.q-image {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin: -6px auto 20px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d8bd8a;
}
.q-image-sm { max-height: 160px; margin: 0 0 10px; }
/* Drawn pictures (SVG) already have their own frame: no second frame, and room to be read. */
.q-image[src$=".svg"], .q-image[src^="data:image/svg"] { padding: 0; border: 0; background: none; width: 100%; max-width: 560px; max-height: 360px; object-fit: contain; }
@media (max-width: 560px) {
  .quiz { padding-left: 8px; padding-right: 8px; }
  .q-card { padding: 20px 12px; }
  .q-image[src$=".svg"], .q-image[src^="data:image/svg"] { max-height: none; margin-bottom: 16px; }
}
.q-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font: 600 1.15rem var(--body-font);
  text-align: left;
  color: #2a1606;
  background: #fffaf0;
  border: 2px solid #d8bd8a;
  border-radius: 12px;
  cursor: pointer;
}
.choice:hover { border-color: #a0702a; }
.choice.sel { background: #fff0c2; border-color: #c98a1b; box-shadow: 0 0 0 3px rgba(201, 138, 27, 0.3); }
.choice-key {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  font: 700 0.9rem var(--head-font);
  color: #fff6da;
  background: #8b5a1f;
  border-radius: 50%;
}
.choice.sel .choice-key { background: #c98a1b; }
.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.q-confirm { margin-top: 16px; padding: 18px; text-align: center; }
.q-confirm p { margin: 0 0 12px; }

/* ---------- Results ---------- */
.report-head { display: grid; grid-template-columns: auto 1fr; gap: 18px 24px; align-items: center; padding: 24px clamp(18px, 4vw, 32px); }
.report-score { font: 700 clamp(2.8rem, 9vw, 4rem)/1 var(--title-font); color: #5a2d0c; text-align: center; }
.report-score small { display: block; margin-top: 4px; font: 700 0.75rem var(--head-font); letter-spacing: 0.16em; color: #8b5a1f; }
.report-head h1 { margin: 0; font: 700 1.5rem var(--head-font); color: #6b2f0a; }
.report-head p { margin: 2px 0 0; color: var(--ink-soft); }
.report-actions { grid-column: 1 / -1; }
@media (max-width: 560px) { .report-head { grid-template-columns: 1fr; text-align: center; } .report-actions { justify-content: center; } }

.unlock-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 18px 0;
  padding: 18px 22px;
  border-radius: 14px;
  background: linear-gradient(120deg, #3a2160, #5a2d6e);
  border: 1px solid rgba(255, 215, 106, 0.5);
}
.unlock-banner h2 { margin: 0 0 2px; font: 700 1.15rem var(--head-font); color: var(--gold); }
.unlock-banner p { margin: 0; color: #e0d4ef; font-size: 0.92rem; }

.strip { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; margin: 4px 0 6px; }
.strip span { height: 14px; border-radius: 3px; background: var(--c); }
.ok { --c: var(--ok); }
.no { --c: var(--no); }
.legend { display: flex; gap: 16px; margin-bottom: 18px; font-size: 0.8rem; color: var(--muted-on-night); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: var(--c); }

.answer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.answer-item { padding: 16px 18px; border-left: 6px solid var(--c); }
.ai-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ai-num { font: 700 1rem var(--head-font); color: #6b2f0a; }
.ai-status { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c); }
.ai-prompt { margin: 6px 0 10px; font-size: 1.15rem; font-weight: 700; color: #2a1606; }
.ai-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.ai-choices li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(160, 112, 42, 0.35);
  background: rgba(255, 255, 255, 0.5);
}
.ai-choices li.is-correct { border-color: var(--ok); background: #e3f4e8; }
.ai-choices li.is-wrong { border-color: var(--no); background: #fbe3df; }
.tag { padding: 1px 7px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 999px; color: #fff; }
.tag-you { background: #6b4a2a; }
.tag-ans { background: var(--ok); }
.ai-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; font-size: 0.92rem; color: #4a240a; }
.pic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0.35em 0.9em;
  font: 700 0.8rem var(--head-font);
  letter-spacing: 0.02em;
  color: #1e5a33;
  background: #e3f4e8;
  border: 2px solid #2f8a4f;
  border-radius: 999px;
  cursor: pointer;
}
.pic-btn:hover { background: #d2ecd9; }
.pic-btn.locked { color: #5a5068; background: #ece6f2; border-color: #8a7fa8; }
.pic-btn.locked:hover { background: #e0d8ea; }
.modal.modal-wide { width: min(100%, 780px); }
.locked-art { display: block; width: min(100%, 320px); height: auto; margin: 0 auto 14px; }
.locked-solution {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed #b08a4a;
  background: rgba(90, 45, 110, 0.07);
  font-size: 0.88rem;
  color: #5b3a1c;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 5, 20, 0.7);
}
.modal { width: min(100%, 460px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; text-align: center; }
.modal h2 { margin: 0 0 8px; }
.modal ul { text-align: left; margin: 0 0 16px; padding-left: 1.2em; }
.modal .note { margin: 0 0 18px; padding: 10px 12px; font-size: 0.85rem; border-radius: 8px; background: rgba(160, 112, 42, 0.12); }

/* ---------- Admin ---------- */
.admin-section { padding: 22px clamp(16px, 4vw, 28px); margin-bottom: 22px; }
.admin-section h2 { margin: 0 0 4px; font-size: 1.3rem; }
.admin-section > p { margin: 0 0 16px; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid rgba(160, 112, 42, 0.3); vertical-align: middle; }
.table th { font: 700 0.75rem var(--head-font); letter-spacing: 0.08em; text-transform: uppercase; color: #8b5a1f; }
.table code { font-size: 0.8rem; color: #5b3a1c; }
.status { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.status.on { color: #1e5a33; background: #d5efdc; }
.status.off { color: #6b5a50; background: #e6ddd2; }
.grade-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.grade-checks label { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.coverage { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.coverage li { padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.5); font-size: 0.85rem; }
.coverage li.missing { background: #fbe0dc; color: #7a1d14; }
textarea.code { font: 0.82rem/1.4 ui-monospace, Menlo, monospace; min-height: 180px; }
pre.code-sample { overflow-x: auto; margin: 0 0 12px; padding: 12px; font-size: 0.78rem; border-radius: 8px; background: #2a1a0d; color: #f4e4bc; }

.empty { padding: 28px; text-align: center; }

/* ---------- Adventure map (assets/map.png + HTML entrances) ---------- */
.map { position: absolute; inset: 0; }
.map-node {
  --s: 1; /* entrance zoom: 1.15 while hovered, focused, or selected */
  position: absolute;
  left: calc(var(--bx) * 100% / 1536);   /* anchored at the badge center */
  top: calc(var(--by) * 100% / 1024);
  z-index: 3;
  display: flex;
  align-items: flex-start;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  transform: translate(-3.1cqw, -3.1cqw) scale(var(--s));
  transform-origin: 3.1cqw 3.1cqw;
  transition: transform 200ms ease;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.map-node::before { content: ""; position: absolute; inset: -6px; } /* extra touch area on small screens */
.gate-badge {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  place-items: center;
  width: 6.2cqw;
  height: 6.2cqw;
  border-radius: 50%;
  font: 700 4.1cqw/1 Georgia, "Times New Roman", serif;
  color: #fff;
  text-shadow: 0 0.2cqw 0 rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 38% 30%, color-mix(in srgb, var(--badge) 55%, #fff), var(--badge) 55%, color-mix(in srgb, var(--badge) 65%, #000));
  border: 0.5cqw solid #e7b444;
  box-shadow: 0 0 0 0.18cqw #7a4a12, 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.35);
  transition: box-shadow 200ms ease;
}
.gate-plaque {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: calc(var(--pw) * 100cqw / 1536);
  height: 6.1cqw;
  margin: calc(var(--py) * 100cqw / 1536 + 0.05cqw) 0 0 -1.4cqw;
  padding: 0 0.5cqw 0 1.4cqw;
  line-height: 1.1;
  background: linear-gradient(#fdf0d0, #f1d6a0);
  border: 0.25cqw solid #a8743a;
  border-radius: 0.9cqw;
  box-shadow: inset 0 0 0 0.2cqw rgba(255, 255, 255, 0.5), 0 0.35cqw 0.7cqw rgba(60, 30, 5, 0.35);
  transition: box-shadow 200ms ease;
}
.gate-plaque b { font: 700 2.3cqw Georgia, "Times New Roman", serif; color: var(--ink); }
.gate-plaque > span:not(.gate-note):not(.node-enter) { font: 700 1.48cqw Georgia, "Times New Roman", serif; color: #3a2410; white-space: nowrap; }
.gate-note {
  position: absolute;
  top: -1.1cqw;
  right: 0.6cqw;
  padding: 0.15cqw 0.6cqw;
  font: 700 0.95cqw var(--body-font);
  color: #fff;
  white-space: nowrap;
  background: #2f8a4f;
  border-radius: 999px;
  box-shadow: 0 0.15cqw 0.4cqw rgba(0, 0, 0, 0.3);
}
.node-enter {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 0.6cqw);
  padding: 0.4cqw 1.1cqw;
  font: 700 max(12px, 1.25cqw) var(--head-font);
  white-space: nowrap;
  color: var(--gold-ink);
  background: linear-gradient(#ffe08a, var(--gold-2));
  border: 0.15cqw solid #8a5a12;
  border-radius: 999px;
  box-shadow: 0 0.3cqw 0.8cqw rgba(60, 30, 5, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.map-node.soon .gate-plaque, .map-node.soon .gate-badge { filter: grayscale(0.7); }
.map-node.soon .node-enter { color: #fff; background: #7b6f8f; border-color: #5a5068; }

/* Active entrance: mouse hover (desktop only), keyboard focus, or the first tap on touch screens. */
.map-node.is-selected, .map-node:focus-visible { --s: 1.15; z-index: 10; outline: none; }
.map-node.is-selected .gate-badge, .map-node:focus-visible .gate-badge {
  box-shadow: 0 0 0 0.18cqw #7a4a12, 0 0 0 0.7cqw rgba(255, 215, 106, 0.55), 0 0 2.4cqw 0.8cqw rgba(255, 200, 80, 0.75);
}
.map-node.is-selected .gate-plaque, .map-node:focus-visible .gate-plaque {
  box-shadow: inset 0 0 0 0.2cqw rgba(255, 255, 255, 0.5), 0 0 2cqw 0.5cqw rgba(255, 200, 80, 0.7);
}
.map-node.is-selected .node-enter, .map-node:focus-visible .node-enter { opacity: 1; }
.map-node:focus-visible .gate-plaque { outline: 3px solid var(--gold-2); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .map-node:hover { --s: 1.15; z-index: 10; }
  .map-node:hover .gate-badge { box-shadow: 0 0 0 0.18cqw #7a4a12, 0 0 0 0.7cqw rgba(255, 215, 106, 0.55), 0 0 2.4cqw 0.8cqw rgba(255, 200, 80, 0.75); }
  .map-node:hover .gate-plaque { box-shadow: inset 0 0 0 0.2cqw rgba(255, 255, 255, 0.5), 0 0 2cqw 0.5cqw rgba(255, 200, 80, 0.7); }
  .map-node:hover .node-enter { opacity: 1; }
}

/* Respect reduced-motion: no zoom; the glow still shows which entrance is active. */
@media (prefers-reduced-motion: reduce) {
  .map-node, .map-node:hover, .map-node:focus-visible, .map-node.is-selected { --s: 1 !important; transition: none; }
  .gate-badge, .gate-plaque, .node-enter { transition: none; }
}

.btn-upgrade { background: linear-gradient(180deg, #ffe08a, #e0a12a); color: #3b1f05; border: 2px solid #fff4d6; box-shadow: 0 0 0 3px rgba(224,161,42,.45), 0 4px 12px rgba(0,0,0,.35); font-weight: 800; }
.map-bar {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}
.pan-hint { display: none; }
.grade-jump { display: none; }
.loading { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: #f7d77a; font-weight: 700; }
.loading-crown { font-size: 3rem; animation: mk-bounce 1s ease-in-out infinite; }
@keyframes mk-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .loading-crown { animation: none; } }

/* ---------- Member map ---------- */
.free-entrance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 18px;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(120deg, #1f4a3a, #2f6b4a);
  border: 1px solid rgba(255, 215, 106, 0.45);
}
.free-entrance > div { flex: 1; min-width: 200px; }
.free-entrance h2 { margin: 0; font: 700 1.15rem var(--head-font); color: var(--gold); }
.free-entrance p { margin: 2px 0 0; font-size: 0.9rem; color: #dcefe2; }
.fe-icon { font-size: 2.2rem; }
.hero-picks { display: grid; gap: 8px; margin: 0 0 16px; text-align: left; }
.hero-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  border: 2px solid #d8bd8a;
  border-radius: 12px;
  background: #fffaf0;
}
.hero-pick:hover { border-color: #a0702a; }
.hero-pick.is-rec { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(224, 161, 42, 0.3); }
.hero-pick .avatar { width: 40px; height: 40px; font-size: 1.1rem; }
.hero-pick small { color: var(--ink-soft); }
button.hero-pick { width: 100%; font: inherit; text-align: left; cursor: pointer; }

/* Member test sets 1–5 */
.set-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0 0 16px; }
.set-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 10px 8px;
  text-decoration: none;
  color: var(--ink);
  border: 2px solid #d8bd8a;
  border-radius: 12px;
  background: #fffaf0;
}
.set-pick b { font: 700 1rem var(--head-font); }
.set-pick small { color: var(--ink-soft); font-size: 0.8rem; }
a.set-pick:hover, a.set-pick:focus-visible { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(224, 161, 42, 0.3); }
.set-pick.is-off { opacity: 0.55; }

.quiz-exit { margin: 22px 0 0; text-align: center; font-size: 0.85rem; }
.quiz-exit a { color: var(--muted-on-night); }
.muted { color: #8b7a66; font-size: 0.85rem; }
.modal .lc-code { margin: 0; }

/* ---------- Full-screen art pages: welcome + adventure map ---------- */
body.art-mode .site-header,
body.art-mode .site-footer { display: none; }
.artscreen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #2a3f5e;
}
.art-blur {
  /* blurred copy of the art fills any letterbox area around the picture */
  position: absolute;
  inset: -40px;
  background: center / cover no-repeat;
  filter: blur(24px) brightness(0.75);
}
.art-stage {
  position: relative;
  container-type: inline-size; /* cqw units scale the map entrances with the art */
  width: min(100vw, 150dvh);
  aspect-ratio: 3 / 2;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}
.art-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.hotspot {
  position: absolute;
  z-index: 4;
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.hotspot:hover, .hotspot:focus-visible {
  outline: none;
  background: rgba(255, 240, 180, 0.12);
  box-shadow: 0 0 0 3px rgba(255, 215, 106, 0.95), 0 0 28px rgba(255, 215, 106, 0.8);
}
.hotspot:active { transform: scale(0.97); }
/* hotspot positions are percentages of each 1536 × 1024 artwork */
.art-welcome .hs-free  { left: 22.9%; top: 62.3%; width: 26.7%; height: 13.5%; border-radius: 1.4vmin; }
.art-welcome .hs-login { left: 51.0%; top: 62.3%; width: 26.6%; height: 13.5%; border-radius: 1.4vmin; }
.art-welcome .hs-sound    { left: 86.8%; top: 2.0%; width: 5.3%; height: 8.0%; border-radius: 50%; }
.art-welcome .hs-settings { left: 93.5%; top: 2.0%; width: 5.3%; height: 8.0%; border-radius: 50%; }
.art-map .hs-home     { left: 2.9%; top: 2.0%; width: 10.7%; height: 16%; border-radius: 30%; }
.art-map .hs-sound    { left: 86.1%; top: 1.9%; width: 5.35%; height: 8.0%; border-radius: 50%; }
.art-map .hs-settings { left: 93.2%; top: 1.9%; width: 5.35%; height: 8.0%; border-radius: 50%; }
.hs-sound.muted::after {
  /* red slash over the painted speaker when sound is off */
  content: "";
  position: absolute;
  left: 12%;
  top: 46%;
  width: 76%;
  height: 9%;
  border-radius: 2px;
  background: #d8352a;
  box-shadow: 0 0 0 1.5px #fff6da;
  transform: rotate(-45deg);
}

/* Phones held upright: show the map at full height and let it pan sideways,
   so the entrances stay large enough to read and tap. */
@media (max-width: 700px) and (orientation: portrait) {
  .artscreen.pannable { display: block; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
  .artscreen.pannable .art-blur { display: none; }
  .artscreen.pannable .art-stage { width: calc(100dvh * 1.5); height: 100dvh; }
  /* Grade buttons along the bottom: every grade one tap away, no swiping needed. */
  .artscreen.pannable .grade-jump {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    position: fixed; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 21;
    padding: 8px; border-radius: 16px; background: rgba(27, 20, 64, .88); box-shadow: 0 4px 16px rgba(0,0,0,.35);
  }
  .artscreen.pannable .grade-jump button {
    min-height: 40px; border-radius: 999px; border: 2px solid #c98a1b; background: #fff4d6; color: #5a3418;
    font: 700 .95rem var(--head-font); cursor: pointer;
  }
  .artscreen.pannable ~ .map-bar, .map-bar { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
  .artscreen.pannable .pan-hint {
    display: block;
    position: fixed;
    left: 50%;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    margin: 0;
    padding: 8px 16px;
    font: 700 0.85rem var(--head-font);
    color: #fff6da;
    background: rgba(20, 12, 40, 0.75);
    border-radius: 999px;
    transform: translateX(-50%);
    pointer-events: none;
    animation: hint-out 0.6s ease 4s forwards;
  }
}
@keyframes hint-out { to { opacity: 0; } }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  font-weight: 700;
}

/* ---------- Membership ---------- */
.solution {
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef6ea;
  border: 1px solid #a9cf9c;
  color: #23401c;
  font-size: 0.95rem;
}
.solution p { margin: 4px 0 0; }
.solution-steps { margin: 6px 0 0; padding-left: 1.4em; }
.solution-steps li { margin: 3px 0; }
.solution-image { display: block; width: 100%; max-width: 720px; height: auto; margin: 12px auto 4px; border-radius: 12px; border: 1px solid #c9dcc0; }
.join-card h1 { font-size: 1.9rem; }
.price-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 6px 0 12px; }
.price-card { border: 2px solid #d9c49b; border-radius: 14px; padding: 14px; background: #fffaf0; display: grid; gap: 4px; justify-items: center; text-align: center; }
.price-card.best { border-color: #c98a1b; box-shadow: 0 0 0 3px rgba(201,138,27,.15); }
.price-card .amt { font-size: 2rem; font-weight: 700; color: #5a3418; }
.price-card small { color: #8b5a1f; }
.price-card .btn { margin-top: 8px; }
.early-note { text-align: center; }
.compare-wrap { overflow-x: auto; margin: 10px 0 6px; }
.compare { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; background: #fffaf0; border: 2px solid #d9c49b; border-radius: 14px; overflow: hidden; }
.compare th, .compare td { padding: 10px 12px; text-align: center; border-bottom: 1px solid #eadcbc; vertical-align: middle; }
.compare thead th { background: #f3e5c4; color: #5a3418; font-size: 1.05rem; }
.compare thead th:last-child { background: #f7d77a; }
.compare tbody th { text-align: left; color: #5a3418; font-weight: 700; }
.compare tbody td:last-child { background: #fff4d6; }
.compare tr:last-child th, .compare tr:last-child td { border-bottom: 0; }
.compare small { color: #8b5a1f; font-weight: normal; }
.compare .no { color: #c0392b; font-weight: 700; }
.compare-note { font-size: .85rem; text-align: center; }
.perks-title { font-size: 1.1rem; margin: 18px 0 10px; color: #6b4a1f; }
.perks-title small { font-weight: normal; font-size: .85rem; color: #8b5a1f; }
.solution-locked { background: #f6efe0; border-color: #d9c49b; }
.solution-locked p { margin: 6px 0 0; }
.perks { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.perks li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(160, 112, 42, 0.3);
  color: #4a240a;
}
.perks li span { font-size: 1.6rem; line-height: 1.2; }
.join-card .note { margin: 0 0 16px; padding: 10px 12px; text-align: center; border-radius: 8px; background: rgba(160, 112, 42, 0.12); }

/* Fractions: numerator over denominator */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.12em;
  font-size: 0.85em;
  line-height: 1.05;
  text-align: center;
}
.frac-num { padding: 0 0.15em 0.04em; border-bottom: 0.09em solid currentColor; }
.frac-den { padding: 0.04em 0.15em 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A hero's test reports */
.report-list { display: grid; gap: 10px; }
.report-row { display: grid; grid-template-columns: 1.3fr 2fr auto auto; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.rr-test { color: #6b4a22; }
.report-row:hover, .report-row:focus-visible { outline: 2px solid #c98a1b; }
.rr-title { font-size: 1.05rem; }
.rr-title b { color: #8b5a1f; }
.rr-score { font-size: 1.15rem; white-space: nowrap; }
.rr-go { color: #8b5a1f; font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) { .report-row { grid-template-columns: 1fr auto; } .rr-test { grid-column: 1 / -1; order: 3; font-size: .9rem; } .rr-go { display: none; } }
.solution .speak-btn { float: right; margin: 0 0 6px 12px; width: 40px; height: 40px; font-size: 1.2rem; }
.renewal-off { background: #fff4d6; border: 1px solid #e3b25a; border-radius: 10px; padding: 10px 14px; }
