:root {
  --deep-navy: #0A1020;
  --navy-mid: #182840;
  --metallic-blue: #2A3858;
  --brushed-steel: #8090B0;
  --silver-bright: #C0D0E8;
  --warm-amber: #D8A848;
  --metallic-glow: rgba(128,144,176,0.2);
  --metallic-glow-soft: rgba(128,144,176,0.08);
  --shimmer-grad: linear-gradient(135deg, rgba(192,208,232,0.05), rgba(216,168,72,0.03), rgba(128,144,176,0.06));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--deep-navy);
  color: var(--silver-bright);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: clamp(14px, 1vw, 17px);
  line-height: 1.75;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top right, rgba(42,56,88,0.5), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(24,40,64,0.6), transparent 60%),
    var(--deep-navy);
}

#bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: 0.55;
}

.shimmer-overlay {
  position: fixed; inset: 0;
  background: var(--shimmer-grad);
  background-size: 220% 220%;
  background-position: 0% 0%;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
  opacity: 0.9;
  transition: background-position 0.4s ease-out;
}

main, .quest-header, .quest-footer { position: relative; z-index: 2; }

/* ====== HEADER ====== */
.quest-header {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8vh 6vw 4vh;
  position: relative;
}

.header-blob {
  position: relative;
  max-width: 920px;
  margin-left: 4vw;
  padding: 6vh 6vw;
  background:
    linear-gradient(135deg, rgba(42,56,88,0.85), rgba(24,40,64,0.92));
  border: 1px solid var(--metallic-glow);
  border-radius: 38% 62% 58% 42% / 44% 38% 62% 56%;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.55),
    inset 0 0 60px rgba(192,208,232,0.04);
  transform: rotate(-1.2deg);
  transition: border-radius 1.6s cubic-bezier(.4,.1,.3,1);
}

.quest-coords {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--brushed-steel);
  display: flex; gap: 18px;
  margin-bottom: 14px;
}

.coord-val { color: var(--warm-amber); }

.logotype {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: clamp(48px, 8vw, 120px);
  line-height: 1.0;
  color: var(--silver-bright);
  transform: rotate(-2deg);
  display: inline-block;
  text-shadow: 0 6px 28px rgba(216,168,72,0.18);
  position: relative;
  padding-right: 0.2em;
}

.logotype::after {
  content: "";
  position: absolute;
  left: 0; bottom: -8px;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--warm-amber) 30%, var(--warm-amber) 70%, transparent);
  transform-origin: left;
  transform: scaleX(0);
  animation: drawline 1.6s 0.4s ease forwards;
}

@keyframes drawline { to { transform: scaleX(1); } }

.tagline {
  font-family: "Caveat", cursive;
  font-size: clamp(20px, 2.4vw, 30px);
  color: var(--brushed-steel);
  margin-top: 18px;
  transform: rotate(-0.6deg);
  letter-spacing: 0.5px;
}

.annotation-arrow {
  position: absolute;
  right: -40px; top: 30%;
  width: 220px; height: 90px;
  pointer-events: none;
  transform: rotate(20deg);
  opacity: 0; animation: fadein 1.4s 1.1s ease forwards;
}

.quest-marker {
  position: absolute;
  right: -120px; bottom: -80px;
  width: 220px; height: 220px;
  pointer-events: none;
  filter: drop-shadow(0 0 22px rgba(216,168,72,0.18));
}

.compass-svg { width: 100%; height: 100%; }
.compass-needle { transform-origin: 50px 50px; animation: spin 18s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { to { opacity: 1; } }

.scroll-hint {
  position: absolute;
  bottom: 4vh; left: 50%;
  transform: translateX(-50%);
  font-family: "Caveat", cursive;
  color: var(--brushed-steel);
  font-size: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: 0.85;
}

.hint-arrow {
  font-size: 28px;
  color: var(--warm-amber);
  animation: bounce 2.4s ease-in-out infinite;
}

@keyframes bounce {
  0%,100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* ====== FLOW SECTIONS ====== */
.flow-section {
  position: relative;
  padding: 14vh 6vw;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.flow-section::before {
  content: "";
  position: absolute;
  left: 50%; top: -40px;
  width: 2px; height: 80px;
  background: linear-gradient(180deg, transparent, var(--brushed-steel));
  opacity: 0.3;
  transform: translateX(-50%);
}

.flow-section[data-flow="5"]  .blob-container { margin-left: 5%;  }
.flow-section[data-flow="15"] .blob-container { margin-left: 15%; }
.flow-section[data-flow="20"] .blob-container { margin-left: 20%; margin-right: 5%; }
.flow-section[data-flow="10"] .blob-container { margin-left: 10%; }

.section-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.flow-section.in-view .section-bg { opacity: 1; }

.section-canvas { width: 100%; height: 100%; }

.blob-container {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding: 7vh 7vw;
  background: linear-gradient(140deg, rgba(42,56,88,0.85), rgba(24,40,64,0.93));
  border: 1px solid var(--metallic-glow);
  box-shadow:
    0 40px 90px rgba(0,0,0,0.55),
    inset 0 0 50px rgba(128,144,176,0.06);
  opacity: 0;
  transform: translateY(40px) scale(0.97);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.2,.7,.3,1), border-radius 1.8s cubic-bezier(.4,.1,.3,1);
}

.flow-section.in-view .blob-container {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.blob-shape-1 { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
.blob-shape-2 { border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%; }
.blob-shape-3 { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
.blob-shape-4 { border-radius: 70% 30% 50% 50% / 40% 60% 40% 60%; }
.blob-shape-5 { border-radius: 50% 50% 30% 70% / 30% 70% 30% 70%; }

.blob-container:hover.blob-shape-1 { border-radius: 50% 50% 60% 40% / 60% 40% 50% 50%; }
.blob-container:hover.blob-shape-2 { border-radius: 30% 70% 60% 40% / 70% 30% 50% 60%; }
.blob-container:hover.blob-shape-3 { border-radius: 60% 40% 70% 30% / 30% 70% 40% 60%; }
.blob-container:hover.blob-shape-4 { border-radius: 50% 50% 70% 30% / 60% 40% 60% 40%; }
.blob-container:hover.blob-shape-5 { border-radius: 70% 30% 50% 50% / 50% 50% 70% 30%; }

.quest-tag {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: rgba(10,16,32,0.6);
  border: 1px solid var(--metallic-glow);
  border-radius: 999px;
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: var(--brushed-steel);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.tag-glyph { color: var(--warm-amber); font-size: 14px; }
.tag-warm { background: rgba(216,168,72,0.08); border-color: rgba(216,168,72,0.4); }
.tag-warm .tag-text { color: var(--silver-bright); }

.section-title {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.05;
  color: var(--silver-bright);
  margin-bottom: 22px;
  transform: rotate(-1deg);
  display: inline-block;
}

.section-body {
  font-size: clamp(15px, 1.1vw, 18px);
  color: rgba(192,208,232,0.88);
  max-width: 56ch;
}

.section-body em {
  font-style: italic;
  color: var(--warm-amber);
}

.meta-row {
  margin-top: 28px;
  display: flex; flex-wrap: wrap; gap: 18px;
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: var(--brushed-steel);
  letter-spacing: 0.12em;
}

.meta-row .spark { color: var(--warm-amber); }

/* ====== Quest List ====== */
.quest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 14px;
}

.quest-item {
  display: flex; gap: 20px;
  padding: 18px 22px;
  background: rgba(10,16,32,0.45);
  border: 1px solid rgba(128,144,176,0.12);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  cursor: pointer;
  transition: transform 0.6s cubic-bezier(.2,.8,.3,1), background 0.4s ease, border-radius 1s ease;
}

.quest-item:hover {
  transform: translateX(10px) rotate(0.4deg);
  background: rgba(42,56,88,0.7);
  border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
}

.quest-rune {
  font-family: "Caveat", cursive;
  font-size: 28px;
  color: var(--warm-amber);
  flex-shrink: 0;
  width: 36px;
  line-height: 1;
}

.quest-item h3 {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 26px;
  color: var(--silver-bright);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.quest-item p {
  font-size: 14px;
  color: rgba(192,208,232,0.72);
  line-height: 1.6;
}

/* ====== Lottie-style stands ====== */
.lottie-stand {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}

.stand-flame { right: 8%; top: 12%; width: 90px; height: 130px; }
.flame-outer, .flame-inner { transform-origin: 30px 70px; animation: flicker 1.6s ease-in-out infinite; }
.flame-inner { animation-delay: 0.2s; animation-duration: 1.1s; }

@keyframes flicker {
  0%,100% { transform: scaleY(1) scaleX(1); }
  30% { transform: scaleY(1.08) scaleX(0.95); }
  60% { transform: scaleY(0.94) scaleX(1.04); }
}

.stand-scroll { right: 6%; bottom: 12%; width: 180px; height: 120px; }
.scroll-paper { animation: unfurl 6s ease-in-out infinite alternate; transform-origin: 50% 50%; }
@keyframes unfurl {
  0% { transform: scaleX(0.95); opacity: 0.16; }
  100% { transform: scaleX(1); opacity: 0.24; }
}

.stand-gear { left: 5%; top: 18%; width: 120px; height: 120px; }
.gear-spin { transform-origin: 40px 38px; animation: spin 14s linear infinite; }

/* ====== Codex grid ====== */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 12px;
}

.codex-card {
  position: relative;
  padding: 20px 22px 28px;
  background: rgba(10,16,32,0.55);
  border: 1px solid rgba(128,144,176,0.18);
  border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%;
  transition: transform 0.5s cubic-bezier(.2,.8,.3,1), border-radius 1.2s ease, background 0.4s ease;
}

.codex-card:nth-child(2) { border-radius: 60% 40% 60% 40% / 30% 70% 30% 70%; }
.codex-card:nth-child(3) { border-radius: 30% 70% 40% 60% / 60% 40% 70% 30%; }
.codex-card:nth-child(4) { border-radius: 50% 50% 70% 30% / 40% 60% 40% 60%; }

.codex-card:hover {
  transform: translateY(-6px) rotate(-0.6deg);
  background: rgba(42,56,88,0.7);
}

.codex-card h3 {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 28px;
  color: var(--silver-bright);
  margin-bottom: 8px;
}

.codex-card p {
  font-size: 14px;
  color: rgba(192,208,232,0.72);
  line-height: 1.6;
}

.card-stamp {
  position: absolute;
  bottom: 10px; right: 16px;
  font-family: "Space Mono", monospace;
  font-size: 10px;
  color: var(--warm-amber);
  letter-spacing: 0.18em;
  opacity: 0.7;
}

/* ====== Journal entries ====== */
.journal-entries {
  list-style: none;
  display: flex; flex-direction: column;
  gap: 26px;
  margin-top: 8px;
}

.journal-entry {
  padding-left: 28px;
  position: relative;
  border-left: 2px dashed rgba(128,144,176,0.35);
  padding-bottom: 6px;
}

.journal-entry::before {
  content: "";
  position: absolute;
  left: -7px; top: 6px;
  width: 12px; height: 12px;
  background: var(--warm-amber);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(216,168,72,0.5);
}

.journal-date {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--brushed-steel);
}

.journal-entry h3 {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 26px;
  color: var(--silver-bright);
  margin: 4px 0 6px;
}

.journal-entry p {
  font-size: 14px;
  color: rgba(192,208,232,0.78);
  line-height: 1.65;
  max-width: 60ch;
}

/* ====== Summon form ====== */
.summon-blob {
  background: linear-gradient(140deg, rgba(42,56,88,0.92), rgba(24,40,64,0.95));
  border: 1px solid rgba(216,168,72,0.35);
}

.summon-form {
  display: flex; flex-direction: column;
  gap: 18px;
  margin-top: 22px;
  max-width: 520px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--brushed-steel);
  text-transform: uppercase;
}

.field input, .field textarea {
  background: rgba(10,16,32,0.6);
  border: 1px solid rgba(128,144,176,0.3);
  border-radius: 18px;
  padding: 12px 16px;
  font-family: "Nunito", sans-serif;
  font-size: 15px;
  color: var(--silver-bright);
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
  resize: vertical;
}

.field input::placeholder, .field textarea::placeholder {
  color: rgba(192,208,232,0.35);
  font-family: "Caveat", cursive;
  font-size: 18px;
}

.field input:focus, .field textarea:focus {
  border-color: var(--warm-amber);
  background: rgba(10,16,32,0.78);
}

.summon-btn {
  display: inline-flex; align-items: center; gap: 12px;
  align-self: flex-start;
  padding: 12px 26px;
  background: linear-gradient(135deg, rgba(216,168,72,0.95), rgba(192,144,56,0.9));
  color: var(--deep-navy);
  border: none;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(.2,.8,.3,1), border-radius 1s ease, box-shadow 0.4s ease;
  box-shadow: 0 8px 24px rgba(216,168,72,0.25);
}

.summon-btn:hover {
  transform: translateY(-3px) rotate(-1deg);
  border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
  box-shadow: 0 14px 30px rgba(216,168,72,0.4);
}

.summon-btn .btn-glyph { font-size: 18px; }

.summon-status {
  margin-top: 14px;
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: var(--warm-amber);
  min-height: 28px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.summon-status.show { opacity: 1; }

/* ====== Footer ====== */
.quest-footer {
  padding: 6vh 6vw 8vh;
  position: relative;
}

.footer-blob {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 32px;
  background: linear-gradient(135deg, rgba(24,40,64,0.85), rgba(10,16,32,0.95));
  border: 1px solid var(--metallic-glow-soft);
  border-radius: 40% 60% 30% 70% / 60% 40% 70% 30%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--brushed-steel);
}

.footer-mark {
  font-family: "Caveat", cursive;
  font-size: 24px;
  color: var(--silver-bright);
  letter-spacing: 0.5px;
}

.footer-meta { color: var(--warm-amber); }

/* ====== Responsive ====== */
@media (max-width: 880px) {
  .header-blob { margin-left: 0; padding: 6vh 7vw; }
  .quest-marker { right: -40px; bottom: -60px; width: 140px; height: 140px; }
  .annotation-arrow { display: none; }
  .codex-grid { grid-template-columns: 1fr; }
  .stand-flame, .stand-scroll, .stand-gear { display: none; }
  .flow-section[data-flow] .blob-container { margin-left: 0; margin-right: 0; }
  .flow-section { padding: 10vh 5vw; }
  .blob-container { padding: 6vh 7vw; }
  .footer-blob { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .logotype { font-size: clamp(40px, 12vw, 72px); }
  .section-title { font-size: clamp(28px, 7vw, 44px); }
}
