/* Dinosaur Universe — hub. A living world: time-of-day sky, parallax, a walking herd, animated world tiles. */
@property --sky1 { syntax: '<color>'; inherits: true; initial-value: #8fd8f0; }
@property --sky2 { syntax: '<color>'; inherits: true; initial-value: #e6f7d8; }
@property --m1   { syntax: '<color>'; inherits: true; initial-value: #8cc4a6; }
@property --m2   { syntax: '<color>'; inherits: true; initial-value: #a6d6b4; }
@property --g1   { syntax: '<color>'; inherits: true; initial-value: #8fd18f; }
@property --g2   { syntax: '<color>'; inherits: true; initial-value: #5fb36f; }
@property --pg1  { syntax: '<color>'; inherits: true; initial-value: #dff4ea; }
@property --pg2  { syntax: '<color>'; inherits: true; initial-value: #f4f9e9; }

:root { --bg: #eaf7f2; --card: #ffffff; --ink: #143c3a; --accent: #0b6e5f; --accent-2: #2a9d8f; --warn: #e9c46a; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--pg1), var(--pg2));
  background-attachment: fixed;
  color: var(--ink); min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  transition: --pg1 3s ease, --pg2 3s ease;
}
body[data-tod="dusk"]  { --pg1: #f3d3e6; --pg2: #ffe7c9; }
body[data-tod="night"] { --pg1: #1d2c5c; --pg2: #2f4a86; color: #eaf3ff; }
body[data-tod="dawn"]  { --pg1: #ffe9dc; --pg2: #e8f6ee; }
body.in-stage { overflow: hidden; }
body.in-stage #hubbar { display: none; }

#hubbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(90deg, #0b6e5f, #1b8b78); color: #fff;
  position: sticky; top: 0; z-index: 10; box-shadow: 0 3px 14px rgba(8,70,60,.25);
}
#hubbar h1 { font-size: 1.1rem; margin: 0; letter-spacing: -.01em; }
.brand-dino { display: inline-block; animation: du-bob2 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.tools { display: flex; gap: 8px; }
.pill {
  border: 0; border-radius: 999px; padding: 10px 14px; font-size: 1rem; background: #fff; color: var(--ink);
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.14); transition: transform .15s, box-shadow .15s;
}
.pill:hover { transform: translateY(-1px) scale(1.04); box-shadow: 0 5px 12px rgba(0,0,0,.18); }
.pill:active { transform: scale(.94); }
.pill.primary { background: var(--accent-2); color: #fff; }
#hub { padding: 16px; max-width: 1000px; margin: 0 auto; }
#hub[hidden] { display: none; }

/* ===================== HERO SCENE ===================== */
.hero-scene {
  position: relative; height: clamp(300px, 46vw, 400px); border-radius: 30px; overflow: hidden; isolation: isolate;
  box-shadow: 0 14px 40px rgba(14,70,70,.22), inset 0 0 0 3px rgba(255,255,255,.35);
  --sky1: #8fd8f0; --sky2: #e6f7d8; --m1: #8cc4a6; --m2: #a6d6b4; --g1: #8fd18f; --g2: #5fb36f;
  --px: 0; --py: 0;
  transition: --sky1 3s ease, --sky2 3s ease, --m1 3s ease, --m2 3s ease, --g1 3s ease, --g2 3s ease;
  animation: du-in .7s cubic-bezier(.2,.9,.3,1.1) both;
}
.hero-scene[data-tod="dusk"]  { --sky1: #6a5fb0; --sky2: #ffb27a; --m1: #7c6a9e; --m2: #a37b98; --g1: #7aa86e; --g2: #4d8a62; }
.hero-scene[data-tod="night"] { --sky1: #0c1a45; --sky2: #2f4f8c; --m1: #243666; --m2: #314678; --g1: #2c6657; --g2: #1d4a45; }
.hero-scene[data-tod="dawn"]  { --sky1: #9ec4f0; --sky2: #ffd7bf; --m1: #96b7b1; --m2: #b5c9b4; --g1: #94cf8e; --g2: #62b078; }
.hs-sky-bg { position: absolute; inset: 0; background: linear-gradient(var(--sky1), var(--sky2)); }
/* The hub opens on the same real valley the story is told in front of, and it
 * changes with the time of day just like the painted sky does. The gradient stays
 * underneath as a wash over the top of the photo, so Rex and the words never sit
 * on a busy picture — and while a photograph is still downloading, or if it never
 * arrives, the scene looks exactly the way it did before the photo existed. */
.hs-photo { position: absolute; inset: 0; background-size: cover; background-position: center 58%;
  animation: hs-photo-in 1.4s ease-out both; }
@keyframes hs-photo-in { from { opacity: 0 } to { opacity: 1 } }
.hero-scene[data-tod="day"] .hs-photo   { background-image: linear-gradient(180deg, rgba(143,216,240,.14), rgba(230,247,216,.52)), url(fx/art/day.jpg); }
.hero-scene[data-tod="dawn"] .hs-photo  { background-image: linear-gradient(180deg, rgba(158,196,240,.20), rgba(255,215,191,.58)), url(fx/art/sun.jpg); }
.hero-scene[data-tod="dusk"] .hs-photo  { background-image: linear-gradient(180deg, rgba(106,95,176,.30), rgba(255,178,122,.52)), url(fx/art/sun.jpg); }
.hero-scene[data-tod="night"] .hs-photo { background-image: linear-gradient(180deg, rgba(12,26,69,.34), rgba(47,79,140,.74)), url(fx/art/night.jpg); }
.hs-layer { position: absolute; inset: 0; transform: translate(calc(var(--px) * var(--k, 1) * -10px), calc(var(--py) * var(--k, 1) * -5px)); transition: transform .25s ease-out; pointer-events: none; }
.hs-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hs-mtn1 { fill: var(--m1); transition: fill 3s; } .hs-mtn2 { fill: var(--m2); transition: fill 3s; }
.hs-g1 { fill: var(--g1); } .hs-g2 { fill: var(--g2); }
.hs-far { transform: translate(calc(var(--px) * -4px), 0); transition: transform .25s ease-out; }

/* sun & moon */
.hs-orb { position: absolute; border-radius: 50%; cursor: pointer; transition: left 3s ease, top 3s ease, opacity 2s, background 3s, box-shadow 3s; z-index: 3; }
.hs-sun { width: 76px; height: 76px; left: 78%; top: 9%; background: radial-gradient(circle at 38% 34%, #fff6c4, #ffd45e 60%, #ffb92e); box-shadow: 0 0 0 10px rgba(255,214,102,.25), 0 0 60px 24px rgba(255,214,102,.5); animation: hs-sunpulse 4s ease-in-out infinite; }
@keyframes hs-sunpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.hs-moon { width: 62px; height: 62px; left: 44%; top: 112%; background: radial-gradient(circle at 38% 34%, #fffdf0, #f3efc9 70%); box-shadow: 0 0 40px 14px rgba(255,250,210,.4); }
.hs-moon b { position: absolute; border-radius: 50%; background: rgba(190,180,140,.4); }
.hs-moon b:nth-child(1) { width: 14px; height: 14px; left: 12px; top: 14px; } .hs-moon b:nth-child(2) { width: 9px; height: 9px; left: 36px; top: 30px; } .hs-moon b:nth-child(3) { width: 7px; height: 7px; left: 20px; top: 40px; }
[data-tod="dusk"] .hs-sun { left: 66%; top: 52%; background: radial-gradient(circle at 38% 34%, #ffe1a3, #ff9a4d 70%); box-shadow: 0 0 0 12px rgba(255,150,80,.25), 0 0 70px 30px rgba(255,120,60,.45); }
[data-tod="night"] .hs-sun { top: 125%; left: 40%; }
[data-tod="dawn"] .hs-sun { left: 16%; top: 50%; background: radial-gradient(circle at 38% 34%, #fff0d6, #ffc58a 70%); }
[data-tod="night"] .hs-moon { top: 10%; }
[data-tod="dusk"] .hs-moon { left: 90%; top: 96%; }

.hs-stars { position: absolute; inset: 0 0 40% 0; opacity: 0; transition: opacity 3s; pointer-events: none; }
[data-tod="night"] .hs-stars { opacity: 1; } [data-tod="dusk"] .hs-stars { opacity: .35; }
.hs-star { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(255,255,255,.8); animation: du-twinkle 2.6s ease-in-out infinite; animation-delay: var(--d); }

.hs-cloud { position: absolute; left: 0; width: var(--w); height: calc(var(--w) * .38); background: rgba(255,255,255,.88); border-radius: 999px; filter: blur(.3px); animation: hs-drift var(--t) linear infinite; animation-delay: var(--o, 0s); transition: background 3s; }
.hs-cloud::before, .hs-cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.hs-cloud::before { width: 46%; height: 120%; left: 14%; top: -52%; } .hs-cloud::after { width: 36%; height: 100%; right: 14%; top: -34%; }
[data-tod="dusk"] .hs-cloud { background: rgba(255,214,190,.85); } [data-tod="night"] .hs-cloud { background: rgba(120,140,190,.35); }
@keyframes hs-drift { from { transform: translateX(-30vw); } to { transform: translateX(110vw); } }
.hs-flyer { position: absolute; left: 0; animation: hs-cross var(--t) linear infinite; animation-delay: var(--o); }
.hs-flyer-2 { animation-direction: reverse; }
@keyframes hs-cross { from { transform: translateX(-20vw); } to { transform: translateX(105vw); } }
[data-tod="night"] .hs-flyer { opacity: .35; filter: brightness(.55); }

/* volcano */
.hs-volcano { left: auto; right: 2%; width: 36%; top: 26%; height: 74%; }
.hs-vol { fill: #8a5d44; } .hs-crater { fill: #ff7a3d; animation: hs-lavapulse 2.4s ease-in-out infinite; }
.hs-lava { fill: none; stroke: #ff9b50; stroke-width: 5; stroke-linecap: round; animation: hs-lavapulse 2.4s ease-in-out infinite; }
@keyframes hs-lavapulse { 0%,100% { opacity: .75; } 50% { opacity: 1; filter: drop-shadow(0 0 8px #ff7a3d); } }
.hs-smoke { position: absolute; right: 13.5%; top: 28%; width: 46px; height: 46px; border-radius: 50%; background: rgba(120,110,110,.55); filter: blur(5px); animation: hs-puff 4.8s ease-out infinite; animation-delay: var(--d); opacity: 0; }
@keyframes hs-puff { 0% { transform: translate(0, 0) scale(.4); opacity: .0; } 15% { opacity: .7; } 100% { transform: translate(-50px, -120px) scale(2.2); opacity: 0; } }

.hs-herd { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; pointer-events: none; }
.hs-walker { position: absolute; left: 0; bottom: var(--b); animation: hs-stroll var(--t) linear infinite; animation-delay: var(--o); will-change: transform; }
.hs-walker .du-dino { width: 100%; }
@keyframes hs-stroll { from { transform: translateX(-22vw); } to { transform: translateX(108vw); } }
[data-tod="night"] .hs-walker { filter: brightness(.62) saturate(.9); }
[data-tod="dusk"] .hs-walker { filter: brightness(.88) sepia(.18); }

.hs-palms { position: absolute; inset: 0; pointer-events: none; }
.hs-palm { position: absolute; bottom: 5%; height: 52%; width: auto; overflow: visible; }
.hs-trunk { fill: none; stroke: #7a5a3a; stroke-width: 9; stroke-linecap: round; }
.hs-fronds path { fill: #4aa56a; stroke: #2f7a4d; stroke-width: 2; }
.hs-fronds { animation: hs-sway 5s ease-in-out infinite; }
.hs-palm2 .hs-fronds path { fill: #5fb97a; }
@keyframes hs-sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
[data-tod="night"] .hs-fronds path { fill: #2d6b55; }

.hs-rex { position: absolute; left: 4%; bottom: 1%; width: clamp(140px, 24vw, 230px); cursor: pointer; filter: drop-shadow(0 8px 6px rgba(0,60,40,.25)); z-index: 4; }
.hs-rex .du-dino { display: block; }
/* Photoreal Rex: a true button, with a grounded silhouette and gentle breathing. */
button.hs-rex { width: clamp(235px, 38vw, 390px); left: 2%; bottom: 3%; padding: 0; border: 0; background: transparent; border-radius: 12px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button.hs-rex:focus-visible { outline: 3px solid #fff2a7; outline-offset: 5px; }
.rex-photo { transform-origin: 60% 93%; animation: rex-breathe 4.5s ease-in-out infinite; }
.rex-photo img { display: block; width: 100%; height: auto; pointer-events: none; }
.rex-photo[data-state="roar"] { animation: rex-roar 3.3s ease-out both; }
.rex-photo[data-state="sleep"] { filter: brightness(.76); }
@keyframes rex-breathe { 50% { transform: scaleY(1.015) rotate(-.35deg); } }
@keyframes rex-roar { 0%,100% { transform: none; } 12% { transform: rotate(-3deg) scale(1.045); } 22%,34%,46% { transform: rotate(-2deg) translateX(2px) scale(1.035); } 28%,40%,52% { transform: rotate(-1deg) translateX(-2px) scale(1.03); } 72% { transform: rotate(-1deg) scale(1.015); } }
@media (max-width:560px) { button.hs-rex { width: 68%; max-width: 270px; } }
.hs-bubble { position: absolute; left: clamp(150px, 25vw, 270px); top: 31%; max-width: min(330px, 62%); background: #fff; color: #143c3a; border-radius: 22px; padding: 12px 18px; font-weight: 800; font-size: clamp(1rem, 2.4vw, 1.35rem); line-height: 1.25; box-shadow: 0 8px 22px rgba(0,50,50,.25); z-index: 5; transform-origin: 0 100%; animation: hs-bubble 5s ease-in-out infinite; }
.hs-bubble::before { content: ""; position: absolute; left: -12px; bottom: 16px; border: 12px solid transparent; border-right-color: #fff; border-left: 0; }
@keyframes hs-bubble { 0%,100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-5px) rotate(.6deg); } }
.hs-bubble.say { animation: hs-bubble-pop .5s cubic-bezier(.2,.9,.3,1.4), hs-bubble 5s ease-in-out .5s infinite; }
@keyframes hs-bubble-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.hs-fore { position: absolute; left: 0; right: 0; bottom: 0; height: 12%; pointer-events: none; z-index: 6; }
.hs-fore i { position: absolute; bottom: -2px; width: 5px; height: var(--h); background: linear-gradient(#5fbf6c, #2f8f4e); border-radius: 4px 4px 0 0; transform-origin: 50% 100%; animation: hs-grass 2.8s ease-in-out infinite; animation-delay: var(--d); }
@keyframes hs-grass { 0%,100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
.hs-fore em { position: absolute; bottom: 2px; font-style: normal; font-size: 22px; transform-origin: 50% 100%; animation: hs-grass 3.4s ease-in-out infinite; }
.hs-fore em:nth-of-type(2) { animation-delay: -1s; } .hs-fore em:nth-of-type(3) { animation-delay: -2s; }

.hs-greet { position: absolute; left: 0; right: 0; top: 0; padding: 16px 22px; z-index: 7; text-shadow: 0 2px 4px rgba(6,44,52,.62), 0 7px 20px rgba(6,44,52,.45); color: #fff; pointer-events: none; }
.hs-greet h1 { margin: 0; font-size: clamp(1.7rem, 4.6vw, 2.7rem); letter-spacing: -.02em; line-height: 1.05; }
.hs-greet p { margin: 4px 0 0; font-size: clamp(.95rem, 2vw, 1.15rem); font-weight: 700; opacity: .96; }
.wave span { display: inline-block; animation: hs-wave 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * .07s); white-space: pre; }
@keyframes hs-wave { 0%,60%,100% { transform: translateY(0) rotate(0); } 15% { transform: translateY(-9px) rotate(-5deg); } 30% { transform: translateY(0) rotate(3deg); } }
.hs-hint { position: absolute; right: 14px; bottom: 10px; z-index: 8; font-size: .72rem; font-weight: 800; color: #fff; background: rgba(0,60,60,.38); padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(4px); }

/* ===================== SECTIONS ===================== */
.worlds-section, .activities-section { margin: 26px 0 30px; }
.section-kicker { display: inline-block; margin-bottom: 5px; color: #3f8a7a; font-size: .7rem; font-weight: 900; letter-spacing: .14em; }
body[data-tod="night"] .section-kicker { color: #9fd9c8; }
.worlds-section > h2, .activities-heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.02em; }
.worlds-section > p, .activities-heading p { margin: 5px 0 14px; opacity: .75; font-size: .92rem; line-height: 1.45; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 18px; margin: 14px 0; perspective: 900px; }
.chapter-card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; border: 0; border-radius: 26px; overflow: hidden;
  background: #fff; color: var(--ink); cursor: pointer; text-align: left; font: inherit;
  box-shadow: 0 8px 22px rgba(10,60,60,.16);
  transform: rotateX(calc(var(--ry, 0) * 1deg)) rotateY(calc(var(--rx, 0) * 1deg));
  transition: transform .18s ease-out, box-shadow .25s;
}
.chapter-card:hover { box-shadow: 0 18px 38px rgba(10,60,60,.28); }
.chapter-card:active { transform: scale(.97); }
.chapter-card:focus-visible { outline: 4px solid var(--warn); outline-offset: 3px; }
.cc-art { position: relative; height: 170px; overflow: hidden; }
.cc-body { padding: 14px 18px 16px; display: grid; gap: 3px; }
.chapter-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; }
.chapter-sub { font-size: .86rem; opacity: .72; line-height: 1.35; }
.cc-chip { justify-self: start; margin-top: 8px; padding: 4px 12px; border-radius: 999px; background: #fff3c2; color: #7a5a00; font-weight: 800; font-size: .8rem; }
.cc-play { position: absolute; right: 14px; top: 14px; z-index: 5; width: 46px; height: 46px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 4px 12px rgba(0,0,0,.22); transition: transform .2s; }
.chapter-card:hover .cc-play { transform: scale(1.18) rotate(8deg); }
.chapter-card .cc-play { animation: cc-beat 2.2s ease-in-out infinite; }
@keyframes cc-beat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* world tiles */
.ca { position: absolute; inset: 0; overflow: hidden; }
.ca-ground { position: absolute; left: -5%; right: -5%; bottom: -10px; height: 32px; background: #6bbf5f; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.ca-ground-m { background: #7fd16e; }
.ca-cloud { position: absolute; left: 0; width: var(--w, 60px); height: calc(var(--w, 60px) * .4); background: rgba(255,255,255,.9); border-radius: 999px; animation: ca-drift var(--t, 24s) linear infinite; animation-delay: var(--o, 0s); }
.ca-cloud::before { content: ""; position: absolute; width: 50%; height: 130%; left: 16%; top: -55%; background: inherit; border-radius: 50%; }
@keyframes ca-drift { from { transform: translateX(-90px); } to { transform: translateX(360px); } }
.ca-park { background: linear-gradient(#ffd08a, #ff9d6a 70%, #e0743f); }
.ca-sunrays { position: absolute; left: 18%; top: -40%; width: 160px; height: 160px; border-radius: 50%; background: repeating-conic-gradient(rgba(255,255,255,.28) 0 10deg, transparent 10deg 20deg); animation: du-spin 30s linear infinite; }
.ca-volc { position: absolute; right: 4%; bottom: 8px; width: 56%; }
.ca-lava { animation: hs-lavapulse 2.2s ease-in-out infinite; }
.ca-smoke { position: absolute; right: 32%; bottom: 100px; width: 30px; height: 30px; border-radius: 50%; background: rgba(90,70,70,.5); filter: blur(4px); animation: hs-puff 4.2s ease-out infinite; animation-delay: var(--d); opacity: 0; }
.ca-ember { position: absolute; left: var(--x); bottom: 96px; width: 6px; height: 6px; border-radius: 50%; background: #ffd25e; box-shadow: 0 0 8px 3px #ff8a2b; animation: ca-ember 1.8s ease-out infinite; animation-delay: var(--d); opacity: 0; }
@keyframes ca-ember { 0% { transform: translate(0,0); opacity: 1; } 100% { transform: translate(24px,-70px); opacity: 0; } }
.ca-walker { position: absolute; bottom: 14px; left: 0; width: 76px; animation: ca-walk var(--t, 11s) linear infinite; }
@keyframes ca-walk { from { transform: translateX(-90px); } to { transform: translateX(330px); } }
.ca-meadow { background: linear-gradient(#bfeaf5, #e4f6c9 75%); }
.ca-sun { position: absolute; left: 12%; top: 14%; width: 40px; height: 40px; border-radius: 50%; background: #ffd45e; box-shadow: 0 0 0 7px rgba(255,212,94,.35), 0 0 30px 10px rgba(255,212,94,.5); animation: hs-sunpulse 3.6s ease-in-out infinite; }
.ca-stego { position: absolute; left: 50%; bottom: 14px; width: 112px; margin-left: -56px; }
.ca-flowers { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; justify-content: space-around; font-size: 24px; }
.ca-flowers em { font-style: normal; transform-origin: 50% 100%; animation: hs-grass 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.55s); }
.ca-bf { position: absolute; font-style: normal; font-size: 22px; left: 22%; top: 40%; animation: ca-flit 7s ease-in-out infinite; animation-delay: calc(var(--p) * -3.5s); }
@keyframes ca-flit { 0% { transform: translate(0,0) rotate(0); } 20% { transform: translate(60px,-26px) rotate(14deg); } 45% { transform: translate(120px,8px) rotate(-10deg); } 70% { transform: translate(190px,-30px) rotate(12deg); } 100% { transform: translate(0,0) rotate(0); } }
.ca-drive { background: linear-gradient(#86cbff, #d3eeff 66%); }
.ca-hills { position: absolute; left: 0; bottom: 38px; width: 100%; height: 60px; }
.ca-road { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; background: #4b5563; }
.ca-road b { position: absolute; left: 0; right: 0; top: 21px; height: 5px; background: repeating-linear-gradient(90deg, #fff 0 24px, transparent 24px 48px); animation: ca-road .5s linear infinite; }
@keyframes ca-road { to { background-position: -48px 0; } }
.ca-car { position: absolute; left: 50%; bottom: 12px; width: 124px; margin-left: -62px; animation: ca-bounce .5s ease-in-out infinite; }
.ca-car svg { width: 100%; display: block; }
@keyframes ca-bounce { 0%,100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-3px) rotate(.6deg); } }
.ca-wheel { animation: du-spin .45s linear infinite; }
.ca-puff { position: absolute; left: -4px; bottom: 6px; width: 14px; height: 14px; border-radius: 50%; background: rgba(240,240,240,.85); animation: ca-puff .9s ease-out infinite; animation-delay: var(--d); }
@keyframes ca-puff { from { transform: translate(0,0) scale(.6); opacity: .9; } to { transform: translate(-46px,-10px) scale(1.8); opacity: 0; } }

/* ===================== ACTIVITY MENU ===================== */
.activities-section { padding: 20px 18px 8px; border: 1px solid rgba(255,255,255,.55); border-radius: 28px; background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(235,248,240,.82)); backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(10,60,60,.08); }
body[data-tod="night"] .activities-section { background: linear-gradient(145deg, rgba(30,50,100,.65), rgba(40,70,120,.7)); border-color: rgba(255,255,255,.14); }
.activities-heading { margin: 0 0 12px; }
.activities-heading .section-kicker { color: #b9792f; }
.module-group { margin: 20px 0 26px; }
.module-group h3 { margin: 0 0 10px; color: #3b7468; font-size: 1rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
body[data-tod="night"] .module-group h3 { color: #a8e3d2; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 11px; }
.module-card {
  position: relative; min-width: 0; min-height: 80px; display: grid; grid-template-columns: 54px minmax(0, 1fr) 20px; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid #d9e9e3; border-radius: 20px; color: var(--ink); background: rgba(255,255,255,.94); text-align: left; font: inherit;
  box-shadow: 0 4px 12px rgba(20,60,58,.07); cursor: pointer; overflow: hidden;
  transition: transform .18s cubic-bezier(.3,.9,.4,1.3), box-shadow .2s, border-color .2s;
}
.module-card:hover { transform: translateY(-4px) rotate(-.4deg); border-color: #8ccbb9; box-shadow: 0 12px 24px rgba(20,60,58,.16); }
.module-card:hover .module-icon { animation: du-wobble .6s ease-in-out; }
.module-card:hover .module-open { transform: translateX(5px); }
.module-card:focus-visible { outline: 3px solid #e9c46a; outline-offset: 2px; }
.module-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; background: var(--tint, #edf6ed); font-size: 29px; animation: du-bob2 3.2s ease-in-out infinite; animation-delay: var(--du-delay, 0s); box-shadow: inset 0 -3px 0 rgba(0,0,0,.06); }
.module-copy { min-width: 0; display: grid; gap: 4px; }
.module-title { font-size: 1rem; font-weight: 900; line-height: 1.2; }
.module-sub { color: #59716d; font-size: .78rem; line-height: 1.35; }
.module-open { justify-self: end; color: #579487; font-size: 1.6rem; font-weight: 600; transition: transform .2s; }
.module-badge { position: absolute; right: 8px; top: 6px; font-size: .95rem; animation: du-twinkle 2.4s ease-in-out infinite; }
.module-card.played { border-color: #f0d680; }
.module-card.played::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 40%, rgba(255,230,140,.28) 50%, transparent 60%); transform: translateX(-120%); animation: hub-shimmer 5s ease-in-out infinite; animation-delay: var(--du-delay, 0s); pointer-events: none; }
@keyframes hub-shimmer { 0%,70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
#renameBtn { display: block; margin: 8px auto 32px; }

/* ===================== STAGE ===================== */
#stage { position: fixed; inset: 0; display: flex; flex-direction: column; background: #fff; z-index: 20; }
#stage[hidden] { display: none; }
#stagebar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); background: linear-gradient(90deg, #0b6e5f, #1b8b78); color: #fff; box-shadow: 0 3px 12px rgba(8,70,60,.3); flex-wrap: wrap; }
#stagebar .back { background: #fff; padding: 9px 16px; font-weight: 800; }
#stageTitle { font-weight: 900; font-size: 1.05rem; letter-spacing: -.01em; }
/* The story strip rides in the game bar, so the main tale is never left behind
 * on the menu. It is deliberately small: the game stays the biggest thing here. */
#stageStory { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
#stageStory .ss-part { background: rgba(255,255,255,.18); border-radius: 999px; padding: 4px 10px; font-size: .72rem; font-weight: 900; letter-spacing: .04em; }
#stageStory .ss-title { font-weight: 800; font-size: .86rem; opacity: .95; }
#stageStory .ss-goal { background: rgba(6,40,35,.35); border-radius: 999px; padding: 4px 10px; font-weight: 900; font-size: .78rem; }
#stageStory .ss-goal.met { background: #ffd23f; color: #40300a; animation: du-twinkle 1.6s ease-in-out infinite; }
#stageStory .ss-mate { font-size: .78rem; font-weight: 800; opacity: .9; }
#stageStory .ss-btn { background: #fff; color: #0b6e5f; font-size: .8rem; padding: 7px 12px; font-weight: 900; }
.sr-path { font-size: .92rem; font-weight: 700; color: #26513f; margin: 6px 0 0; }
.sr-trail { font-size: .84rem; color: #4b6a5c; margin: 2px 0 0; }
#chapter { flex: 1; border: 0; width: 100%; background: #fff; opacity: 0; transition: opacity .45s; }
#chapter.ready { opacity: 1; }
#loader { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: 150px; z-index: 0; transition: opacity .3s; }
#loader.off { opacity: 0; pointer-events: none; }
#loader::after { content: "Opening your adventure…"; position: absolute; left: 50%; transform: translateX(-50%); top: 100%; white-space: nowrap; font-weight: 800; color: #3b7468; animation: du-twinkle 1.4s ease-in-out infinite; }

/* ===================== DIALOGS ===================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,40,38,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: du-fade .25s ease-out; }
@keyframes du-fade { from { opacity: 0; } }
.modal { background: #fff; color: var(--ink); border-radius: 24px; padding: 22px; max-width: 460px; width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 16px 50px rgba(0,0,0,.3); animation: du-in .45s cubic-bezier(.2,.9,.3,1.25) both; }
.modal h2 { margin: 0 0 8px; }
.modal label { display: block; margin: 10px 0; font-weight: 700; }
.modal input[type="text"] { width: 100%; padding: 12px; font-size: 1.1rem; border: 2px solid #cfe8e2; border-radius: 12px; margin-top: 6px; }
.modal .row { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.modal .row input[type="checkbox"] { width: 19px; height: 19px; margin: 0; accent-color: var(--accent-2); }
.setting-field { display: grid; gap: 6px; margin: 13px 0 !important; font-size: .9rem; }
.setting-field input, .setting-field select { width: 100%; min-height: 43px; padding: 9px 11px; border: 2px solid #cfe8e2; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; }
.setting-field input:focus-visible, .setting-field select:focus-visible { outline: 3px solid #e9c46a; outline-offset: 2px; }
.setting-error, #name-error { min-height: 1em; margin: 5px 0; color: #a13d3d; font-size: .82rem; }
.subtle { font-size: .85rem; opacity: .72; }
.toolbar { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; display: none; z-index: 60; max-width: 90vw; text-align: center; font-weight: 700; box-shadow: 0 8px 22px rgba(0,0,0,.3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01s !important; animation-duration: .01s !important; animation-iteration-count: 1 !important; }
  .hs-walker, .hs-flyer, .hs-cloud { animation: none !important; }
}
@media (max-width: 560px) {
  #hub { padding: 11px; }
  .module-grid { grid-template-columns: 1fr; }
  .hs-bubble { top: 36%; max-width: 55%; }
  .hs-volcano { width: 46%; }
  .activities-section { padding: 16px 12px 4px; }
}

/* Dino Adventures tile */
.ca-adv { background: linear-gradient(#ffd9a8, #ffeccc 55%, #bfe8a8 56%); }
.ca-balloon { position: absolute; bottom: 30%; left: var(--x); width: 20px; height: 26px; border-radius: 50% 50% 46% 46%; background: var(--c); box-shadow: inset -4px -4px 0 rgba(0,0,0,.12); animation: ca-rise 6s ease-in-out infinite; animation-delay: var(--d); }
.ca-balloon::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 24px; background: rgba(0,0,0,.35); }
@keyframes ca-rise { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-34px) rotate(4deg); } }

/* Prehistoric Arcade tile — a dusk drum circle, one rune falling into each lane */
.ca-arcade { background: linear-gradient(#241a44 0%, #4b2f5d 40%, #9c4a45 72%, #dd8c54 100%); }
.ca-arc-sun { position: absolute; left: 16%; top: 16%; width: 34px; height: 34px; border-radius: 50%; background: #ffd9a0; box-shadow: 0 0 0 7px rgba(255,206,140,.16), 0 0 28px 12px rgba(255,150,80,.4); animation: hs-sunpulse 4.5s ease-in-out infinite; }
.ca-arc-cloud { position: absolute; left: 0; width: var(--w, 56px); height: calc(var(--w, 56px) * .3); border-radius: 999px; background: rgba(255,214,190,.2); filter: blur(1px); animation: ca-drift var(--t, 36s) linear infinite; animation-delay: var(--o, 0s); }
.ca-arc-lanes { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.ca-arc-lanes b { position: relative; background: linear-gradient(to top, rgba(255,198,138,.15), rgba(255,198,138,.03) 62%, transparent); }
.ca-arc-lanes b::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 64%; background: linear-gradient(transparent, rgba(255,222,176,.32)); }
.ca-arc-ridge { position: absolute; left: 0; bottom: 0; width: 100%; height: 66px; }
.ca-arc-glow { position: absolute; left: 50%; bottom: -34px; width: 88%; height: 100px; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(255,152,84,.4), transparent 68%); }
.ca-arc-stage { position: absolute; left: 5%; right: 5%; bottom: 7px; display: grid; grid-template-columns: repeat(4, 1fr); }
.ca-arc-stage b { position: relative; width: 47%; max-width: 42px; aspect-ratio: 1.5; margin: 0 auto; border-radius: 20% 20% 26% 26% / 16% 16% 38% 38%; background: linear-gradient(#9c6742, #5d3627 72%, #3c2117); box-shadow: 0 6px 10px rgba(0,0,0,.35), inset 0 -4px 0 rgba(0,0,0,.22); transform-origin: 50% 100%; animation: ca-arc-pulse 2.7s ease-in-out infinite; animation-delay: calc(var(--i) * -.27s); }
.ca-arc-stage b::before { content: ""; position: absolute; left: -7%; right: -7%; top: -34%; height: 74%; border-radius: 50%; background: radial-gradient(ellipse at 40% 34%, #fff2d4, #ebd1a6 58%, #b98c5c); box-shadow: inset 0 -2px 0 rgba(90,50,30,.3), 0 0 12px rgba(255,190,120,.22); }
.ca-arc-stage s { position: absolute; left: 50%; top: -16%; width: 34%; max-width: 12px; aspect-ratio: 1; transform: translateX(-50%) rotate(45deg); border-radius: 2px; background: #ffcf6a; }
.ca-arc-stage b:nth-child(2) s { background: #ff8f5e; }
.ca-arc-stage b:nth-child(3) s { background: #7de3d4; }
.ca-arc-stage b:nth-child(4) s { background: #c9b6ff; }
.ca-arc-notes { position: absolute; inset: 0; }
.ca-arc-notes i { position: absolute; left: calc(16.25% + var(--i) * 22.5%); top: 28px; width: 15px; height: 15px; margin-left: -7.5px; border-radius: 50%; border: 2px solid #ffcf6a; background: rgba(255,240,212,.16); box-shadow: 0 0 9px 1px rgba(255,200,130,.5); animation: ca-arc-fall 2.9s cubic-bezier(.5,.05,.8,.65) infinite; animation-delay: var(--d); }
.ca-arc-notes i:nth-child(2) { border-color: #ff8f5e; box-shadow: 0 0 9px 1px rgba(255,143,94,.5); }
.ca-arc-notes i:nth-child(3) { border-color: #7de3d4; box-shadow: 0 0 9px 1px rgba(125,227,212,.5); }
.ca-arc-notes i:nth-child(4) { border-color: #c9b6ff; box-shadow: 0 0 9px 1px rgba(201,182,255,.5); }
@keyframes ca-arc-fall { 0% { transform: translateY(-16px) scale(.8); opacity: 0; } 14% { opacity: 1; } 76% { transform: translateY(76px) scale(1); opacity: 1; } 94%, 100% { transform: translateY(92px) scale(1.12); opacity: 0; } }
@keyframes ca-arc-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, .975); } }

/* ===================== STORY RIBBON ===================== */
.story-ribbon {
  display: grid; grid-template-columns: 26px 1fr; gap: 16px; align-items: start;
  margin: 18px 0 6px; padding: 18px 20px;
  border-radius: 28px; border: 2px solid rgba(233,196,106,.7);
  background: linear-gradient(150deg, rgba(255,247,224,.92), rgba(232,248,240,.9));
  box-shadow: 0 10px 26px rgba(20,60,58,.12);
}
body[data-tod="night"] .story-ribbon { background: linear-gradient(150deg, rgba(48,58,120,.86), rgba(30,52,96,.82)); border-color: rgba(255,226,120,.45); }
.story-ribbon h2 { margin: 2px 0 4px; font-size: 1.35rem; }
.story-ribbon p { margin: 0 0 10px; color: #4b6b66; max-width: 62ch; }
body[data-tod="night"] .story-ribbon p { color: #c9e2dd; }
.story-ribbon .toolbar { margin-top: 4px; }
/* The crystals read left to right down the side of the ribbon, like a path. */
.sr-crystals { display: grid; gap: 9px; align-content: start; padding-top: 4px; }
.sr-pip { width: 15px; height: 15px; border-radius: 50%; background: #d7e7e1; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.sr-pip.now { background: #ffd45e; animation: du-twinkle 1.6s ease-in-out infinite; }
.sr-pip.won { background: #2a9d8f; box-shadow: 0 0 0 2px #ffe9a8, 0 0 10px rgba(255,226,120,.8); }
.cc-crystal { position: absolute; right: 10px; top: 8px; font-size: 1.5rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); animation: du-bob2 2.8s ease-in-out infinite; }
.chapter-card.begun::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 42%, rgba(255,232,150,.26) 50%, transparent 58%); transform: translateX(-120%); animation: hub-shimmer 6.5s ease-in-out infinite; pointer-events: none; }

/* ===================== JOURNEY MAP ===================== */
.modal-wide { max-width: 680px; }
.jy-totals { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.jy-pill { padding: 7px 13px; border-radius: 999px; background: #eef8f3; border: 1px solid #cfe8e2; font-size: .86rem; font-weight: 700; }
.jy-pill b { font-size: 1.02rem; }
.jy-h { margin: 18px 0 8px; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: #177a63; }
.jy-path, .jy-worlds { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.jy-path button, .jy-worlds button {
  width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 11px;
  padding: 9px 12px; border: 1px solid #dceee7; border-radius: 16px; background: #fbfffd; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: transform .16s, border-color .2s, box-shadow .2s;
}
.jy-path button:hover, .jy-worlds button:hover { transform: translateX(3px); border-color: #8ccbb9; box-shadow: 0 6px 16px rgba(20,60,58,.12); }
.jy-num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #dff0e8; color: #177a63; font-weight: 900; font-size: .9rem; }
.jy-step.won .jy-num { background: #2a9d8f; color: #fff; }
.jy-step.now .jy-num { background: #ffd45e; color: #6b4c00; animation: du-twinkle 1.8s ease-in-out infinite; }
.jy-what { min-width: 0; display: grid; gap: 2px; }
.jy-what b { font-size: .98rem; }
.jy-what i { font-style: normal; color: #5c7a75; font-size: .78rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jy-mark { font-weight: 900; color: #2a9d8f; white-space: nowrap; }
.jy-worlds .jy-icon { font-size: 1.5rem; display: grid; place-items: center; }
.jy-wonders { margin: 0; color: #4b6b66; font-size: .88rem; }
.jy-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jy-picks li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 9px 12px;
  border: 1px solid #e6d9bd; border-radius: 16px; background: linear-gradient(180deg, #fffdf4, #fff);
  box-shadow: 0 3px 10px rgba(60,50,20,.06);
}
.jy-picks b { font-size: .82rem; color: #a5691c; letter-spacing: .04em; text-transform: uppercase; }
.jy-picks i { font-style: normal; font-size: .92rem; font-weight: 700; color: var(--ink); }
body[data-tod="night"] .jy-picks li { background: linear-gradient(180deg, rgba(56,64,104,.8), rgba(34,44,78,.8)); border-color: rgba(255,255,255,.16); }
body[data-tod="night"] .jy-picks b { color: #f0c46a; }
@media (max-width: 560px) {
  .story-ribbon { grid-template-columns: 1fr; }
  .sr-crystals { grid-auto-flow: column; justify-content: start; }
}
/* Photographic environment: the terrain and plants are part of the landscape. */
.hero-scene .hs-photo { background-image: url('assets/environments/jungle.webp'); background-position: center bottom; }
.hero-scene[data-tod] .hs-photo { background-image: url('assets/environments/jungle.webp'); }
.hero-scene .hs-far, .hero-scene .hs-volcano, .hero-scene .hs-hills,
.hero-scene .hs-palms, .hero-scene .hs-fore, .hero-scene .hs-cloud,
.hero-scene .hs-smoke { display: none; }
.hero-scene[data-tod="night"] .hs-photo { filter: brightness(.45) saturate(.65); }
.hero-scene[data-tod="dusk"] .hs-photo { filter: brightness(.8) sepia(.18); }
@media (prefers-reduced-motion: no-preference) {
  .hero-scene .hs-photo { animation: environment-drift 28s ease-in-out infinite alternate; }
}
@keyframes environment-drift { from { transform: scale(1.025) translateX(-.3%); } to { transform: scale(1.06) translateX(.3%); } }

.hero-scene[data-tod="night"] .hs-photo { background-image: url("assets/environments/night.webp"); filter: none; }
.ca-park { background: url("assets/environments/volcanic.webp") center/cover; }
.ca-meadow { background: url("assets/environments/jungle.webp") center/cover; }
.ca-drive { background: url("assets/environments/jungle.webp") center/cover; }
.ca-park .ca-volc, .ca-park .ca-ground { display:none; }
