:root {
  --fundo: #FFFFFF;
  --tinta: #1B2130;
  --tinta-2: #4A5466;
  --tinta-3: #8A93A5;
  --borda: #E4E7ED;
  --sombra: 0 10px 30px -12px rgba(20, 25, 40, .28);
  --fonte: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--fundo); color: var(--tinta); font-family: var(--fonte); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

/* Topo */
.topo { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: 14px 20px 10px; pointer-events: none;
  background: linear-gradient(#fff 55%, rgba(255,255,255,0)); }
.topo h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.topo .dica { margin: 2px 0 0; font-size: 13px; color: var(--tinta-3); }
.dica-toque { display: none; }
@media (hover: none) { .dica-mouse { display: none; } .dica-toque { display: inline; } }

/* Palco */
#viewport { position: fixed; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#viewport.arrastando { cursor: grabbing; }
#palco { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#linhas { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#linhas path { fill: none; stroke-linecap: round; }

/* Tópicos */
.no { position: absolute; left: 0; top: 0; width: max-content; max-width: 330px; padding: 6px 9px; border-radius: 10px;
  font-size: 16px; line-height: 1.4; font-weight: 500; color: #2A3142; will-change: transform, opacity; }
.no.tem-filhos { cursor: pointer; }
.no.tem-filhos:hover { background: color-mix(in srgb, var(--cor) 9%, transparent); }
.no:focus-visible { outline: 3px solid color-mix(in srgb, var(--cor) 55%, transparent); outline-offset: 2px; }
.no.n2 { font-weight: 700; color: var(--tinta); }
.no.n1 { max-width: 300px; font-size: 19px; font-weight: 800; color: var(--tinta); padding: 10px 16px 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--cor) 11%, #fff); display: flex; align-items: center; gap: 10px; }
.no.n1.tem-filhos:hover { background: color-mix(in srgb, var(--cor) 18%, #fff); }
.no.n1 .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cor); color: #fff; font-size: 14px; font-weight: 800; display: grid; place-items: center; }
.no.n0 { max-width: 360px; font-size: 26px; font-weight: 800; letter-spacing: -.015em; color: var(--tinta); padding: 16px 28px;
  border: 3px solid var(--tinta); border-radius: 18px; background: #fff; box-shadow: var(--sombra); cursor: default; }
.no.oculto { display: none; }
.no-txt a { color: color-mix(in srgb, var(--cor) 80%, #000); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.preencher { display: inline-block; padding: 0 8px; border: 1.5px dashed var(--tinta-3); border-radius: 6px; color: var(--tinta-3); font-size: .9em; }

/* Abre e fecha */
.tg { position: absolute; top: calc(var(--anc) - 11px); min-width: 22px; height: 22px; border-radius: 11px; padding: 0 5px;
  border: 2.5px solid var(--cor); background: #fff; cursor: pointer; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; line-height: 1; color: #fff; transition: transform .15s; }
.no.d .tg { left: calc(100% + 3px); }
.no.e .tg { right: calc(100% + 3px); }
.tg:hover { transform: scale(1.18); }
.no.fechado .tg { background: var(--cor); }
.no:not(.fechado) .tg span { display: none; }
.no:not(.fechado) .tg:hover::after { content: ""; width: 9px; height: 2.5px; border-radius: 2px; background: var(--cor); }

/* Imagem dentro do tópico */
.no-img { display: block; position: relative; margin: 8px 0 3px; padding: 0; border: 1px solid var(--borda); border-radius: 12px; overflow: hidden;
  background: #F6F7F9; cursor: zoom-in; box-shadow: 0 6px 18px -10px rgba(20,25,40,.35); transition: transform .18s, box-shadow .18s; }
.no-img img { display: block; width: 100%; height: auto; }
.no-img:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -12px rgba(20,25,40,.45); }
.no-img .lupa { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 7px;
  border-radius: 999px; background: rgba(27,33,48,.82); color: #fff; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.no-img .lupa svg { width: 14px; height: 14px; }
.no-img:hover .lupa, .no-img:focus-visible .lupa { opacity: 1; }
.no-img .qtd { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 999px; background: var(--cor); color: #fff; font-size: 12px; font-weight: 800; }
@media (hover: none) { .no-img .lupa { opacity: 1; } }

/* Sumário dos ramos */
.sumario { position: fixed; left: 16px; bottom: 16px; z-index: 20; display: flex; gap: 6px; padding: 6px; border-radius: 16px;
  background: rgba(255,255,255,.94); border: 1px solid var(--borda); box-shadow: var(--sombra); }
.sumario button { width: 36px; height: 36px; border-radius: 11px; border: 0; background: color-mix(in srgb, var(--cor) 13%, #fff);
  color: color-mix(in srgb, var(--cor) 82%, #000); font-weight: 800; font-size: 15px; cursor: pointer; }
.sumario button:hover, .sumario button:focus-visible { background: var(--cor); color: #fff; outline: none; }

/* Controles */
.controles { position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 2px; padding: 6px;
  border-radius: 16px; background: rgba(255,255,255,.94); border: 1px solid var(--borda); box-shadow: var(--sombra); }
.controles button { height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 13.5px; font-weight: 700; color: var(--tinta-2); }
.controles button:hover, .controles button:focus-visible { background: #F0F2F5; color: var(--tinta); outline: none; }
.controles button.texto { padding: 0 11px; }
.controles svg, .lb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#zoom-valor { min-width: 48px; text-align: center; font-size: 13px; font-weight: 700; color: var(--tinta-3); font-variant-numeric: tabular-nums; }
.controles .sep { width: 1px; height: 22px; background: var(--borda); margin: 0 4px; }
@media (max-width: 699px) {
  .controles .texto, .controles .sep:first-of-type { display: none; }
  .sumario { bottom: 70px; right: 16px; left: auto; }
  .topo h1 { font-size: 17px; }
  .no { max-width: 250px; font-size: 15px; }
  .no.n1 { max-width: 220px; font-size: 16px; padding: 8px 12px 8px 10px; }
  .no.n1 .num { width: 24px; height: 24px; font-size: 13px; }
  .no.n0 { max-width: 230px; font-size: 19px; padding: 12px 18px; }
}

/* Imagem ampliada */
.lb { position: fixed; inset: 0; z-index: 50; background: rgba(15, 18, 27, .9); display: grid; place-items: center; padding: 24px 76px; }
.lb[hidden] { display: none; }
.lb-fig { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lb-fig img { display: block; max-width: min(1500px, 100%); max-height: calc(100vh - 130px); width: auto; height: auto; border-radius: 14px;
  background: #fff; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); }
.lb-fig figcaption { margin-top: 14px; color: #E9ECF2; font-size: 15px; line-height: 1.45; text-align: center; max-width: 900px; }
.lb-rodape { display: flex; gap: 16px; justify-content: center; margin-top: 6px; font-size: 13px; color: #A9B1C1; }
.lb-rodape a { color: #A9B1C1; }
.lb-fechar, .lb-nav { position: absolute; border: 0; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lb-fechar:hover, .lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-fechar { top: 16px; right: 16px; }
.lb-ant { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-prox { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-nav[hidden] { display: none; }
.lb svg { width: 24px; height: 24px; }
@media (max-width: 640px) { .lb { padding: 64px 10px 20px; } .lb-ant, .lb-prox { top: auto; bottom: 14px; transform: none; } }

@media (prefers-reduced-motion: reduce) { .no-img, .tg { transition: none; } }
