/* Bebela Code | atlas e mapas dos mundos.
   Carregar depois de app.css. Tudo aqui fica dentro de .atlas e .realm. */

/* As oito capas já pertencem ao projeto. A mesma chave serve a cartões e mapas;
   --realm-accent e --realm-deep podem substituir as cores de qualquer mundo. */
:is(.portal, .realm, .lesson)[data-world="w1"], body[data-world="w1"] .realm {
  --journey-banner: url("../img/world-w1.png");
  --journey-world-accent: #73e8d2;
  --journey-world-deep: #173043;
}
:is(.portal, .realm, .lesson)[data-world="w2"], body[data-world="w2"] .realm {
  --journey-banner: url("../img/world-w2.png");
  --journey-world-accent: #9b87ff;
  --journey-world-deep: #252447;
}
:is(.portal, .realm, .lesson)[data-world="w3"], body[data-world="w3"] .realm {
  --journey-banner: url("../img/world-w3.png");
  --journey-world-accent: #85e6e1;
  --journey-world-deep: #27354d;
}
:is(.portal, .realm, .lesson)[data-world="w4"], body[data-world="w4"] .realm {
  --journey-banner: url("../img/world-w4.png");
  --journey-world-accent: #e2abff;
  --journey-world-deep: #312746;
}
:is(.portal, .realm, .lesson)[data-world="w5"], body[data-world="w5"] .realm {
  --journey-banner: url("../img/world-w5.png");
  --journey-world-accent: #80e2d6;
  --journey-world-deep: #18304c;
}
:is(.portal, .realm, .lesson)[data-world="w6"], body[data-world="w6"] .realm {
  --journey-banner: url("../img/world-w6.png");
  --journey-world-accent: #b9a1ff;
  --journey-world-deep: #2c2551;
}
:is(.portal, .realm, .lesson)[data-world="w7"], body[data-world="w7"] .realm {
  --journey-banner: url("../img/world-w7.png");
  --journey-world-accent: #78e7dd;
  --journey-world-deep: #202b4b;
}
:is(.portal, .realm, .lesson)[data-world="w8"], body[data-world="w8"] .realm {
  --journey-banner: url("../img/world-w8.png");
  --journey-world-accent: #a4a5ff;
  --journey-world-deep: #1b2850;
}

/* A missão permanece legível, mas ainda pertence ao mesmo cenário do mapa. */
.lesson[data-world] .lesson__body {
  background-color: #f1edff;
  background-image: linear-gradient(90deg, #f6f4fff2 0%, #f6f4ffe0 48%, #f6f4ffa8 100%), var(--journey-banner);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat;
}
.lesson[data-world] .lesson__foot { background: #f3efff; }
@media (max-width: 700px) {
  .lesson[data-world] .lesson__body {
    background-image: linear-gradient(#f6f4ffed, #f6f4ffed), var(--journey-banner);
  }
}

/* Atlas: uma mesa de aventuras, com a rota atual em primeiro plano. */
.atlas.view {
  --atlas-ink: #f8f5ff;
  --atlas-muted: #c9c0e4;
  width: 100%;
  min-height: 100%;
  padding: clamp(18px, 3vw, 42px) clamp(14px, 3vw, 36px) calc(44px + var(--safe-b));
  background:
    radial-gradient(ellipse 75% 34% at 92% 0%, #3b3272 0%, transparent 74%),
    radial-gradient(ellipse 38% 24% at 2% 75%, #234b60 0%, transparent 75%),
    #191936;
  color: var(--atlas-ink);
}
.atlas > * { width: min(100%, 1220px); margin-inline: auto; }
.atlas__hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) clamp(110px, 19vw, 230px);
  gap: clamp(12px, 3vw, 34px);
  min-height: clamp(270px, 30vw, 390px);
  padding: clamp(24px, 4.4vw, 58px);
  overflow: hidden;
  border: 1px solid #8174bc;
  border-radius: 28px;
  background:
    radial-gradient(circle at 75% 72%, #4f5697 0 9%, transparent 38%),
    radial-gradient(circle at 87% 12%, #51428f 0 12%, transparent 44%),
    #292450;
  box-shadow: 0 22px 55px #0a0b2299, inset 0 1px #ffffff2b;
}
.atlas__hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    radial-gradient(circle at 15% 17%, #e8dfff 0 2px, transparent 3px),
    radial-gradient(circle at 52% 31%, #75e6da 0 2px, transparent 3px),
    radial-gradient(circle at 73% 18%, #e8dfff 0 1px, transparent 2px),
    radial-gradient(circle at 90% 70%, #75e6da 0 2px, transparent 3px);
  opacity: .62;
  pointer-events: none;
}
.atlas__hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: min(48vw, 460px);
  aspect-ratio: 1;
  right: -4%;
  bottom: -81%;
  border: 1px solid #b3a7ff55;
  border-radius: 50%;
  box-shadow: 0 0 0 31px #aca0ff12, 0 0 0 74px #aca0ff0c;
  pointer-events: none;
}
.atlas__hero > :not(.atlas__mascot, .atlas__sound) { position: relative; z-index: 1; grid-column: 1; }
.atlas__hero > .atlas__mascot { grid-column: 2; grid-row: 1; }
.atlas__sound { position: absolute; z-index: 3; top: 18px; right: 18px; }
.atlas__sound .music-toggle {
  width: 48px;
  height: 48px;
  border-color: #c8c0ed;
  border-radius: 14px;
  background: #201d42e8;
  color: #fff;
  box-shadow: 0 5px 15px #11142b99;
}
.atlas__sound .music-toggle[aria-pressed="true"] { border-color: #a2f2e5; background: #2b6f70; color: #fff; }
.atlas__kicker, .realm__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8df1dc;
  font: 800 11px/1.3 var(--font);
  letter-spacing: .19em;
  text-transform: uppercase;
}
.atlas__kicker::before, .realm__eyebrow::before {
  content: "";
  width: 20px;
  height: 2px;
  background: currentColor;
}
.atlas__heading {
  max-width: 800px;
  margin-top: 16px;
  color: #fff;
  font: 400 clamp(34px, 5.8vw, 68px)/1.13 var(--font-game);
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 4px 22px #1712378c;
}
.atlas__lead {
  max-width: 55ch;
  margin-top: 15px;
  color: #e7defb;
  font: 500 clamp(15px, 1.5vw, 18px)/1.55 var(--font);
}
.atlas__mascot {
  position: relative;
  z-index: 1;
  display: block;
  justify-self: center;
  width: min(100%, 220px);
  aspect-ratio: 1;
  filter: drop-shadow(0 20px 22px #100d3299);
}
.atlas__mascot .bb-mascot-frame,
.atlas__mascot .bb-sprite,
.portal__mascot .bb-mascot-frame,
.portal__mascot .bb-sprite { display: block; width: 100%; height: 100%; object-fit: contain; }
.atlas__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-top: 22px;
  padding: 8px 13px;
  border: 1px solid #b5a9ed77;
  border-radius: 100px;
  background: #16143388;
  color: #e9e3ff;
  font: 800 12px/1.35 var(--font);
}
.atlas__resume {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(calc(100% - 32px), 1150px);
  min-height: 92px;
  margin-top: -21px;
  padding: 17px clamp(16px, 3vw, 30px);
  border: 1px solid #a99cec;
  border-left: 5px solid #72e7d6;
  border-radius: 17px;
  background: #302957;
  box-shadow: 0 15px 30px #0d0c2880;
}
.atlas__resume-copy { min-width: 0; color: #f6f2ff; line-height: 1.4; }
.atlas__resume-copy > :first-child { color: #9aeee0; }
.atlas__resume-copy h2 { margin: 3px 0; color: #fff; font: 400 23px/1.28 var(--font-game); }
.atlas__resume-copy p { color: #e7dff8; font-size: 13px; }
.atlas__resume-actions { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: 9px; }
.atlas__resume-direct { min-height: 35px; padding: 4px 8px; border: 0; background: transparent; color: #c8f8ee; font: 800 12px/1.2 var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.atlas__resume-direct:hover { color: #fff; }
.atlas__resume-copy strong,
.atlas__resume-copy b { color: #fff; font-family: var(--font-game); font-weight: 400; }
.atlas__resume-button, .realm__reward-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid #0a8f85;
  border-bottom-width: 4px;
  border-radius: 11px;
  background: #19baa9;
  color: #102639;
  font: 800 13px/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.atlas__resume-button:hover, .realm__reward-button:hover { background: #63e2d0; transform: translateY(-2px); }
.atlas__worlds { padding-top: clamp(30px, 5vw, 64px); }
.atlas__worlds > :not(.atlas__grid) { max-width: 64ch; margin-bottom: 19px; }
.atlas__worlds h2 { color: #fff; font: 400 clamp(25px, 3.5vw, 38px)/1.25 var(--font-game); }
.atlas__section-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.atlas__section-heading > span { color: #b9e9e2; font-size: 12px; font-weight: 800; }
.atlas__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

/* Cada portal usa a capa inteira como pequena janela para o próximo mundo. */
.portal {
  --portal-accent: var(--realm-accent, var(--journey-world-accent, #80e4d9));
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 315px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #73689d;
  border-bottom: 4px solid #655994;
  border-radius: 18px;
  background: #282343;
  color: #faf7ff;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.portal:hover:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(-5px);
  border-color: var(--portal-accent);
  box-shadow: 0 18px 30px #0c0b2780;
}
.portal:active:not(:disabled) { transform: translateY(-1px); }
.portal__art {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(150px, 17vw, 205px);
  flex: 0 0 auto;
  background-color: #262547;
  background-image: var(--journey-banner, none);
  background-size: cover;
  background-position: center;
  object-fit: cover;
  object-position: center;
}
.portal__art::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, #282343);
  pointer-events: none;
}
.portal__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  margin-top: -14px;
  padding: 0 clamp(16px, 2.2vw, 24px) 19px;
}
.portal__number {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid #ffffffb8;
  border-radius: 11px;
  background: #191936df;
  color: #fff;
  font: 900 15px/1 var(--font);
  letter-spacing: .04em;
  box-shadow: 0 5px 14px #0b103899;
}
.portal__title {
  color: #fff;
  font: 400 clamp(20px, 2.3vw, 28px)/1.23 var(--font-game);
  text-wrap: balance;
}
.portal__tag { color: #d2cbe9; font: 600 13px/1.4 var(--font); }
.portal__progress { display: grid; gap: 6px; margin-top: auto; padding-top: 13px; color: #ece8ff; font: 800 11px/1.25 var(--font); }
.portal__bar {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 20px;
  background: #5c567d;
}
.portal__bar::before,
.portal__bar > * {
  content: "";
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--portal-accent);
}
.portal__bar:has(> *)::before { display: none; }
.portal__bar > * { width: var(--progress, 100%); }
.portal__state {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  margin-top: 4px;
  color: var(--portal-accent);
  font: 800 11px/1.3 var(--font);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.portal__mascot {
  position: absolute;
  z-index: 2;
  display: block;
  top: 112px;
  right: 18px;
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 5px 6px #101026b0);
}
.portal:is(.is-locked, [data-state="locked"], [aria-disabled="true"], :disabled) { cursor: default; }
.portal:is(.is-locked, [data-state="locked"], [aria-disabled="true"], :disabled) .portal__art { filter: saturate(.55); }
.portal:is(.is-current, [data-state="current"]) { border-color: #76dfd8; box-shadow: 0 0 0 2px #76dfd838; }
.portal:is(.is-done, .is-complete, [data-state="done"], [data-state="complete"]) .portal__state { color: #9af0d2; }

/* Reino: a capa abre a cena; as camadas minerais continuam até a recompensa. */
.realm.view {
  --journey-accent: var(--realm-accent, var(--journey-world-accent, #82e6db));
  --journey-deep: var(--realm-deep, var(--journey-world-deep, #242347));
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 42% 20% at 3% 48%, #447a8170, transparent 80%),
    radial-gradient(ellipse 47% 26% at 100% 76%, #6655a269, transparent 75%),
    linear-gradient(180deg, var(--journey-deep) 0%, #211d43 50%, #171b39 100%);
  color: #fff;
}
/* A exploração ocupa o palco inteiro; o restante do app mantém sua navegação. */
#app:has(.realm.view) { padding-left: var(--safe-l); }
#app:has(.realm.view) > :is(#topbar, #tabbar) { display: none; }
.realm.view::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 260px 0 0;
  background:
    radial-gradient(ellipse 42% 19% at 0% 11%, #649d9661 0 59%, transparent 60%),
    radial-gradient(ellipse 51% 16% at 100% 22%, #8162a467 0 59%, transparent 60%),
    radial-gradient(ellipse 47% 14% at 0% 48%, #627f9966 0 58%, transparent 59%),
    radial-gradient(ellipse 52% 17% at 100% 66%, #69558470 0 58%, transparent 59%),
    radial-gradient(ellipse 45% 15% at 0% 88%, #32798169 0 58%, transparent 59%);
  opacity: .85;
  pointer-events: none;
}
.realm.view::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 300px 0 0;
  background:
    radial-gradient(circle at 12% 19%, #b6f9e5 0 2px, transparent 3px),
    radial-gradient(circle at 84% 31%, #e0ccff 0 2px, transparent 3px),
    radial-gradient(circle at 20% 62%, #e0ccff 0 1px, transparent 2px),
    radial-gradient(circle at 72% 82%, #a5e9e8 0 2px, transparent 3px);
  opacity: .65;
  pointer-events: none;
}
.realm__top {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: calc(14px + var(--safe-t)) clamp(14px, 3vw, 32px) 12px;
}
.realm__back, .realm__switch, .realm__music {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #c7bdf088;
  border-radius: 10px;
  background: #16172dbb;
  color: #f8f6ff;
  font: 800 12px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(9px);
  transition: background .18s ease, border-color .18s ease;
}
.realm__back:hover, .realm__switch:hover, .realm__music:hover { border-color: var(--journey-accent); background: #302a52; }
.realm__switch button { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid #aaa0cf; border-radius: 8px; background: #332c58; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.realm__switch button:disabled { opacity: .35; cursor: default; }
.realm__switch button:not(:disabled):hover { border-color: var(--journey-accent); color: var(--journey-accent); }
.realm__music .music-toggle { min-width: 36px; width: 36px; min-height: 36px; height: 36px; border-color: #aaa0cf; background: #332c58; color: #fff; }
.realm__music .music-toggle[aria-pressed="true"] { border-color: var(--journey-accent); background: var(--journey-accent); color: #102a3b; }
.realm__music .music-menu__panel { left: 0; right: auto; }
.realm__scene {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 9px;
  width: 100%;
  min-height: clamp(310px, 35vw, 455px);
  padding: 55px max(clamp(20px, 6vw, 90px), calc((100vw - 1080px)/2)) 38px;
  overflow: hidden;
  background: var(--journey-deep);
}
.atlas__hero:has(.music-menu[open]), .realm__scene:has(.music-menu[open]) { overflow: visible; }
.realm__scene::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(90deg, #15192fdc 0%, #15192fa8 31%, transparent 76%),
              linear-gradient(0deg, var(--journey-deep) 0%, transparent 48%);
  pointer-events: none;
}
.realm__art {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--journey-deep);
  background-image: var(--journey-banner, none);
  background-size: cover;
  background-position: center 45%;
  object-fit: cover;
  object-position: center 45%;
  animation: realm-arrive-art .9s cubic-bezier(.18,.7,.27,1) both;
}
.realm__scene > :not(.realm__art) { position: relative; z-index: 2; }
.realm__intro { animation: realm-arrive-title .65s .12s ease-out both; }
@keyframes realm-arrive-art { from { opacity: .35; transform: scale(1.08); } to { opacity: 1; transform: scale(1); } }
@keyframes realm-arrive-title { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.realm__eyebrow { color: var(--journey-accent); }
.realm__title {
  max-width: 720px;
  color: #fff;
  font: 400 clamp(32px, 5vw, 62px)/1.15 var(--font-game);
  text-shadow: 0 4px 22px #111633c9;
  text-wrap: balance;
}
.realm__desc { max-width: 55ch; color: #f2edff; font: 600 clamp(14px, 1.7vw, 18px)/1.5 var(--font); text-shadow: 0 2px 9px #0d122e; }
.realm__progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-top: 11px;
  padding: 7px 12px;
  border: 1px solid #eee8ffa1;
  border-radius: 100px;
  background: #1a1e3bc9;
  color: #fff;
  font: 800 12px/1.25 var(--font);
}
.realm__progress > .bar, .realm__progress > progress { width: 90px; accent-color: var(--journey-accent); }
.realm__jump { display: inline-flex; align-items: center; min-height: 39px; margin-top: 4px; padding: 6px 12px; border: 1px solid var(--journey-accent); border-radius: 9px; background: #172541c9; color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.realm__jump:hover { background: #314b6b; }
.realm__gate { position: relative; z-index: 3; display: flex; align-items: center; gap: 16px; width: min(calc(100% - 32px), 1050px); margin: -18px auto 0; padding: 15px 19px; border: 1px solid #a998da; border-left: 5px solid var(--journey-accent); border-radius: 14px; background: #312b54; box-shadow: 0 12px 28px #12152f7a; }
.realm__gate-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 10px; background: #574783; color: #e9d7ff; font-size: 25px; }
.realm__gate-copy { flex: 1; min-width: 0; }
.realm__gate-copy strong { display: block; color: #fff; font: 400 18px/1.3 var(--font-game); }
.realm__gate-copy p { margin-top: 3px; color: #ded6f2; font-size: 12px; line-height: 1.4; }
.realm__gate button { flex: 0 0 auto; min-height: 42px; padding: 8px 12px; border: 1px solid var(--journey-accent); border-radius: 9px; background: #463c72; color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.realm__gate button:hover { background: #5b4c8d; }

/* A estrada tem duas passadas SVG: contorno e centro. O JS fornece a curva. */
.realm__trail {
  position: relative;
  isolation: isolate;
  width: min(100%, 1120px);
  min-height: 440px;
  margin: 0 auto;
  padding: clamp(35px, 5vw, 70px) clamp(18px, 4vw, 48px) 58px;
}
.realm__road {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.realm__road path {
  fill: none;
  stroke: #95ded7;
  stroke-width: 17px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 4px 3px #0d153bb0);
}
.realm__road path:first-child:not(:last-child) { stroke: #102d4a; stroke-width: 36px; }
.realm__road path:last-child:not(:first-child) { stroke: var(--journey-accent); stroke-width: 16px; }
.realm__chapter-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 7vw, 98px);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.realm__prop {
  position: absolute;
  z-index: 0;
  display: block;
  width: clamp(160px, 21vw, 230px);
  aspect-ratio: 1;
  background-image: var(--realm-prop-sheet);
  background-size: 212% 212%;
  background-repeat: no-repeat;
  background-position: 0 0;
  filter: drop-shadow(0 16px 14px #071322a8);
  pointer-events: none;
  user-select: none;
}
.realm__prop--tr { background-position: 100% 0; }
.realm__prop--bl { background-position: 0 100%; }
/* O letreiro e o cavalete do ateliê têm silhuetas largas: enquadre cada um inteiro. */
.realm[data-world="w7"] .realm__prop--tl { background-size: 175% 212%; }
.realm[data-world="w7"] .realm__prop--tr { background-size: 240% 212%; }
.realm-node {
  --node-accent: var(--journey-accent);
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 17px;
  width: min(44%, 430px);
  min-height: 112px;
  margin: 0 0 0 4%;
  padding: 16px 18px 16px 8px;
  border: 1px solid #a1b7c69c;
  border-bottom: 4px solid #577586;
  border-radius: 18px;
  background: #182b48ed;
  color: #fff;
  text-align: left;
  box-shadow: 0 15px 25px #0b123782, inset 0 1px #ffffff20;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.realm-node:nth-of-type(even) { margin-left: auto; margin-right: 4%; }
.realm-node:hover:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(-4px);
  border-color: var(--node-accent);
  box-shadow: 0 20px 30px #0b123799, 0 0 0 2px #c0f9ec33;
}
.realm-node:active:not(:disabled) { transform: translateY(-1px); }
.realm-node__badge {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  color: #102a3b;
  font: 900 24px/1 var(--font);
}
.realm-node__badge::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 11px;
  transform: rotate(45deg);
  border: 3px solid #e8ffff;
  border-radius: 9px;
  background: var(--node-accent);
  box-shadow: 5px 5px 0 #0d354c, 0 0 0 6px #a3eee43b;
}
.realm-node__body { display: block; min-width: 0; }
.realm-node__title { display: block; color: #fff; font: 400 clamp(16px, 1.7vw, 20px)/1.28 var(--font-game); overflow-wrap: anywhere; }
.realm-node__desc { display: block; margin-top: 5px; color: #d8e6ed; font: 600 12px/1.42 var(--font); }
.realm-node__stars { display: flex; align-items: center; gap: 4px; margin-top: 7px; color: #ffd479; font-size: 15px; }
.realm-node__state {
  display: inline-block;
  margin-top: 8px;
  color: var(--node-accent);
  font: 900 10px/1.25 var(--font);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.realm-node:is(.is-current, [data-state="current"], [aria-current="step"]) {
  border-color: var(--node-accent);
  background: #243b58f5;
  box-shadow: 0 17px 27px #0b123790, 0 0 0 3px #a9eee638;
}
.realm-node:is(.realm-node--done, .is-done, .is-complete, [data-state="done"], [data-state="complete"]) {
  --node-accent: #9bdeff;
  background: #214f73;
  border-color: #77bfeb;
  box-shadow: 0 4px 0 #183b58, inset 0 1px 0 #b5e7ff33;
}
.realm-node:is(.realm-node--locked, .is-locked, [data-state="locked"], [aria-disabled="true"], :disabled) {
  --node-accent: #a6aec9;
  border-color: #7584a2;
  background: #252c3eeF;
  cursor: default;
}
.realm-node:is(.is-locked, [data-state="locked"], [aria-disabled="true"], :disabled) .realm-node__badge::before { background: #8594aa; box-shadow: 5px 5px 0 #17213a; }
.realm-node:is(.is-locked, [data-state="locked"], [aria-disabled="true"], :disabled) .realm-node__desc { color: #c3c8d8; }

.realm__reward {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: min(calc(100% - 36px), 920px);
  min-height: 130px;
  margin: 8px auto calc(58px + var(--safe-b));
  padding: 20px clamp(18px, 3vw, 34px);
  border: 1px solid #d0bbf2;
  border-bottom: 5px solid #8670be;
  border-radius: 19px;
  background: #332b59f2;
  box-shadow: 0 20px 34px #0b12378c;
}
.realm__reward-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: 2px solid #dfc6ff;
  border-radius: 17px;
  background: #5a4688;
  color: #fff0b3;
  font-size: 35px;
}
.realm__reward-icon--sprite {
  background-image: var(--realm-prop-sheet);
  background-size: 212% 212%;
  background-position: 100% 100%;
  background-repeat: no-repeat;
}
.realm__reward-copy { min-width: 0; color: #e4dcf7; font: 600 13px/1.4 var(--font); }
.realm__reward-copy p { margin-bottom: 4px; color: #a9f3e2; font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.realm__reward-copy h2 { margin-bottom: 5px; color: #fff; font: 400 21px/1.25 var(--font-game); }
.realm__reward-copy span { display: block; color: #e4dcf7; }
.realm__reward-copy strong, .realm__reward-copy b { display: block; margin-bottom: 5px; color: #fff; font: 400 20px/1.3 var(--font-game); }
.realm__reward-button { border-color: #9170d2; background: #b79bf8; color: #24173f; }
.realm__reward-button:hover { background: #d0baff; }

/* Navegação por teclado permanece visível sobre qualquer arte. */
.atlas :is(button, a, [role="button"]):focus-visible,
.realm :is(button, a, [role="button"]):focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px #12b5a6;
}

@media (max-width: 760px) {
  .atlas__hero { grid-template-columns: minmax(0, 1fr) 110px; padding: 26px; }
  .atlas__grid { grid-template-columns: 1fr; }
  .portal { min-height: 325px; }
  .portal__art { height: clamp(165px, 34vw, 220px); }
  .realm__scene { min-height: 350px; }
  .realm-node { width: min(71%, 460px); margin-left: 0; }
  .realm-node:nth-of-type(even) { margin-right: 0; }
  .realm__prop { width: clamp(88px, 16vw, 122px); }
  .realm__gate { flex-wrap: wrap; }
  .realm__gate button { width: 100%; }
}

@media (max-width: 520px) {
  .atlas.view { padding-inline: 12px; }
  .atlas__hero { grid-template-columns: minmax(0, 1fr) 68px; gap: 4px; min-height: 255px; padding: 23px 16px; border-radius: 19px; }
  .atlas__heading { font-size: clamp(29px, 8vw, 40px); }
  .atlas__lead { font-size: 14px; }
  .atlas__mascot { align-self: end; width: 86px; transform: translateX(8px); }
  .atlas__status { margin-top: 14px; font-size: 11px; }
  .atlas__resume { flex-wrap: wrap; width: calc(100% - 12px); margin-top: -13px; padding: 15px; }
  .atlas__resume-actions { width: 100%; }
  .atlas__resume-button { width: 100%; }
  .portal__mascot { right: 12px; }
  .realm__top { padding-inline: 12px; }
  .realm__scene { min-height: 340px; padding: 42px 20px 32px; }
  .realm__scene::after { background: linear-gradient(90deg, #15192fe8, #15192f5e 92%), linear-gradient(0deg, var(--journey-deep), transparent 65%); }
  .realm__art { background-position: 64% center; object-position: 64% center; }
  .realm__trail { padding: 38px 16px 46px; }
  .realm__chapter-list { gap: 48px; }
  .realm__prop { width: clamp(72px, 20vw, 102px); }
  .realm-node, .realm-node:nth-of-type(even) { width: min(86%, 390px); }
  .realm-node:nth-of-type(odd) { margin-left: 0; }
  .realm-node:nth-of-type(even) { margin-left: auto; margin-right: 0; }
  .realm-node { grid-template-columns: 58px minmax(0, 1fr); gap: 8px; min-height: 108px; padding: 12px 11px 12px 6px; }
  .realm-node__badge { width: 58px; height: 58px; font-size: 20px; }
  .realm-node__badge::before { inset: 10px; }
  .realm-node__title { font-size: 16px; }
  .realm-node__desc { font-size: 11px; }
  .realm__road path:first-child:not(:last-child) { stroke-width: 27px; }
  .realm__road path:last-child:not(:first-child), .realm__road path:only-child { stroke-width: 12px; }
  .realm__reward { grid-template-columns: 54px minmax(0, 1fr); gap: 13px; width: calc(100% - 24px); padding: 17px; }
  .realm__reward-icon { width: 54px; height: 54px; font-size: 27px; }
  .realm__reward-button { grid-column: 1 / -1; width: 100%; }
}

/* O atlas mantém o painel de progresso, mas faz parte do mesmo palco noturno. */
#app:has(.atlas.view) .topbar { border-bottom: 1px solid #625b88; background: #191936; }
#app:has(.atlas.view) .brand { color: #fff; }
#app:has(.atlas.view) .brand__mark { background: #7c5cff; }
#app:has(.atlas.view) .brand span { color: #91f2e1; }
#app:has(.atlas.view) .stat { border-color: #625b88; background: #2a2649; color: #fff; }
#app:has(.atlas.view) .stat small, #app:has(.atlas.view) .goalbar__top { color: #d4caef; }
#app:has(.atlas.view) .tabbar { border-top-color: #625b88; background: #211d3e; }
#app:has(.atlas.view) .tab { color: #c9c0e4; }
#app:has(.atlas.view) .tab[aria-current="page"] { color: #91f2e1; }

@media (max-width: 360px) {
  .atlas__hero { grid-template-columns: 1fr; }
  .atlas__mascot { display: none; }
  .realm__switch { max-width: 100%; }
  .realm-node, .realm-node:nth-of-type(even) { width: 91%; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas.view, .realm.view,
  .realm__art, .realm__intro,
  .atlas :is(button, a, [role="button"]),
  .realm :is(button, a, [role="button"]) { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
