:root {
    --midnight: #101427;
    --parchment: #F1DCA7;
    --ink: #2B1B3F;
    --ember: #E85D3F;
    --teal: #2FA6A1;
    --gold: #D6A83A;
    --violet: #7D4DD8;
    --route-progress: 0;
    --chapter-angle: -36deg;
    --Interface-labels: 'Unbounded', sans-serif;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    background: var(--midnight);
}

body {
    margin: 0;
    color: var(--parchment);
    background: var(--midnight);
    font-family: 'Libre Baskerville', serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background-image: radial-gradient(circle at 25% 15%, rgba(241,220,167,.09), transparent 16rem), radial-gradient(circle at 80% 75%, rgba(125,77,216,.16), transparent 20rem), linear-gradient(135deg, rgba(43,27,63,.55), transparent 45%);
    mix-blend-mode: screen;
}

.map-sky, .route-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.map-sky { z-index: 0; overflow: hidden; }

.halftone {
    position: absolute;
    inset: -10%;
    opacity: .18;
    background-image: radial-gradient(circle, var(--parchment) 1px, transparent 1.5px);
    background-size: 18px 18px;
    transform: rotate(-8deg);
}

.constellation {
    position: absolute;
    width: 44vw;
    height: 44vw;
    border: 1px dashed rgba(241,220,167,.18);
    border-radius: 50%;
}

.constellation::before, .constellation::after {
    content: "";
    position: absolute;
    width: .6rem;
    height: .6rem;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 4rem 6rem 0 var(--teal), 10rem 2rem 0 var(--violet), 17rem 9rem 0 var(--ember), 23rem 4rem 0 var(--parchment);
}

.constellation-one { left: -14vw; top: 8vh; animation: drift 28s linear infinite; }
.constellation-two { right: -18vw; bottom: -8vh; animation: drift 34s linear reverse infinite; }

.quest-map { position: relative; z-index: 1; }

.chapter {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
    display: grid;
    place-items: center;
    padding: 8vmin;
    border-bottom: 2px solid rgba(214,168,58,.25);
}

.chapter::before {
    content: "";
    position: absolute;
    inset: 5vmin;
    z-index: -1;
    opacity: .27;
    background-image: linear-gradient(30deg, transparent 35%, rgba(241,220,167,.22) 36% 37%, transparent 38%), linear-gradient(150deg, transparent 35%, rgba(47,166,161,.22) 36% 37%, transparent 38%);
    background-size: 120px 104px;
    clip-path: polygon(7% 15%, 80% 4%, 96% 40%, 84% 86%, 22% 93%, 3% 55%);
}

.summons { background: radial-gradient(circle at 52% 38%, rgba(214,168,58,.16), transparent 24rem), var(--midnight); }
.maze { background: linear-gradient(160deg, var(--midnight), #2B1B3F 62%, var(--midnight)); }
.arena { background: radial-gradient(circle, rgba(232,93,63,.18), transparent 31rem), var(--midnight); }
.forge { background: radial-gradient(circle at 30% 70%, rgba(232,93,63,.25), transparent 28rem), #1a1529; }
.bridge { background: linear-gradient(140deg, #101427, #10333c 48%, #2B1B3F); }
.reliquary { background: radial-gradient(circle, rgba(214,168,58,.22), transparent 29rem), var(--midnight); }

h1, h2 {
    font-family: 'Cinzel', serif;
    margin: 0;
    line-height: .92;
    letter-spacing: .035em;
}

h1 { font-size: clamp(3.4rem, 10vw, 9.6rem); color: var(--ink); text-shadow: 0 2px 0 var(--gold); }
h2 { font-size: clamp(2.3rem, 5vw, 5.4rem); color: var(--parchment); }
p { font-size: clamp(1rem, 1.35vw, 1.35rem); line-height: 1.75; }

.objective, .coordinate, .inventory-title, .choice, .compass-face a, .inventory-tab, .hex, .civic-monster, .token-cluster b {
    font-family: var(--Interface-labels);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .68rem;
}

.quest-compass {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 11rem;
    height: 11rem;
    z-index: 10;
}

.compass-face {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid var(--gold);
    border-radius: 50%;
    background: rgba(16,20,39,.78);
    box-shadow: inset 0 0 0 8px rgba(241,220,167,.08), 0 0 35px rgba(214,168,58,.18);
}

.compass-face a {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4rem;
    margin-left: -2rem;
    color: var(--parchment);
    text-align: center;
    text-decoration: none;
    transform: rotate(calc(var(--i) * 60deg)) translateY(-4.6rem) rotate(calc(var(--i) * -60deg));
    opacity: .68;
}

.compass-face a:nth-of-type(1) { --i: 0; }
.compass-face a:nth-of-type(2) { --i: 1; }
.compass-face a:nth-of-type(3) { --i: 2; }
.compass-face a:nth-of-type(4) { --i: 3; }
.compass-face a:nth-of-type(5) { --i: 4; }
.compass-face a:nth-of-type(6) { --i: 5; }
.compass-face a.active { color: var(--gold); opacity: 1; }

.compass-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3px;
    height: 4.4rem;
    background: var(--ember);
    transform-origin: 50% 0;
    transform: rotate(var(--chapter-angle));
    box-shadow: 0 0 18px var(--ember);
    transition: transform .55s ease;
}

.quest-inventory {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 10;
    width: min(21rem, calc(100vw - 2rem));
    padding: 1rem;
    color: var(--ink);
    background: var(--parchment);
    border: 3px solid var(--ink);
    box-shadow: 9px 9px 0 rgba(0,0,0,.35);
    clip-path: polygon(0 9%, 7% 0, 100% 0, 100% 90%, 92% 100%, 0 100%);
}

.inventory-title { color: var(--violet); margin-bottom: .7rem; }
.inventory-tab, .choice {
    border: 2px solid var(--ink);
    background: transparent;
    color: var(--ink);
    padding: .55rem .75rem;
    cursor: pointer;
}
.inventory-tab.active, .choice.selected { background: var(--teal); color: var(--midnight); }
.inventory-card { display: none; margin-top: .9rem; line-height: 1.5; }
.inventory-card.active { display: block; animation: tabReveal .35s ease; }

.route-layer { z-index: 8; }
.route-layer svg { width: 100%; height: 100%; }
#quest-route {
    fill: none;
    stroke: var(--gold);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--route-progress));
    filter: drop-shadow(0 0 8px rgba(214,168,58,.75));
}
.player-token {
    position: fixed;
    left: 11%;
    top: 86%;
    width: 2.7rem;
    height: 2.7rem;
    margin: -1.35rem 0 0 -1.35rem;
    border: 4px solid var(--ink);
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 5px var(--parchment), 0 0 28px var(--gold);
}
.player-token span { display: block; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 35% 32%, var(--parchment) 0 18%, transparent 19%); }

.notice-tree { position: relative; width: min(78rem, 90vw); min-height: 70vh; display: grid; place-items: center; }
.notice-tree::before { content: ""; position: absolute; bottom: 0; width: 7rem; height: 62vh; background: var(--ink); clip-path: polygon(30% 0,70% 0,86% 100%,8% 100%); }
.branch { position: absolute; height: 2rem; background: var(--ink); width: 30rem; top: 32%; }
.branch-left { left: 8%; transform: rotate(-17deg); }
.branch-right { right: 8%; transform: rotate(14deg); }
.forest-edge { position: absolute; inset: auto 0 0; height: 28vh; background: repeating-linear-gradient(90deg, transparent 0 35px, rgba(43,27,63,.9) 36px 52px); clip-path: polygon(0 30%, 8% 0, 14% 45%, 23% 4%, 31% 55%, 42% 6%, 50% 44%, 60% 10%, 69% 62%, 80% 0, 88% 48%, 100% 8%, 100% 100%, 0 100%); }
.summons-scroll {
    position: relative;
    width: min(56rem, 84vw);
    padding: clamp(2rem, 5vw, 5rem);
    color: var(--ink);
    text-align: center;
    background: var(--parchment);
    border: 5px double var(--ink);
    box-shadow: 0 0 60px rgba(241,220,167,.45), 16px 16px 0 rgba(43,27,63,.65);
    transform: rotate(-2deg);
}
.declaration { color: var(--ink); max-width: 44rem; margin: 1.2rem auto; }
.seal-ring { width: 9rem; height: 9rem; margin: 1rem auto 0; display: grid; place-items: center; border: 6px double var(--gold); border-radius: 50%; color: var(--ember); font-family: 'Cinzel', serif; animation: sealPulse 3s ease-in-out infinite; }

.chapter-copy {
    position: absolute;
    max-width: 34rem;
    z-index: 2;
    padding: 2rem;
}
.offset-left { left: 8vw; bottom: 8vh; }
.offset-right { right: 8vw; top: 14vh; }
.parchment-panel { color: var(--ink); background: var(--parchment); border: 3px solid var(--ink); box-shadow: 11px 11px 0 rgba(0,0,0,.33); }
.parchment-panel h2 { color: var(--ink); }
.ink-panel { background: rgba(43,27,63,.82); border: 2px solid var(--gold); }
.teal-panel { background: rgba(47,166,161,.85); color: var(--midnight); border: 3px solid var(--parchment); }
.teal-panel h2 { color: var(--midnight); }
.objective { display: inline-block; margin-bottom: .8rem; color: var(--gold); }

.hex-field { position: relative; width: min(72rem, 92vw); height: 70vh; }
.hex {
    position: absolute;
    width: 15rem;
    height: 13rem;
    display: grid;
    place-items: center;
    color: var(--ink);
    background: var(--parchment);
    border: 4px solid var(--ink);
    clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%);
}
.h1 { left: 4%; top: 9%; background: var(--gold); }
.h2 { left: 24%; top: 26%; }
.h3 { left: 43%; top: 4%; background: var(--teal); }
.h4 { left: 62%; top: 30%; }
.h5 { left: 31%; top: 55%; background: var(--violet); color: var(--parchment); }
.h6 { left: 70%; top: 59%; background: var(--ember); }
.civic-monster { position: absolute; padding: .7rem 1rem; border: 2px solid var(--parchment); color: var(--parchment); background: var(--violet); border-radius: 45% 55% 40% 60%; animation: bob 2.5s ease-in-out infinite; }
.rumor { left: 14%; top: 22%; }
.apathy { right: 19%; bottom: 18%; animation-delay: -.8s; background: var(--ember); }
.choice-row { display: flex; gap: .65rem; flex-wrap: wrap; }

.council-ring {
    position: relative;
    width: min(76vh, 82vw);
    height: min(76vh, 82vw);
    border: 5px double var(--gold);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(241,220,167,.12) 0 30%, transparent 31% 100%);
}
.council-ring span { position: absolute; width: 4rem; height: 4rem; background: var(--parchment); border: 3px solid var(--ink); border-radius: 50%; left: calc(50% - 2rem); top: calc(50% - 2rem); transform: rotate(calc(var(--seat) * 60deg)) translateY(-34vh); }
.council-ring span:nth-child(1) { --seat: 0; } .council-ring span:nth-child(2) { --seat: 1; } .council-ring span:nth-child(3) { --seat: 2; } .council-ring span:nth-child(4) { --seat: 3; } .council-ring span:nth-child(5) { --seat: 4; } .council-ring span:nth-child(6) { --seat: 5; }
.debate-altar { position: absolute; inset: 32%; display: grid; place-items: center; border: 4px solid var(--ember); border-radius: 50%; color: var(--gold); font-family: 'Cinzel', serif; font-size: 8rem; background: var(--ink); }
.spark { position: absolute; width: 1rem; height: 1rem; border-radius: 50%; background: var(--ember); left: 50%; top: 50%; transform-origin: 0 0; animation: orbit 4s linear infinite; box-shadow: 0 0 20px var(--ember); }
.spark-two { background: var(--violet); animation-duration: 5.5s; }
.spark-three { background: var(--teal); animation-duration: 6.5s; }
blockquote { margin: 1rem 0 0; padding-left: 1rem; border-left: 4px solid var(--ember); color: var(--gold); font-style: italic; }

.forge-table { position: relative; width: min(58rem, 88vw); height: 58vh; display: grid; place-items: center; }
.anvil-scroll { width: min(34rem, 78vw); padding: 3rem; color: var(--ink); background: var(--parchment); border: 4px solid var(--ink); font-family: 'Cinzel', serif; font-size: clamp(1.6rem, 4vw, 3rem); transform: rotate(4deg); }
.hammer { position: absolute; width: 24rem; height: 3rem; background: var(--ink); top: 17%; left: 18%; transform: rotate(-34deg); transform-origin: 80% 50%; animation: hammer 2.8s ease-in-out infinite; }
.hammer::after { content: ""; position: absolute; right: -3rem; top: -2rem; width: 6rem; height: 7rem; background: var(--gold); border: 4px solid var(--ink); }
.ember { position: absolute; width: 1.2rem; height: 1.2rem; background: var(--ember); border-radius: 50%; animation: rise 2s ease-in-out infinite; }
.ember-one { left: 35%; bottom: 22%; } .ember-two { left: 49%; bottom: 18%; animation-delay: -.5s; } .ember-three { left: 61%; bottom: 25%; animation-delay: -1s; }
.clause-list { color: var(--ink); line-height: 2; }

.rope-bridge { position: absolute; width: 82vw; height: 26vh; top: 44%; left: 9vw; border-top: 8px solid var(--teal); border-bottom: 8px solid var(--teal); transform: rotate(-8deg); }
.rope-bridge span { position: absolute; top: 0; width: 3rem; height: 100%; background: rgba(241,220,167,.78); border: 2px solid var(--ink); transform: rotate(8deg); }
.rope-bridge span:nth-child(1) { left: 8%; } .rope-bridge span:nth-child(2) { left: 25%; } .rope-bridge span:nth-child(3) { left: 44%; } .rope-bridge span:nth-child(4) { left: 63%; } .rope-bridge span:nth-child(5) { left: 80%; }
.token-cluster { position: absolute; right: 9vw; top: 16vh; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.token-cluster b { width: 6.5rem; height: 6.5rem; display: grid; place-items: center; color: var(--ink); background: var(--gold); border: 3px solid var(--ink); border-radius: 50%; }

.reliquary-dais { position: relative; width: min(42rem, 82vw); height: 42rem; display: grid; place-items: center; border: 6px double var(--gold); border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(241,220,167,.13) 0 8deg, transparent 8deg 16deg); }
.ballot-chest { position: relative; width: min(28rem, 72vw); height: 18rem; color: var(--ink); }
.chest-lid { height: 7rem; background: var(--gold); border: 5px solid var(--ink); border-radius: 7rem 7rem 0 0; transform-origin: bottom; transition: transform .8s ease; }
.chest-body { height: 11rem; display: grid; place-items: center; background: var(--parchment); border: 5px solid var(--ink); border-top: 0; font-family: 'Cinzel', serif; font-size: clamp(1.7rem, 5vw, 3rem); }
.ballot-slip { position: absolute; left: 50%; top: -2.5rem; width: 9rem; height: 5rem; display: grid; place-items: center; background: white; border: 3px solid var(--ink); transform: translateX(-50%) rotate(-8deg); font-family: 'Unbounded', sans-serif; text-transform: uppercase; transition: transform .8s ease, opacity .8s ease; }
.reliquary.reached .chest-lid { transform: rotateX(58deg); }
.reliquary.reached .ballot-slip { transform: translateX(-50%) translateY(7rem) rotate(2deg); opacity: .2; }
.final-inscription { position: absolute; bottom: 6vh; right: 8vw; width: min(39rem, 84vw); text-align: right; }
.question { color: var(--gold); font-family: 'Cinzel', serif; font-size: clamp(1.4rem, 2.8vw, 2.5rem); }

@keyframes drift { to { transform: rotate(360deg); } }
@keyframes sealPulse { 50% { box-shadow: 0 0 35px var(--gold); transform: scale(1.04); } }
@keyframes tabReveal { from { transform: translateY(.5rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-.8rem) rotate(3deg); } }
@keyframes orbit { to { transform: rotate(360deg) translateX(15rem); } }
@keyframes hammer { 50% { transform: rotate(-18deg); } }
@keyframes rise { 50% { transform: translateY(-4rem) scale(.4); opacity: .4; } }

@media (max-width: 760px) {
    .quest-compass { transform: scale(.72); transform-origin: top right; }
    .quest-inventory { display: none; }
    .chapter { padding: 6rem 1.25rem; align-items: start; }
    .chapter-copy, .offset-left, .offset-right, .final-inscription { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: 100%; margin-top: 2rem; text-align: left; }
    .hex { width: 10rem; height: 8.8rem; }
    .council-ring span { transform: rotate(calc(var(--seat) * 60deg)) translateY(-37vw); }
    .route-layer { display: none; }
}
