/* Phase 2: all layers and controls are scoped to this standalone page. */
.fr { --aether:236,210,151; --depth:0px; }
.fr[data-world=temple] { --aether:207,227,239; }
.fr[data-world=forest] { --aether:185,215,150; }
.fr[data-world=inferno] {
  --aether:183,192,236; --ink:#e9e3ef; --muted:#c3b8ca; --accent:#b5a4c9;
  --line:#a292b34f; --paper:#1c1723; --veil:28,23,35;
}
.fr-backdrop__layer[data-scene=inferno],.fr[data-world=inferno] #story-image { filter:saturate(.46) hue-rotate(322deg); }
.fr-environment,.fr-effects { position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none; }
.fr-depth { position:absolute; inset:-5%; }
.fr-depth--far { transform:translateY(calc(var(--depth) * -.15)); }
.fr-depth--middle { transform:translateY(calc(var(--depth) * -.5)); }
.fr-depth--near { transform:translateY(calc(var(--depth) * -1)); }
.fr-air,.fr-mist,.fr-near,.fr-world-light { position:absolute; inset:0; opacity:0; }
.fr-world-light { background:radial-gradient(ellipse at 72% 43%,rgba(var(--aether),.22),transparent 55%); }
.fr[data-world=sky] .fr-air { background:radial-gradient(ellipse at 79% 12%,#ffe7b440,transparent 53%); animation:fr-breathe 27s ease-in-out infinite alternate; }
.fr[data-world=sky] .fr-mist { top:45%; background:radial-gradient(ellipse at 85% 50%,#fff9e6a1,transparent 37%),radial-gradient(ellipse at 30% 75%,#fff8e875,transparent 45%); animation:fr-cloud 74s ease-in-out infinite alternate; }
.fr[data-world=sky] .fr-near { top:65%; background:radial-gradient(ellipse at 80% 70%,#fffaf091,transparent 48%); animation:fr-cloud 49s ease-in-out -18s infinite alternate-reverse; }
.fr[data-world=temple] .fr-air { background:conic-gradient(from 169deg at 80% -5%,transparent 0deg,#edf8ff36 6deg,transparent 13deg,#edf8ff29 21deg,transparent 27deg); animation:fr-breathe 29s ease-in-out infinite alternate; }
.fr[data-world=temple] .fr-mist { background:radial-gradient(circle at 76% 35%,#fff9 0 1px,transparent 2px),radial-gradient(circle at 58% 52%,#fff8 0 1px,transparent 2px),radial-gradient(circle at 89% 65%,#fff6 0 1px,transparent 2px); animation:fr-dust 36s ease-in-out infinite alternate; }
.fr[data-world=forest] .fr-air { background:conic-gradient(from 185deg at 87% -10%,transparent,#d9e7a126 6deg,transparent 12deg,#d9e7a118 19deg,transparent 25deg); animation:fr-breathe 23s ease-in-out infinite alternate; }
.fr[data-world=forest] .fr-mist { top:60%; background:radial-gradient(ellipse at 70% 70%,#9ab3a32b,transparent 60%); animation:fr-cloud 46s ease-in-out infinite alternate; }
.fr[data-world=forest] .fr-near { inset:5% -8% auto auto; width:180px; height:280px; background:radial-gradient(ellipse at 70% 14%,#102c1b88 0 15%,transparent 16%),radial-gradient(ellipse at 90% 39%,#14332177 0 12%,transparent 13%),radial-gradient(ellipse at 72% 64%,#102c1b66 0 10%,transparent 11%); transform-origin:100% 0; animation:fr-sway 17s ease-in-out infinite alternate; }
.fr[data-world=inferno] .fr-air { background:radial-gradient(ellipse at 78% 44%,#7c356441,transparent 44%); animation:fr-breathe 21s ease-in-out infinite alternate; }
.fr[data-world=inferno] .fr-mist { top:60%; background:radial-gradient(ellipse at 70% 65%,#05040bbb,transparent 67%); animation:fr-cloud 43s ease-in-out infinite alternate; }
.fr[data-world=inferno] .fr-near { top:76%; background:radial-gradient(ellipse at 34% 75%,#03030bb8,transparent 65%); animation:fr-cloud 31s ease-in-out -12s infinite alternate-reverse; }
@keyframes fr-breathe { from { opacity:.35; } to { opacity:.8; } }
@keyframes fr-cloud { from { opacity:.35; transform:translateX(-4%); } to { opacity:.65; transform:translateX(4%); } }
@keyframes fr-dust { from { opacity:.28; transform:translate(-10px,20px); } to { opacity:.55; transform:translate(12px,-15px); } }
@keyframes fr-sway { from { opacity:.5; transform:rotate(-2deg); } to { opacity:.7; transform:rotate(2deg); } }
/* The foreground artifact occupies the empty side of the existing hero. */
.fr-relic { position:relative; align-self:center; width:220px; min-height:220px; margin:-20px 0; text-align:center; color:var(--accent); }
.fr-relic__touch { position:relative; display:flex; flex-direction:column; align-items:center; gap:12px; margin:auto; padding:12px 16px; background:radial-gradient(ellipse,rgba(var(--veil),.82),rgba(var(--veil),.2) 60%,transparent 72%); border-radius:50%; touch-action:pan-y; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.fr-relic__art { width:104px; height:104px; overflow:visible; transition:filter .7s,opacity .7s; }
.fr-relic.is-journey-ready .fr-relic__art { filter:drop-shadow(0 0 9px rgba(var(--aether),.8)); animation:fr-journey-beacon 4.8s ease-in-out infinite; }
@keyframes fr-journey-beacon { 0%,100% { opacity:.65; } 50% { opacity:1; } }
.fr-motion-paused .fr-relic.is-journey-ready .fr-relic__art { animation:none; }
.fr-relic__touch:hover .fr-relic__art { filter:drop-shadow(0 0 6px rgba(var(--aether),.7)); }
.fr-relic__crack { position:absolute; width:104px; height:104px; top:12px; fill:none; stroke:#dae4ff; stroke-width:1.4; opacity:0; filter:drop-shadow(0 0 5px #c2cfff); pointer-events:none; }
.fr-relic.is-holding .fr-relic__crack { opacity:.6; animation:fr-crack 1.2s ease-out both; }
.fr-relic.is-holding .fr-relic__art { color:#e2efff; filter:drop-shadow(0 0 12px #c1d9ff); transition:none; }
.fr-relic__touch:before { content:""; position:absolute; inset:-25%; border-radius:50%; pointer-events:none; opacity:0; background:radial-gradient(circle,#d1e2ff70, #99baff25 35%,transparent 68%); }
.fr-relic.is-holding .fr-relic__touch:before { opacity:.65; animation:fr-charge 1.2s ease-out both; }
.fr[data-world=temple] .fr-relic.is-unsealed .fr-relic__art { filter:drop-shadow(0 0 7px rgba(var(--aether),.55)); }
.fr-runes { display:flex; justify-content:center; gap:6px; margin-top:4px; }
.fr-runes button { width:44px; height:44px; background:rgba(var(--veil),.55); border:1px solid var(--line); border-radius:50%; font:24px Georgia,serif; }
.fr-runes button.is-found { color:var(--ink); border-color:var(--accent); background:rgba(var(--aether),.3); }
.fr-spirit-touch { position:absolute; right:-20px; top:25px; width:48px; height:48px; padding:10px; background:none; color:#dae9ad; }
.fr-spirit-touch svg { width:100%; height:100%; filter:drop-shadow(0 0 5px #d6e98c); }
.fr:not(.fr-effects-suspended) .fr-spirit-touch { animation:fr-dust 11s ease-in-out infinite alternate; }
.fr-relic.is-responding .fr-relic__art { animation:fr-mark-light 3.2s ease-out both; }
.fr-relic.is-glyph .fr-relic__art { animation:fr-mark-light 6s ease-in-out both; }
.fr-relic.is-eyes:after { content:''; position:absolute; top:32px; left:calc(50% - 10px); width:20px; height:4px; background:radial-gradient(circle at 2px 2px,#fff,transparent 3px),radial-gradient(circle at 18px 2px,#fff,transparent 3px); filter:drop-shadow(0 0 5px #e6f7ff); animation:fr-eyes 7s ease-in-out both; pointer-events:none; }
@keyframes fr-crack { from { opacity:.6; } to { opacity:1; } }
@keyframes fr-charge { from { opacity:.55; transform:scale(.75); } to { opacity:.9; transform:scale(1.2); } }
@keyframes fr-mark-light { 0%,100% { filter:none; } 40% { filter:drop-shadow(0 0 10px rgba(var(--aether),.9)); } }
@keyframes fr-eyes { 0%,32%,100% { opacity:0; } 48%,62% { opacity:.85; } }
/* Ephemeral effects: one event group, at most four fragments on desktop / two on mobile. */
.fr-mote { position:absolute; left:var(--x); top:var(--y,24%); width:var(--size,20px); height:var(--size,20px); color:#faf7ea; opacity:0; animation:fr-fall var(--life,12s) ease-in-out both; animation-delay:var(--delay,0s); }
.fr-mote svg { width:100%; height:100%; }
.fr-mote--gold { color:#caaa63; }
.fr-mote--leaf { color:#a1ae65; }
.fr-mote--soul,.fr-mote--spirit,.fr-mote--ash,.fr-mote--spark { border-radius:50%; width:var(--size,5px); height:var(--size,5px); background:currentColor; box-shadow:0 0 12px 3px currentColor; animation-name:fr-rise; }
.fr-mote--soul { color:#b5c7e9; }
.fr-mote--spirit { color:#d8e6ab; }
.fr-mote--ash { color:#aba6b5; box-shadow:none; }
.fr-mote--spark { color:rgb(var(--aether)); }
@keyframes fr-fall { 0% { opacity:0; transform:translate(-25px,-35px) rotate(-28deg); } 15%,70% { opacity:.65; } 45% { transform:translate(24px,80px) rotate(18deg); } 100% { opacity:0; transform:translate(-12px,220px) rotate(65deg); } }
@keyframes fr-rise { 0% { opacity:0; transform:translate(-14px,35px) scale(.6); } 22%,65% { opacity:.6; } 55% { transform:translate(18px,-40px); } 100% { opacity:0; transform:translate(-8px,-100px) scale(.3); } }
.fr-apparition { position:absolute; width:45vw; max-width:650px; height:32vh; left:48%; top:23%; opacity:0; color:#242623; filter:blur(2px); animation:fr-apparition 16s ease-in-out both; }
.fr-apparition--stag { width:35vw; color:#071810; left:59%; top:43%; filter:blur(3px); }
.fr-apparition--giant { width:48vw; height:55vh; color:#040308; left:45%; top:20%; filter:blur(5px); }
@keyframes fr-apparition { 0%,100% { opacity:0; transform:translateX(6%); } 35%,65% { opacity:.18; } 100% { transform:translateX(-10%); } }
.fr[data-world=inferno][data-event=rare] .fr-world-light { background:#05030d; animation:fr-dim 16s ease-in-out both; }
.fr[data-world=temple][data-event=rare] .fr-world-light { animation:fr-light 7s ease-in-out both; }
.fr[data-event=touch] .fr-world-light { animation:fr-light 3.2s ease-in-out both; }
@keyframes fr-light { 0%,100% { opacity:0; } 40% { opacity:.7; } }
@keyframes fr-dim { 0%,100% { opacity:0; } 40%,60% { opacity:.17; } }
.fr-ripple { position:absolute; left:var(--x); top:var(--y); width:140px; height:140px; margin:-70px; border:1px solid rgba(var(--aether),.7); border-radius:50%; background:radial-gradient(circle,rgba(var(--aether),.12),transparent 65%); animation:fr-ripple 3.2s ease-out both; }
@keyframes fr-ripple { from { opacity:.7; transform:scale(.25); } to { opacity:0; transform:scale(2.5); } }
.fr-effects-preview { padding:15px 0; font-size:11px; }
.fr-effects-preview button { margin:6px; padding:8px 12px; border:1px solid var(--line); background:var(--paper); }
.fr-effects-suspended .fr-environment,.fr-effects-suspended .fr-effects { visibility:hidden; }
.fr-effects-suspended .fr-depth { transform:none; }
.fr-effects-suspended .fr-environment *,.fr-effects-suspended .fr-relic * { animation-play-state:paused!important; }
@media(max-width:700px) {
  .fr-relic { width:100%; max-width:280px; min-height:180px; margin:-12px 0 -14px; }
  .fr-relic__touch { padding:6px 16px; gap:6px; }
  .fr-relic__art,.fr-relic__crack { width:76px; height:76px; }
  .fr-relic__crack { top:6px; }
  .fr-relic.is-eyes:after { top:20px; width:16px; left:calc(50% - 8px); background:radial-gradient(circle at 2px 2px,#fff,transparent 3px),radial-gradient(circle at 14px 2px,#fff,transparent 3px); }
  .fr-spirit-touch { right:8px; top:15px; }
  .fr-apparition { width:80vw; left:22%; }
  .fr-apparition--stag { width:60vw; left:38%; }
  .fr-apparition--giant { width:90vw; left:22%; }
}
@media(prefers-reduced-motion:reduce) {
  .fr-relic.is-journey-ready .fr-relic__art { animation:none; }
  .fr-environment,.fr-effects { display:none; }
  .fr-depth { transform:none; }
}

.fr-symbols { position:absolute; overflow:hidden; pointer-events:none; }
.fr-page-hidden *,.fr-page-hidden *:before,.fr-page-hidden *:after { animation-play-state:paused!important; }

.fr-glyph-clue { margin-top:10px!important; font:16px/1.6 Georgia,serif; letter-spacing:6px; color:var(--accent); }
.fr-summon-bloom { position:absolute; left:var(--x); top:var(--y); width:min(100vw,850px); aspect-ratio:1; border-radius:50%; background:radial-gradient(circle,#fff 0%,#e4f2ffed 8%,#bbd9ffb3 18%,#a3c5f252 35%,transparent 65%); animation:fr-summon-bloom 2.2s ease-out both; }
@keyframes fr-summon-bloom { 0% { opacity:.65; transform:translate(-50%,-50%) scale(.12); } 15% { opacity:.95; transform:translate(-50%,-50%) scale(.85); } 100% { opacity:0; transform:translate(-50%,-50%) scale(1.35); } }
.fr[data-event=summon] .fr-world-light { animation:fr-light 2.2s ease-out both; }
/* A single persistent companion; world changes only replace .fr-effects children. */
.fr-companion { position:fixed; left:0; bottom:calc(-22px + env(safe-area-inset-bottom,0px)); width:clamp(160px,48vw,260px); aspect-ratio:1; z-index:12; pointer-events:none; user-select:none; }
.fr-companion__facing,.fr-companion__arrival { width:100%; height:100%; }
.fr-companion[data-facing=left] .fr-companion__facing { transform:scaleX(-1); }
.fr-companion__arrival { position:relative; }
.fr-companion.is-arriving .fr-companion__arrival { animation:fr-ghost-arrive 1.2s ease-out both; }
.fr-companion.is-arriving .fr-companion__arrival:before { content:''; position:absolute; left:16%; right:16%; top:46%; bottom:0; border-radius:50%; background:radial-gradient(ellipse,#d7edff80,transparent 65%); animation:fr-ghost-halo 1.2s ease-out both; }
.fr-companion__image,.fr-companion__still { display:block; width:100%; height:100%; object-fit:contain; }
.fr-companion.is-still .fr-companion__arrival { animation:none; }
.fr-companion.is-still .fr-companion__arrival:before { display:none; }
.fr-intro-open .fr-companion,.fr-page-hidden .fr-companion { visibility:hidden; }
@keyframes fr-ghost-arrive { from { opacity:0; transform:translateY(20px) scale(.8); } to { opacity:1; transform:none; } }
@keyframes fr-ghost-halo { 0% { opacity:0; transform:scale(.4); } 25% { opacity:1; } 100% { opacity:0; transform:scale(1.4); } }
