/* ============================================================
   Salvador Histórico — design system "azulejo"
   Paleta: porcelana / cobalto / amarelo Pelourinho + fitas do Bonfim
   Tipos:  Amarante (display) + Archivo (UI)
   ============================================================ */

:root {
  --cobalto: #1E4E8C;
  --cobalto-ink: #122E56;
  --cobalto-vivo: #2B62B8;
  --porcelana: #F5F8FA;
  --porcelana-2: #E9F0F4;
  --linha: #CFDCE6;
  --tinta: #22364C;
  --tinta-suave: #5A7089;

  --amarelo: #F2B32E;
  --ouro: #D99A28;
  --terracota: #BE5B34;
  --verde: #3F7D53;

  --fita-1: #F2B32E;
  --fita-2: #3F7D53;
  --fita-3: #D64545;
  --fita-4: #2B62B8;
  --fita-5: #E77FA3;
  --fita-6: #E8842C;

  --f-display: "Amarante", "Georgia", serif;
  --f-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sombra: 0 4px 18px rgba(18, 46, 86, 0.18);
  --sombra-leve: 0 2px 8px rgba(18, 46, 86, 0.12);
  --raio: 14px;
  --transicao: 220ms cubic-bezier(0.32, 0.72, 0.28, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--f-ui);
  color: var(--tinta);
  background: var(--porcelana);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
}

button {
  font-family: var(--f-ui);
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

a { color: var(--cobalto); }

:focus-visible {
  outline: 3px solid var(--amarelo);
  outline-offset: 2px;
}

/* ---------- Mapa ---------- */

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--porcelana-2);
}

.leaflet-container { font-family: var(--f-ui); }
.leaflet-control-attribution {
  font-size: 9px;
  background: rgba(245, 248, 250, 0.75) !important;
  color: var(--tinta-suave);
}

/* Modo "Outrora": sépia + papel envelhecido */
body.past .leaflet-tile-pane {
  filter: sepia(0.85) saturate(0.45) contrast(1.07) brightness(0.98) hue-rotate(-6deg);
}

#pastfx {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms ease;
  background-image:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(74, 52, 18, 0.28) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.33 0 0 0 0 0.18 0 0 0 0.35 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

body.past #pastfx {
  opacity: 1;
  animation: graos 0.9s steps(3) infinite;
}

@keyframes graos {
  0% { background-position: 0 0, 0 0; }
  33% { background-position: 0 0, -42px 26px; }
  66% { background-position: 0 0, 31px -38px; }
  100% { background-position: 0 0, -13px 9px; }
}

/* Flash de viagem no tempo */
#flash {
  position: fixed;
  inset: 0;
  z-index: 75;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(246, 236, 210, 0.95), rgba(58, 42, 18, 0.85));
}
#flash.on { animation: flashfx 0.75s ease-out both; }

@keyframes flashfx {
  0% { opacity: 0; }
  16% { opacity: 0.92; }
  100% { opacity: 0; }
}

/* Modo Outrora: a interface inteira envelhece */
body.past .marca { background: #F3E9D2; border-color: #D9C9A3; }
body.past .marca h1 { color: #4A3417; }
body.past .marca-tile { background: #6B4F23; }
body.past .progresso { background: #4A3417; color: #F3E9D2; }
body.past .chip { background: #F3E9D2; border-color: #D9C9A3; color: #6B583A; }
body.past .chip[aria-pressed="true"] { background: #4A3417; border-color: #4A3417; color: #F3E9D2; }
body.past .fab { background: #F3E9D2; border-color: #D9C9A3; color: #4A3417; }
body.past .fab[aria-pressed="true"] { background: #4A3417; border-color: #4A3417; color: #F3E9D2; }
body.past #fabPast[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--cobalto-ink); }
body.past .sheet { background: #F6EDDA; }
body.past .sheet-close { background: #EBDFC2; color: #6B583A; }
body.past .sabia { background: #EFE3C8; }
body.past .radar { background: #F3E9D2; border-color: #D9C9A3; }

/* nome antigo da cidade no cabeçalho */
.marca h1 .nome-outrora { display: none; }
body.past .marca h1 .nome-hoje { display: none; }
body.past .marca h1 .nome-outrora {
  display: block;
  font-size: 11.5px;
  line-height: 1.25;
  max-width: 172px;
  white-space: normal;
}

/* ---------- Marcadores: losangos de azulejo ---------- */

.tz-wrap { background: none; border: none; }

.tz {
  display: block;
  width: 22px;
  height: 22px;
  transform: rotate(45deg);
  border: 2.5px solid #fff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(18, 46, 86, 0.4);
  transition: transform var(--transicao), box-shadow var(--transicao);
}

.tz i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform: rotate(-45deg);
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  opacity: 0;
}

.tz.descoberta i { opacity: 1; }

.c-igreja { background: var(--ouro); }
.c-forte { background: var(--terracota); }
.c-casa { background: var(--cobalto-vivo); }
.c-marco { background: var(--verde); }

.tz.ativa {
  transform: rotate(45deg) scale(1.3);
  box-shadow: 0 0 0 4px rgba(242, 179, 46, 0.55), 0 3px 10px rgba(18, 46, 86, 0.45);
}

/* Posição do usuário */
.me-dot { background: none; border: none; }
.me-dot span {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cobalto-vivo);
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(18, 46, 86, 0.5);
  position: relative;
}
.me-dot span::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(43, 98, 184, 0.5);
  animation: pulso 2.2s ease-out infinite;
}

@keyframes pulso {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- Cabeçalho flutuante ---------- */

.topo {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.marca {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--porcelana);
  border: 1px solid var(--linha);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  box-shadow: var(--sombra-leve);
}

.marca-tile {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--cobalto);
  display: grid;
  place-items: center;
  flex: none;
}
.marca-tile::before {
  content: "";
  width: 11px;
  height: 11px;
  background: var(--amarelo);
  transform: rotate(45deg);
  border-radius: 2px;
}

.marca h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 19px;
  color: var(--cobalto-ink);
  line-height: 1;
  white-space: nowrap;
}

.progresso {
  pointer-events: auto;
  margin-left: auto;
  background: var(--cobalto-ink);
  color: var(--porcelana);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 9px 14px;
  box-shadow: var(--sombra-leve);
  flex: none;
}

.selo-outrora {
  position: fixed;
  top: calc(64px + var(--safe-top));
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 19;
  background: var(--amarelo);
  color: var(--cobalto-ink);
  font-family: var(--f-display);
  font-size: 15px;
  padding: 5px 18px;
  border-radius: 999px;
  box-shadow: var(--sombra-leve);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transicao), transform var(--transicao);
}
body.past .selo-outrora { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Filtros ---------- */

.filtros {
  position: fixed;
  top: calc(62px + var(--safe-top));
  left: 0;
  right: 0;
  z-index: 18;
  display: flex;
  gap: 8px;
  padding: 6px 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filtros::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  background: var(--porcelana);
  border: 1px solid var(--linha);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tinta-suave);
  box-shadow: var(--sombra-leve);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background var(--transicao), color var(--transicao);
}

.chip .ponto {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  transform: rotate(45deg);
  flex: none;
}

.chip[aria-pressed="true"] {
  background: var(--cobalto-ink);
  border-color: var(--cobalto-ink);
  color: #fff;
}

/* ---------- FABs ---------- */

.fabs {
  position: fixed;
  right: 14px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--porcelana);
  border: 1px solid var(--linha);
  box-shadow: var(--sombra);
  display: grid;
  place-items: center;
  color: var(--cobalto-ink);
  transition: background var(--transicao), color var(--transicao), transform 120ms ease;
}
.fab:active { transform: scale(0.94); }
.fab svg { width: 24px; height: 24px; }

.fab[aria-pressed="true"] { background: var(--cobalto-ink); color: #fff; border-color: var(--cobalto-ink); }
#fabPast[aria-pressed="true"] { background: var(--amarelo); color: var(--cobalto-ink); border-color: var(--amarelo); }
.fab.buscando svg { animation: girar 1.2s linear infinite; }

@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Fita do Bonfim (assinatura) ---------- */

.fita-strip {
  height: 6px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(
    90deg,
    var(--fita-1) 0 16.6%,
    var(--fita-2) 16.6% 33.3%,
    var(--fita-3) 33.3% 50%,
    var(--fita-4) 50% 66.6%,
    var(--fita-5) 66.6% 83.3%,
    var(--fita-6) 83.3% 100%
  );
}

/* ---------- Bottom sheet ---------- */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--porcelana);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(18, 46, 86, 0.25);
  transform: translateY(105%);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0.28, 1);
  max-height: 78dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet.aberta { transform: translateY(0); }
.sheet.arrastando { transition: none; }

.sheet > .fita-strip { flex: none; }

.sheet-grip {
  flex: none;
  padding: 10px 0 4px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}
.sheet-grip span {
  width: 42px;
  height: 5px;
  border-radius: 3px;
  background: var(--linha);
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--porcelana-2);
  color: var(--tinta-suave);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.sheet-body {
  overflow-y: auto;
  padding: 2px 20px 22px;
  -webkit-overflow-scrolling: touch;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.eyebrow .ponto {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  transform: rotate(45deg);
}

.s-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.12;
  color: var(--cobalto-ink);
  margin-bottom: 8px;
  padding-right: 34px;
}

.s-meta {
  font-size: 13.5px;
  color: var(--tinta-suave);
  margin-bottom: 16px;
}
.s-meta .descoberta-tag {
  color: var(--verde);
  font-weight: 700;
}

.sheet h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 18px;
  color: var(--cobalto);
  margin: 18px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sheet h3::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--cobalto);
  transform: rotate(45deg);
  border-radius: 1.5px;
  flex: none;
}

.sheet section p {
  font-size: 15.5px;
  line-height: 1.62;
}

.outrora-texto::first-letter {
  font-family: var(--f-display);
  font-size: 3.1em;
  line-height: 0.85;
  float: left;
  color: var(--cobalto);
  padding: 4px 8px 0 0;
}

.sabia {
  margin-top: 18px;
  background: var(--porcelana-2);
  border-left: 4px solid var(--amarelo);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
}
.sabia h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ouro);
  margin-bottom: 4px;
}
.sabia p { font-size: 14.5px; line-height: 1.55; }

.s-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: var(--raio);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--transicao), color var(--transicao);
}

.btn-primario { background: var(--cobalto-ink); color: #fff; }
.btn-primario.feito { background: var(--verde); }
.btn-contorno {
  background: var(--porcelana);
  border: 1.5px solid var(--cobalto-ink);
  color: var(--cobalto-ink);
}

/* ---------- Painel Explorar (lista) ---------- */

.painel {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--porcelana);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0.28, 1);
  display: flex;
  flex-direction: column;
}
.painel.aberto { transform: translateY(0); }

.painel-topo {
  flex: none;
  background: var(--cobalto-ink);
  color: var(--porcelana);
  padding: calc(14px + var(--safe-top)) 20px 18px;
}

.painel-topo .linha1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.painel-topo h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 24px;
}

.painel-fechar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(245, 248, 250, 0.12);
  color: var(--porcelana);
  font-size: 20px;
  display: grid;
  place-items: center;
}

.painel-topo .placar {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 10px;
}

/* fitinhas de progresso: uma por lugar */
.fitas {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.fitas span {
  width: 9px;
  height: 26px;
  border-radius: 4px 4px 5px 5px;
  background: rgba(245, 248, 250, 0.16);
  transition: background var(--transicao);
}
.fitas span.f1.on { background: var(--fita-1); }
.fitas span.f2.on { background: var(--fita-2); }
.fitas span.f3.on { background: var(--fita-3); }
.fitas span.f4.on { background: var(--fita-4); }
.fitas span.f5.on { background: var(--fita-5); }
.fitas span.f6.on { background: var(--fita-6); }

.gps-dica {
  background: none;
  border: none;
  color: var(--amarelo);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  margin-top: 10px;
  padding: 0;
}
.gps-dica.oculta { display: none; }

.painel-lista {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 calc(16px + var(--safe-bottom));
}

.item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--porcelana-2);
}
.item:active { background: var(--porcelana-2); }

.item .tile {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  transform: rotate(45deg);
  border: 2px solid #fff;
  box-shadow: var(--sombra-leve);
  display: grid;
  place-items: center;
}
.item .tile i {
  transform: rotate(-45deg);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
}
.item.descoberto .tile i { opacity: 1; }

.item .info { flex: 1; min-width: 0; }
.item .nome {
  font-weight: 600;
  font-size: 15px;
  color: var(--tinta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item.descoberto .nome { color: var(--tinta-suave); }
.item .sub {
  font-size: 12.5px;
  color: var(--tinta-suave);
  margin-top: 2px;
}

.item .dist {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--cobalto);
}

.painel-rodape {
  flex: none;
  text-align: center;
  font-size: 11px;
  color: var(--tinta-suave);
  padding: 10px 20px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--porcelana-2);
}

/* ---------- Foto antiga (álbum) ---------- */

.foto-antiga {
  margin: 2px 0 6px;
  background: #FBF7EE;
  border: 1px solid #E6DCC6;
  border-radius: 4px;
  padding: 8px 8px 9px;
  box-shadow: var(--sombra-leve);
  transform: rotate(-0.6deg);
}

.foto-antiga .quadro {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: #E9E2D2;
}

.foto-antiga img {
  display: block;
  width: 100%;
  max-height: 235px;
  object-fit: cover;
  filter: sepia(0.5) saturate(0.62) contrast(0.95) brightness(1.03);
}

.foto-antiga .quadro::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(58, 42, 18, 0.38) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.33 0 0 0 0 0.18 0 0 0 0.28 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

.foto-antiga figcaption {
  margin-top: 7px;
  font-size: 11px;
  color: var(--tinta-suave);
  text-align: right;
}
.foto-antiga figcaption a { color: inherit; }

/* ---------- Fontes ---------- */

.fontes ul {
  list-style: none;
  margin-top: 2px;
}

.fontes li {
  position: relative;
  padding: 5px 0 5px 18px;
  font-size: 14px;
  line-height: 1.45;
}

.fontes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 7px;
  height: 7px;
  background: var(--amarelo);
  transform: rotate(45deg);
  border-radius: 1.5px;
}

.fontes a {
  color: var(--cobalto);
  word-break: break-word;
}

/* ---------- Ordenação (painel Explorar) ---------- */

.ordem {
  display: flex;
  gap: 4px;
  background: rgba(245, 248, 250, 0.12);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 12px;
}

.ordem button {
  flex: 1;
  min-height: 36px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(245, 248, 250, 0.75);
  transition: background var(--transicao), color var(--transicao);
}

.ordem button[aria-pressed="true"] {
  background: var(--porcelana);
  color: var(--cobalto-ink);
}

/* Linha do tempo 2.0 */

.epoca {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 20px 10px;
  background: rgba(245, 248, 250, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--porcelana-2);
}

.epoca-sec {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-size: 19px;
  color: var(--cobalto);
}
.epoca-sec::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--linha);
}

.epoca-sub {
  font-size: 12.5px;
  color: var(--tinta-suave);
}

.titem {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr 58px;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 20px;
  text-align: left;
}
.titem:active { background: var(--porcelana-2); }

/* trilho vertical */
.titem::before {
  content: "";
  position: absolute;
  left: 31px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--linha);
}

.titem-no {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  transform: rotate(45deg);
  border: 2.5px solid var(--porcelana);
  border-radius: 3px;
  box-shadow: var(--sombra-leve);
  display: grid;
  place-items: center;
}
.titem-no i {
  transform: rotate(-45deg);
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

.titem-corpo { min-width: 0; }
.titem-ano {
  display: block;
  font-family: var(--f-display);
  font-size: 17px;
  line-height: 1.1;
  color: var(--cobalto-ink);
}
.titem.descoberto .titem-ano { color: var(--ouro); }
.titem-corpo .nome {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--tinta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.titem.descoberto .nome { color: var(--tinta-suave); }
.titem-corpo .sub {
  display: block;
  font-size: 12px;
  color: var(--tinta-suave);
  margin-top: 1px;
}

.titem-foto {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #fff;
  box-shadow: var(--sombra-leve);
  filter: sepia(0.45) saturate(0.7);
  background: #E9E2D2;
  transform: rotate(-1.4deg);
}
.titem:nth-child(even) .titem-foto { transform: rotate(1.6deg); }

/* reveal ao rolar (só quando movimento é permitido) */
@media (prefers-reduced-motion: no-preference) {
  .titem.prep {
    opacity: 0;
    transform: translateY(16px);
  }
  .titem.prep.vis {
    opacity: 1;
    transform: none;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 0.7, 0.3, 1);
  }
}

/* ---------- Radar do explorador ---------- */

.radar {
  position: fixed;
  left: 14px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--porcelana);
  border: 1px solid var(--linha);
  border-radius: 16px;
  box-shadow: var(--sombra);
  padding: 10px 14px;
  max-width: min(60vw, 300px);
  text-align: left;
}
.radar[hidden] { display: none; }

.radar-seta {
  width: 22px;
  height: 22px;
  color: var(--terracota);
  flex: none;
  transition: transform 0.4s ease;
}

.radar-info { min-width: 0; }
.radar-rotulo {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tinta-suave);
}
.radar-nome {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--cobalto-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radar-dist {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--terracota);
}

/* ---------- Carimbo de descoberta ---------- */

.carimbo {
  position: fixed;
  inset: 0;
  z-index: 56;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.carimbo-box {
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 30px;
  border: 5px double var(--terracota);
  border-radius: 14px;
  color: var(--terracota);
  background: rgba(245, 248, 250, 0.9);
  transform: rotate(-7deg);
  box-shadow: var(--sombra);
}
.carimbo.bate .carimbo-box { animation: carimbada 2.1s ease-out both; }

@keyframes carimbada {
  0% { opacity: 0; transform: rotate(-7deg) scale(1.8); }
  10% { opacity: 1; transform: rotate(-7deg) scale(0.96); }
  15% { transform: rotate(-7deg) scale(1.03); }
  20% { transform: rotate(-7deg) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-7deg) scale(1); }
}

.carimbo-titulo {
  font-family: var(--f-display);
  font-size: 15px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
}
.carimbo-nome {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--cobalto-ink);
  text-align: center;
  max-width: 70vw;
}
.carimbo-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tinta-suave);
}

/* ---------- Som do passado ---------- */

.fab-som { display: none; }
body.past .fab-som { display: grid; }
.fab-som .icone-mudo { display: none; }
.fab-som.mudo .icone-som { display: none; }
.fab-som.mudo .icone-mudo { display: block; }

body.imerso .fabs { z-index: 82; }
body.imerso .fab { display: none; }
body.imerso .fab-som {
  display: grid;
  background: rgba(13, 9, 3, 0.55);
  border-color: rgba(243, 233, 210, 0.3);
  color: #F3E9D2;
}

/* ---------- Botão "Mergulhar no passado" ---------- */

.btn-viver {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin: 10px 0 4px;
  border-radius: 12px;
  font-family: var(--f-display);
  font-size: 16.5px;
  color: #F6EDDA;
  background: linear-gradient(135deg, #4A3417, #122E56);
  box-shadow: var(--sombra-leve);
  transition: transform 120ms ease;
}
.btn-viver:active { transform: scale(0.97); }
.btn-viver::before { content: "✦"; color: var(--amarelo); }

/* ---------- Modo cinema: "Mergulhar no passado" ---------- */

.viver {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0D0903;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.viver.aberto { opacity: 1; pointer-events: auto; }

.viver::before,
.viver::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3.5vh;
  background: #000;
  z-index: 2;
}
.viver::before { top: 0; }
.viver::after { bottom: 0; }

.viver-foto img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.75) saturate(0.5) contrast(1.05) brightness(0.78);
}
.viver.aberto .viver-foto img { animation: kenburns 26s ease-in-out infinite alternate; }

@keyframes kenburns {
  from { transform: scale(1.02); }
  to { transform: scale(1.16) translate(-2%, -1.5%); }
}

.viver-veu {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(13, 9, 3, 0.92), rgba(13, 9, 3, 0.25) 32%, rgba(13, 9, 3, 0.35) 60%, rgba(13, 9, 3, 0.95)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.33 0 0 0 0 0.18 0 0 0 0.3 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}
.viver.aberto .viver-veu { animation: graos 0.9s steps(3) infinite; }

.viver-conteudo {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12vh 26px 14vh;
}
.viver-conteudo > * {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.viver-ano {
  font-family: var(--f-display);
  font-size: clamp(64px, 20vw, 120px);
  color: var(--amarelo);
  line-height: 0.9;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.viver-nome {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  color: #F6EDDA;
  margin-top: 10px;
  margin-bottom: 22px;
}

.viver-texto {
  font-size: 17px;
  line-height: 1.8;
  color: #F1E7D0;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
  margin-bottom: 22px;
}
.viver-texto::first-letter {
  font-family: var(--f-display);
  font-size: 3em;
  line-height: 0.85;
  float: left;
  color: var(--amarelo);
  padding: 4px 8px 0 0;
}

.viver-sabia {
  border-left: 3px solid var(--amarelo);
  border-radius: 0 10px 10px 0;
  background: rgba(13, 9, 3, 0.45);
  padding: 10px 14px;
  margin-bottom: 40px;
}
.viver-sabia h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--amarelo);
  margin-bottom: 4px;
}
.viver-sabia p { font-size: 14.5px; line-height: 1.6; color: #EADFC5; }

.viver-fechar {
  position: absolute;
  top: calc(3.5vh + 12px + var(--safe-top));
  left: 16px;
  z-index: 3;
  background: rgba(13, 9, 3, 0.55);
  border: 1px solid rgba(243, 233, 210, 0.35);
  color: #F3E9D2;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
}

.viver.aberto .rev { animation: sobe 0.8s cubic-bezier(0.22, 0.7, 0.3, 1) both; }
.viver.aberto .viver-ano { animation-delay: 0.15s; }
.viver.aberto .viver-nome { animation-delay: 0.5s; }
.viver.aberto .viver-texto { animation-delay: 0.95s; }
.viver.aberto .viver-sabia { animation-delay: 1.7s; }

@keyframes sobe {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translate(-50%, 16px);
  z-index: 50;
  background: var(--cobalto-ink);
  color: var(--porcelana);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--sombra);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transicao), transform var(--transicao);
  max-width: min(88vw, 420px);
  text-align: center;
}
.toast.mostrar { opacity: 1; transform: translate(-50%, 0); }
.toast.dourado { background: var(--verde); }

/* ---------- Introdução ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(18, 46, 86, 0.88), rgba(18, 46, 86, 0.94)),
    repeating-conic-gradient(from 45deg, #2B62B8 0deg 90deg, #1E4E8C 90deg 180deg);
  background-size: auto, 46px 46px;
  opacity: 1;
  transition: opacity 350ms ease;
}
.intro.saindo { opacity: 0; pointer-events: none; }
.intro.oculta { display: none; }

.intro-card {
  width: min(400px, 100%);
  background: var(--porcelana);
  border-radius: 20px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  position: relative;
}
.intro-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--fita-1) 0 16.6%, var(--fita-2) 16.6% 33.3%, var(--fita-3) 33.3% 50%,
    var(--fita-4) 50% 66.6%, var(--fita-5) 66.6% 83.3%, var(--fita-6) 83.3% 100%
  );
}

.intro-tile {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  background: var(--cobalto);
  margin: 4px auto 14px;
  display: grid;
  place-items: center;
}
.intro-tile::before {
  content: "";
  width: 24px;
  height: 24px;
  background: var(--amarelo);
  transform: rotate(45deg);
  border-radius: 4px;
}

.intro-card h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 30px;
  color: var(--cobalto-ink);
  line-height: 1.1;
  margin-bottom: 10px;
}

.intro-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--tinta-suave);
  margin-bottom: 22px;
}

.intro-card .btn { width: 100%; }
.intro-card .btn + .btn { margin-top: 10px; }

.intro-build {
  margin-top: 16px;
  font-size: 10.5px;
  color: var(--tinta-suave);
  opacity: 0.7;
}

/* ---------- Acessibilidade / movimento ---------- */

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

/* Telas maiores: contém a largura dos flutuantes */
@media (min-width: 720px) {
  .topo { left: 50%; right: auto; transform: translateX(-50%); width: 660px; }
  .filtros { justify-content: center; }
  .sheet { left: 50%; right: auto; transform: translate(-50%, 105%); width: 620px; border-radius: 18px 18px 0 0; }
  .sheet.aberta { transform: translate(-50%, 0); }
  .painel { left: 50%; right: auto; transform: translate(-50%, 100%); width: 620px; }
  .painel.aberto { transform: translate(-50%, 0); }
}
