.relic-map{
  --bg:#090909;
  --accent:#b88746;
  --glow:#f4e2a8;
  background:radial-gradient(900px 700px at 50% -10%,#2c2112 0%,#090909 85%);
  font-family:'Inter',system-ui,serif;
  text-align:center;
  color:#f5f0e9;
  padding:clamp(60px,7vw,100px) 24px;
  position:relative;
  overflow:hidden;
}

.relic-map .visually-hidden{
  position:absolute!important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

.relic-map .machine{
  position:relative;
  width:min(360px,80vw);
  aspect-ratio:1;
  margin:0 auto;
  display:grid;
  place-items:center;
  isolation:isolate;
  transform-origin:center;
  will-change:transform, filter;
  animation:evSunIdlePulse 5.6s ease-in-out infinite;
}

@keyframes evSunIdlePulse{
  0%{transform:scale(1);filter:brightness(1);}
  35%{transform:scale(1.035);filter:brightness(1.12);}
  70%{transform:scale(1.015);filter:brightness(1.06);}
  100%{transform:scale(1);filter:brightness(1);}
}

.relic-map .machine.is-solved{
  animation:evSunSolvedPulse 2.6s ease-in-out infinite;
  filter:
    drop-shadow(0 0 18px rgba(255,230,150,.45))
    drop-shadow(0 0 36px rgba(255,230,150,.25));
}

@keyframes evSunSolvedPulse{
  0%{transform:scale(1.01);filter:brightness(1.08);}
  40%{transform:scale(1.08);filter:brightness(1.25);}
  75%{transform:scale(1.03);filter:brightness(1.15);}
  100%{transform:scale(1.01);filter:brightness(1.08);}
}

.relic-map .machine.is-hit{ animation:evSunHit .22s ease-out 1; }
@keyframes evSunHit{
  0%{transform:scale(1);} 60%{transform:scale(1.03);} 100%{transform:scale(1);}
}

@media (prefers-reduced-motion: reduce){
  .relic-map .machine,
  .relic-map .machine.is-solved,
  .relic-map .machine.is-hit,
  .relic-map .core.active{ animation:none !important; filter:none !important; }
}

.relic-map .gear{
  position:absolute;
  border-radius:50%;
  cursor:pointer;
  transition:transform .45s ease;
  background:repeating-conic-gradient(
    from 0deg,
    var(--accent) 0deg 10deg,
    transparent 10deg 20deg
  );
  mask:radial-gradient(circle at center,transparent 42%,black 45%);
  z-index:2;
  pointer-events:auto;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  appearance:none;
  border:0;
  padding:0;
}

.relic-map .gear:nth-child(1){width:100%;height:100%;opacity:.4;}
.relic-map .gear:nth-child(2){width:70%;height:70%;opacity:.6;}
.relic-map .gear:nth-child(3){width:40%;height:40%;opacity:.8;}

.relic-map .gear::after{ content:""; position:absolute; inset:-14px; border-radius:50%; }
@media (max-width:480px){ .relic-map .gear::after{ inset:-18px; } }

.relic-map .mark{
  position:absolute;
  width:10px;height:10px;
  border-radius:50%;
  background:var(--glow);
  box-shadow:0 0 10px var(--glow);
  top:0;left:50%;
  transform:translate(-50%,-50%);
  pointer-events:none;
}

.relic-map .link{
  position:absolute;
  width:3px;
  height:160px;
  background:linear-gradient(to bottom,var(--accent),transparent);
  top:50%;left:50%;
  transform:translate(-50%,-50%) rotate(var(--angle));
  opacity:.3;
  transition:opacity .3s;
  pointer-events:none;
  z-index:1;
}

.relic-map .link.active{ opacity:.85; filter:brightness(1.5); }

.relic-map .core{
  width:90px;height:90px;
  border-radius:50%;
  background:radial-gradient(circle,var(--accent) 0%,#2c2112 70%);
  box-shadow:0 0 20px rgba(184,135,70,.4);
  z-index:3;
  pointer-events:none;
  transition:box-shadow .4s ease, background .4s ease, filter .4s ease, transform .4s ease;
}

.relic-map .core.partial{ box-shadow:0 0 34px 10px rgba(184,135,70,.45); }

.relic-map .core.active{
  background:radial-gradient(circle,var(--glow) 0%,var(--accent) 70%);
  box-shadow:0 0 70px 25px rgba(255,230,150,.8);
  animation:corePulse 2.1s ease-in-out infinite;
  will-change:transform,filter;
}

@keyframes corePulse{
  0%,100%{transform:scale(1);filter:brightness(1);}
  50%{transform:scale(1.06);filter:brightness(1.12);}
}

.relic-map .video-modal{
  position:fixed; inset:0;
  display:none; place-items:center;
  background:rgba(0,0,0,.7);
  backdrop-filter:blur(3px);
  z-index:99999;
}
.relic-map .video-modal.show{ display:grid; }

.relic-map .video-box{
  width:min(960px,94vw);
  background:#0e0e0e;
  border:1px solid #3b2f1a;
  border-radius:16px;
  padding:12px;
  box-shadow:0 20px 60px rgba(0,0,0,.6);
}
.relic-map .video-head{
  display:flex;justify-content:space-between;align-items:center;
  color:#e9e4d8;font-weight:700;margin:2px 6px 8px;
}
.relic-map .video-close{
  appearance:none;border:1px solid #443620;background:#1a1712;
  color:#f0e8d8;border-radius:8px;padding:6px 10px;cursor:pointer;
}
.relic-map .video-wrap{ position:relative;border-radius:10px;overflow:hidden;background:#000; }
.relic-map .video-wrap video{ width:100%;height:auto;display:block; }
.relic-map .unmute{
  position:absolute;right:10px;bottom:10px;z-index:2;
  appearance:none;border:1px solid #444;background:#111;color:#eee;border-radius:999px;
  padding:8px 12px;cursor:pointer;display:none;
}
.relic-map .unmute.show{ display:inline-block; }

.relic-map .video-modal,
.relic-map .afterlife-video-modal{
  min-height:100vh;
  min-height:100dvh;
}

@media (max-width:480px){
  .relic-map .video-box{
    width:min(960px,96vw);
    border-radius:14px;
    padding:10px;
  }
  .relic-map .video-head{ font-size:.95rem; }
}

.relic-map .afterlife-game{
  padding:3rem 1.5rem;
  max-width:1100px;
  margin:2.5rem auto 0;
  background:#000;
  color:#fff;
  font-family:'Inter',system-ui,sans-serif;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
}
.relic-map .is-hidden{ display:none !important; }

.relic-map .ag-layout{
  display:flex;
  gap:2rem;
  margin-top:2rem;
  flex-wrap:wrap;
  text-align:left;
}
.relic-map .ag-pool, .relic-map .ag-tomb{ flex:1 1 340px; }

.relic-map .ag-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px,1fr));
  gap:1.2rem;
}

.relic-map .ag-card{
  position:relative;
  padding:0;
  border:1px solid rgba(212,165,63,.35);
  border-radius:14px;
  background:#111;
  cursor:pointer;
  overflow:hidden;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.22),
    0 10px 24px rgba(0,0,0,.35);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.relic-map .ag-card:hover{
  transform:translateY(-1px) scale(1.02);
  border-color:rgba(212,165,63,.6);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.15),
    0 14px 28px rgba(0,0,0,.45),
    0 0 26px rgba(212,165,63,.18);
}
.relic-map .ag-card img{
  position:relative;
  z-index:1;
  width:100%;
  height:140px;
  object-fit:cover;
  object-position:center 38%;
  filter:sepia(.32) saturate(.85) contrast(1.08) brightness(.94);
  display:block;
}

.relic-map .ag-slots{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1rem;
  margin-bottom:1rem;
}

.relic-map .ag-slot{
  position:relative;
  background:#111;
  border:1px solid rgba(212,165,63,.3);
  border-radius:14px;
  height:140px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  overflow:hidden;
  padding:4px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.2),
    0 8px 20px rgba(0,0,0,.28);
  transition:transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  appearance:none;
  font:inherit;
  color:inherit;
}
.relic-map .ag-slot img{
  position:relative;
  z-index:1;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center 38%;
  filter:sepia(.32) saturate(.85) contrast(1.08) brightness(.94);
  display:block;
}
.relic-map .ag-slot span{
  position:relative;
  z-index:1;
  color:#d8c9aa;
  font-weight:700;
}

.relic-map .ag-card::after,
.relic-map .ag-slot::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(120% 80% at 50% 10%, rgba(255,220,150,.14), transparent 55%),
    linear-gradient(to bottom, rgba(32,22,10,.18), rgba(10,10,10,.34));
  pointer-events:none;
  z-index:2;
}

.relic-map .evaluate-btn{
  width:100%;
  padding:.9rem;
  border-radius:999px;
  border:none;
  background:#d4a53f;
  color:#000;
  font-weight:800;
  cursor:pointer;
  margin-top:.25rem;
}
.relic-map .evaluate-btn:hover{ filter:brightness(1.1); }

.relic-map .result{ margin-top:.75rem; font-size:.95rem; white-space:pre-line; }

.relic-map .ag-description{
  margin-top:.75rem;
  color:#ccc;
  font-size:.95rem;
  line-height:1.45;
}

.relic-map .ag-description.flash{
  outline:2px solid rgba(212,165,63,.55);
  box-shadow:0 0 0 6px rgba(212,165,63,.10), 0 14px 34px rgba(0,0,0,.55);
  transition:outline .15s ease;
}

@media (max-width:768px){
  .relic-map .ag-card img,
  .relic-map .ag-slot{ height:120px; }
}

@media (max-width:420px){
  .relic-map .ag-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:.9rem;
  }
  .relic-map .ag-card img,
  .relic-map .ag-slot{ height:132px; }
}

.relic-map .ag-card,
.relic-map .ag-slot,
.relic-map .evaluate-btn,
.relic-map .video-close,
.relic-map .afterlife-video-close{
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

.relic-map .ag-slot:active,
.relic-map .ag-card:active{ transform:scale(.98); }

@media (max-width:640px){
  .relic-map .ag-description{
    position:sticky;
    bottom:10px;
    z-index:5;
    margin-top:12px;
    padding:10px 12px;
    border-radius:14px;
    background:rgba(16,16,16,.92);
    border:1px solid rgba(255,255,255,.14);
    box-shadow:0 14px 34px rgba(0,0,0,.55);
    color:#e9ecef;
    font-size:.98rem;
    line-height:1.35;
  }
  .relic-map .ag-description::before{
    content:"Info";
    display:inline-block;
    margin-right:10px;
    padding:6px 10px;
    border-radius:999px;
    background:rgba(212,165,63,.12);
    border:1px solid rgba(212,165,63,.25);
    color:#d4a53f;
    font-weight:900;
    font-size:.75rem;
    letter-spacing:.08em;
    text-transform:uppercase;
    vertical-align:middle;
  }
}

.relic-map .afterlife-game.pharaoh-wrath{
  animation:pharaohWrathShake .42s ease-in-out 1;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 0 0 9999px rgba(179,18,23,.06) inset;
}
@keyframes pharaohWrathShake{
  0%{transform:translateX(0);}
  15%{transform:translateX(-6px);}
  30%{transform:translateX(6px);}
  45%{transform:translateX(-5px);}
  60%{transform:translateX(5px);}
  75%{transform:translateX(-3px);}
  100%{transform:translateX(0);}
}

.relic-map .afterlife-video-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.85);
  backdrop-filter:blur(4px);
  display:none;
  place-items:center;
  z-index:999999;
}
.relic-map .afterlife-video-modal.show{ display:grid; }

.relic-map .afterlife-video-box{
  width:min(900px,95vw);
  background:#000;
  border-radius:12px;
  padding:10px;
  position:relative;
  box-shadow:0 0 40px rgba(0,0,0,.6);
}
.relic-map .afterlife-video-close{
  position:absolute;
  top:8px;
  right:8px;
  background:#111;
  border:1px solid #333;
  color:#fff;
  padding:5px 10px;
  border-radius:6px;
  cursor:pointer;
  z-index:2;
}
.relic-map .afterlife-video-box video{
  width:100%;
  border-radius:8px;
  display:block;
}

.relic-map .artefacts-epilog{
  background:#0b0f12;
  color:#e9ecef;
  font-family:Inter,system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
  padding:clamp(44px,6vw,72px) clamp(16px,4vw,40px);
  text-align:center;
  margin:2.5rem auto 0;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  max-width:1100px;
}
.relic-map .artefacts-epilog .box{
  max-width:920px;
  margin:0 auto;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.14);
  border-radius:18px;
  padding:18px;
  box-shadow:0 18px 48px rgba(0,0,0,.55);
  text-shadow:0 1px 2px rgba(0,0,0,.65);
}
.relic-map .artefacts-epilog h2{
  margin:0 0 10px;
  font:900 clamp(22px,3.6vw,34px)/1.15 Inter;
  color:#fff;
}
.relic-map .artefacts-epilog .lead{
  margin:0 auto 14px;
  max-width:64ch;
  color:#d5dbe1;
  line-height:1.55;
}
.relic-map .artefacts-epilog .glyphs{
  margin:10px 0 14px;
  font-family:'Segoe UI Symbol','Noto Sans Symbols','Arial Unicode MS',Arial,sans-serif;
  font-size:18px;
  letter-spacing:14px;
  color:#d4a53f;
  white-space:nowrap;
}
.relic-map .artefacts-epilog .cta-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:12px;
  margin:14px auto 8px;
  max-width:720px;
}
.relic-map .artefacts-epilog .btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  font:900 14px/1 Inter;
  padding:12px 14px;
  border-radius:999px;
  background:#50a605;
  color:#071407;
  box-shadow:0 12px 26px rgba(80,166,5,.22);
  transition:transform .15s ease, filter .15s ease, box-shadow .15s ease;
  min-height:44px;
}
.relic-map .artefacts-epilog .btn:hover{
  filter:brightness(1.06);
  transform:translateY(-1px);
  box-shadow:0 16px 34px rgba(80,166,5,.32);
}
.relic-map .artefacts-epilog .hint{
  margin:10px auto 0;
  max-width:70ch;
  color:#b7c0c8;
  font-size:.92rem;
  line-height:1.55;
}
.relic-map .artefacts-epilog .hint a{
  color:#d4a53f;
  text-decoration:none;
  font-weight:800;
}
.relic-map .artefacts-epilog .hint a:hover{ text-decoration:underline; }

@media (max-width:640px){
  .relic-map .artefacts-epilog .cta-grid{ grid-template-columns:1fr; }
}

.relic-map .gear:focus-visible,
.relic-map .ag-card:focus-visible,
.relic-map .ag-slot:focus-visible,
.relic-map .evaluate-btn:focus-visible,
.relic-map .video-close:focus-visible,
.relic-map .afterlife-video-close:focus-visible,
.relic-map .artefacts-epilog .btn:focus-visible{
  outline:2px solid #d4a53f;
  outline-offset:2px;
}
