/* Gatlas: o mapa ilustrado da cidade deitado numa mesa em 3D, com as eras e os contos de cada lugar. */

/* a página é só o mapa: sem rodapé e sem rolagem */
body.pagina-mundo { overflow: hidden; }

.mundo {
    position: relative;
    height: 640px; /* o mundo.js ajusta pra ocupar a tela entre o topo e o menu de baixo */
    min-height: 420px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(255, 214, 153, 0.55), transparent 65%),
        var(--cor-hero-grad);
    transition: background 0.6s ease;
    user-select: none;
    -webkit-user-select: none;
}
.mundo[data-era="eclipse"] {
    background: radial-gradient(ellipse at 50% 40%, #3b3470 0%, #1f1a3d 55%, #120f26 100%);
}
.mundo[data-era="bugingangas"] {
    background: radial-gradient(ellipse at 50% 40%, #f3d7a3 0%, #d9b077 55%, #b88a52 100%);
}

/* ---------- expansões: uma fileira de cartões com o logo de cada coleção ---------- */
.mundo-eras {
    position: absolute; z-index: 5; left: 50%; bottom: calc(var(--nav-livre, 0px) + 10px); transform: translateX(-50%);
    display: flex; gap: 8px; padding: 8px;
    max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none;
    background: var(--cor-surface-soft); border: 1px solid var(--cor-borda);
    border-radius: 22px; box-shadow: 0 16px 40px rgba(62, 39, 35, 0.22), 0 4px 12px rgba(62, 39, 35, 0.12);
    transition: bottom 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.mundo-eras::-webkit-scrollbar { display: none; }
.mundo-era {
    position: relative; flex-shrink: 0; width: 158px; height: 84px; padding: 0; overflow: hidden;
    display: grid; place-items: center; cursor: pointer;
    border: 2px solid var(--cor-borda); border-radius: 16px;
    background: var(--cor-card-bg);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.mundo-era:hover { transform: translateY(-2px); border-color: var(--cor-topo); }
.mundo-era:active { transform: scale(0.97); }
.mundo-era-selo {
    position: relative; display: block; max-width: 86%; max-height: 66px; width: auto; height: auto;
    filter: drop-shadow(0 2px 3px rgba(62, 39, 35, 0.35)); opacity: 0.9;
    transition: transform 0.2s, opacity 0.2s, filter 0.2s;
}
.mundo-era.ativa { background: var(--cor-hero-grad); border-color: var(--cor-topo); box-shadow: 0 0 0 2px rgba(242, 148, 0, 0.35), 0 8px 20px rgba(242, 148, 0, 0.35); transform: translateY(-3px); }
.mundo-era.ativa .mundo-era-selo { opacity: 1; filter: drop-shadow(0 3px 5px rgba(62, 39, 35, 0.45)); transform: scale(1.06); }
.mundo-era.bloqueada .mundo-era-selo { filter: grayscale(0.85) drop-shadow(0 2px 3px rgba(62, 39, 35, 0.3)); opacity: 0.6; }
.mundo-era-cadeado {
    position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 24px; height: 24px;
    border-radius: 50%; background: var(--cor-fundo); border: 1px solid var(--cor-borda); font-size: 0.72rem;
}

/* ---------- a mesa (WebGL) e a camada de cima ---------- */
.mundo-palco { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.mundo-palco.arrastando { cursor: grabbing; }
.mundo-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Tudo que fica "em pé" (Cristal, cacos, nuvens, pinos) é desenhado aqui, plano, na posição que o mundo.js
   calcula a cada quadro: nunca encosta no papel, então nada some nem corta. */
.mundo-sobre { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mundo-sobre > * { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; will-change: transform; }

/* ---------- o Cristal ---------- */
.cristal { width: 100px; height: 100px; opacity: 0; visibility: hidden; transition: opacity 0.5s, visibility 0s linear 0.5s; }
.cristal.ativa { opacity: 1; visibility: visible; transition: opacity 0.5s; }
.cristal img { position: relative; width: 100%; height: 100%; display: block; }
.cristal-brilho {
    position: absolute; inset: -70%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 246, 200, 0.95) 0%, rgba(150, 230, 255, 0.55) 30%, rgba(150, 230, 255, 0) 65%);
    animation: mundo-pulsa 2.4s ease-in-out infinite;
}
.cristal-corpo { position: absolute; inset: 0; animation: mundo-flutua 3s ease-in-out infinite; }
@keyframes mundo-pulsa { 0%, 100% { transform: scale(0.75); opacity: 0.6; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes mundo-flutua { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14%); } }
/* no Eclipse ele sofre: verde, tremendo e piscando */
.cristal--eclipse img { filter: hue-rotate(95deg) saturate(1.6) brightness(1.1); }
.cristal--eclipse .cristal-brilho {
    background: radial-gradient(circle, rgba(200, 255, 200, 0.95) 0%, rgba(80, 255, 140, 0.6) 30%, rgba(80, 255, 140, 0) 65%);
    animation: mundo-pisca 1.7s steps(1) infinite;
}
.cristal--eclipse .cristal-corpo { animation: mundo-treme 0.9s linear infinite; }
@keyframes mundo-treme {
    0% { transform: translate(0, 0) rotate(0); } 8% { transform: translate(-6%, 2%) rotate(-4deg); } 16% { transform: translate(5%, -3%) rotate(3deg); }
    24% { transform: translate(0, 0) rotate(0); } 52% { transform: translate(0, -4%) rotate(0); } 58% { transform: translate(7%, 1%) rotate(5deg); }
    64% { transform: translate(-5%, -2%) rotate(-6deg); } 70% { transform: translate(2%, 2%) rotate(2deg); } 100% { transform: translate(0, 0) rotate(0); }
}
@keyframes mundo-pisca { 0% { opacity: 1; transform: scale(1); } 20% { opacity: 0.35; transform: scale(0.8); } 27% { opacity: 1; transform: scale(1.25); } 55% { opacity: 0.7; transform: scale(0.95); } 61% { opacity: 0.2; transform: scale(0.7); } 66% { opacity: 1; transform: scale(1.1); } }
/* em Bugingangas sobram os cacos, espalhados pela cidade */
.caco { width: 100px; height: 100px; opacity: 0; visibility: hidden; transition: opacity 0.6s, visibility 0s linear 0.6s; }
.caco.ativa { opacity: 1; visibility: visible; transition: opacity 0.6s; transition-delay: var(--atraso, 0s); }
.caco .cristal-brilho { inset: -75%; animation-duration: 1.9s; animation-delay: var(--atraso, 0s); background: radial-gradient(circle, rgba(255, 250, 215, 0.95) 0%, rgba(255, 210, 120, 0.5) 32%, rgba(255, 210, 120, 0) 66%); }
.caco img { position: relative; width: 100%; height: 100%; display: block; }

/* ---------- passagens pros próximos mapas ---------- */
.mundo-sobre .mundo-portal {
    display: inline-flex; align-items: center; gap: 8px; pointer-events: auto; cursor: pointer;
    padding: 8px 16px 8px 8px; border-radius: 999px; white-space: nowrap;
    background: var(--cor-card-bg); color: var(--cor-texto-escuro);
    border: 2.5px solid var(--cor-topo); box-shadow: 0 8px 22px rgba(62, 39, 35, 0.35);
    font: 900 0.9rem 'Nunito', sans-serif;
}
.mundo-sobre .mundo-portal[hidden] { display: none; }
.mundo-portal::after {
    content: ''; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px;
    background: var(--cor-card-bg); border-right: 2.5px solid var(--cor-topo); border-bottom: 2.5px solid var(--cor-topo);
    transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0;
}
.mundo-portal-icone {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--cor-hero-grad); font-size: 1.05rem;
    animation: mundo-portal 2.2s ease-in-out infinite;
}
@keyframes mundo-portal { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(242, 148, 0, 0.5); } 50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(242, 148, 0, 0); } }
.mundo[data-era="eclipse"] .mundo-portal { border-color: #8be0a8; }
.mundo[data-era="eclipse"] .mundo-portal::after { border-color: #8be0a8; }

/* ---------- nuvens ---------- */
.nuvem-sombra {
    width: 200px; height: 60px; border-radius: 50%; transform-origin: 50% 50%;
    background: radial-gradient(ellipse, rgba(40, 30, 20, 0.22), rgba(40, 30, 20, 0) 70%);
}
.nuvem-corpo { width: 200px; height: 100px; }
.nuvem-corpo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.nuvem-corpo .linha { fill: var(--nuvem-linha, #5a4636); }
.nuvem-corpo .sombra { fill: var(--nuvem-sombra, #d6e4f1); }
.nuvem-corpo .luz { fill: var(--nuvem-luz, #fffdf6); }
.mundo[data-era="eclipse"] { --nuvem-linha: #1b1730; --nuvem-sombra: #3f3866; --nuvem-luz: #605890; }
.mundo[data-era="bugingangas"] { --nuvem-linha: #6b4a2a; --nuvem-sombra: #d7b37f; --nuvem-luz: #f3e0bb; }

/* ---------- transições de era ---------- */
.mundo-fx { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.mundo-fx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.mundo-fx .voo { position: absolute; left: 0; top: 0; will-change: transform; }
.mundo-fx .voo img { width: 100%; height: 100%; display: block; }
.mundo-fx .clarao { position: absolute; inset: 0; background: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), #fff 0%, rgba(255, 250, 220, 0.9) 25%, rgba(255, 240, 200, 0) 70%); opacity: 0; }
.mundo.em-transicao .mundo-eras { pointer-events: none; }

/* ---------- lugares ---------- */
/* área de toque: um círculo achatado deitado no papel, que brilha quando passa o mouse */
.mundo-sobre .lugar-area {
    width: 100px; height: 100px; transform-origin: 50% 50%;
    border: 0; padding: 0; border-radius: 50%; cursor: pointer; pointer-events: auto;
    background: radial-gradient(circle, rgba(255, 214, 120, 0.55), rgba(255, 180, 60, 0) 70%);
    opacity: 0; transition: opacity 0.25s;
}
.mundo-sobre .lugar-area:hover, .mundo-sobre .lugar-area.foco { opacity: 1; }
.mundo-sobre .lugar-area:focus-visible { opacity: 1; outline: 3px solid var(--cor-topo); }
.mundo-sobre .lugar-area[hidden], .mundo-sobre .lugar-pino[hidden] { display: none; }
/* marcador em pé: conta quantos contos tem no lugar */
.lugar-pino { pointer-events: none; }
.lugar-pino span {
    display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
    border-radius: 999px; background: var(--cor-topo); color: #fff;
    font: 900 0.85rem 'Nunito', sans-serif;
    border: 2.5px solid #fff; box-shadow: 0 6px 14px rgba(62, 39, 35, 0.35);
    animation: mundo-pino 2.6s ease-in-out infinite;
    animation-delay: var(--atraso, 0s);
}
.lugar-pino span::after {
    content: ''; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px;
    background: var(--cor-topo); border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
    transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0;
}
@keyframes mundo-pino { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- zoom, dica e aviso ---------- */
.mundo-dica {
    position: absolute; z-index: 4; left: 50%; bottom: calc(var(--nav-livre, 0px) + 116px); transform: translateX(-50%);
    margin: 0; padding: 7px 14px; border-radius: 999px;
    background: rgba(62, 39, 35, 0.78); color: #fff; font-weight: 800; font-size: 0.82rem; white-space: nowrap;
    pointer-events: none; transition: opacity 0.5s;
}
.mundo-dica.some { opacity: 0; }
.mundo-aviso {
    position: absolute; z-index: 6; left: 50%; top: 84px; transform: translateX(-50%);
    padding: 10px 16px; border-radius: 14px; background: var(--cor-texto-escuro); color: var(--cor-fundo);
    font-weight: 800; font-size: 0.9rem; box-shadow: var(--sombra-card); white-space: nowrap;
}

/* ---------- painel do lugar ---------- */
.mundo-painel-fundo { position: fixed; inset: 0; z-index: 1000; background: rgba(30, 18, 10, 0.35); }
.mundo-painel {
    position: fixed; z-index: 1001; left: 50%; bottom: 0;
    width: min(560px, 100%); max-height: 78vh; overflow-y: auto;
    transform: translate(-50%, 105%); transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.05);
    background: var(--cor-surface-panel); color: var(--cor-texto-escuro);
    border: 1px solid var(--cor-borda); border-bottom: 0;
    border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(62, 39, 35, 0.25);
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
}
.mundo-painel.aberto { transform: translate(-50%, 0); }
.mundo-painel-alca { width: 44px; height: 5px; border-radius: 3px; background: var(--cor-borda); margin: 0 auto 12px; }
.mundo-painel-fechar { position: absolute; top: 12px; right: 14px; }
.mundo-painel-topo { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.mundo-painel-icone {
    display: grid; place-items: center; flex-shrink: 0; width: 52px; height: 52px; border-radius: 16px;
    background: var(--cor-hero-grad); border: 1px solid var(--cor-borda); font-size: 1.7rem;
}
.mundo-painel-era { font-size: 0.75rem; font-weight: 800; color: var(--cor-topo); }
.mundo-painel h2 { margin: 1px 0 0; font-size: 1.35rem; font-weight: 900; }
.mundo-painel-desc { margin: 12px 0 6px; color: var(--cor-texto-claro); font-weight: 600; line-height: 1.5; }
.mundo-secao { margin: 18px 0 8px; font-size: 0.82rem; font-weight: 900; color: var(--cor-texto-claro); text-transform: uppercase; letter-spacing: 0.04em; }
.mundo-conto {
    display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 8px;
    background: var(--cor-card-bg); border: 1px solid var(--cor-borda); border-radius: 16px;
    color: inherit; text-decoration: none; box-shadow: var(--sombra-suave);
    transition: transform 0.15s, border-color 0.15s;
}
.mundo-conto:hover { border-color: var(--cor-topo); transform: translateY(-1px); }
.mundo-conto-capa {
    width: 56px; height: 56px; flex-shrink: 0; border-radius: 12px;
    background: var(--cor-image-wrap-bg) center / cover no-repeat;
    display: grid; place-items: center; font-size: 1.5rem;
}
.mundo-conto-info { flex: 1; min-width: 0; }
.mundo-conto-info strong { display: block; font-weight: 900; font-size: 0.98rem; }
.mundo-conto-info span { display: block; font-size: 0.8rem; font-weight: 700; color: var(--cor-texto-claro); margin-top: 2px; }
.mundo-conto-ler {
    flex-shrink: 0; padding: 8px 14px; border-radius: 999px;
    background: var(--cor-topo); color: #fff; font-weight: 900; font-size: 0.85rem;
}
.mundo-conto.outra-era { opacity: 0.85; }
.mundo-conto.outra-era .mundo-conto-ler { background: var(--cor-borda); color: var(--cor-texto-escuro); }
.mundo-vazio { margin: 16px 0 4px; padding: 16px; text-align: center; border-radius: 16px; background: var(--cor-card-bg); border: 1px dashed var(--cor-borda); color: var(--cor-texto-claro); font-weight: 700; }

@media (max-width: 640px) {
    .mundo-eras { bottom: calc(var(--nav-livre, 0px) + 8px); gap: 6px; padding: 6px; border-radius: 18px; }
    .mundo-era { width: calc((100vw - 20px - 12px - 18px - 4px) / 4); height: 62px; border-radius: 12px; }
    .mundo-era-selo { max-height: 48px; max-width: 90%; }
    .mundo-era-cadeado { width: 20px; height: 20px; right: 4px; top: 4px; font-size: 0.62rem; }
    .mundo-dica { bottom: calc(var(--nav-livre, 0px) + 86px); font-size: 0.76rem; }
}
@media (prefers-reduced-motion: reduce) {
    .lugar-pino span, .cristal-corpo, .cristal-brilho, .mundo-portal-icone { animation: none; }
}

/* conto principal em destaque, os que só passam pelo lugar em menção pequena */
.mundo-conto { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.mundo-conto--destaque { padding: 12px; border: 2px solid var(--cor-topo); box-shadow: var(--sombra-card); }
.mundo-conto--destaque .mundo-conto-capa { width: 72px; height: 72px; }
.mundo-conto--destaque .mundo-conto-info strong { font-size: 1.08rem; }
.mundo-mencoes { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--cor-borda); }
.mundo-mencoes-titulo { margin: 0 0 6px; font-size: 0.78rem; font-weight: 800; color: var(--cor-texto-claro); }
.mundo-mencao {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; padding: 5px 10px;
    border: 1px solid var(--cor-borda); border-radius: 999px; background: var(--cor-card-bg);
    color: var(--cor-texto-escuro); font: 700 0.8rem 'Nunito', sans-serif; cursor: pointer;
}
.mundo-mencao:hover { border-color: var(--cor-topo); color: var(--cor-topo); }
.mundo-mencao span { color: var(--cor-texto-claro); font-weight: 700; }
