:root {
  --ink: #f6ecdd;
  --muted: #d7c7b4;
  --paper: #fff8ec;
  --paper-2: #f7ead8;
  --night: #12091f;
  --night-2: #211036;
  --purple: #5b2b7a;
  --purple-2: #7b3f9e;
  --gold: #f7c46c;
  --gold-light: #ffe0a1;
  --copper: #cf7f4d;
  --teal: #73d7cc;
  --teal-light: #b8fff5;
  --green: #97bf95;
  --rose: #ee9ab0;
  --charcoal: #2b2620;
  --danger: #da6c62;
  --success: #8fca8d;
  --max: 1440px;
  --radius: 26px;
  --shadow: 0 24px 64px rgba(8, 3, 14, 0.32);
  --tracker-height: 74px;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  max-width: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
  background: var(--night);
  overflow-x: clip;
}

body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding-bottom: calc(var(--tracker-height) + env(safe-area-inset-bottom) + 26px);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(123, 63, 158, .25), transparent 28%),
    radial-gradient(circle at 95% 12%, rgba(115, 215, 204, .12), transparent 24%),
    radial-gradient(circle at 50% 65%, rgba(247, 196, 108, .08), transparent 34%),
    linear-gradient(180deg, #12091f 0%, #211036 45%, #12091f 100%);
  font-family: "Nunito Sans", Arial, sans-serif;
  line-height: 1.65;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .34;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.42) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(247,196,108,.38) 0 1px, transparent 1.5px);
  background-position: 0 0, 42px 55px;
  background-size: 96px 96px, 140px 140px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

body.modal-open { overflow: hidden; }

img, svg, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

h1, h2, h3, h4, p { overflow-wrap: anywhere; }

h1, h2, h3 {
  font-family: "Cinzel", Georgia, serif;
  line-height: 1.08;
}

p { margin-top: 0; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -90px;
  z-index: 9999;
  padding: 10px 14px;
  color: var(--night);
  background: var(--gold);
  border-radius: 12px;
  font-weight: 900;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.section-shell,
.hero-shell,
.footer-shell {
  width: min(var(--max), calc(100% - 32px));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease, background .16s ease;
}
.button:hover,
.button:focus-visible { transform: translateY(-2px); filter: brightness(1.06); }
.button:disabled { cursor: not-allowed; opacity: .52; transform: none; filter: none; }
.button-gold {
  color: var(--night-2);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: 0 12px 30px rgba(247,196,108,.18);
}
.button-teal {
  color: #0e2230;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
}
.button-ghost {
  color: var(--ink);
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
}
.button-small { min-height: 40px; padding: 9px 14px; font-size: .88rem; }
.button-wide { width: 100%; }
.text-button {
  padding: 8px 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
}

.quest-hero { padding: clamp(18px, 3vw, 36px) 0 22px; }
.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  gap: clamp(18px, 4vw, 54px);
  align-items: stretch;
}
.hero-copy,
.boss-card {
  min-width: 0;
  border: 1px solid rgba(247,196,108,.35);
  border-radius: 30px;
  background:
    radial-gradient(circle at 92% 5%, rgba(115,215,204,.14), transparent 29%),
    linear-gradient(145deg, rgba(49,25,76,.98), rgba(18,9,31,.98));
  box-shadow: var(--shadow);
}
.hero-copy { padding: clamp(22px, 4vw, 48px); }
.brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: .83rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.brand-logo {
  width: 64px;
  height: 50px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 8px 22px rgba(0,0,0,.24);
}
.hero-copy h1 {
  max-width: 900px;
  margin: 0 0 16px;
  color: var(--gold);
  font-size: clamp(2.35rem, 5.7vw, 5.4rem);
  letter-spacing: -.035em;
}
.hero-lead {
  max-width: 780px;
  margin-bottom: 18px;
  color: var(--paper);
  font-family: "Lora", Georgia, serif;
  font-size: clamp(1rem, 1.55vw, 1.19rem);
}
.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.hero-notes span {
  padding: 7px 11px;
  color: var(--gold-light);
  border: 1px solid rgba(247,196,108,.25);
  border-radius: 999px;
  background: rgba(247,196,108,.07);
  font-size: .78rem;
  font-weight: 900;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.boss-card {
  display: grid;
  grid-template-columns: minmax(170px, .78fr) minmax(220px, 1fr);
  overflow: hidden;
}
.boss-image-wrap {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  background: #100819;
}
.boss-image-wrap img {
  width: 100%;
  height: 100%;
  min-height: 310px;
  object-fit: cover;
  transition: filter .5s ease, transform .5s ease, opacity .5s ease;
}
.boss-image-wrap[data-stage="1"] img { filter: saturate(.94) brightness(.94); }
.boss-image-wrap[data-stage="2"] img { filter: saturate(.86) brightness(.86) contrast(1.08); transform: scale(1.015); }
.boss-image-wrap[data-stage="3"] img { filter: saturate(.72) brightness(.78) contrast(1.12); transform: scale(1.03); }
.boss-image-wrap[data-stage="4"] img { filter: saturate(.48) brightness(.68) contrast(1.2); transform: scale(1.045); }
.boss-image-wrap[data-stage="5"] img { filter: grayscale(.82) brightness(.55); opacity: .6; transform: scale(.98); }
.boss-image-runes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 44%, rgba(247,196,108,.18));
  mix-blend-mode: screen;
}
.boss-status-copy { padding: 24px 24px 20px; }
.boss-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.boss-heading-row h2 { margin: 0 0 14px; color: var(--gold-light); font-size: clamp(1.35rem, 2.3vw, 2rem); }
.boss-heading-row strong { color: var(--teal); font-size: 1.25rem; }
.boss-kicker { margin: 0 0 4px; color: var(--muted); font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.health-track {
  height: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(0,0,0,.28);
}
.health-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--copper), var(--gold));
  transition: width .6s cubic-bezier(.22,.9,.3,1);
}
#bossStageMessage { min-height: 50px; margin: 0 0 12px; color: var(--muted); font-family: "Lora", Georgia, serif; font-size: .94rem; }
.scale-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.scale {
  position: relative;
  aspect-ratio: .82;
  border: 1px solid rgba(247,196,108,.45);
  border-radius: 60% 60% 54% 54% / 52% 52% 72% 72%;
  background: linear-gradient(150deg, #ffe0a1, #cf7f4d 55%, #6d2f35);
  box-shadow: inset 0 1px rgba(255,255,255,.4), 0 4px 9px rgba(0,0,0,.18);
  transition: transform .45s ease, filter .45s ease, opacity .45s ease;
}
.scale::after {
  content: "";
  position: absolute;
  left: 48%;
  top: 12%;
  width: 2px;
  height: 75%;
  background: rgba(52,17,35,.35);
  transform: rotate(16deg);
  opacity: 0;
}
.scale.broken { transform: rotate(-9deg) scale(.78); filter: grayscale(.9) brightness(.5); opacity: .38; }
.scale.broken::after { opacity: 1; }
.scale.breaking { animation: scaleBreak .65s ease both; }
@keyframes scaleBreak { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(6deg); filter: brightness(1.5); } 100% { transform: scale(.78) rotate(-9deg); } }

.quest-intro { padding: 20px 0 8px; }
.section-heading {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(300px, 1.15fr);
  gap: clamp(18px, 4vw, 52px);
  align-items: end;
  margin-bottom: 22px;
}
.section-heading h2 { margin: 0; color: var(--gold); font-size: clamp(1.8rem, 3.8vw, 3.15rem); }
.section-heading > p { margin: 0; color: var(--muted); font-family: "Lora", Georgia, serif; }
.compact-heading { margin-bottom: 16px; }

.control-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.control-button {
  min-width: 0;
  padding: 14px 16px;
  color: var(--ink);
  text-align: left;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  cursor: pointer;
}
.control-button span { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.control-button strong { display: block; margin-top: 3px; color: var(--gold-light); }
.control-button:hover,
.control-button:focus-visible { border-color: rgba(247,196,108,.45); background: rgba(247,196,108,.08); }

.chapter-nav {
  display: flex;
  gap: 8px;
  padding: 10px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chapter-nav::-webkit-scrollbar { display: none; }
.chapter-nav a {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  font-size: .83rem;
  font-weight: 900;
  text-decoration: none;
}
.chapter-nav a:hover,
.chapter-nav a:focus-visible { color: var(--night); background: var(--gold); }

.chapter-stack { padding: 8px 0 22px; }
.chapter {
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid rgba(247,196,108,.28);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(49,25,76,.9), rgba(18,9,31,.92));
  box-shadow: 0 18px 48px rgba(0,0,0,.18);
}
.chapter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px);
  list-style: none;
  cursor: pointer;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter-title-block { min-width: 0; }
.chapter-title-block small { display: block; margin-bottom: 4px; color: var(--teal); font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.chapter-title-block h2 { margin: 0 0 6px; color: var(--gold); font-size: clamp(1.35rem, 2.7vw, 2.3rem); }
.chapter-title-block p { margin: 0; color: var(--muted); font-family: "Lora", Georgia, serif; font-size: .91rem; }
.chapter-count { flex: 0 0 auto; display: grid; place-items: center; min-width: 72px; min-height: 54px; padding: 8px; color: var(--gold-light); border: 1px solid rgba(247,196,108,.25); border-radius: 15px; background: rgba(247,196,108,.07); font-size: .82rem; font-weight: 900; text-align: center; }
.chapter-count span { display: block; font-size: 1.2rem; }
.chapter[open] > summary { border-bottom: 1px solid rgba(255,255,255,.08); }
.quest-list { display: grid; gap: 10px; padding: 14px; }

.quest-card {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  background: rgba(255,255,255,.045);
  transition: border-color .2s ease, background .2s ease, opacity .2s ease;
}
.quest-card.completed { border-color: rgba(151,191,149,.52); background: rgba(151,191,149,.09); }
.quest-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 15px;
  list-style: none;
  cursor: pointer;
}
.quest-card > summary::-webkit-details-marker { display: none; }
.quest-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: var(--night);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  font-weight: 1000;
}
.quest-card.completed .quest-number { color: #132013; background: linear-gradient(135deg, var(--green), #dff1cb); }
.quest-summary-copy { min-width: 0; }
.quest-summary-copy h3 { margin: 0 0 3px; color: var(--paper); font-family: "Nunito Sans", Arial, sans-serif; font-size: 1rem; line-height: 1.25; }
.quest-summary-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .74rem; font-weight: 800; }
.quest-summary-meta span { white-space: nowrap; }
.quest-xp-badge { color: var(--teal-light); font-size: .8rem; font-weight: 1000; white-space: nowrap; }
.quest-card.completed .quest-xp-badge { color: #cce8bc; }
.quest-body { padding: 0 15px 16px 69px; }
.quest-read-aloud {
  margin: 0 0 12px;
  padding: 13px 14px;
  color: var(--paper);
  border-left: 3px solid var(--copper);
  border-radius: 0 12px 12px 0;
  background: rgba(0,0,0,.16);
  font-family: "Lora", Georgia, serif;
}
.quest-objective { margin: 0 0 10px; color: var(--ink); }
.quest-path-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px solid rgba(115,215,204,.2);
  border-radius: 12px;
  background: rgba(115,215,204,.06);
  font-size: .88rem;
}
.quest-path-note strong { color: var(--teal-light); }
.quest-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quest-complete-button[aria-pressed="true"] { color: #152214; background: linear-gradient(135deg, var(--green), #e0f2c9); }
.quest-mini-button {
  min-height: 42px;
  padding: 9px 13px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  font-weight: 900;
  cursor: pointer;
}
.quest-mini-button:hover,
.quest-mini-button:focus-visible { border-color: rgba(247,196,108,.5); }
.share-bonus-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  font-size: .82rem;
}
.share-bonus-row label { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; cursor: pointer; }
.share-bonus-row input { width: 19px; height: 19px; accent-color: var(--gold); }
.share-bonus-row a { color: var(--teal-light); font-weight: 900; }
.quest-result-box {
  margin-top: 12px;
  padding: 12px 14px;
  color: var(--gold-light);
  border: 1px solid rgba(247,196,108,.26);
  border-radius: 13px;
  background: rgba(247,196,108,.07);
}

.finale-shell { padding: 16px 0 32px; }
.finale-lock {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 20px;
  align-items: center;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(247,196,108,.38);
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 20%, rgba(238,154,176,.15), transparent 28%),
    linear-gradient(145deg, rgba(59,28,91,.96), rgba(18,9,31,.98));
  box-shadow: var(--shadow);
}
.finale-lock.unlocked { border-color: rgba(115,215,204,.58); box-shadow: 0 0 0 1px rgba(115,215,204,.12), var(--shadow); }
.lock-mark { display: grid; place-items: center; width: 64px; height: 64px; color: var(--gold); border: 1px solid rgba(247,196,108,.45); border-radius: 50%; background: rgba(247,196,108,.08); font-size: 2rem; }
.finale-lock h2 { margin: 0 0 6px; color: var(--gold); font-size: clamp(1.6rem, 3.4vw, 2.8rem); }
.finale-lock p { margin-bottom: 0; color: var(--muted); }

.map-inline { padding: 28px 0; }
.map-preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(247,196,108,.34);
  border-radius: 24px;
  background: #09050f;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.map-preview img { display: block; width: 100%; max-height: 620px; object-fit: contain; background: #101010; }
.map-preview span { position: absolute; right: 16px; bottom: 16px; padding: 9px 14px; color: var(--night); border-radius: 999px; background: var(--gold); font-weight: 1000; }

.vendor-section { padding: 38px 0 32px; }
.vendor-tools { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr); gap: 12px; align-items: center; margin-bottom: 18px; }
.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 15px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  outline: none;
  background: rgba(255,255,255,.06);
}
.search-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(115,215,204,.12); }
.vendor-filter { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.vendor-filter::-webkit-scrollbar { display: none; }
.vendor-filter button {
  flex: 0 0 auto;
  padding: 8px 11px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
}
.vendor-filter button.active { color: var(--night); border-color: var(--gold); background: var(--gold); }
.vendor-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.vendor-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 17px;
  background: rgba(255,255,255,.045);
}
.vendor-card h3 { margin: 0 0 6px; color: var(--paper); font-family: "Nunito Sans", Arial, sans-serif; font-size: 1rem; }
.vendor-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-bottom: 10px; color: var(--muted); font-size: .74rem; font-weight: 800; }
.vendor-card p { margin: 0 0 12px; color: var(--muted); font-size: .84rem; }
.vendor-card a { align-self: flex-start; margin-top: auto; color: var(--teal-light); font-size: .82rem; font-weight: 900; }
.vendor-empty { grid-column: 1 / -1; padding: 28px; color: var(--muted); text-align: center; border: 1px dashed rgba(255,255,255,.16); border-radius: 18px; }

.completed-chapter {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(320px,1fr);
  gap: clamp(24px, 5vw, 60px);
  padding: 48px 0;
  align-items: center;
}
.completed-chapter h2 { margin: 0 0 12px; color: var(--gold); font-size: clamp(1.8rem, 3.6vw, 3rem); }
.completed-chapter p { color: var(--muted); font-family: "Lora", Georgia, serif; }
.completed-cards { display: grid; gap: 9px; }
.completed-cards article { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid rgba(151,191,149,.28); border-radius: 15px; background: rgba(151,191,149,.07); }
.completed-cards span { color: #cfe8c2; font-weight: 900; }

.site-footer { border-top: 1px solid rgba(255,255,255,.08); background: rgba(8,3,14,.42); }
.footer-shell { padding: 30px 0 36px; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer-brand img { width: 58px; height: 46px; object-fit: contain; border-radius: 10px; background: white; }
.footer-brand strong, .footer-brand span { display: block; }
.footer-brand span { color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.footer-links a { color: var(--teal-light); font-weight: 900; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-note { max-width: 900px; margin: 0; color: var(--muted); font-size: .82rem; }

.floating-tracker {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 900;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  min-height: var(--tracker-height);
  overflow: hidden;
  border: 1px solid rgba(247,196,108,.52);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(18,9,31,.97), rgba(49,25,76,.97));
  box-shadow: 0 18px 56px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(16px);
}
.tracker-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  color: var(--ink);
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.tracker-level { color: var(--gold); font-weight: 1000; white-space: nowrap; }
.tracker-xp { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--paper); font-weight: 900; white-space: nowrap; }
.tracker-scales { color: var(--teal-light); font-size: .76rem; font-weight: 900; white-space: nowrap; }
.tracker-map { min-width: 62px; color: var(--night); border: 0; background: var(--gold); font-weight: 1000; cursor: pointer; }

.toast-region { position: fixed; left: 50%; bottom: calc(var(--tracker-height) + 26px + env(safe-area-inset-bottom)); z-index: 1100; width: min(520px, calc(100% - 28px)); transform: translateX(-50%); pointer-events: none; }
.toast { margin-top: 8px; padding: 13px 15px; color: var(--ink); border: 1px solid rgba(247,196,108,.42); border-radius: 15px; background: rgba(33,16,54,.97); box-shadow: 0 16px 40px rgba(0,0,0,.4); animation: toastIn .25s ease both; }
.toast strong { color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.quest-dialog,
.level-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: min(88vh, 900px);
  padding: 0;
  overflow: visible;
  color: var(--ink);
  border: 1px solid rgba(247,196,108,.38);
  border-radius: 26px;
  background: transparent;
  box-shadow: 0 30px 100px rgba(0,0,0,.62);
}
.quest-dialog::backdrop,
.level-dialog::backdrop { background: rgba(5,2,9,.78); backdrop-filter: blur(7px); }
.dialog-card {
  position: relative;
  max-height: min(88vh, 900px);
  padding: clamp(22px, 4vw, 42px);
  overflow-y: auto;
  border-radius: 25px;
  background:
    radial-gradient(circle at 92% 8%, rgba(115,215,204,.12), transparent 28%),
    linear-gradient(145deg, #31194c, #12091f);
}
.dialog-card h2 { margin: 0 0 12px; color: var(--gold); font-size: clamp(1.65rem, 4vw, 2.8rem); }
.dialog-lead { color: var(--muted); font-family: "Lora", Georgia, serif; }
.dialog-close {
  position: sticky;
  float: right;
  top: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -5px -5px 4px 12px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: rgba(18,9,31,.82);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.field-label { display: grid; gap: 7px; margin: 18px 0; color: var(--gold-light); font-weight: 900; }
.field-label input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 13px;
  outline: 0;
  background: rgba(255,255,255,.07);
}
.field-label input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(115,215,204,.12); }
.choice-fieldset { margin: 20px 0; padding: 0; border: 0; }
.choice-fieldset legend { margin-bottom: 10px; color: var(--gold-light); font-weight: 1000; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.choice-card { position: relative; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card label {
  display: block;
  height: 100%;
  padding: 13px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  cursor: pointer;
}
.choice-card label strong { display: block; color: var(--paper); }
.choice-card label small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.choice-card input:checked + label { color: var(--night); border-color: var(--gold); background: linear-gradient(135deg, var(--gold), var(--gold-light)); }
.choice-card input:checked + label strong,
.choice-card input:checked + label small { color: var(--night); }
.style-choice-list { display: grid; gap: 9px; margin: 18px 0; }
.style-option { position: relative; }
.style-option input { position: absolute; opacity: 0; }
.style-option label { display: block; padding: 14px 15px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: rgba(255,255,255,.05); cursor: pointer; }
.style-option label strong { display: block; color: var(--gold-light); }
.style-option label small { display: block; color: var(--muted); }
.style-option input:checked + label { border-color: var(--teal); background: rgba(115,215,204,.11); }
.toggle-row { display: flex; align-items: flex-start; gap: 11px; margin: 10px 0; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.04); cursor: pointer; }
.toggle-row input { width: 21px; height: 21px; margin-top: 2px; accent-color: var(--gold); }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { color: var(--muted); }
.form-message { min-height: 24px; margin: 10px 0; color: var(--teal-light); font-weight: 800; }


/* Map launchers are anchors so they still open the map image if JavaScript is unavailable. */
.map-launch-link { text-decoration: none; }
a.control-button { text-decoration: none; }
a.tracker-map { display: grid; place-items: center; text-decoration: none; }
.map-preview { text-decoration: none; }
.map-dialog[open] { display: block; }
.map-dialog-card { width: 100%; }
.map-direct-link { justify-self: start; }

.map-dialog { width: min(1180px, calc(100% - 18px)); }
.map-dialog-card {
  position: relative;
  height: min(92vh, 920px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto auto;
}
.map-dialog-card > .dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  float: none;
  margin: 0;
}
.map-dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 12px;
  padding-right: 46px;
}
.map-dialog-heading h2 { font-size: clamp(1.2rem, 2.6vw, 2rem); }
.map-zoom-controls { display: flex; gap: 6px; }
.map-zoom-controls button { min-width: 42px; min-height: 40px; color: var(--night); border: 0; border-radius: 11px; background: var(--gold); font-weight: 1000; cursor: pointer; }
.map-viewport { position: relative; min-height: 0; overflow: hidden; touch-action: none; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; background: #0b0b0d; cursor: grab; }
.map-viewport.dragging { cursor: grabbing; }
.map-viewport img { position: absolute; left: 50%; top: 50%; width: min(1100px, 92vw); max-width: none; transform: translate(-50%, -50%) scale(1); transform-origin: center; user-select: none; pointer-events: none; }
.map-hint { margin: 10px 0 0; color: var(--muted); font-size: .82rem; }

.journal-dialog { width: min(900px, calc(100% - 22px)); }
.journal-dialog-card { min-height: min(74vh, 720px); }
.journal-title-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.journal-title-row h2 { margin-bottom: 4px; }
.journal-title-row p { margin: 0; color: var(--muted); }
.journal-tabs { display: flex; gap: 6px; margin: 20px 0 14px; overflow-x: auto; scrollbar-width: none; }
.journal-tabs::-webkit-scrollbar { display: none; }
.journal-tabs button { flex: 0 0 auto; padding: 8px 11px; color: var(--muted); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.04); font-weight: 900; cursor: pointer; }
.journal-tabs button[aria-selected="true"] { color: var(--night); border-color: var(--gold); background: var(--gold); }
.journal-panel { min-height: 280px; }
.progress-panel-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; margin-bottom: 15px; }
.stat-card { padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.05); }
.stat-card span { display: block; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; margin-top: 2px; color: var(--gold-light); font-size: 1.2rem; }
.journal-list { display: grid; gap: 8px; }
.journal-list article { padding: 13px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.04); }
.journal-list h3 { margin: 0 0 5px; color: var(--paper); font-family: "Nunito Sans", Arial, sans-serif; font-size: 1rem; }
.journal-list p { margin: 0; color: var(--muted); font-size: .86rem; }
.empty-journal { padding: 25px; color: var(--muted); text-align: center; border: 1px dashed rgba(255,255,255,.16); border-radius: 15px; }
.save-actions { display: grid; gap: 9px; }
.save-code-box { width: 100%; min-height: 118px; padding: 12px; color: var(--ink); border: 1px solid rgba(255,255,255,.14); border-radius: 13px; background: rgba(0,0,0,.18); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem; resize: vertical; }
.danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(238,154,176,.18); }
.danger-button { color: #fff; border-color: rgba(218,108,98,.46); background: rgba(218,108,98,.16); }

.result-dialog-card { text-align: center; }
.result-die,
.final-die { display: grid; place-items: center; width: 94px; height: 94px; margin: 12px auto 18px; color: var(--night); border-radius: 24px; background: linear-gradient(145deg, var(--gold-light), var(--gold)); box-shadow: 0 18px 40px rgba(247,196,108,.22); font-size: 2.5rem; font-weight: 1000; }
.result-dialog-card p { color: var(--muted); font-family: "Lora", Georgia, serif; font-size: 1.05rem; }

.relic-choice-grid { display: grid; gap: 10px; margin-top: 18px; }
.relic-button { width: 100%; padding: 16px; color: var(--ink); text-align: left; border: 1px solid rgba(247,196,108,.27); border-radius: 16px; background: rgba(247,196,108,.06); cursor: pointer; }
.relic-button strong { display: block; color: var(--gold-light); font-family: "Cinzel", Georgia, serif; font-size: 1.05rem; }
.relic-button span { display: block; margin-top: 4px; color: var(--muted); }
.relic-button:hover,
.relic-button:focus-visible { border-color: var(--teal); background: rgba(115,215,204,.08); }
.lore-card #loreText { color: var(--paper); font-family: "Lora", Georgia, serif; font-size: 1.03rem; }
.lore-card #loreText p { margin-bottom: 14px; }

.level-dialog { width: min(620px, calc(100% - 22px)); border: 0; background: transparent; }
.level-celebration { position: relative; max-height: min(88vh, 900px); overflow-x: hidden; overflow-y: auto; padding: clamp(32px, 7vw, 70px); text-align: center; border: 1px solid rgba(247,196,108,.58); border-radius: 28px; background: radial-gradient(circle at 50% 25%, rgba(247,196,108,.24), transparent 34%), linear-gradient(145deg, #4a2168, #12091f); box-shadow: 0 30px 90px rgba(0,0,0,.65); }
.level-celebration > p { margin: 0; color: var(--teal); font-weight: 1000; letter-spacing: .18em; text-transform: uppercase; }
.level-celebration > strong { display: block; margin: 4px 0; color: var(--gold); font-family: "Cinzel", Georgia, serif; font-size: clamp(4rem, 18vw, 8rem); line-height: .95; }
.level-celebration h2 { margin: 0 0 14px; color: var(--gold-light); font-size: clamp(1.55rem, 5vw, 2.7rem); }
#levelMessage { margin: 0 auto 22px; max-width: 490px; color: var(--paper); font-family: "Lora", Georgia, serif; }
.particle { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); pointer-events: none; animation: particleFly .9s ease-out forwards; }
@keyframes particleFly { from { opacity: 1; transform: translate(0,0) scale(1); } to { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(.2); } }

.final-dialog { width: min(820px, calc(100% - 22px)); }
.final-dialog-card { text-align: center; }
.final-action-grid { grid-template-columns: repeat(3, minmax(0,1fr)); text-align: left; }
.final-roll-area { display: grid; place-items: center; margin-top: 18px; }
.final-die.rolling { animation: dieRoll .7s ease; }
@keyframes dieRoll { 0% { transform: rotate(0) scale(1); } 25% { transform: rotate(75deg) scale(1.12); } 50% { transform: rotate(165deg) scale(.9); } 75% { transform: rotate(275deg) scale(1.12); } 100% { transform: rotate(360deg) scale(1); } }

.victory-dialog { width: min(880px, calc(100% - 20px)); }
.victory-card { text-align: center; }
.victory-story { max-width: 690px; margin: 0 auto 20px; color: var(--paper); font-family: "Lora", Georgia, serif; text-align: left; }
.victory-story p { margin-bottom: 14px; }
#victoryCanvas { display: block; width: min(100%, 520px); margin: 18px auto; border: 1px solid rgba(247,196,108,.35); border-radius: 18px; background: #211036; box-shadow: 0 18px 48px rgba(0,0,0,.32); }
.victory-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

.gentle-effects *,
.gentle-effects *::before,
.gentle-effects *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 1060px) {
  .hero-shell { grid-template-columns: 1fr; }
  .boss-card { grid-template-columns: minmax(200px,.7fr) minmax(0,1fr); }
  .control-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .vendor-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  :root { --tracker-height: 68px; }
  body { line-height: 1.58; }
  .section-shell, .hero-shell, .footer-shell { width: min(100% - 20px, var(--max)); }
  .quest-hero { padding-top: 10px; }
  .hero-copy, .boss-card { border-radius: 22px; }
  .hero-copy { padding: 20px 18px; }
  .brand-line { margin-bottom: 11px; }
  .brand-logo { width: 54px; height: 43px; }
  .hero-copy h1 { margin-bottom: 12px; font-size: clamp(2rem, 11vw, 3.15rem); }
  .hero-lead { font-size: .98rem; }
  .hero-notes { margin-bottom: 16px; }
  .hero-actions .button { flex: 1 1 180px; }
  .boss-card { grid-template-columns: 132px minmax(0,1fr); }
  .boss-image-wrap, .boss-image-wrap img { min-height: 218px; }
  .boss-status-copy { padding: 16px 14px 13px; }
  .boss-heading-row h2 { font-size: 1.1rem; }
  .boss-heading-row strong { font-size: 1rem; }
  #bossStageMessage { min-height: 0; font-size: .82rem; }
  .scale-grid { grid-template-columns: repeat(10, 1fr); gap: 3px; }
  .section-heading { grid-template-columns: 1fr; gap: 8px; align-items: start; }
  .section-heading h2 { font-size: 1.8rem; }
  .section-heading > p { font-size: .91rem; }
  .control-bar { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  .control-button { padding: 11px; border-radius: 14px; }
  .control-button strong { font-size: .85rem; }
  .chapter > summary { padding: 16px 14px; }
  .chapter-title-block h2 { font-size: 1.3rem; }
  .chapter-count { min-width: 58px; min-height: 48px; }
  .quest-list { padding: 8px; }
  .quest-card > summary { grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; padding: 12px 11px; }
  .quest-number { width: 38px; height: 38px; border-radius: 11px; }
  .quest-summary-copy h3 { font-size: .93rem; }
  .quest-summary-meta { font-size: .68rem; }
  .quest-body { padding: 0 11px 14px 58px; }
  .quest-read-aloud { padding: 11px; font-size: .89rem; }
  .quest-objective, .quest-path-note { font-size: .87rem; }
  .quest-actions .button, .quest-actions .quest-mini-button { flex: 1 1 145px; }
  .finale-lock { grid-template-columns: auto minmax(0,1fr); gap: 12px; padding: 18px; }
  .finale-lock .button { grid-column: 1 / -1; width: 100%; }
  .lock-mark { width: 50px; height: 50px; }
  .vendor-tools { grid-template-columns: 1fr; }
  .vendor-grid { grid-template-columns: 1fr; }
  .completed-chapter { grid-template-columns: 1fr; }
  .tracker-main { grid-template-columns: auto minmax(0,1fr); gap: 7px; padding: 9px 11px; }
  .tracker-scales { grid-column: 1 / -1; }
  .tracker-map { min-width: 55px; }
  .choice-grid, .final-action-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 20px 17px; }
  .map-dialog-card { padding: 14px; }
  .map-dialog-heading { align-items: flex-start; }
  .map-dialog-heading .eyebrow { display: none; }
  .map-zoom-controls button { min-width: 38px; }
  .journal-title-row { align-items: flex-start; }
  .progress-panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-shell { gap: 10px; }
  .hero-copy h1 { font-size: clamp(1.9rem, 10.8vw, 2.7rem); }
  .boss-card { grid-template-columns: 112px minmax(0,1fr); }
  .boss-image-wrap, .boss-image-wrap img { min-height: 206px; }
  .boss-status-copy { padding: 13px 11px 11px; }
  .boss-kicker { display: none; }
  .boss-heading-row h2 { margin-bottom: 8px; font-size: .96rem; }
  #bossStageMessage { margin-bottom: 7px; font-size: .75rem; line-height: 1.35; }
  .health-track { height: 9px; margin-bottom: 7px; }
  .scale-grid { gap: 2px; }
  .control-bar { grid-template-columns: 1fr 1fr; }
  .control-button span { font-size: .64rem; }
  .quest-body { padding-left: 11px; }
  .quest-read-aloud { margin-left: 47px; }
  .floating-tracker { left: 6px; right: 6px; bottom: max(6px, env(safe-area-inset-bottom)); border-radius: 18px; }
  .tracker-level { font-size: .86rem; }
  .tracker-xp { font-size: .8rem; }
  .tracker-scales { font-size: .67rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Shared realm tracker */
.realm-tracker {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: center;
  margin-top: 2px;
  margin-bottom: 22px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(115,215,204,.28);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 15%, rgba(115,215,204,.13), transparent 30%),
    linear-gradient(145deg, rgba(49,25,76,.94), rgba(18,9,31,.96));
  box-shadow: var(--shadow);
}
.realm-tracker-copy h2 { margin: 0 0 8px; color: var(--gold-light); font-size: clamp(1.35rem, 2.5vw, 2rem); }
.realm-tracker-copy p:last-child { margin: 0; color: var(--muted); }
.realm-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.realm-stat-grid article { min-width: 0; padding: 13px 10px; text-align: center; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.05); }
.realm-stat-grid strong { display: block; color: var(--teal-light); font-family: "Cinzel", Georgia, serif; font-size: clamp(1.25rem, 2.7vw, 2rem); line-height: 1; }
.realm-stat-grid span { display: block; margin-top: 6px; color: var(--muted); font-size: .71rem; font-weight: 800; line-height: 1.25; }
.realm-tracker-status { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .76rem; text-align: right; }

.style-story-text {
  margin: 12px 0 16px;
  padding: 12px 15px;
  color: var(--paper);
  border-left: 3px solid var(--teal);
  border-radius: 0 14px 14px 0;
  background: rgba(115,215,204,.07);
  font-family: "Lora", Georgia, serif;
  font-size: .93rem;
}

.map-direct-link { justify-self: start; margin-top: 2px; }
.final-choice-intro { max-width: 680px; margin: 0 auto 18px; color: var(--muted); font-family: "Lora", Georgia, serif; }

.reset-section {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 20px;
  align-items: center;
  margin-top: 24px;
  margin-bottom: 32px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid rgba(238,154,176,.24);
  border-radius: 24px;
  background: rgba(238,154,176,.055);
}
.reset-section h2 { margin: 0 0 8px; color: var(--paper); }
.reset-section p:last-child { max-width: 850px; margin: 0; color: var(--muted); }

@media (max-width: 900px) {
  .realm-tracker { grid-template-columns: 1fr; }
  .realm-stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .realm-tracker-status { text-align: left; }
}

@media (max-width: 620px) {
  .realm-stat-grid { gap: 6px; }
  .realm-stat-grid article { padding: 11px 7px; }
  .realm-stat-grid span { font-size: .65rem; }
  .reset-section { grid-template-columns: 1fr; }
  .reset-section .button { width: 100%; }
  .map-dialog-card { height: auto; max-height: 94dvh; }
  .map-viewport { min-height: 240px; aspect-ratio: 4 / 3; }
  .map-viewport img { width: calc(100% - 8px); height: auto; }
}


/* Reset confirmation */
.reset-dialog { width: min(680px, calc(100% - 22px)); }
.reset-dialog-card { text-align: left; }
.reset-chronicle-note {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid rgba(115,215,204,.26);
  border-radius: 16px;
  background: rgba(115,215,204,.08);
}
.reset-chronicle-note strong { display: block; color: var(--teal-light); }
.reset-chronicle-note p { margin: 7px 0 0; color: var(--muted); }
.reset-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 520px) {
  .reset-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .reset-dialog-actions .button { width: 100%; }
}

.victory-epilogue { margin-top: 22px; padding: 18px; border: 1px solid rgba(247,196,108,.24); border-radius: 16px; background: rgba(247,196,108,.07); }
.victory-epilogue h3 { margin: 0 0 10px; color: var(--gold-light); font-family: "Cinzel", Georgia, serif; }
.victory-epilogue p:last-child { margin-bottom: 0; color: var(--gold-light); }

/* Final battle sequence: keep unrevealed controls truly hidden and let the result breathe. */
[hidden] { display: none !important; }
.final-die.revealed {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(115,215,204,.13), 0 20px 48px rgba(247,196,108,.32);
}
#revealFinalOutcome { margin-top: 10px; }

.level-twenty-rewards { margin: 22px auto; }
.level-twenty-rewards .victory-actions { margin-bottom: 18px; }


/* ==========================================================================\n   Version 3 — first-step flow, restored Warden art, and compact mobile play\n   ========================================================================== */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 0; }
body:not(.game-ready) { padding-bottom: 0; }
.intro-screen { min-height: 100svh; display: grid; align-items: center; padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 75% 25%, rgba(123,63,158,.26), transparent 34%), radial-gradient(circle at 18% 82%, rgba(115,215,204,.13), transparent 30%), linear-gradient(145deg, #12091f, #211036 58%, #31194c); color: var(--ink); overflow: hidden; }
.intro-shell { width: min(1180px, 100%); margin: auto; }
.intro-brand { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 800 .82rem/1.2 "Nunito Sans", sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.intro-brand img { width: 64px; height: 50px; object-fit: contain; border-radius: 12px; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); align-items: center; gap: clamp(22px, 5vw, 70px); margin-top: 22px; }
.intro-copy h1 { margin: 8px 0 18px; max-width: 760px; color: var(--gold); font: 900 clamp(2.45rem, 6.2vw, 5.5rem)/.98 "Cinzel", Georgia, serif; letter-spacing: -.045em; text-wrap: balance; }
.intro-lead { max-width: 760px; margin: 0; color: var(--ink); font: 500 clamp(1.02rem, 2vw, 1.26rem)/1.72 "Lora", Georgia, serif; }
.three-steps { counter-reset: step; margin: 24px 0 20px; padding: 0; display: grid; gap: 10px; list-style: none; }
.three-steps li { display: flex; align-items: center; gap: 12px; color: var(--paper); font-weight: 700; }
.three-steps li::before { counter-increment: step; content: counter(step); width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; color: #211036; background: linear-gradient(135deg, var(--gold), #ffe0a1); font-weight: 900; }
.intro-notes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.intro-notes span { padding: 8px 12px; border: 1px solid rgba(247,196,108,.25); border-radius: 999px; background: rgba(255,255,255,.055); color: var(--muted); font-size: .88rem; font-weight: 800; }
.intro-button { min-width: min(100%, 260px); min-height: 58px; font-size: 1.03rem; }
.intro-dragon { position: relative; min-height: 360px; display: grid; place-items: center; }
.intro-dragon::before { content:""; position:absolute; inset: 12% 4%; border-radius: 50%; background: radial-gradient(circle, rgba(247,196,108,.18), rgba(91,43,122,.14) 42%, transparent 70%); filter: blur(18px); }
.intro-dragon img { position: relative; width: min(620px, 100%); max-height: 72svh; object-fit: contain; filter: drop-shadow(0 28px 38px rgba(0,0,0,.46)); }

.game-header { position: sticky; top: 0; z-index: 60; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px max(16px, calc((100vw - 1440px)/2)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); color: var(--paper); background: rgba(18,9,31,.92); border-bottom: 1px solid rgba(247,196,108,.24); backdrop-filter: blur(16px); }
.game-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 900 1rem/1.05 "Cinzel", serif; }
.game-brand img { width: 48px; height: 38px; object-fit: contain; border-radius: 10px; }
.game-brand small { display: block; color: var(--muted); font: 800 .62rem/1.1 "Nunito Sans", sans-serif; letter-spacing: .08em; text-transform: uppercase; }

.section-shell { width: min(1440px, calc(100% - 32px)); }
.boss-card.section-shell { margin: 30px auto 22px; display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); align-items: center; min-height: 0; padding: clamp(18px, 3vw, 34px); }
.boss-image-wrap { min-height: 250px; display: grid; place-items: center; overflow: visible; background: radial-gradient(circle, rgba(247,196,108,.12), transparent 65%); }
.boss-image-wrap img { width: min(500px, 100%); height: min(420px, 45vw); min-height: 250px; object-fit: contain; filter: drop-shadow(0 22px 26px rgba(0,0,0,.45)); transition: opacity .5s ease, filter .5s ease; }
.boss-image-wrap[data-stage] img { filter: drop-shadow(0 22px 26px rgba(0,0,0,.45)); opacity: 1; }

.quest-intro { margin-top: 22px; }
.control-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.style-story-text { border-left: 4px solid var(--teal); }

.share-bonus-row.disabled { opacity: .7; }

.realm-tracker { margin-top: 44px; }
.community-goal { margin-top: 20px; padding: 16px; border: 1px solid rgba(247,196,108,.28); border-radius: 18px; background: rgba(255,255,255,.045); }
.community-goal > div:first-child { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 9px; }
.community-goal strong { color: var(--gold); }
.community-goal span { color: var(--muted); }
.community-goal-track { height: 13px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.11); }
.community-goal-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .45s ease; }

.tools-card { max-width: 640px; }
.tool-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 20px; }
.tool-grid button { min-height: 54px; border: 1px solid rgba(247,196,108,.25); border-radius: 14px; padding: 12px; color: var(--paper); background: rgba(255,255,255,.06); font: 900 .92rem "Nunito Sans", sans-serif; cursor: pointer; }
.tool-grid button:hover { background: rgba(247,196,108,.13); }
.tool-grid .danger-tool { color: #ffd7d2; border-color: rgba(238,154,176,.35); }
.starter-card { max-width: 720px; }
.starter-actions { display: grid; gap: 10px; margin-top: 22px; }
.level-dragon { display: block; width: min(520px, 82vw); max-height: 38vh; object-fit: contain; margin: 8px auto 16px; filter: drop-shadow(0 18px 30px rgba(247,196,108,.32)); }

.map-dialog-card { grid-template-rows: auto minmax(0,1fr) auto auto; }
.map-viewport { min-height: min(68vh, 720px); }
.map-viewport img { touch-action: none; user-select: none; }

.floating-tracker { grid-template-columns: minmax(0,1fr) auto auto; }
.tracker-action { display: grid; place-items: center; min-width: 62px; border: 0; border-left: 1px solid rgba(247,196,108,.2); color: var(--paper); background: transparent; font: 900 .76rem "Nunito Sans",sans-serif; cursor: pointer; }

.toast { display: grid; gap: 3px; }
.toast span { color: var(--muted); font-size: .88rem; }
.toast.leaving { opacity: 0; transform: translateY(8px); }

@media (max-width: 800px) {
  .intro-screen { align-items: start; }
  .intro-grid { grid-template-columns: 1fr; }
  .intro-copy { order: 1; }
  .intro-dragon { order: 2; min-height: 190px; margin-top: -8px; }
  .intro-dragon img { width: min(420px, 94vw); max-height: 36svh; }
  .intro-copy h1 { font-size: clamp(2.25rem, 11.2vw, 4rem); }
  .intro-lead { line-height: 1.58; }
  .three-steps { margin-top: 19px; }
  .intro-notes { gap: 6px; }
  .intro-notes span { padding: 7px 9px; font-size: .78rem; }
  .intro-button { width: 100%; }
  .game-header { padding: 8px 12px; }
  .game-brand span { font-size: .86rem; }
  .boss-card.section-shell { grid-template-columns: 1fr; margin-top: 14px; }
  .boss-image-wrap { min-height: 190px; }
  .boss-image-wrap img { width: min(390px, 100%); height: 255px; min-height: 0; }
  .control-bar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tool-grid { grid-template-columns: 1fr; }
  .realm-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .map-viewport { min-height: 62vh; }
  .floating-tracker { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; }
  body.game-ready { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .section-shell { width: min(100% - 20px, 1440px); }
  .intro-screen { padding-left: 13px; padding-right: 13px; }
  .intro-brand img { width: 52px; height: 42px; }
  .intro-copy h1 { font-size: clamp(2.05rem, 10.7vw, 3rem); }
  .intro-lead { font-size: .98rem; }
  .game-header .button { padding-inline: 11px; }
  .control-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .control-button { min-height: 68px; padding: 10px; }
  .control-button strong { font-size: .82rem; }
  .floating-tracker { grid-template-columns: minmax(0,1fr) 54px 62px; }
  .tracker-action { min-width: 0; font-size: .69rem; }
}

/* Artist credit for the Sweet River dragon */
.intro-dragon,
.boss-image-wrap {
  margin: 0;
  align-content: center;
}

.artist-credit {
  position: relative;
  z-index: 1;
  width: min(100%, 42rem);
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  color: rgba(255, 248, 232, .84);
  font: 800 .82rem/1.35 "Nunito Sans", system-ui, sans-serif;
  text-align: center;
}

.artist-credit strong {
  color: var(--gold, #F7C46C);
}

.artist-social-links {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.artist-social-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  color: #0E2230;
  background: linear-gradient(135deg, #73D7CC, #B8FFF5);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .18);
}

.artist-social-links a:hover,
.artist-social-links a:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.level-artist-credit {
  margin-top: -8px;
  margin-bottom: 16px;
}

.level-dragon[hidden] + .level-artist-credit {
  display: none;
}

@media (max-width: 620px) {
  .artist-credit {
    font-size: .76rem;
    gap: 6px 9px;
  }

  .artist-social-links a {
    min-height: 30px;
    padding: 4px 9px;
  }
}


/* v3.0.5: simpler map viewer and easy return to the final battle */
.floating-tracker {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}
.final-ready-button {
  color: var(--night);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.floating-tracker.final-ready {
  border-color: rgba(247,196,108,.88);
  box-shadow: 0 18px 56px rgba(0,0,0,.5), 0 0 24px rgba(247,196,108,.16);
}
.final-unlock-card {
  max-width: 660px;
  text-align: center;
}
.final-unlock-card .starter-actions {
  max-width: 420px;
  margin-inline: auto;
}
.static-map-viewport {
  min-height: 0 !important;
  overflow: auto !important;
  touch-action: auto !important;
  cursor: default !important;
  background: #0b0b0d;
}
.static-map-viewport img {
  position: static !important;
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  transform: none !important;
  pointer-events: auto !important;
  touch-action: auto !important;
  user-select: auto !important;
}
@media (max-width: 800px) {
  .floating-tracker {
    grid-template-columns: minmax(0,1fr) 48px 48px 58px;
  }
  .final-ready-button {
    font-size: .66rem;
  }
  .map-dialog-card {
    max-height: 94dvh;
  }
}

/* Keep the ordinary three-part tracker compact until the final battle unlocks. */
.floating-tracker {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.floating-tracker.final-ready {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}
.tracker-action[hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  .floating-tracker {
    grid-template-columns: minmax(0,1fr) 54px 62px;
  }
  .floating-tracker.final-ready {
    grid-template-columns: minmax(0,1fr) 48px 48px 58px;
  }
}

/* v3.1.0 — shorter Sunday quest path and clearer mobile progression */
.quest-route-card {
  margin: 16px 0;
  padding: clamp(16px, 3vw, 22px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, .46fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(247,196,108,.32);
  border-radius: 20px;
  background:
    radial-gradient(circle at 92% 18%, rgba(115,215,204,.1), transparent 34%),
    linear-gradient(145deg, rgba(49,25,76,.92), rgba(18,9,31,.94));
  box-shadow: 0 16px 38px rgba(18,9,31,.18);
}
.quest-route-card .eyebrow { margin: 0 0 5px; }
.quest-route-card strong { display: block; color: var(--gold-light); font: 800 clamp(1rem, 2vw, 1.24rem)/1.35 "Lora", Georgia, serif; }
.quest-route-card > div:first-child > span { display: block; margin-top: 6px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.route-progress-track { height: 14px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.11); box-shadow: inset 0 1px 4px rgba(0,0,0,.25); }
.route-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .45s ease; }
.quest-route-card .button { white-space: nowrap; }

.control-bar { grid-template-columns: repeat(3, minmax(0,1fr)); }

.quest-xp-badge { display: grid; gap: 2px; justify-items: end; line-height: 1.05; }
.quest-xp-badge strong { color: inherit; font-size: .78rem; }
.quest-xp-badge small { color: currentColor; opacity: .82; font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }

.starter-note {
  margin: 4px 0 14px;
  padding: 10px 12px;
  color: var(--muted);
  border-left: 3px solid var(--teal);
  background: rgba(115,215,204,.07);
  font-size: .9rem;
  line-height: 1.5;
}

.realm-tracker.realm-tracker-compact {
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: center;
  margin-top: 38px;
  padding: clamp(20px, 4vw, 34px);
}
.realm-goal-panel { min-width: 0; }
.realm-goal-number { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.realm-goal-number strong { color: var(--teal-light); font: 900 clamp(2.4rem, 7vw, 4.8rem)/.95 "Cinzel", Georgia, serif; }
.realm-goal-number span { max-width: 13ch; color: var(--muted); font-size: .85rem; font-weight: 900; line-height: 1.25; text-transform: uppercase; letter-spacing: .05em; }
.realm-tracker-compact .community-goal { margin-top: 0; }
.realm-quick-stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 12px; }
.realm-quick-stats > span { padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.045); font-size: .77rem; font-weight: 800; line-height: 1.35; }
.realm-quick-stats strong { display: block; margin-bottom: 3px; color: var(--gold-light); font: 900 1.35rem/1 "Cinzel", Georgia, serif; }
.realm-more { margin-top: 10px; color: var(--muted); }
.realm-more summary { cursor: pointer; color: var(--teal-light); font-size: .82rem; font-weight: 900; }
.realm-more p { margin: 9px 0 0; font-size: .78rem; }
.realm-tracker-compact .realm-tracker-status { margin-top: 12px; text-align: left; }
.realm-tracker.goal-met { border-color: rgba(247,196,108,.75); box-shadow: var(--shadow), 0 0 32px rgba(247,196,108,.13); }
.realm-tracker.goal-met .community-goal-track span { background: linear-gradient(90deg, var(--teal), var(--gold), var(--gold-light)); }

.utility-strip {
  margin-top: 28px;
  padding: clamp(18px, 4vw, 28px);
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid rgba(115,215,204,.24);
  border-radius: 22px;
  background: rgba(115,215,204,.055);
}
.utility-strip h2 { margin: 0 0 5px; color: var(--paper); }
.utility-strip p:last-child { margin: 0; color: var(--muted); }

.vendor-details { margin-top: 18px; padding: 0; overflow: hidden; border: 1px solid rgba(247,196,108,.24); border-radius: 22px; background: rgba(255,255,255,.025); }
.vendor-details > summary { list-style: none; min-height: 78px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; color: var(--paper); }
.vendor-details > summary::-webkit-details-marker { display: none; }
.vendor-details > summary span:first-child { display: grid; gap: 3px; }
.vendor-details > summary small { color: var(--teal); font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.vendor-details > summary strong { font: 800 clamp(1.05rem, 2vw, 1.35rem)/1.2 "Lora", Georgia, serif; }
.vendor-details > summary span:last-child { color: var(--gold); font-size: 1.7rem; transition: transform .2s ease; }
.vendor-details[open] > summary span:last-child { transform: rotate(45deg); }
.vendor-details-body { padding: 0 clamp(18px, 4vw, 28px) clamp(22px, 4vw, 32px); }

/* The tracker now leads with useful next actions. Its main panel still opens the journal. */
.floating-tracker { grid-template-columns: minmax(0,1fr) 62px 54px; }
.floating-tracker.final-ready { grid-template-columns: minmax(0,1fr) 52px 62px 54px; }

@media (max-width: 900px) {
  .quest-route-card { grid-template-columns: 1fr; }
  .quest-route-card .button { width: 100%; }
  .realm-tracker.realm-tracker-compact { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .control-bar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .control-bar .control-button:last-child { grid-column: 1 / -1; }
  .utility-strip { grid-template-columns: 1fr; }
  .utility-strip .button { width: 100%; }
  .realm-goal-number { align-items: center; }
  .realm-quick-stats { grid-template-columns: 1fr 1fr; }
  .floating-tracker { grid-template-columns: minmax(0,1fr) 58px 50px; }
  .floating-tracker.final-ready { grid-template-columns: minmax(0,1fr) 48px 56px 48px; }
}

@media (max-width: 420px) {
  .quest-route-card { padding: 14px; }
  .quest-route-card strong { font-size: .98rem; }
  .quest-route-card > div:first-child > span { font-size: .82rem; }
  .realm-tracker.realm-tracker-compact { padding: 18px 16px; }
  .realm-goal-number strong { font-size: 2.75rem; }
  .realm-quick-stats { grid-template-columns: 1fr; }
  .floating-tracker { grid-template-columns: minmax(0,1fr) 54px 47px; }
  .floating-tracker.final-ready { grid-template-columns: minmax(0,1fr) 45px 53px 45px; }
  .tracker-action { font-size: .65rem; }
}

/* Keep linked sections clear of the sticky game header. */
#questBoard,
#sharedBattle,
.chapter,
.quest-card {
  scroll-margin-top: 86px;
}
