:root {
  --bar-1: #c31ad4;
  --bar-2: #a012c6;
  --trail: #f6c9ee;
  --trail-shadow: #7a1f74;
  --star-on: #ffcb2e;
  --star-off: #2a1350;

  /* alturas das barras — escalam um pouco com a viewport */
  --top-h: clamp(56px, 9vw, 76px);
  --bottom-h: clamp(62px, 10vw, 84px);

  /* fator de escala das casinhas (definido pelo JS) */
  --s: 1;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: #0c0220;
  color: #fff;
  font-family: "Baloo 2", "Nunito", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  overflow: hidden; /* o scroll acontece dentro do mapa */
  -webkit-font-smoothing: antialiased;
}

/* ocupa a viewport inteira, sem depender de vh/dvh */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */

.topbar {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, var(--bar-1), var(--bar-2));
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45), inset 0 -3px 0 rgba(0, 0, 0, .18);
}

.topbar-inner,
.bottombar-inner {
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title {
  margin: 0;
  font-size: clamp(16px, 2.6vw, 24px);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  white-space: nowrap;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: clamp(32px, 5.4vw, 42px);
  padding: 0 8px 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .32), rgba(0, 0, 0, .18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.pill--right { padding: 0 5px 0 12px; }

.pill-icon svg, .badge svg {
  width: clamp(20px, 3.2vw, 26px);
  height: clamp(20px, 3.2vw, 26px);
  display: block;
}
.pill-icon svg { fill: var(--star-on); }
.badge svg { fill: none; stroke: #f7d7ff; stroke-width: 1.6; }

.pill-value {
  font-weight: 800;
  font-size: clamp(14px, 2.2vw, 18px);
  min-width: 12px;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}

.badge {
  width: clamp(26px, 4.4vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #e04ff0, #a51ec2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}

/* ---------- mapa ---------- */

.map {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background:
    radial-gradient(60vw 46vh at 80% 8%, rgba(96, 24, 168, .40) 0%, transparent 68%),
    radial-gradient(54vw 44vh at 6% 58%, rgba(76, 20, 140, .36) 0%, transparent 66%),
    linear-gradient(180deg, #1a0538, #120329 45%, #0c0220);
  background-attachment: local, local, local;
  scrollbar-width: none;
}
.map::-webkit-scrollbar { display: none; }

/* coluna onde a trilha vive — não deixa o mapa esticar em telas largas */
.track {
  position: relative;
  width: min(100%, 600px);
  margin: 0 auto;
}

/* poeira estelar de fundo — preenche as sobras em telas largas */
.map::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 28% 72%, #ffd6f7, transparent),
    radial-gradient(1.8px 1.8px at 46% 32%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 63% 84%, #d9c4ff, transparent),
    radial-gradient(1.6px 1.6px at 78% 22%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 88% 58%, #ffd6f7, transparent),
    radial-gradient(1.5px 1.5px at 6% 52%, #d9c4ff, transparent),
    radial-gradient(1.4px 1.4px at 36% 92%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 8%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 94% 88%, #d9c4ff, transparent);
}

.nodes, .trail {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
}
.trail { z-index: 1; overflow: visible; }
.nodes { z-index: 2; }

.trail path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trail .trail-shadow {
  stroke: var(--trail-shadow);
  stroke-width: calc(9px * var(--s));
  opacity: .55;
}
.trail .trail-line {
  stroke: var(--trail);
  stroke-width: calc(4.5px * var(--s));
  opacity: .5;
}
/* trecho já percorrido: acende */
.trail .trail-feito {
  stroke: #ffe9fb;
  stroke-width: calc(5px * var(--s));
  filter: drop-shadow(0 0 6px rgba(255, 160, 240, .85));
}

/* ---------- nó de nível ---------- */

.level {
  position: absolute;
  transform: translate(-50%, -50%);
  width: calc(130px * var(--s));
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.level .art {
  position: relative;
  width: calc(130px * var(--s));
  height: calc(130px * var(--s));
  transition: transform .12s ease;
}
.level .art svg { width: 100%; height: 100%; display: block; overflow: visible; }

.level .glow {
  position: absolute;
  left: 50%; top: 62%;
  transform: translate(-50%, -50%);
  width: 84%; height: 42%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 100, 255, .55), transparent 70%);
  filter: blur(3px);
  z-index: -1;
}

.level .num {
  position: relative;
  z-index: 2;
  margin-top: calc(-28px * var(--s));
  font-size: calc(21px * var(--s));
  font-weight: 800;
  text-shadow: 0 2px 0 #3a0a55, 0 0 10px rgba(0, 0, 0, .6);
}

.level .lock {
  position: relative;
  z-index: 2;
  margin-top: calc(-26px * var(--s));
}
.level .lock svg {
  width: calc(22px * var(--s));
  height: calc(22px * var(--s));
  display: block;
  fill: #ffd24a;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6));
}

.stars {
  position: relative;
  z-index: 2;
  display: flex;
  gap: calc(3px * var(--s));
  margin-top: calc(4px * var(--s));
  align-items: flex-end;
}
.stars svg {
  width: calc(19px * var(--s));
  height: calc(19px * var(--s));
  display: block;
}
.stars .s2 svg {
  width: calc(22px * var(--s));
  height: calc(22px * var(--s));
  margin-bottom: calc(2px * var(--s));
}
.stars svg path { stroke: #4a1b6e; stroke-width: 1.2; }
.stars .on svg path {
  fill: var(--star-on);
  filter: drop-shadow(0 0 5px rgba(255, 190, 40, .75));
}
.stars .off svg path { fill: var(--star-off); opacity: .85; }

/* estados */
.level--locked .art { filter: saturate(.9) brightness(.9); }
.level--locked .glow { opacity: .35; }
.level--current .art { animation: bob 2.2s ease-in-out infinite; }
.level:active .art { transform: scale(.94); }
.level:focus-visible { outline: none; }
.level:focus-visible .art { filter: drop-shadow(0 0 8px #ffe36b); }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (prefers-reduced-motion: reduce) {
  .level--current .art { animation: none; }
}

/* nome da casa sob as estrelas */
.casa-nome {
  position: relative;
  z-index: 2;
  margin-top: calc(3px * var(--s));
  max-width: calc(150px * var(--s));
  font-size: calc(11.5px * var(--s));
  font-weight: 700;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .62);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  line-height: 1.15;
}
.level--locked .casa-nome { color: rgba(255, 255, 255, .34); }
.level--santuario .casa-nome { color: #ffd979; }
.level--santuario .num { color: #ffd979; text-shadow: 0 2px 0 #5a3606, 0 0 14px rgba(255, 200, 70, .6); }
.level--santuario .glow {
  background: radial-gradient(closest-side, rgba(255, 200, 70, .5), transparent 70%);
  width: 100%; height: 52%;
}

/* faixa de região */
.regiao {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
  padding: 0 clamp(10px, 4vw, 26px);
  pointer-events: none;
}
.regiao::before, .regiao::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 190, 255, .35), transparent);
}
.regiao span {
  flex: 0 0 auto;
  font-size: calc(11px * var(--s));
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 200, 255, .72);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .7);
}

/* câmaras laterais (leitura opcional) */
.camara {
  position: absolute;
  transform: translate(-50%, -50%);
  width: calc(84px * var(--s));
  z-index: 1;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.camara svg { width: 100%; height: auto; display: block; }
.camara:hover { transform: translate(-50%, -54%); }
.camara-nome {
  margin-top: calc(2px * var(--s));
  font-size: calc(10px * var(--s));
  font-weight: 700;
  color: rgba(255, 190, 240, .7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  line-height: 1.1;
}
.camara--vista svg { filter: saturate(.55) brightness(.85); }

/* ---------- bottombar ---------- */

.bottombar {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, #a812c8, #8b0fae);
  box-shadow: 0 -6px 22px rgba(0, 0, 0, .45), inset 0 3px 0 rgba(255, 255, 255, .08);
}
.bottombar-inner {
  max-width: 720px;
  justify-content: space-around;
}

.nav-btn {
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .78);
  padding: 6px clamp(6px, 2.4vw, 20px);
  min-width: 0;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font: inherit;
  font-size: clamp(10px, 1.5vw, 13px);
  font-weight: 700;
  text-decoration: none;
}
.nav-btn svg {
  width: clamp(22px, 3.4vw, 28px);
  height: clamp(22px, 3.4vw, 28px);
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-btn--active {
  color: #ffe36b;
  background: rgba(0, 0, 0, .22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

/* telas estreitas: só ícones, sem título */
@media (max-width: 430px) {
  .nav-btn span { display: none; }
  .title { display: none; }
  .topbar-inner { justify-content: space-between; }
}

/* =========================================================
   CAMADA DE AVENTURA — atmosfera, missão e hubs
   ========================================================= */

.map {
  isolation: isolate;
  background: #10032a;
}

.track::before {
  content: "";
  position: absolute;
  inset: 0 -34vw;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(17, 3, 44, .04), rgba(17, 3, 44, .28) 54%, rgba(8, 1, 25, .5)),
    url("assets/jornada-cosmica.webp") center top / 100% 100% no-repeat;
  opacity: .78;
  filter: saturate(.9) contrast(1.04);
}

.map-atmosfera {
  position: fixed;
  inset: var(--top-h) 0 var(--bottom-h);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orbita {
  position: absolute;
  width: 44vw;
  aspect-ratio: 1;
  border: 1px solid rgba(224, 173, 255, .16);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(144, 70, 255, .08);
  animation: girar 24s linear infinite;
}
.orbita::after {
  content: "";
  position: absolute;
  top: 15%; left: 6%;
  width: 8px; aspect-ratio: 1;
  border-radius: 50%;
  background: #ffe9a8;
  box-shadow: 0 0 16px #ffd86b;
}
.orbita--1 { left: -20vw; top: 12%; }
.orbita--2 { right: -24vw; top: 54%; animation-direction: reverse; animation-duration: 30s; }

.cometa {
  position: absolute;
  top: 17%; left: -20%;
  width: 90px; height: 2px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, #fff);
  box-shadow: 26px 0 10px #e9c9ff;
  transform: rotate(-16deg);
  animation: cruzar 13s ease-in-out infinite 2s;
}

@keyframes girar { to { transform: rotate(360deg); } }
@keyframes cruzar {
  0%, 67% { transform: translate(-20vw, 0) rotate(-16deg); opacity: 0; }
  72% { opacity: 1; }
  88%, 100% { transform: translate(140vw, 34vh) rotate(-16deg); opacity: 0; }
}

.level .art::after {
  content: "";
  position: absolute;
  inset: 15% 10%;
  border: 1px solid rgba(255, 237, 167, 0);
  border-radius: 50%;
  transform: scale(.7);
  transition: transform .35s ease, opacity .35s ease, border-color .35s ease;
}
.level:not(.level--locked):hover .art::after,
.level:focus-visible .art::after {
  transform: scale(1.06);
  border-color: rgba(255, 237, 167, .7);
  opacity: 0;
}
.level:not(.level--locked):hover .art { transform: translateY(-6px) scale(1.05); }

.mission-dock {
  position: sticky;
  left: 100%;
  bottom: 18px;
  z-index: 4;
  width: min(310px, calc(100% - 28px));
  margin: 0 14px 18px auto;
  padding: 15px 16px 14px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, rgba(37, 11, 77, .9), rgba(15, 4, 42, .94));
  box-shadow: 0 16px 42px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(255, 255, 255, .14);
  backdrop-filter: blur(14px);
}
.mission-dock::before {
  content: "✦";
  position: absolute;
  top: -13px; right: 18px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 11px;
  color: #3b1650;
  background: linear-gradient(180deg, #ffe995, #ffbd38);
  box-shadow: 0 7px 18px rgba(255, 190, 56, .32);
}
.mission-dock__eyebrow,
.mission-dock__hint { display: block; }
.mission-dock__eyebrow {
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #e7b8ff;
}
.mission-dock strong { display: block; padding-right: 28px; font-size: 15px; line-height: 1.25; }
.mission-dock__hint { margin-top: 4px; font-size: 12px; line-height: 1.35; color: rgba(255,255,255,.62); }
.mission-dock__button {
  width: 100%;
  margin-top: 11px;
  padding: 10px 13px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #2b1037;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe47b, #ffb936);
  transition: transform .12s ease, filter .15s ease;
}
.mission-dock__button:hover { filter: brightness(1.06); }
.mission-dock__button:active { transform: scale(.98); }

/* hubs acessíveis pela barra inferior */
.hub {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  align-items: end;
  background: rgba(6, 1, 19, .64);
  backdrop-filter: blur(6px);
  animation: hub-fundo .2s ease;
}
.hub[hidden] { display: none; }
.hub__folha {
  max-height: min(82vh, 760px);
  overflow-y: auto;
  padding: 18px clamp(16px, 4vw, 34px) max(30px, env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at 85% 0, rgba(194, 63, 223, .22), transparent 34%),
    #160732;
  box-shadow: 0 -18px 70px rgba(0, 0, 0, .5), inset 0 1px rgba(255,255,255,.15);
  animation: hub-subir .28s cubic-bezier(.2,.8,.2,1);
}
.hub__topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 860px; margin: 0 auto 20px; }
.hub__topo span { display: block; font-size: 11px; color: #cda8ef; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
.hub__topo h2 { margin: 3px 0 0; font-size: clamp(24px, 5vw, 36px); }
.hub__fechar {
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  cursor: pointer; color: #fff;
  font-size: 22px; background: rgba(255,255,255,.09);
}
.hub__grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; max-width: 860px; margin: auto; }
.hub-card {
  position: relative;
  min-height: 132px;
  padding: 17px;
  border: 0;
  border-radius: 18px;
  text-align: left;
  color: #fff;
  font: inherit;
  background: linear-gradient(145deg, rgba(130, 72, 214, .22), rgba(255,255,255,.035));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.11);
}
button.hub-card { cursor: pointer; transition: transform .14s ease, background .2s ease; }
button.hub-card:hover { transform: translateY(-3px); background: rgba(143, 91, 224, .25); }
.hub-card__num { display: block; margin-bottom: 8px; font-size: 11px; color: #ffcf59; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.hub-card strong { display: block; font-size: 16px; line-height: 1.3; }
.hub-card p { margin: 7px 0 0; color: #c6b6db; font-size: 13px; line-height: 1.45; }
.hub-card--locked { opacity: .45; filter: saturate(.5); }
.hub-stat { font-size: 32px; font-weight: 900; color: #ffcf59; }
.hub-progress { height: 8px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.hub-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c92edc, #ffcf59); }
@keyframes hub-fundo { from { opacity: 0; } }
@keyframes hub-subir { from { transform: translateY(26px); opacity: 0; } }

@media (min-width: 900px) {
  .track::before { inset-inline: -44vw; }
  .mission-dock { position: fixed; right: 24px; bottom: calc(var(--bottom-h) + 18px); margin: 0; }
}

@media (max-width: 560px) {
  .mission-dock { padding: 12px 13px; }
  .mission-dock__hint { display: none; }
  .mission-dock__button { margin-top: 8px; }
  .track::before { inset-inline: -52vw; opacity: .64; }
}

@media (prefers-reduced-motion: reduce) {
  .orbita, .cometa { animation: none; }
  .level:not(.level--locked):hover .art { transform: none; }
  .hub, .hub__folha { animation: none; }
}

/* =========================================================
   MAPA V2 — composição com assets de game mobile
   ========================================================= */

.topbar {
  background:
    linear-gradient(180deg, rgba(41, 10, 76, .97), rgba(24, 5, 54, .94));
  box-shadow: 0 8px 26px rgba(5, 0, 22, .62), inset 0 -1px rgba(255, 220, 125, .22);
  backdrop-filter: blur(14px);
}
.title { color: #fff3ce; text-shadow: 0 2px 10px rgba(0,0,0,.55); }
.pill {
  background: linear-gradient(180deg, rgba(112, 52, 157, .4), rgba(24, 7, 58, .74));
  box-shadow: inset 0 0 0 1px rgba(255, 226, 150, .18), 0 5px 16px rgba(0,0,0,.22);
}
.bottombar {
  background: linear-gradient(180deg, rgba(42, 10, 78, .97), rgba(20, 4, 48, .99));
  box-shadow: 0 -8px 28px rgba(5, 0, 22, .62), inset 0 1px rgba(255, 220, 125, .16);
}
.nav-btn--active {
  color: #ffe18a;
  background: linear-gradient(180deg, rgba(255, 211, 95, .16), rgba(255, 211, 95, .06));
  box-shadow: inset 0 0 0 1px rgba(255, 224, 133, .24), 0 0 18px rgba(255, 194, 63, .08);
}

.map {
  background: #0b021d;
  scroll-snap-type: y proximity;
}
.track { width: min(100%, 620px); }
.track::before {
  inset: 0 auto;
  left: 50%;
  width: max(100vw, 680px);
  height: 100%;
  transform: translateX(-50%);
  opacity: 1;
  filter: saturate(1.05) contrast(1.02);
  background:
    linear-gradient(180deg, rgba(255, 190, 110, .02), rgba(44, 7, 75, .04) 44%, rgba(4, 1, 20, .22)),
    url("assets/map-cosmos-v2.webp") center / 100% 100% no-repeat;
}
.map::before { opacity: .3; z-index: 1; }
.map-atmosfera { z-index: 1; mix-blend-mode: screen; }

.nodes, .trail { z-index: 2; }
.nodes { z-index: 3; }
.trail .trail-shadow {
  stroke: rgba(25, 2, 50, .78);
  stroke-width: calc(22px * var(--s));
  opacity: .9;
  filter: drop-shadow(0 6px 7px rgba(0,0,0,.45));
}
.trail .trail-line {
  stroke: url(#gameTrail);
  stroke-width: calc(10px * var(--s));
  opacity: .78;
  filter: drop-shadow(0 0 7px rgba(229, 85, 255, .75));
}
.trail .trail-dots {
  fill: none;
  stroke: rgba(255, 246, 210, .8);
  stroke-width: calc(2.2px * var(--s));
  stroke-dasharray: calc(2px * var(--s)) calc(18px * var(--s));
  animation: trilha-correr 1.8s linear infinite;
}
.trail .trail-feito {
  stroke: #ffe68c;
  stroke-width: calc(11px * var(--s));
  opacity: .92;
  filter: drop-shadow(0 0 10px rgba(255, 211, 80, .95));
}
@keyframes trilha-correr { to { stroke-dashoffset: calc(-40px * var(--s)); } }

.level {
  width: calc(194px * var(--s));
  min-height: calc(220px * var(--s));
  scroll-snap-align: center;
  filter: drop-shadow(0 18px 16px rgba(3, 0, 18, .44));
}
.level .art {
  width: calc(194px * var(--s));
  height: calc(194px * var(--s));
  z-index: 2;
  transition: transform .26s cubic-bezier(.2,.8,.2,1), filter .25s ease;
  transform-origin: 50% 70%;
}
.level-asset {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.level .glow {
  top: 57%;
  width: 110%; height: 70%;
  z-index: 0;
  opacity: .55;
  background: radial-gradient(closest-side, rgba(205, 89, 255, .7), rgba(99, 41, 224, .22) 48%, transparent 73%);
  filter: blur(9px);
}
.level .art::after {
  inset: 12% 5% 20%;
  z-index: 1;
  border: 2px solid rgba(255, 230, 139, 0);
  box-shadow: 0 0 0 0 rgba(255, 214, 92, 0);
}
.level--current .art::after {
  border-color: rgba(255, 231, 149, .8);
  box-shadow: 0 0 0 8px rgba(255, 214, 92, .08), 0 0 38px rgba(255, 202, 65, .55);
  animation: current-ring 1.9s ease-out infinite;
}
@keyframes current-ring {
  0% { transform: scale(.76); opacity: .9; }
  78%, 100% { transform: scale(1.08); opacity: 0; }
}
.level--regiao-2:not(.level--santuario) .level-asset { filter: hue-rotate(18deg) saturate(.94); }
.level--regiao-3:not(.level--santuario) .level-asset { filter: hue-rotate(-18deg) saturate(1.08) brightness(1.04); }

.level-state {
  position: absolute;
  top: calc(118px * var(--s));
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
}
.level .num,
.level .lock {
  display: grid;
  place-items: center;
  width: calc(38px * var(--s));
  height: calc(38px * var(--s));
  margin: 0;
  border-radius: 50%;
  font-size: calc(18px * var(--s));
  font-weight: 900;
  color: #35103e;
  text-shadow: 0 1px rgba(255,255,255,.45);
  background: linear-gradient(180deg, #fff0a5, #f6b82d);
  box-shadow: 0 0 0 calc(4px * var(--s)) rgba(45, 11, 72, .78), 0 5px 14px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.7);
}
.level .lock svg {
  width: calc(19px * var(--s));
  height: calc(19px * var(--s));
  fill: #3a2145;
  filter: none;
}
.level--locked .art {
  filter: grayscale(.72) saturate(.38) brightness(.54);
  opacity: .82;
}
.level--locked .level-state { filter: grayscale(.5); }
.level--locked .glow { opacity: .12; }
.level--locked::after {
  content: "";
  position: absolute;
  inset: 20% 8% 29%;
  z-index: 4;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(34, 17, 58, .06), rgba(23, 9, 43, .5) 72%);
  backdrop-filter: blur(1.2px);
}
.level--current .art { animation: game-float 2.7s ease-in-out infinite; }
@keyframes game-float {
  0%, 100% { transform: translateY(0) rotate(-.7deg); }
  50% { transform: translateY(calc(-9px * var(--s))) rotate(.7deg); }
}
.level:not(.level--locked):hover .art { transform: translateY(calc(-7px * var(--s))) scale(1.06); filter: brightness(1.08); }
.level:active .art { transform: scale(.96); }

.current-flag {
  position: absolute;
  top: calc(-4px * var(--s));
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  padding: calc(6px * var(--s)) calc(13px * var(--s));
  border-radius: 999px;
  font-size: calc(9px * var(--s));
  font-weight: 950;
  letter-spacing: .13em;
  color: #3b173b;
  background: linear-gradient(180deg, #fff0a9, #ffbd36);
  box-shadow: 0 6px 18px rgba(255, 190, 54, .36), inset 0 1px rgba(255,255,255,.7);
  animation: flag-pulse 1.8s ease-in-out infinite;
}
@keyframes flag-pulse { 50% { transform: translateX(-50%) scale(1.06); } }
.complete-check {
  position: absolute;
  top: 23%; right: 10%;
  z-index: 7;
  display: grid;
  place-items: center;
  width: calc(28px * var(--s)); height: calc(28px * var(--s));
  border-radius: 50%;
  color: #133d30;
  font-size: calc(16px * var(--s));
  font-weight: 950;
  background: linear-gradient(180deg, #8ff0c9, #35d6a6);
  box-shadow: 0 0 0 3px rgba(18, 54, 46, .72), 0 5px 14px rgba(0,0,0,.4);
}

.stars {
  margin-top: calc(-28px * var(--s));
  padding: calc(4px * var(--s)) calc(8px * var(--s));
  gap: calc(2px * var(--s));
  border-radius: 999px;
  background: rgba(22, 5, 48, .84);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 5px 15px rgba(0,0,0,.35);
  backdrop-filter: blur(7px);
}
.stars svg { width: calc(16px * var(--s)); height: calc(16px * var(--s)); }
.stars .s2 svg { width: calc(19px * var(--s)); height: calc(19px * var(--s)); }
.casa-nome {
  margin-top: calc(5px * var(--s));
  max-width: calc(170px * var(--s));
  padding: calc(4px * var(--s)) calc(8px * var(--s));
  border-radius: calc(8px * var(--s));
  font-size: calc(11px * var(--s));
  color: rgba(255, 249, 235, .9);
  background: rgba(16, 3, 39, .55);
  text-shadow: 0 2px 5px #080116;
  backdrop-filter: blur(6px);
}
.level--locked .casa-nome { color: rgba(218, 202, 228, .52); }

.level--santuario {
  width: calc(270px * var(--s));
  min-height: calc(280px * var(--s));
}
.level--santuario .art { width: calc(270px * var(--s)); height: calc(270px * var(--s)); }
.level--santuario .level-state { top: calc(174px * var(--s)); }
.level--santuario .stars { margin-top: calc(-40px * var(--s)); }
.level--santuario .glow {
  width: 120%; height: 82%;
  background: radial-gradient(closest-side, rgba(255, 222, 112, .78), rgba(255, 138, 47, .2) 48%, transparent 74%);
}

.regiao {
  z-index: 2;
  padding-inline: clamp(22px, 7vw, 54px);
}
.regiao::before, .regiao::after { background: linear-gradient(90deg, transparent, rgba(255, 228, 151, .52), transparent); }
.regiao span {
  padding: calc(7px * var(--s)) calc(13px * var(--s));
  border-radius: 999px;
  color: #ffe7ad;
  font-size: calc(9px * var(--s));
  background: rgba(34, 9, 65, .78);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 142, .2), 0 8px 22px rgba(0,0,0,.25);
  backdrop-filter: blur(8px);
}

.camara {
  width: calc(112px * var(--s));
  z-index: 4;
  filter: drop-shadow(0 12px 12px rgba(0,0,0,.44));
}
.camara-asset { display: block; width: 100%; height: auto; pointer-events: none; }
.camara:hover { transform: translate(-50%, -55%) scale(1.07); }
.camara-pulse {
  position: absolute;
  top: 3%; right: 5%;
  display: grid;
  place-items: center;
  width: calc(23px * var(--s)); height: calc(23px * var(--s));
  border-radius: 50%;
  color: #381137;
  font-size: calc(13px * var(--s));
  font-weight: 950;
  background: #ffd765;
  box-shadow: 0 0 0 4px rgba(255, 215, 101, .12), 0 0 15px rgba(255, 215, 101, .65);
  animation: camara-chamar 1.8s ease-in-out infinite;
}
@keyframes camara-chamar { 50% { transform: translateY(-4px) scale(1.08); } }
.camara-nome {
  margin-top: calc(-9px * var(--s));
  padding: calc(4px * var(--s)) calc(7px * var(--s));
  border-radius: 7px;
  color: #f5dcff;
  background: rgba(23, 5, 48, .76);
  backdrop-filter: blur(6px);
}
.camara--vista { opacity: .68; }
.camara--vista .camara-asset { filter: saturate(.65); }
.camara--vista .camara-pulse { display: none; }

.mission-dock {
  border-color: rgba(255, 223, 133, .22);
  background: linear-gradient(145deg, rgba(48, 16, 83, .93), rgba(14, 3, 38, .96));
  box-shadow: 0 18px 46px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255, 226, 149, .16);
}

@media (max-width: 560px) {
  .track::before { width: 680px; opacity: 1; }
  .level { filter: drop-shadow(0 13px 12px rgba(3,0,18,.42)); }
  .mission-dock { width: min(270px, calc(100% - 24px)); }
}
@media (min-width: 900px) {
  .track::before { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  .trail .trail-dots, .level--current .art, .level--current .art::after,
  .current-flag, .camara-pulse { animation: none; }
}

/* =========================================================
   MOBILE FIRST — alvo principal: 320px a 480px
   ========================================================= */

@media (max-width: 720px) {
  :root {
    --top-h: 58px;
    --bottom-h: 70px;
  }

  .map {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scroll-padding-block: 90px 150px;
  }
  .topbar-inner { padding-inline: 10px; }
  .pill { height: 36px; min-width: 70px; }
  .pill--right { justify-content: flex-end; }
  .pill-value { font-size: 14px; }

  .bottombar-inner { padding-inline: 5px; gap: 2px; }
  .nav-btn {
    flex: 1 1 25%;
    min-height: 58px;
    padding: 5px 3px;
    gap: 2px;
    font-size: 9px;
    line-height: 1;
  }
  .nav-btn svg { width: 24px; height: 24px; }
  .bottombar .nav-btn span { display: block; }

  .track::before { width: max(680px, 155vw); }
  .orbita { display: none; }
  .map-atmosfera { opacity: .64; }
  .cometa { animation-duration: 17s; }

  .level,
  .camara,
  .nav-btn,
  .mission-dock__button { touch-action: manipulation; }
  .level { -webkit-tap-highlight-color: transparent; }
  .level:active .art { transform: scale(.94); filter: brightness(1.1); }
  .casa-nome,
  .stars,
  .regiao span,
  .camara-nome { backdrop-filter: none; }

  .mission-dock {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 9px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: auto;
    min-height: 58px;
    margin: 0;
    padding: 9px 9px 9px 13px;
    border-radius: 17px;
    backdrop-filter: none;
  }
  .mission-dock::before,
  .mission-dock__eyebrow,
  .mission-dock__hint { display: none; }
  .mission-dock strong {
    min-width: 0;
    padding: 0;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mission-dock__button {
    width: auto;
    min-height: 42px;
    margin: 0;
    padding: 9px 12px;
    white-space: nowrap;
    font-size: 11px;
  }

  .hub__folha {
    max-height: calc(100dvh - 72px);
    padding: 15px 12px max(22px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }
  .hub__topo { margin-bottom: 14px; }
  .hub__topo h2 { font-size: 24px; }
  .hub__fechar { width: 44px; height: 44px; }
  .hub__grade { grid-template-columns: 1fr; gap: 9px; }
  .hub-card { min-height: 112px; padding: 15px; }
}

@media (max-width: 480px) {
  .track::before { width: 680px; }
  .level { min-height: calc(208px * var(--s)); }
  .level--santuario { min-height: calc(260px * var(--s)); }
  .current-flag { top: calc(1px * var(--s)); }
  .casa-nome {
    max-width: calc(160px * var(--s));
    font-size: max(9px, calc(10.5px * var(--s)));
    line-height: 1.12;
  }
  .regiao { padding-inline: 8px; }
  .regiao span { letter-spacing: .12em; }
  .camara { width: calc(104px * var(--s)); }
}

@media (max-width: 360px) {
  :root { --top-h: 54px; --bottom-h: 66px; }
  .topbar-inner { padding-inline: 7px; }
  .pill { min-width: 62px; height: 34px; }
  .pill-icon svg, .badge svg { width: 21px; height: 21px; }
  .badge { width: 27px; }
  .nav-btn { min-height: 54px; font-size: 8.5px; }
  .nav-btn svg { width: 22px; height: 22px; }
  .mission-dock { left: 7px; right: 7px; gap: 7px; padding-left: 10px; }
  .mission-dock strong { font-size: 11px; }
  .mission-dock__button { min-height: 40px; padding-inline: 9px; font-size: 10px; }
  .trail .trail-shadow { stroke-width: calc(19px * var(--s)); }
  .trail .trail-line { stroke-width: calc(9px * var(--s)); }
}

@media (hover: none) and (pointer: coarse) {
  .level:not(.level--locked):hover .art,
  .camara:hover,
  button.hub-card:hover {
    transform: none;
    filter: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root { --top-h: 50px; --bottom-h: 58px; }
  .mission-dock {
    left: auto;
    right: 8px;
    width: min(300px, 46vw);
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 7px);
  }
  .mission-dock strong { display: none; }
  .mission-dock__button { width: 100%; }
  .nav-btn { min-height: 48px; }
}
