/* W-117 · Relics (relic-ui.js): the row under the health bar, the tap-to-read sheet, the boss's relic pick and the
   shop's relic slot. Linked by the game pages (index.html and the review pages) so the Layout and Animations settings reach its media rules; everything the relics draw is styled here. */

/* The row: its own strip straight under the HUD, right-aligned under the health and gold, only while the run holds a
   relic. It is part of the page's column, so the board and screens below simply start lower. */
#relic-row{flex-shrink:0;display:flex;justify-content:flex-end;align-items:center;gap:3px;height:38px;padding:0 8px;position:relative;z-index:3;
  background:linear-gradient(#00000026,#00000010);border-bottom:1px solid #927347aa}
#relic-row[hidden]{display:none}
#game:is([data-era="2"],[data-era="3"],[data-era="4"]) #relic-row{border-color:var(--era-edge,#927347)}
.relic-chip{position:relative;width:34px;height:34px;padding:1px;border-radius:8px;border:1px solid #d9b77566;background:radial-gradient(circle at 50% 40%,#f3e2b62e,#0000 72%);display:grid;place-items:center;min-height:0;flex-shrink:0}
.relic-chip:hover{border-color:#d9b775cc}
.relic-chip .relic-icon{width:30px;height:30px;object-fit:contain;filter:drop-shadow(0 1px 1px #0008);pointer-events:none}
.relic-chip.fired{animation:relic-fire .9s cubic-bezier(.3,1.5,.5,1)}
@keyframes relic-fire{0%{transform:scale(1);box-shadow:0 0 0 0 #ffd16600}30%{transform:scale(1.28);box-shadow:0 0 0 5px #ffd16688}100%{transform:scale(1);box-shadow:0 0 0 0 #ffd16600}}
.relic-fx{position:absolute;top:calc(100% + 4px);right:50%;transform:translateX(50%);white-space:nowrap;pointer-events:none;padding:2px 7px;border-radius:9px;background:#1d2a22e8;color:#ffe3a0;font-size:var(--fs-xs);font-weight:700;border:1px solid #d9b77599;animation:relic-fx 2.4s ease-out forwards;z-index:4}
.relic-chip:last-child .relic-fx{right:0;transform:none}
@keyframes relic-fx{0%{opacity:0;translate:0 -4px}12%{opacity:1;translate:0 0}75%{opacity:1}100%{opacity:0;translate:0 6px}}

/* Tap to read: the same parchment sheet as a keyword's. */
#relic-sheet{position:absolute;z-index:12;padding:10px 12px 8px;background:var(--paper,#ebdfbd) url('/assets/ui/parchment.svg') center/100% 100%;border:2px solid #716043;color:var(--ink,#302f25);box-shadow:0 8px 28px #10160aa0;pointer-events:none;animation:overlay-reveal 140ms ease-out}
#relic-sheet[hidden]{display:none}
.relic-sheet-head{display:flex;align-items:center;gap:9px;margin-bottom:6px}
.relic-sheet-head .relic-icon{width:46px;height:46px;object-fit:contain;flex-shrink:0}
.relic-sheet-head strong{display:block;font-size:var(--fs-lg)}
.relic-sheet-head small{display:block;font-size:var(--fs-xs);color:var(--muted,#696b54);text-transform:uppercase;letter-spacing:.06em}
#relic-sheet p{font-size:var(--fs-base);line-height:1.4}
.relic-sheet-hint{display:block;margin-top:6px;font-size:var(--fs-xs);color:var(--muted,#696b54)}

/* The boss's reward: the relic pick sits under the boss's towers (D-143: two uncommon and one rare). */
.relic-pick{margin-top:12px}
.relic-pick-title{display:flex;align-items:center;gap:8px;font-size:var(--fs-md);font-weight:700;color:#5b5236;text-transform:uppercase;letter-spacing:.08em;margin:0 2px 7px}
.relic-pick-title span{padding:2px 8px;border-radius:9px;background:#3b4a35;color:#f2e3b6;letter-spacing:.1em}
.relic-pick-title::after{content:"";flex:1;height:1px;background:currentColor;opacity:.3}
.relic-offers{display:grid;gap:7px}
.offer.relic-offer{min-height:78px;animation:offer-deal .38s both;animation-delay:var(--deal-delay,0ms)}
.win-sequence .offer.relic-offer{animation:none}/* W-151 (#51) rec 7: rises with the reward (it dealt in 0.9 s late) */
.offer.relic-offer .relic-icon.offer-art{width:60px;height:60px;object-fit:contain;filter:drop-shadow(0 3px 3px #18232a30)}
#screen[data-view="reward"] .offer.relic-offer .offer-art{width:60px;height:60px}
.offer.relic-offer.chosen{outline:3px solid #b99645;outline-offset:-3px}
.offer.relic-offer.passed{opacity:.5;filter:grayscale(.6)}
.relic-pick.done .relic-pick-title span{background:#7b6a43}
@keyframes offer-deal{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

@media (prefers-reduced-motion:reduce){.relic-chip.fired,.relic-fx,.offer.relic-offer{animation:none}}
:root[data-motion="reduced"] :is(.relic-chip.fired,.relic-fx,.offer.relic-offer){animation:none}

/* The laptop layout (the same query as wide.css): a larger row and three relics side by side. The row rides in the HUD
   row with the items strip (item-belt.css, W-121), so the map's side panels start right under the HUD. */
@media (min-width:960px) and (min-height:600px) and (min-aspect-ratio:5/4){
  #relic-row{height:44px;padding:0 14px;gap:5px}
  .relic-chip{width:40px;height:40px}
  .relic-chip .relic-icon{width:36px;height:36px}
  .relic-offers{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* The in-game gallery's Relics group (Cards tab) and a relic's page. */
.gal-card-art img[src^="/assets/relics/"]{width:100%;height:100%;object-fit:contain}
.gal-card.sealed .gal-card-art img[src^="/assets/relics/"],.gal-cardart.sealed img{filter:brightness(0);opacity:.72}
.gal-cardart>img{display:block;width:100%;height:auto;filter:drop-shadow(0 10px 24px #000a)}

/* W-150 (#48) Fathom's Grip: the kraken's arm round the card it held (relic-ui.js gripArm). It curls up round the card's
   left edge once as the card is held, then squeezes slowly. It holds the lower left corner only (under two thirds of the
   card's height, inside the card: the hand's scroller clips anything further out), and the card's name and icons sit over it
   so the card still reads. */
#hand .card .grip-arm{position:absolute;left:-3px;bottom:-4px;height:62%;aspect-ratio:1/2;pointer-events:none;z-index:3;transform-origin:30% 100%;rotate:-6deg}
#hand .card:has(.grip-arm) :is(.card-name,.card-kind){position:relative;z-index:4;text-shadow:0 0 3px #f6eedc,0 0 2px #f6eedc}
#hand .card .grip-arm img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(1px 2px 1.5px #0b1a22aa);transform-origin:35% 100%;animation:grip-squeeze 2.8s ease-in-out var(--grip-phase,0s) infinite}
#hand .card .grip-arm.fresh{animation:grip-in .65s cubic-bezier(.25,1.3,.4,1) var(--grip-in,0s) both}
#hand .card:has(.grip-arm){box-shadow:0 0 0 2px #3f8593,0 0 12px #52bfd080}
@keyframes grip-in{from{transform:translateY(60%) rotate(-26deg) scale(.5);opacity:0}45%{opacity:1}to{transform:none;opacity:1}}
@keyframes grip-squeeze{0%,100%{transform:none}50%{transform:scale(1.045,.965) rotate(-1.5deg)}}
/* W-150: a relic's token flies from its icon to a HUD counter (Firecrackers' mana, Packed House's heal), which pops. */
.relic-fly{position:fixed;left:0;top:0;z-index:1000;pointer-events:none;width:32px;height:32px;display:grid;place-items:center;border-radius:50%}
.relic-fly .ui-icon,.relic-fly svg{width:22px;height:22px}
.relic-fly.mana{color:#8fdcff;background:radial-gradient(#173b5fd9 35%,#173b5f00 70%);filter:drop-shadow(0 0 5px #6cc8ff)}
.relic-fly.heart{color:#ff6f6f;background:radial-gradient(#5f1717d9 35%,#5f171700 70%);filter:drop-shadow(0 0 5px #ff7a7a)}
.relic-pop{animation:relic-pop .6s cubic-bezier(.3,1.6,.5,1)}
@keyframes relic-pop{0%{transform:scale(1)}35%{transform:scale(1.35);filter:brightness(1.7)}100%{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){#hand .card .grip-arm,#hand .card .grip-arm img,.relic-pop{animation:none}}
:root[data-motion="reduced"] :is(#hand .card .grip-arm,#hand .card .grip-arm img,.relic-pop){animation:none}
/* W-179 (#148): an elite's relic offer on the reward card. A PNG's own 256 px would size the stage's auto row and push the
   icon down over the name (the tower models are SVG), so the row takes the stage's height. */
#game .tower-card.kind-relic .tc-stage{grid-template-rows:100%}
