/* =====================================================================
   PREMIUM SCREENS: the world behind every screen between fights, scenes for
   the Rest Stop, encounters, loot and the rival, map terrain, fight foregrounds
   ===================================================================== */
/* 1. the hunt's region behind the map, encounters, rest stops and rewards */
.overlay.world { background: radial-gradient(ellipse at 50% 42%, rgba(14,11,8,.28), rgba(14,11,8,.78) 78%), var(--world) center / cover no-repeat fixed, #17110c; backdrop-filter: none; }
.overlay.world > .ov-fx { position: fixed; inset: 0; z-index: 0; opacity: .85; }
   /* only where the weather layer sits behind: full-screen scenes position themselves */
.overlay.world > .modal { box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 24px 60px rgba(0,0,0,.7); position: relative; z-index: 1; }

/* scene art shared by the screens between fights */
.sc-wrap { position: relative; margin: -6px -6px 12px; border-radius: 10px; overflow: hidden; border: 3px solid #0f0b08; box-shadow: inset 0 0 0 2px #6d5a44, 0 10px 24px rgba(0,0,0,.5); }
.sc-svg { display: block; width: 100%; height: auto; }
.sc-flicker { animation: scFlicker 2.4s ease-in-out infinite; }
@keyframes scFlicker { 0%,100% { opacity: 1; } 25% { opacity: .82; } 50% { opacity: .95; } 70% { opacity: .78; } }
.sc-flame { transform-box: fill-box; transform-origin: 50% 100%; animation: scFlame .9s ease-in-out infinite alternate; }
.sc-flame.f2 { animation-duration: .7s; animation-delay: -.3s; } .sc-flame.f3 { animation-duration: .5s; }
@keyframes scFlame { 0% { transform: scale(1, 1) skewX(0deg); } 50% { transform: scale(.94, 1.08) skewX(-4deg); } 100% { transform: scale(1.04, .94) skewX(3deg); } }
.sc-ember { animation: scEmber 2.2s ease-out infinite; } .sc-ember.e1 { animation-delay: -.5s; } .sc-ember.e2 { animation-delay: -1s; } .sc-ember.e3 { animation-delay: -1.5s; } .sc-ember.e4 { animation-delay: -1.9s; }
@keyframes scEmber { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(8px, -90px); opacity: 0; } }
.sc-twinkle { animation: scFlicker 3.4s ease-in-out infinite; }
.sc-spin { transform-box: fill-box; transform-origin: center; animation: scSpin 3s linear infinite; } @keyframes scSpin { to { transform: rotate(360deg); } }
.sc-bell { transform-box: fill-box; transform-origin: 50% 0; animation: scBell 4s ease-in-out infinite; } @keyframes scBell { 0%,80%,100% { transform: rotate(0); } 85% { transform: rotate(12deg); } 92% { transform: rotate(-10deg); } }
.sc-z { animation: scZ 2.4s ease-in-out infinite; } .sc-z.z2 { animation-delay: -1.2s; } @keyframes scZ { 0% { opacity: 0; transform: translateY(6px); } 50% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.sc-spark { animation: scSpark 1s ease-out infinite; } .sc-spark.s1 { animation-delay: -.33s; } .sc-spark.s2 { animation-delay: -.66s; } @keyframes scSpark { 0% { opacity: 1; transform: translate(0,0); } 100% { opacity: 0; transform: translate(10px,-10px); } }
.sc-glint { animation: scGlint 2.6s ease-in-out infinite; opacity: 0; } .sc-glint.g1 { animation-delay: -.6s; } .sc-glint.g2 { animation-delay: -1.3s; } .sc-glint.g3 { animation-delay: -1.9s; }
@keyframes scGlint { 0%,70%,100% { opacity: 0; } 80% { opacity: 1; } }
body.no-fx .sc-flicker, body.no-fx .sc-flame, body.no-fx .sc-ember, body.no-fx .sc-spin, body.no-fx .sc-bell, body.no-fx .sc-z, body.no-fx .sc-spark, body.no-fx .sc-glint, body.no-fx .sc-twinkle { animation: none; }

/* 2. the Rest Stop: the chapel scene with your hero by the fire, illustrated choices */
.modal.rest-modal { width: min(760px, 96vw); max-width: 760px; }
.rest-scene .sc-hero { position: absolute; left: 27%; bottom: 3%; width: 17%; height: 80%; background: none; border: 0; box-shadow: none; padding: 0; }
.rest-scene .sc-hero .sprite { position: absolute; inset: 0; }
.sc-title { margin-top: 2px; }
.sc-options .option-card { padding: 0 10px 12px; overflow: hidden; background: linear-gradient(#2e2216, #1e160e); border: 2px solid #6d5a44; box-shadow: inset 0 0 0 1px #0f0b08, 0 6px 14px rgba(0,0,0,.45); transition: transform .15s, box-shadow .15s, border-color .15s; }
.sc-options .option-card:hover:not(:disabled) { transform: translateY(-3px); border-color: #e2b552; box-shadow: inset 0 0 0 1px #0f0b08, 0 10px 22px rgba(0,0,0,.55), 0 0 18px rgba(226,181,82,.25); }
.sc-opt { display: block; width: calc(100% + 20px); margin: 0 -10px 8px; height: 70px; background: linear-gradient(#3a2a1a, #24180e); border-bottom: 2px solid #0f0b08; }

/* 3. encounters as a storybook page: a framed painting, a title plaque, parchment text, carved choices */
.event-modal .event-scene { box-shadow: inset 0 0 0 4px #17110c, inset 0 0 0 7px #b48a3c, inset 0 0 0 9px #17110c, inset 0 -60px 80px rgba(0,0,0,.35); }
.event-modal .event-scene::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(0,0,0,.35)); pointer-events: none; }
.event-modal .event-scene h1 { z-index: 1; text-shadow: 0 2px 0 #17110c, 0 0 18px rgba(0,0,0,.8); letter-spacing: .02em; }
.event-modal .event-scene h1::after { content: ""; display: block; width: 120px; height: 2px; margin: 6px auto 0; background: linear-gradient(90deg, transparent, #e2b552, transparent); }
.event-modal .event-text, .modal.narrow .event-text { position: relative; padding: 16px 22px; border-radius: 6px; color: #2a1d12; font-family: var(--font-display); font-style: italic; font-size: 16.5px;
  background: radial-gradient(ellipse at 50% 40%, #f3e6c4, #dcc89a); box-shadow: inset 0 0 0 2px #b48a3c, inset 0 0 30px rgba(120,80,30,.3), 0 8px 18px rgba(0,0,0,.45); }
.ev-story .event-text .ev-first { color: #8a2a1f; font-style: normal; font-weight: 800; letter-spacing: .02em; }
.choices .choice { background: linear-gradient(#3a2a1a, #24180e); border: 2px solid #6d5a44; box-shadow: inset 0 0 0 1px #0f0b08, inset 0 1px 0 rgba(255,220,160,.12), 0 6px 14px rgba(0,0,0,.45); transition: transform .15s, border-color .15s, box-shadow .15s; }
.choices .choice:hover:not(:disabled) { border-color: #e2b552; background: linear-gradient(#46321e, #2a1c10); box-shadow: inset 0 0 0 1px #0f0b08, 0 10px 22px rgba(0,0,0,.55), 0 0 18px rgba(226,181,82,.22); }
.choices .choice b { text-shadow: 0 1px 0 #0f0b08; }
.event-modal .choice-pic { box-shadow: inset 0 0 0 2px #b48a3c; }
.result-box { background: radial-gradient(ellipse at 50% 40%, #f3e6c4, #dcc89a); color: #2a1d12; border: 0; box-shadow: inset 0 0 0 2px #b48a3c, 0 8px 18px rgba(0,0,0,.45); font-family: var(--font-display); }

/* 4. loot: an opened chest, your hero in a fitting frame, armor on carved cards */
.sc-chest-head { width: 220px; margin: -10px auto -6px; filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); }
.sc-chest-head.rare .sc-svg { filter: hue-rotate(160deg) saturate(1.2); }
.doll.sc-fitting { border-radius: 14px 14px 10px 10px; background: radial-gradient(ellipse at 50% 30%, rgba(255,214,140,.35), transparent 60%), linear-gradient(#e8d8b0, #cdb488); box-shadow: inset 0 0 0 3px #17110c, inset 0 0 0 7px #b48a3c, inset 0 0 0 9px #17110c, inset 0 -40px 40px rgba(90,60,30,.35), 0 12px 24px rgba(0,0,0,.5); }
.doll.sc-fitting::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 5%; height: 10px; border-radius: 50%; background: rgba(0,0,0,.3); filter: blur(2px); }
.loot-grid .gear-tile, .reward-modal .gear-tile, .relic-row .gear-tile { background: linear-gradient(#3a2a1a, #22170d); border: 2px solid #6d5a44; box-shadow: inset 0 0 0 1px #0f0b08, inset 0 1px 0 rgba(255,220,160,.12), 0 6px 14px rgba(0,0,0,.45); transition: transform .15s, border-color .15s, box-shadow .15s; }
.loot-grid .gear-tile:hover:not(:disabled), .relic-row .gear-tile:hover:not(:disabled) { transform: translateY(-3px); border-color: #e2b552; box-shadow: inset 0 0 0 1px #0f0b08, 0 10px 22px rgba(0,0,0,.55), 0 0 16px rgba(226,181,82,.25); }
.gear-tile .art { filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
.gear-tile:has(.set-line:not(.nonset)) { border-color: #8a6a32; }
.gear-tile.rare-find { border-color: #7ad0e6; box-shadow: inset 0 0 0 1px #0f0b08, 0 0 18px rgba(122,208,230,.35), 0 6px 14px rgba(0,0,0,.45); }
.gear-tile.chosen { border-color: #9ee07a; box-shadow: 0 0 0 2px rgba(158,224,122,.4), 0 0 20px rgba(158,224,122,.3); }
/* rewards: a victory banner behind the title */
.reward-modal > h1 { position: relative; display: inline-block; padding: 6px 54px 8px; margin-top: 2px; color: #f3e6c4; text-shadow: 0 2px 0 #17110c;
  background: linear-gradient(#9a2e22, #6a1c14); clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%); box-shadow: inset 0 2px 0 rgba(255,255,255,.15); }
.reward-modal.rw-boss > h1 { background: linear-gradient(#c89a3a, #8a6012); }
.reward-modal .big-icon { filter: drop-shadow(0 0 14px rgba(226,181,82,.5)); }

/* 5. the rival: a framed portrait with a name ribbon */
.rival-modal .rv-portrait { position: relative; box-shadow: inset 0 0 0 3px #17110c, inset 0 0 0 7px #b48a3c, inset 0 0 0 9px #17110c, inset 0 -70px 70px rgba(0,0,0,.35), 0 12px 26px rgba(0,0,0,.55); }
.rival-modal .rv-portrait::before { content: ""; position: absolute; inset: 9px; background: radial-gradient(ellipse at 50% 35%, rgba(255,220,150,.35), transparent 60%); pointer-events: none; z-index: 0; }
.rival-modal .rv-portrait .hero-live { z-index: 1; }
.rival-modal .rv-talk { box-shadow: 0 12px 26px rgba(0,0,0,.5); background-image: var(--rv-paper, var(--sel-paper)); }   /* a wide parchment drawn for this box, not the tall hero-select one stretched */
.rival-modal .rv-name b { display: inline-block; padding: 4px 34px 6px 18px; margin-left: -34px; color: #f3e6c4; text-shadow: 0 2px 0 #17110c;
  background: linear-gradient(#9a2e22, #6a1c14); clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%); box-shadow: inset 0 2px 0 rgba(255,255,255,.15); }
.rival-modal .rv-name small { display: block; margin-top: 6px; }

/* 6. the map: terrain in the margins, a banner where you stand, the road you just took inks itself in */
.map .map-terrain { position: absolute; left: 0; top: 0; pointer-events: none; }
.map-scroll.woodcut { box-shadow: inset 0 0 0 4px #e3d5b3, inset 0 0 0 6px #b48a3c, inset 0 0 60px rgba(120,80,30,.35), 0 10px 24px rgba(0,0,0,.5); }
.map .road.traveled.fresh { stroke-dasharray: 400; stroke-dashoffset: 400; animation: mapInk 1.1s ease-out .2s forwards; }
@keyframes mapInk { to { stroke-dashoffset: 0; } }
.map-here { position: absolute; width: 0; height: 0; z-index: 6; pointer-events: none; }
.map-here i { position: absolute; left: 0; top: -58px; width: 3px; height: 34px; background: #3e3020; animation: mapBob 1.6s ease-in-out infinite; }
.map-here i::after { content: ""; position: absolute; left: 3px; top: 0; width: 22px; height: 15px; background: #8a2a1f; border: 1.5px solid #17110c; clip-path: polygon(0 0, 100% 0, 78% 50%, 100% 100%, 0 100%); }
@keyframes mapBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
body.no-fx .map-here i, body.no-fx .map .road.traveled.fresh { animation: none; stroke-dashoffset: 0; }

/* 7. fights: the region's ground along the bottom of the stage, pieces at the edges in front, cleaner plates */
.stage-fg { position: absolute; left: 0; right: 0; bottom: 0; height: 13%; z-index: -1; pointer-events: none; display: none; }
.stage-fg svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 -2px 4px rgba(0,0,0,.25)); }
.stage-edge { position: absolute; bottom: 0; width: 15%; max-width: 200px; z-index: 3; pointer-events: none; display: none; filter: drop-shadow(0 -2px 6px rgba(0,0,0,.4)); }
.stage-edge.l { left: 0; } .stage-edge.r { right: 0; } .stage-edge svg { width: 100%; height: auto; display: block; }
.stage.has-fg .stage-fg, .stage.has-fg .stage-edge { display: block; }
.fg-glow { animation: scFlicker 2s ease-in-out infinite; } body.no-fx .fg-glow { animation: none; }
.stage .plate { box-shadow: 0 0 0 1px rgba(23,17,12,.8), 0 0 0 3px rgba(180,138,60,.55), 0 6px 14px rgba(0,0,0,.45); }
.stage .ground { opacity: .9; }
@media (max-width: 680px) { .stage-edge { width: 18%; } }

/* 8. a shared finish: carved panels with a brass rim, wood buttons, gold rules under titles (never the title screen) */
.overlay:not(.title-mode) > .modal:not(.title-modal):not(.rival-modal):not(.shop-modal), #popup > .modal {
  background: linear-gradient(180deg, rgba(255,220,160,.05), transparent 30%), repeating-linear-gradient(-35deg, rgba(234,223,196,.03) 0 1px, transparent 1px 6px), linear-gradient(180deg, #2a2016, #1a130d);
  border: 2px solid #0f0b08; box-shadow: inset 0 0 0 1px #6d5a44, inset 0 0 0 3px #0f0b08, inset 0 0 0 4px rgba(180,138,60,.45), 0 30px 80px rgba(0,0,0,.65); }
.overlay:not(.title-mode) > .modal:not(.title-modal) > h1:not(.sc-title), .overlay:not(.title-mode) > .modal:not(.title-modal) .sc-title, #popup > .modal > h1 { text-shadow: 0 2px 0 #0f0b08, 0 0 18px rgba(226,181,82,.18); }
.overlay:not(.title-mode) > .modal:not(.title-modal):not(.reward-modal) > h1::after, .overlay:not(.title-mode) > .modal:not(.title-modal) .sc-title::after, #popup > .modal > h1::after {
  content: ""; display: block; width: 140px; height: 2px; margin: 6px auto 0; background: linear-gradient(90deg, transparent, #b48a3c, transparent); }
.overlay:not(.title-mode) .modal:not(.title-modal) .btn:not(.primary):not(.danger):not(.tab), #popup .modal .btn:not(.primary):not(.danger):not(.tab) {
  background: linear-gradient(#3e2c1a, #261a0e); border: 1.5px solid #0f0b08; box-shadow: inset 0 0 0 1px rgba(180,138,60,.4), inset 0 1px 0 rgba(255,220,160,.12), 0 3px 0 #0f0b08; }
.overlay:not(.title-mode) .modal:not(.title-modal) .btn:not(.primary):not(.danger):not(.tab):hover:not(:disabled), #popup .modal .btn:not(.primary):not(.danger):not(.tab):hover:not(:disabled) {
  background: linear-gradient(#4e3822, #2e2012); box-shadow: inset 0 0 0 1px rgba(226,181,82,.7), inset 0 1px 0 rgba(255,220,160,.18), 0 3px 0 #0f0b08; }
.overlay:not(.title-mode) .modal .sub { color: #cdbd98; }

/* developer one-shot mode: a corner tag so it is never left on by accident */
body.dev-oneshot::after { content: "DEV · ONE-SHOT"; position: fixed; right: 8px; bottom: 8px; z-index: 400; padding: 3px 8px; border-radius: 6px; background: #8a2a1f; color: #f3e6c4; font: 800 10px var(--font-body); letter-spacing: .1em; pointer-events: none; opacity: .85; }
