/* Missão Depósito — mapa infantil, pensado para celular */

:root {
    --sol: #FFD23F;
    --laranja: #FF8C42;
    --rosa: #FF5D8F;
    --rosa-esc: #D63B6D;
    --roxo: #7B5CFF;
    --roxo-esc: #5A3ED9;
    --ceu: #4CC9F0;
    --tinta: #2B2D42;
    --tinta-suave: #6B6D80;
    --papel: #FFFDF5;
    --trilho: #E8E4D8;
    --sombra: 0 6px 0 rgba(43, 45, 66, .16), 0 12px 24px rgba(43, 45, 66, .18);
    --fonte: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
    --topo: calc(env(safe-area-inset-top) + 10px);
    --base: calc(env(safe-area-inset-bottom) + 12px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--ceu);
    color: var(--tinta);
    font-family: var(--fonte);
    -webkit-user-select: none;
    user-select: none;
}

button {
    font-family: inherit;
    color: inherit;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
}

#mapa { position: fixed; inset: 0; z-index: 0; background: #CFEFFC; }

/* ---------- Topo ---------- */
.topo {
    position: fixed;
    top: var(--topo);
    left: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}
.topo > * { pointer-events: auto; }

.titulo {
    background: var(--sol);
    border: 4px solid #fff;
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: var(--sombra);
}

.btn-redondo {
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #fff;
    font-size: 26px;
    box-shadow: var(--sombra);
}
.btn-redondo:active { transform: translateY(3px); }

/* Créditos do mapa ficam embaixo do botão de som (o rodapé fica coberto pelos cartões) */
.leaflet-top.leaflet-right { top: calc(var(--topo) + 62px); }
.leaflet-control-attribution { font-size: 10px; border-radius: 8px 0 0 8px; }

/* ---------- Aviso flutuante ---------- */
.aviso {
    position: fixed;
    top: calc(var(--topo) + 66px);
    left: 50%;
    z-index: 1001;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--tinta);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--sombra);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity .25s, transform .25s;
}
.aviso.mostrar { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Cartão inicial ---------- */
.cartao {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: var(--base);
    z-index: 1000;
    max-width: 520px;
    margin: 0 auto;
    padding: 18px 18px 12px;
    background: var(--papel);
    border: 5px solid #fff;
    border-radius: 32px;
    box-shadow: var(--sombra);
}

.trajeto { display: flex; align-items: flex-start; gap: 6px; }

.ponto {
    flex: none;
    width: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 17px;
    font-weight: 600;
}
.ponto .emoji {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 5px solid var(--sol);
    font-size: 36px;
}
.ponto.destino .emoji { border-color: var(--rosa); }

.caminho {
    flex: 1;
    height: 66px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle, var(--roxo) 3.5px, transparent 4px) center / 16px 16px repeat-x;
}

.carrinho {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--roxo);
    font-size: 26px;
    animation: vrum 1.6s ease-in-out infinite;
}

.info {
    margin: 12px 0 16px;
    min-height: 1.3em;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

.btn-grande {
    display: block;
    width: 100%;
    padding: 18px 12px;
    border-radius: 22px;
    background: var(--rosa);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .5px;
    box-shadow: 0 8px 0 var(--rosa-esc);
    transition: transform .08s, box-shadow .08s;
}
.btn-grande:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--rosa-esc); }
.so-inicio .btn-grande { animation: chamando 2.4s ease-in-out infinite; }

.link {
    display: block;
    margin: 12px auto 2px;
    padding: 6px 10px;
    background: none;
    color: var(--roxo-esc);
    font-size: 15px;
    font-weight: 500;
    text-decoration: underline;
}

/* ---------- Seta grande (lado direito) ---------- */
.seta {
    position: fixed;
    right: calc(env(safe-area-inset-right) + 10px);
    top: 50%;
    z-index: 1000;
    width: clamp(132px, 38vw, 210px);
    padding: 12px 10px 14px;
    background: #fff;
    border: 6px solid var(--sol);
    border-radius: 32px;
    text-align: center;
    box-shadow: var(--sombra);
    transform: translateY(-50%);
    transition: background-color .3s, border-color .3s;
}
.seta.agora { background: #FFF0F5; border-color: var(--rosa); }

.seta-icone { display: grid; place-items: center; width: 100%; aspect-ratio: 1; }
.seta.agora .seta-icone { animation: pulo .8s ease-in-out infinite; }

.seta-icone svg {
    width: 94%;
    height: 94%;
    filter: drop-shadow(0 5px 0 rgba(43, 45, 66, .18));
    transition: transform .6s cubic-bezier(.34, 1.56, .64, 1);
}
.seta-emoji { font-size: clamp(64px, 22vw, 120px); line-height: 1; }
.seta[data-modo="emoji"] svg,
.seta[data-modo="seta"] .seta-emoji { display: none; }

.seta-dist { margin-top: 4px; font-size: clamp(28px, 8.5vw, 42px); font-weight: 700; line-height: 1; }
.seta-dist:empty { display: none; }
.seta-txt {
    margin-top: 6px;
    font-size: clamp(16px, 4.8vw, 23px);
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
}
.seta.agora .seta-txt { color: var(--rosa-esc); }
.seta-depois { margin-top: 6px; font-size: 14px; line-height: 1.2; color: var(--tinta-suave); }
.seta-depois:empty { display: none; }

/* ---------- Barra inferior ---------- */
.barra {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: var(--base);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.progresso {
    flex: 1;
    min-width: 0;
    padding: 10px 14px 8px;
    background: var(--papel);
    border: 4px solid #fff;
    border-radius: 24px;
    box-shadow: var(--sombra);
}

.pista {
    position: relative;
    height: 14px;
    margin: 22px 24px 8px;
    background: var(--trilho);
    border-radius: 999px;
}
.pista-cheia {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sol), var(--rosa));
    transition: width .6s;
}
.marco { position: absolute; top: 50%; font-size: 26px; transform: translate(-50%, -50%); }
.marco.ini { left: -10px; }
.marco.fim { left: calc(100% + 10px); }
.corredor {
    position: absolute;
    top: 50%;
    left: 0%;
    font-size: 30px;
    transform: translate(-50%, -78%) scaleX(-1); /* carrinho virado para a direita, rumo ao destino */
    transition: left .6s;
}
.faltam { font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.acoes { display: flex; gap: 10px; }
.btn-acao {
    width: 62px;
    border-radius: 22px;
    background: #fff;
    font-size: 28px;
    box-shadow: var(--sombra);
}
.btn-acao:active { transform: translateY(3px); }
#btnCentralizar { background: var(--sol); }

/* ---------- Estados da tela ---------- */
body:not([data-estado="nav"]) .so-nav { display: none !important; }
body:not([data-estado="inicio"]) .so-inicio { display: none !important; }

/* ---------- Pinos no mapa ---------- */
.pino {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 5px solid var(--sol);
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
}
.pino.rosa { border-color: var(--rosa); }
.pino-nome {
    position: absolute;
    top: 58px;
    left: 50%;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--tinta);
    color: #fff;
    font: 600 14px var(--fonte);
    white-space: nowrap;
    transform: translateX(-50%);
}

.eu { position: relative; width: 60px; height: 60px; display: grid; place-items: center; }
.eu::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(123, 92, 255, .4);
    animation: onda 1.6s ease-out infinite;
}
.eu span {
    position: relative;
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--roxo);
    font-size: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}

/* ---------- Chegada ---------- */
.festa {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(76, 201, 240, .82);
}
.festa-card {
    width: 100%;
    max-width: 420px;
    padding: 26px 22px 14px;
    background: var(--papel);
    border: 6px solid #fff;
    border-radius: 36px;
    text-align: center;
    box-shadow: var(--sombra);
    animation: entra .6s cubic-bezier(.34, 1.56, .64, 1);
}
.trofeu { font-size: 96px; line-height: 1; animation: pulo 1s ease-in-out infinite; }
.festa h2 { margin: 10px 0 4px; font-size: 46px; color: var(--rosa); letter-spacing: 1px; }
.festa-texto { margin: 0 0 20px; font-size: 21px; font-weight: 500; }

.confete {
    position: fixed;
    top: -60px;
    z-index: 2001;
    pointer-events: none;
    animation: cair linear forwards;
}

/* ---------- Animações ---------- */
@keyframes pulo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes chamando { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-2deg); } 94% { transform: rotate(2deg); } }
@keyframes vrum { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
@keyframes onda { from { transform: scale(.8); opacity: 1; } to { transform: scale(2.1); opacity: 0; } }
@keyframes entra { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes cair { to { transform: translateY(calc(100vh + 120px)) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before { animation: none !important; transition: none !important; }
}

/* Celular deitado: seta menor e barra só do lado esquerdo */
@media (orientation: landscape) and (max-height: 540px) {
    .seta { width: clamp(120px, 24vw, 180px); padding: 8px 8px 10px; }
    .seta-icone { width: 72%; margin: 0 auto; }
    .barra { right: auto; width: min(58vw, 520px); }
    .cartao { left: 12px; right: auto; width: min(460px, 60vw); margin: 0; padding: 12px 14px 8px; }
    .info { margin: 8px 0 10px; }
    .btn-grande { padding: 12px; font-size: 24px; }
}
