/* ============================================================================
   Chão do mapa v3 (FEAT-21.T04): mar, regiões, ilhas, buraco e moldura de nuvens.
   O desenho é montado por js/mapa-chao-view.js; os números de posição vêm de assets/map/v3/mundo-v3.json.
   Movimento usa transform e opacity; a névoa das fases bloqueadas fica recortada à ilha.
   ============================================================================ */

/* ── Abertura: informa a espera enquanto as primeiras imagens da jornada são decodificadas ── */
.map-loading { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; color: #f4e5bf; background: #173e51; font: 18px Georgia, serif; text-align: center; }
.map-loading[hidden] { display: none; }
.map-image-status { position: fixed; left: 12px; right: 12px; top: 72px; z-index: 80; padding: 8px 12px; border-radius: 6px; color: #f4e5bf; background: #173e51ed; font: 14px Georgia, serif; text-align: center; }
.map-image-status[hidden] { display: none; }

/* ── Mar: fundo fixo na tela, duas camadas da textura à deriva em sentidos opostos ── */
.sea {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #1d5f8c;
}

.sea-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% + 3 * var(--tile, 480px));
  height: calc(100% + 3 * var(--tile, 480px));
  will-change: transform;
}

.sea-drift {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  animation: sea-drift linear infinite;
  will-change: transform;
  opacity: .46;
  background-color: #1d5f8c;
}

.sea-b {
  opacity: .24;
  background-position: 37% 61%;
}

@keyframes sea-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--drift, 480px), 0, 0); }
}

/* ── Mar do celular: move a textura dentro da tela, sem superfícies que crescem com o zoom (BUG-112) ── */
.sea-bounded .sea-layer {
  width: 100%;
  height: 100%;
  will-change: auto;
}

.sea-bounded .sea-drift {
  will-change: auto;
  animation-name: sea-drift-bounded;
  /* A deriva lenta avança 2 px de mundo por passo: só 2 e 3 pinturas por segundo nos dois fundos. */
  animation-timing-function: steps(480);
}

@keyframes sea-drift-bounded {
  from { background-position: var(--sea-x, 0px) var(--sea-y, 0px); }
  to { background-position: calc(var(--sea-x, 0px) + var(--drift, 480px)) var(--sea-y, 0px); }
}

/* ── Camadas do mundo: todas moram em #mapWorld, em coordenadas de mundo ── */
.map-world {
  position: absolute;
  width: 0;
  height: 0;
}

.world-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.world-layer img {
  position: absolute;
  display: block;
  max-width: none;
}

/* Região pintada: a borda esmaece onde se funde numa vizinha de número menor (--fade-* vêm do JS). */
.region {
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--fade-t, 0px), #000 calc(100% - var(--fade-b, 0px)), transparent 100%);
  -webkit-mask-composite: source-in;
  -webkit-mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
  mask-image:
    linear-gradient(to right, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--fade-t, 0px), #000 calc(100% - var(--fade-b, 0px)), transparent 100%);
  mask-composite: intersect;
}

/* ── Buraco vivo: névoa no fundo, a sombra da ilha e as pedras, recortadas pela elipse ── */
.hole {
  position: absolute;
  border-radius: 50%;
  overflow: hidden;
}

/* Névoa no fundo, na cor do tema da fase: o buraco deixa de ser um preto chapado e ganha distância (FEAT-25.T18). */
.hole::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse 62% 58% at 50% 64%, var(--mist-core), var(--mist-edge) 50%, transparent 78%);
}

/* Névoa temática que sobe do buraco, passa da borda e envolve a ponta da ilha; respira devagar (FEAT-25.T19). */
.hole-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse 50% 46% at 50% 58%, var(--glow) 0, var(--glow-edge) 45%, transparent 72%);
  animation: hole-breath 8s ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}

/* Fio de névoa: uma mancha sem borda na cor do tema, que nasce no fundo, sobe, cresce e some; várias se sobrepõem. */
.hole-wisp {
  position: absolute;
  bottom: 26%;
  width: 34%;
  height: 40%;
  margin-left: -17%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--wisp), transparent);
  opacity: 0;
  animation: wisp-rise var(--wisp-s, 7s) ease-out infinite;
  animation-delay: var(--wisp-delay, 0s);
  will-change: transform, opacity;
}

@keyframes wisp-rise {
  0% { opacity: 0; transform: translate(0, 35%) scale(.55); }
  22% { opacity: var(--wisp-alpha, .6); }
  100% { opacity: 0; transform: translate(var(--wisp-drift, 0), -110%) scale(1.6); }
}

/* Fase bloqueada: sem fios subindo. */
.hole-glow-locked .hole-wisp { display: none; }

@keyframes hole-breath {
  0%, 100% { opacity: .78; transform: scale(.96, .93); }
  50% { opacity: 1; transform: scale(1.03, 1.07); }
}

/* Fase bloqueada: a névoa fica parada, apagada e sem cor, como a vida dela (RN-01). */
.hole-glow-locked {
  opacity: .3;
  filter: saturate(.3);
  animation: none;
}

/* ── Tema de cada buraco: fundo (--mist-*), névoa que sobe (--glow*) e base da ilha (--haze-*) ──
   Luminosos (lava, ouro, turquesa, lilás...) clareiam a base da ilha por baixo; escuros (fumaça, sombra, tempestade)
   a escurecem. */
.hole, .hole-glow, .island {
  --mist-core: rgba(96, 118, 150, .55); --mist-edge: rgba(70, 88, 118, .28);
  --glow: rgba(96, 118, 150, .35); --glow-edge: rgba(96, 118, 150, .12);
  --haze-a: rgba(40, 52, 74, .45); --haze-b: rgba(56, 72, 100, .8);
  --wisp: rgb(160, 176, 200);
}
/* I Cidade da Destruição: fumaça acesa por baixo pela lava. */
[data-phase="1"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 120, 50);
  --mist-core: rgba(255, 92, 28, .75); --mist-edge: rgba(130, 32, 12, .55);
  --glow: rgba(255, 104, 38, .55); --glow-edge: rgba(120, 44, 24, .3);
  --haze-a: rgba(200, 60, 20, .35); --haze-b: rgba(255, 110, 40, .65);
}
/* II Pântano do Desânimo: vapor verde-amarelado de brejo. */
[data-phase="2"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(175, 210, 80);
  --mist-core: rgba(170, 200, 60, .7); --mist-edge: rgba(80, 110, 30, .5);
  --glow: rgba(160, 200, 70, .5); --glow-edge: rgba(100, 130, 40, .28);
  --haze-a: rgba(80, 110, 30, .45); --haze-b: rgba(150, 190, 60, .7);
}
/* III Desvio da Moralidade: poeira ocre e calor avermelhado do monte que arde. */
[data-phase="3"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(225, 155, 90);
  --mist-core: rgba(235, 140, 60, .7); --mist-edge: rgba(150, 70, 30, .5);
  --glow: rgba(225, 150, 80, .5); --glow-edge: rgba(170, 90, 45, .28);
  --haze-a: rgba(160, 80, 35, .4); --haze-b: rgba(230, 140, 70, .65);
}
/* IV Porta Estreita: luz dourada subindo como de uma porta entreaberta. */
[data-phase="4"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 225, 140);
  --mist-core: rgba(255, 220, 120, .85); --mist-edge: rgba(230, 170, 60, .5);
  --glow: rgba(255, 215, 110, .6); --glow-edge: rgba(255, 190, 80, .25);
  --haze-a: rgba(230, 170, 70, .3); --haze-b: rgba(255, 215, 120, .7);
}
/* V Casa do Intérprete: brilho âmbar de vela em névoa cor de mel. */
[data-phase="5"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 185, 90);
  --mist-core: rgba(255, 175, 70, .75); --mist-edge: rgba(180, 100, 40, .5);
  --glow: rgba(255, 170, 70, .5); --glow-edge: rgba(200, 120, 50, .25);
  --haze-a: rgba(180, 100, 40, .35); --haze-b: rgba(255, 180, 80, .65);
}
/* VI Cruz e Sepulcro: névoa branca e dourada, luz suave da manhã. */
[data-phase="6"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 250, 230);
  --mist-core: rgba(255, 250, 225, .85); --mist-edge: rgba(240, 220, 160, .45);
  --glow: rgba(255, 245, 210, .6); --glow-edge: rgba(250, 230, 180, .25);
  --haze-a: rgba(240, 225, 180, .3); --haze-b: rgba(255, 248, 220, .7);
}
/* VII Colina da Dificuldade: nuvens frias de montanha. */
[data-phase="7"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(232, 236, 242);
  --mist-core: rgba(228, 232, 238, .8); --mist-edge: rgba(170, 178, 190, .5);
  --glow: rgba(225, 230, 236, .55); --glow-edge: rgba(190, 196, 206, .28);
  --haze-a: rgba(180, 188, 200, .4); --haze-b: rgba(225, 230, 236, .75);
}
/* VIII Palácio Belo: névoa turquesa e prata de jardim com fonte. */
[data-phase="8"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(140, 238, 228);
  --mist-core: rgba(100, 230, 220, .75); --mist-edge: rgba(40, 140, 140, .5);
  --glow: rgba(110, 230, 220, .5); --glow-edge: rgba(60, 170, 165, .25);
  --haze-a: rgba(40, 130, 130, .4); --haze-b: rgba(110, 225, 215, .65);
}
/* IX Vale da Humilhação: fumaça cinza da batalha com brasas. */
[data-phase="9"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(70, 62, 58);
  --mist-core: rgba(210, 80, 30, .5); --mist-edge: rgba(60, 52, 48, .7);
  --glow: rgba(80, 70, 64, .6); --glow-edge: rgba(60, 52, 48, .3);
  --haze-a: rgba(45, 38, 35, .5); --haze-b: rgba(40, 34, 32, .85);
}
/* X Vale da Sombra da Morte: sombra negro-violeta que engole a luz, com fios verde-azulados. */
[data-phase="10"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(30, 18, 50);
  --mist-core: rgba(70, 230, 205, .45); --mist-edge: rgba(22, 10, 40, .85);
  --glow: rgba(25, 12, 45, .7); --glow-edge: rgba(50, 160, 150, .18);
  --haze-a: rgba(20, 10, 35, .55); --haze-b: rgba(14, 8, 26, .9);
}
/* XI Feira das Vaidades: neblina de festa em magenta, ciano e açafrão. */
[data-phase="11"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(250, 120, 190);
  --mist-core: rgba(240, 80, 170, .7); --mist-edge: rgba(60, 200, 220, .45);
  --glow: rgba(255, 180, 60, .45); --glow-edge: rgba(230, 80, 170, .3);
  --haze-a: rgba(150, 50, 120, .4); --haze-b: rgba(240, 90, 170, .65);
}
/* XII Castelo das Dúvidas: névoa cinzenta de tempestade. */
[data-phase="12"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(120, 130, 142);
  --mist-core: rgba(130, 140, 152, .7); --mist-edge: rgba(55, 62, 72, .65);
  --glow: rgba(110, 120, 132, .55); --glow-edge: rgba(70, 78, 88, .3);
  --haze-a: rgba(55, 62, 72, .5); --haze-b: rgba(45, 50, 58, .85);
}
/* XIII Montes Deleitáveis: nuvens brancas de manhã limpa. */
[data-phase="13"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 255, 255);
  --mist-core: rgba(252, 253, 255, .85); --mist-edge: rgba(200, 225, 240, .45);
  --glow: rgba(245, 250, 255, .6); --glow-edge: rgba(215, 235, 248, .25);
  --haze-a: rgba(215, 230, 240, .35); --haze-b: rgba(248, 252, 255, .75);
}
/* XIV Terra Encantada: névoa lilás de sonho, com brilho violeta. */
[data-phase="14"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(210, 170, 255);
  --mist-core: rgba(200, 150, 255, .75); --mist-edge: rgba(110, 70, 180, .5);
  --glow: rgba(200, 155, 255, .55); --glow-edge: rgba(150, 100, 220, .28);
  --haze-a: rgba(110, 70, 170, .4); --haze-b: rgba(200, 150, 255, .7);
}
/* XV País de Beulá: névoa rosa e dourada de pétalas. */
[data-phase="15"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 200, 215);
  --mist-core: rgba(255, 175, 205, .8); --mist-edge: rgba(230, 160, 90, .45);
  --glow: rgba(255, 190, 205, .55); --glow-edge: rgba(250, 200, 120, .25);
  --haze-a: rgba(210, 120, 150, .35); --haze-b: rgba(255, 185, 205, .7);
}
/* XVI Rio da Morte: névoa fria prata-azulada de rio. */
[data-phase="16"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(215, 232, 252);
  --mist-core: rgba(205, 225, 250, .8); --mist-edge: rgba(110, 140, 185, .55);
  --glow: rgba(195, 218, 248, .55); --glow-edge: rgba(140, 170, 210, .28);
  --haze-a: rgba(110, 140, 185, .45); --haze-b: rgba(200, 222, 250, .75);
}
/* XVII Cidade Celestial: nuvens douradas e radiantes. */
[data-phase="17"]:is(.hole, .hole-glow, .island) {
  --wisp: rgb(255, 232, 150);
  --mist-core: rgba(255, 230, 140, .9); --mist-edge: rgba(240, 190, 80, .5);
  --glow: rgba(255, 225, 130, .65); --glow-edge: rgba(255, 205, 100, .28);
  --haze-a: rgba(240, 190, 90, .3); --haze-b: rgba(255, 228, 140, .75);
}

.hole-shadow {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  animation: hole-shadow var(--bob, 7s) ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}

@keyframes hole-shadow {
  0%, 100% { transform: translate(calc(var(--sun-x) * 16px), calc(var(--sun-y) * 16px)) scale(1); }
  50% { transform: translate(calc(var(--sun-x) * 22px), calc(var(--sun-y) * 22px)) scale(.96); }
}

.falling-stone {
  position: absolute;
  will-change: transform, opacity;
}

/* ── Ilha suspensa: sobe e desce; leva o pergaminho com o nome e o medalhão com o número ── */
.island-hover { position: absolute; left: 0; top: 0; transition: transform .2s ease-out; }
.island-hover:has(.island:not(.island-locked) .island-art:is(:hover, :active)) { transform: scale(1.03); }
/* O nome mora na camada dos nomes (acima das aves); ao tocá-lo, só ele cresce e acende. */
.island-nome-hover { position: absolute; left: 0; top: 0; }
.island-nome:not(.island-locked) .island-scroll:is(:hover, :active, :focus-visible) { filter: brightness(1.12); }
.island-nome:not(.island-locked) .island-label:has(.island-scroll:is(:hover, :active)) { scale: 1.03; }
/* Os marcos ficam fora da ilha; só a ilha da fase atual ilumina suas bandeiras, mantendo o tremular. */
.map-world:has(:is(.island-current .island-art:is(:hover, :active), .island-nome.island-current .island-scroll:is(:hover, :active, :focus-visible))) #checkpointNodesContainer .checkpoint-node:is(.available, .completed) .marco-strip {
  filter: brightness(1.22) drop-shadow(0 0 2px rgba(246, 215, 122, .45));
}
.island-hover:has(.island-locked .island-art:active),
.island-nome-hover:has(.island-locked .island-scroll:active) { animation: island-nudge .25s ease-out; }
@keyframes island-nudge { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) {
  .island-hover { transition: none; }
  .island-nome-hover:has(.island-scroll:active) { animation: none; }
}
.island, .island-nome {
  position: absolute;
  left: 0;
  top: 0;
  animation: island-bob var(--bob, 7s) ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
  will-change: transform;
}

@keyframes island-bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, calc(-1 * var(--bob-amp, 6px)), 0); }
}

.island-art {
  pointer-events: auto;
  filter: drop-shadow(calc(var(--sun-x) * 22px) calc(var(--sun-y) * 22px) 16px rgba(0, 0, 0, calc(.35 * var(--sombra-forca, 1))));
}

.island-locked .island-art {
  filter: saturate(.35) brightness(.65) drop-shadow(calc(var(--sun-x) * 22px) calc(var(--sun-y) * 22px) 16px rgba(0, 0, 0, calc(.35 * var(--sombra-forca, 1))));
}

.island-locked {
  animation-play-state: paused;
}

/* A ponta de pedra embaixo da ilha some na névoa do tema da fase: a ilha flutua longe do fundo. */
.island-haze {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 46%, var(--haze-a) 78%, var(--haze-b) 100%);
  -webkit-mask-image: var(--island-mask);
  mask-image: var(--island-mask);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* A ilha bloqueada só aparece pelas beiradas; o recorte segue a arte e deixa o oceano contínuo. */
.island-veil {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, #17242d 0 28%, rgba(23, 36, 45, .88) 46%, transparent 76%);
  -webkit-mask-image: var(--island-mask);
  mask-image: var(--island-mask);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  opacity: 0;
}

.island-locked .island-veil {
  opacity: 1;
}

.phase-lock {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(calc(var(--sun-x) * 12px) calc(var(--sun-y) * 12px) 12px rgba(0, 0, 0, calc(.65 * var(--sombra-forca, 1))));
}

.phase-lock[hidden] { display: none; }
.phase-lock-shackle { clip-path: inset(0 0 53% 0); transform-origin: 26% 42%; }
.phase-lock-body { clip-path: inset(46% 0 0 0); }

.island-label {
  position: absolute;
  z-index: 3;
}

.island-scroll {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}

.island-scroll:focus-visible {
  outline: 3px solid #2a1808;
  box-shadow: 0 0 0 6px var(--gold-bright, #f6d77a);
  outline-offset: 0;
  border-radius: 10px;
}

.island-scroll-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.island-name {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-align: center;
  font-family: var(--font-heading, 'Cinzel', serif);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  white-space: normal;
  text-wrap: balance;
  color: #3a2616;
}

.island-medallion {
  position: absolute;
  pointer-events: none;
}

.island-medallion img {
  width: 100%;
  height: 100%;
}

.island-medallion span {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading, 'Cinzel', serif);
  font-weight: 700;
  font-size: 26px;
  color: #f6d77a;
  text-shadow: 0 0 3px #2a1808, 0 0 3px #2a1808, 0 1px 2px #2a1808;
}

/* ── Moldura de nuvens: tapa o fim do mar nos quatro lados ──
   A ponta da peça que encosta na anterior nasce transparente (--lead) e a outra esmaece um pouco (--tail): o corte reto
   da arte some dentro da vizinha. Nos cantos, as duas pontas cortadas da arte se dissolvem do mesmo jeito. */
.frame-cloud {
  transform: rotate(var(--rot, 0deg)) scaleX(var(--flip, 1));
  animation: frame-breathe 56s ease-in-out infinite alternate;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.frame-cloud.fade-left {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--lead), #000 calc(100% - var(--tail)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--lead), #000 calc(100% - var(--tail)), transparent 100%);
}

.frame-cloud.fade-right {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--lead), #000 calc(100% - var(--tail)), transparent 100%);
  mask-image: linear-gradient(to left, transparent 0, #000 var(--lead), #000 calc(100% - var(--tail)), transparent 100%);
}

.frame-cloud.frame-corner {
  -webkit-mask-image:
    linear-gradient(to left, transparent 0, #000 var(--corner-fade)),
    linear-gradient(to top, transparent 0, #000 var(--corner-fade));
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to left, transparent 0, #000 var(--corner-fade)),
    linear-gradient(to top, transparent 0, #000 var(--corner-fade));
  mask-composite: intersect;
}

/* Balanço lento ao longo do lado, sem mudar tamanho nem transparência (isso abria as emendas). */
@keyframes frame-breathe {
  from { transform: rotate(var(--rot, 0deg)) scaleX(var(--flip, 1)) translate3d(-14px, -3px, 0); }
  to { transform: rotate(var(--rot, 0deg)) scaleX(var(--flip, 1)) translate3d(14px, 3px, 0); }
}

/* ── Pausa: aba oculta e "reduzir movimento" param tudo que se mexe sozinho ── */
.paused,
.paused * {
  animation-play-state: paused !important;
}

/* ── Marcos dos checkpoints (T05): o botão é só o ponto do pé; as peças moram em .marco e a área de toque em ::before ── */
.checkpoint-node {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 48;
}

/* Área de toque: 44 px na tela em qualquer zoom (--touch vem do JS), centrada no corpo do marco. */
.checkpoint-node::before {
  content: '';
  position: absolute;
  left: 0;
  top: -26px;
  width: var(--touch, 46px);
  height: var(--touch, 46px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.checkpoint-node:focus-visible::before {
  outline: 3px solid #2a1808;
  box-shadow: 0 0 0 6px var(--gold-bright, #f6d77a);
}

.marco {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
}

.marco img {
  position: absolute;
  max-width: none;
}

/* Bloqueado: base com cadeado, sem bandeira. Disponível: bandeira tremulando e brilho. Concluído: bandeira parada e selo. */
.marco-lock, .marco-seal, .marco-mast, .marco-strip { display: none; }
.checkpoint-node.locked .marco-lock, .checkpoint-node.paywalled .marco-lock { display: block; }
.checkpoint-node.available .marco-mast, .checkpoint-node.available .marco-strip,
.checkpoint-node.completed .marco-mast, .checkpoint-node.completed .marco-strip { display: block; }
.checkpoint-node.completed .marco-seal { display: block; }
.checkpoint-node.locked .marco-base { filter: saturate(.55) brightness(.9); }
.checkpoint-node.paywalled .marco-base { filter: saturate(.35) brightness(.8); }

/* O pano muda de forma: cada faixa sobe e desce numa onda que corre do mastro para a ponta (1,1 Hz). */
@keyframes marco-wave {
  0%, 100% { transform: translateY(calc(var(--amp) * -1)); }
  50% { transform: translateY(var(--amp)); }
}
.checkpoint-node.available .marco-strip {
  animation: marco-wave .909s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* Brilho pulsando na base do checkpoint atual. */
@keyframes marco-glow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(246, 215, 122, .35)); }
  50% { filter: drop-shadow(0 0 9px rgba(246, 215, 122, .85)); }
}
.checkpoint-node.available .marco-base { animation: marco-glow 2.2s ease-in-out infinite; }

.paused .marco-strip, .paused .marco-base { animation-play-state: paused; }

/* ── Gente: um canvas por pessoa, preso ao mundo; nunca recebe clique ── */
.layer-gente canvas {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
}

/* ── Mar vivo: barcos, peixes, brilhos, farol, ilhotas e espuma; nada recebe clique ── */
.layer-mar img,
.layer-mar canvas,
.layer-mar div {
  position: absolute;
  pointer-events: none;
}

.layer-mar canvas,
.mar-fish,
.mar-splash,
.mar-spark {
  left: 0;
  top: 0;
}

.mar-foam {
  transform-origin: 50% 100%;
  animation: mar-foam-pulse 1.4s ease-in-out infinite;
}

@keyframes mar-foam-pulse {
  0%,
  100% { transform: scale(0.95); }
  50% { transform: scale(1.05); }
}

/* Farol: a lanterna pulsa a cada 4 s; o facho que gira é desenhado em js/mapa-mar-view.js. */
.mar-lantern {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 160, 0.95), rgba(255, 220, 120, 0) 70%);
  animation: mar-lantern-pulse 4s ease-in-out infinite;
}

@keyframes mar-lantern-pulse {
  0%,
  100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.layer-mar.paused .mar-foam,
.layer-mar.paused .mar-lantern {
  animation-play-state: paused;
}

/* ── Modo leve (celular e tablet; js/mapa.js põe .mapa-leve no <html>): o iPhone travava ao abrir o mapa ──
   Sombra desfocada de cada ilha e desfoque das sombras de nuvem custam uma cópia da imagem na GPU, em 3x no
   iPhone. No modo leve as ilhas ficam sem sombra; a bloqueada continua acinzentada e a ave mantém a sombra escura. */
.mapa-leve .island-art,
.mapa-leve .phase-lock { filter: none; }
.mapa-leve .island-locked .island-art { filter: saturate(.35) brightness(.65); }
.mapa-leve .ceu-sombra { filter: brightness(0); }
.mapa-leve .passing-cloud-shadow { display: none; }
