/* Prévia da fase no mapa da história. Posição e tamanho vêm de phase-preview.mjs (--pp-*), medidos no próprio mapa:
   no desktop fica acima e à esquerda do nó selecionado, sem tocar o caminho; no celular deitado vira uma faixa no topo. */
#stage .phase-preview{--pp-pad:5px;position:absolute;left:var(--pp-left,3%);top:var(--pp-top,22%);width:min(var(--pp-width,40%),var(--pp-max-width,560px));height:auto;max-height:var(--pp-height,none);z-index:11;box-sizing:border-box;display:grid;grid-template-columns:clamp(104px,min(30%,calc((var(--pp-height,96px) - 16px) * 16 / 9)),var(--pp-thumb-max,200px)) minmax(0,1fr);align-items:center;gap:9px;margin:0;padding:var(--pp-pad);overflow:hidden;text-align:left;color:#eaf3ee;background:#0d1726f0;border:3px solid var(--episode-accent,#f1cc70);box-shadow:4px 4px #061120;pointer-events:auto}
#overlay:has(.resources-intro) .phase-preview{display:none}
#stage .phase-preview.is-locked{border-color:#8296a5;background:#121c2bf2}
#stage .phase-preview.pp-enter{animation:pp-enter .18s ease-out}
@keyframes pp-enter{from{opacity:.55;translate:0 4px}}
#stage .pp-thumb{position:relative;display:block;width:auto;aspect-ratio:16/9;align-self:center;min-height:0;background-color:#1c2a44;background-repeat:no-repeat;background-size:cover;image-rendering:pixelated;border:2px solid #f6ecc8;box-shadow:inset 0 0 0 1px #061120}
#stage .phase-preview.is-locked .pp-thumb{filter:grayscale(.75) brightness(.7)}
#stage .pp-thumb>b{position:absolute;left:-2px;bottom:-2px;display:flex;align-items:baseline;gap:4px;padding:2px 4px;background:#10182a;color:#ffe598;font:9px/1 'Brasil Arcade',monospace;font-weight:400}
#stage .pp-thumb>b>small{font:13px/.8 VT323,monospace;color:#b8cbd8}
#stage .pp-thumb>.pp-icon{position:absolute;right:3px;top:3px;width:18px;height:18px}
#stage .pp-icon{width:14px;height:14px;flex:none;image-rendering:pixelated}
#stage .pp-body{display:flex;flex-direction:column;justify-content:center;align-self:center;gap:2px;min-width:0;min-height:0}
#stage .pp-body>*{margin:0;min-width:0}
#stage .pp-kicker{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
#stage .phase-preview[data-layout=roomy] .pp-kicker{position:static;width:auto;height:auto;clip:auto;overflow:visible;white-space:normal;padding-right:20px;font:8px/1.3 'Brasil Arcade',monospace;color:#ffe598}
/* V470 · O título quebra em até duas linhas em vez de cortar com reticências. */
#stage .phase-preview h3{padding-right:20px;font:9px/1.45 'Brasil Arcade',monospace;color:#fff9dc;text-shadow:2px 2px #080f20;white-space:normal;text-wrap:balance;overflow-wrap:break-word}
#stage .phase-preview[data-layout=roomy] h3{font-size:11px}
#stage .pp-goal{font:16px/1 VT323,monospace;color:#cfdbe4;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;text-wrap:pretty}
#stage .phase-preview[data-layout=roomy] .pp-goal{font-size:18px}
#stage .pp-lock{display:none}
#stage .pp-markers{display:flex;flex-wrap:nowrap;gap:3px;padding:0;list-style:none;overflow:hidden}
#stage .pp-marker{display:inline-flex;align-items:center;gap:3px;flex:0 1 auto;min-width:0;padding:1px 4px 1px 2px;border:1px solid #4d6478;background:#16243a;font:14px/1 VT323,monospace;color:#e8eef2;white-space:nowrap}
#stage .pp-marker-short{overflow:hidden;text-overflow:ellipsis}
/* Chefe, tempo e perseguição ficam só com ícone; o texto completo segue no title (dica ao passar o mouse) e para leitores de tela. */
#stage .phase-preview :is(.pp-m-boss,.pp-m-timer,.pp-m-car){flex:none;padding:1px 2px}
#stage .phase-preview :is(.pp-m-boss,.pp-m-timer,.pp-m-car) .pp-marker-short{display:none}
#stage .pp-marker.pp-m-done{border-color:#7fe08a;color:#c9f5cf}
#stage .pp-marker.pp-m-locked{border-color:#e9c46a;color:#f6e2a8;flex-shrink:0}
#stage .pp-marker.pp-m-boss{border-color:#e14b35}
#stage .pp-marker.pp-m-boss.is-optional{border-style:dashed}
#stage .pp-marker.pp-m-boss.is-beaten{border-color:#7fe08a}
#stage .pp-marker.pp-m-timer{border-color:#6ec0e8}
#stage .pp-marker.pp-m-car{border-color:#f6c64a}
#stage .pp-marker.pp-m-goal{border-color:#3fa65f}
#stage .pp-stats{display:none;gap:10px;font:15px/1 VT323,monospace}
#stage .phase-preview[data-layout=roomy] .pp-stats{display:flex}
#stage .pp-stats>div{display:flex;gap:6px}
#stage .pp-stats dt{color:#b8cbd8}
#stage .pp-stats dd{margin:0;color:#ffe598}
#stage .pp-close{position:absolute;top:0;right:0;width:24px;height:24px;min-width:0;min-height:0;padding:0;border:0;border-left:2px solid #34495c;border-bottom:2px solid #34495c;background:#16243a;color:#eaf3ee;font:12px/1 'Brasil Arcade',monospace;cursor:pointer}
#stage .pp-close:hover{background:#24364e}
#stage .pp-close:focus-visible{outline:3px solid #fff3b9;outline-offset:-3px}

/* Fases bloqueadas continuam focáveis para mostrar a prévia; o visual segue o das fases desativadas. */
#stage .campaign-map-node[aria-disabled=true] .campaign-node-disc{background:#455767;color:#c1cbd3;border-color:#8296a5;box-shadow:3px 5px #203442;opacity:.85}
#stage #overlay .history-journey-route .campaign-map-node[aria-disabled=true]{opacity:1;filter:none;cursor:help}
#stage .history-journey-route .campaign-map-node[aria-disabled=true] .campaign-node-label{background:#172539f5;color:#becbd5}
#stage .history-journey-route .campaign-map-node[aria-disabled=true] .campaign-node-disc{opacity:.65}
#stage .history-journey-route .campaign-map-node.is-previewed .campaign-node-disc{opacity:1;outline:3px dashed #f0d48a;outline-offset:4px}
#stage .history-journey-route .campaign-map-node.is-previewed .campaign-node-label{color:#f0d48a}

/* Celular deitado: faixa no topo, entre o menu e os botões de tela cheia e voltar. V470 · Miniatura pequena, título numa linha na largura toda
   e o resumo em duas linhas ao lado dos ícones; a altura (--pp-height) vem do espaço livre acima da cabeça do personagem. */
@media (orientation:landscape) and (max-height:600px) and (pointer:coarse){
 #stage .phase-preview[data-layout=strip]{--pp-pad:3px;gap:7px;padding-right:34px;border-width:2px;box-shadow:3px 3px #061120;width:var(--pp-width,400px);height:var(--pp-height,46px);max-height:none;grid-template-columns:auto minmax(0,1fr);align-items:stretch}
 #stage .phase-preview[data-layout=strip] .pp-thumb{width:min(calc((var(--pp-height,46px) - 10px) * 16 / 9),calc(var(--pp-width,400px) * .2));align-self:stretch;aspect-ratio:auto;border-width:1px}
 #stage .phase-preview[data-layout=strip] .pp-thumb>b{font-size:7px;padding:1px 2px}
 #stage .phase-preview[data-layout=strip] .pp-thumb>b>small{display:none}
 #stage .phase-preview[data-layout=strip] .pp-thumb>.pp-icon{width:12px;height:12px;right:2px;top:2px}
 #stage .phase-preview[data-layout=strip] .pp-body{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"title title" "goal markers";align-content:center;align-self:stretch;column-gap:6px;row-gap:2px}
 #stage .phase-preview[data-layout=strip] h3{grid-area:title;padding-right:0;font-size:8px;line-height:1.25;text-wrap:nowrap}
 #stage .phase-preview[data-layout=strip] .pp-goal{grid-area:goal;font:13px/1 VT323,monospace;display:-webkit-box}
 #stage .phase-preview[data-layout=strip][data-lines="1"] .pp-goal{-webkit-line-clamp:1;line-clamp:1}
 #stage .phase-preview[data-layout=strip] .pp-lock{grid-area:goal;font:13px/1 VT323,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:4px;color:#f6e2a8}
 #stage .phase-preview[data-layout=strip].is-locked .pp-goal{display:none}
 #stage .phase-preview[data-layout=strip] .pp-lock>span{overflow:hidden;text-overflow:ellipsis}
 #stage .phase-preview[data-layout=strip] .pp-markers{grid-area:markers;align-self:center;gap:3px}
 #stage .phase-preview[data-layout=strip] .pp-marker{padding:2px}
 #stage .phase-preview[data-layout=strip] .pp-marker-short,#stage .phase-preview[data-layout=strip] .pp-stats{display:none}
 #stage .phase-preview[data-layout=strip] .pp-close{width:30px;height:100%;border-bottom:0;font-size:12px}
}
@media (prefers-reduced-motion:reduce){#stage .phase-preview.pp-enter{animation:none}}
/* V665 · As frases do modo quebram linha no cartão; Mandato não acrescenta conteúdo. */
#stage .pp-mode{font:13px/1 VT323,monospace;color:#d6e8c9}
#stage .pp-mode h4{margin:0;font:inherit;color:#ffe598;white-space:normal;overflow:visible}
#stage .pp-mode ul{margin:0;padding:0;list-style:none}
#stage .pp-mode li{display:inline}
#stage .pp-mode li+li::before{content:' · '}
/* A faixa mantém a altura medida entre o menu, o personagem e os botões. */
@media (orientation:landscape) and (max-height:600px) and (pointer:coarse){
 #stage .phase-preview[data-layout=strip] .pp-mode{grid-area:mode;display:block;font:13px/1.15 VT323,monospace;white-space:normal;overflow:visible}
 #stage .phase-preview[data-layout=strip] .pp-mode h4,#stage .phase-preview[data-layout=strip] .pp-mode ul,#stage .phase-preview[data-layout=strip] .pp-mode li{display:inline;overflow:visible;white-space:normal}
 #stage .phase-preview[data-layout=strip] .pp-mode h4::after{content:' · '}
 #stage .phase-preview[data-layout=strip] .pp-mode-heading{display:none}
}
@media (orientation:landscape) and (max-height:600px) and (pointer:coarse){
 /* 36 px de faixa deixam 26 px úteis: três linhas de 8 px e dois intervalos. Cabe só a primeira frase; as duas seguem no anúncio. */
 #stage .phase-preview[data-layout=strip][data-mode-fit=tight] h3{font-size:7px;line-height:8px}
 #stage .phase-preview[data-layout=strip][data-mode-fit=tight] :is(.pp-goal,.pp-mode){font-size:11px;line-height:8px}
 #stage .phase-preview[data-layout=strip][data-mode-fit=tight] .pp-mode li+li{display:inline}
 #stage .phase-preview[data-layout=strip][data-mode-fit=tight] .pp-marker{padding:0;border-width:0}
 #stage .phase-preview[data-layout=strip][data-mode-fit=tight] .pp-icon{width:8px;height:8px}
}
/* Cartão do computador sem altura para tudo: encolhe para objetivo, modo e marcadores caberem. */
#stage .phase-preview[data-layout=card][data-mode-fit=tight]{--pp-pad:3px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] .pp-body{gap:1px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] h3{font-size:8px;line-height:10px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] .pp-goal{font-size:13px;line-height:13px;-webkit-line-clamp:1;line-clamp:1;padding-right:22px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] .pp-mode{font-size:12px;line-height:10px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] .pp-marker{font-size:12px;line-height:12px;padding:0 2px}
#stage .phase-preview[data-layout=card][data-mode-fit=tight] .pp-icon{width:12px;height:12px}

/* The measured space above the compact bar is a scrollable content viewport. */
#stage .phase-preview[data-bounded=true]{height:auto;max-height:var(--pp-height);overflow:auto;align-items:start;animation:none}
#stage .phase-preview[data-bounded=true] .pp-body{align-self:start}
#stage .phase-preview[data-bounded=true] .pp-goal{display:block;overflow:visible;-webkit-line-clamp:unset;line-clamp:unset}
#stage .phase-preview[data-bounded=true] .pp-mode{white-space:normal;overflow:visible}
#stage .phase-preview[data-bounded=true] .pp-mode li+li{display:inline}
#stage .phase-preview[data-bounded=true] h3{white-space:normal;text-wrap:wrap}

.colapso-map-badge{position:absolute;bottom:-9px;left:50%;transform:translateX(-50%);width:max-content;pointer-events:none;display:block;background:#45152b;color:#ffe598;border:1px solid #f57a9d;border-radius:4px;padding:2px 4px;font:11px/1.3 system-ui,sans-serif}
.difficulty-suggestion{position:fixed;bottom:12px;left:50%;transform:translateX(-50%);z-index:100;box-sizing:border-box;width:min(94vw,540px);padding:8px;display:flex;align-items:center;flex-wrap:wrap;gap:6px;background:#172235;color:#fff;border:1px solid #d9bd75;font:12px/1.4 system-ui,sans-serif}
.difficulty-suggestion[hidden]{display:none}
/* Celular deitado: canto inferior esquerdo, estreito, ao lado dos botões da derrota (sem cobrir título nem TENTAR DE NOVO / VOLTAR AO MAPA). */
@media (max-height:460px){.difficulty-suggestion{left:8px;bottom:8px;top:auto;transform:none;width:min(40vw,240px);padding:4px 6px;gap:4px}.difficulty-suggestion button{min-height:28px}}
/* Muito baixo (568x320): uma linha só no rodapé, abaixo de VOLTAR AO MAPA e do link das regras. */
@media (max-height:360px){.difficulty-suggestion{right:8px;bottom:2px;width:auto;flex-wrap:nowrap;padding:2px 6px}.difficulty-suggestion>span{flex:1}.difficulty-suggestion button{min-height:26px;white-space:nowrap}}
.difficulty-suggestion button{font:inherit;min-height:32px;cursor:pointer}

/* V737 · Na faixa do celular a prévia fica só com título, objetivo e marcadores: a dificuldade já está na barra. */
#stage .phase-preview[data-layout=strip] .pp-mode{display:none!important}
#stage .phase-preview[data-layout=strip][data-thumb=off]{grid-template-columns:minmax(0,1fr)}
#stage .phase-preview[data-layout=strip][data-thumb=off] .pp-thumb{display:none}
