:root{
  --bg:#0b1220;
  --panel:rgba(255,255,255,0.08);
  --panel2:rgba(255,255,255,0.12);
  --text:#e6eefc;
  --muted:#a9b7d1;
  --brand:#1aa3ff;
  --accent:#ffb703;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius:18px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(26,163,255,.25), transparent 55%),
              radial-gradient(900px 700px at 95% 15%, rgba(255,183,3,.15), transparent 50%),
              var(--bg);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
.header{
  position:sticky; top:0; z-index:50;
  padding:14px 16px;
  background: rgba(11,18,32,.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header .row{
  max-width:1100px; margin:0 auto;
  display:flex; align-items:center; gap:12px; justify-content:space-between;
}
.brand{
  display:flex; flex-direction:column; gap:2px;
}
.brand .kicker{font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted)}
.brand .title{font-size:16px; font-weight:800}
.controls{display:flex; gap:10px; align-items:center}
.btn{
  display:inline-flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius: 14px;
  background: var(--panel);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: none;
  cursor:pointer;
  user-select:none;
}
.btn:hover{background: var(--panel2)}
.btn.primary{background: rgba(26,163,255,.18); border-color: rgba(26,163,255,.35)}
.btn.primary:hover{background: rgba(26,163,255,.24)}
.btn .mini{font-size:12px; color:var(--muted)}
.container{max-width:1100px; margin:0 auto; padding:18px 16px 28px}
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:14px;
}
@media (min-width:820px){ .grid{grid-template-columns: repeat(4, minmax(0,1fr));} }
.card{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.thumb{
  width:100%;
  aspect-ratio: 3/4;
  background: rgba(255,255,255,.04);
  display:block;
  object-fit: cover;
}
.card .meta{padding:12px 12px 14px}
.card .meta .h{font-weight:800}
.card .meta .p{font-size:12px; color:var(--muted); margin-top:4px}
.searchBox{
  display:flex; gap:10px; align-items:center;
  padding:10px; border-radius: 16px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}
.searchBox input{
  flex:1;
  padding:10px 12px;
  border: none; outline: none;
  border-radius: 12px;
  background: rgba(0,0,0,.18);
  color: var(--text);
}
.pills{display:flex; gap:8px; flex-wrap:wrap}
.pill{
  font-size:12px; font-weight:700;
  padding:8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.results{
  margin-top:14px;
  display:grid;
  gap:10px;
}
.result{
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
}
.result .top{display:flex; justify-content:space-between; gap:12px; align-items:center}
.result .top .p{font-size:12px; color:var(--muted)}
.result .snip{margin-top:8px; color: #d7e4fb; font-size:13px; line-height:1.35}
mark{
  background: rgba(255,183,3,.35);
  border-bottom: 2px solid rgba(255,183,3,.9);
  color: inherit;
  border-radius: 3px;
  padding:0 2px;
}

/* page viewer */
.viewer{
  display:flex; justify-content:center;
}
.pageWrap{
  width:min(980px, 100%);
  background: rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.pageImg{
  width:100%;
  height:auto;
  display:block;
}
.pageFooter{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:12px 12px;
  background: rgba(0,0,0,.22);
  border-top:1px solid rgba(255,255,255,.08);
}
.pageFooter .info{font-size:12px; color:var(--muted)}
kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:11px;
  padding:2px 6px;
  border-radius: 7px;
  background: rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.12);
}


/* =========================
   Viewer + overlays (v2)
   ========================= */

.viewer{
  height:100vh;
  display:flex;
  flex-direction:column;
  background: linear-gradient(180deg, rgba(26,163,255,.10), rgba(0,0,0,0));
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px 14px 10px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.brand{
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--brand);
}

.page-title{
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-top: 6px;
  max-width: 70vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  display: none;
}

.page-pill{
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}

.stage{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px;
  overflow:hidden;
  touch-action: none;
}

.page-img{
  max-width: 100%;
  max-height: calc(100vh - 120px);
  border-radius: 14px;
  box-shadow: var(--shadow);
  user-select:none;
  -webkit-user-drag:none;
  touch-action: none; /* permite swipe/drag horizontal e pinch via Hammer sem bloquear */
}

.hint{
  padding: 10px 14px 16px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}

/* Overlay base */
.overlay{
  position: fixed;
  inset: 0;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding: 14px;
  background: rgba(0,0,0,.55);
  z-index: 9999;
}

.hidden{ display:none; }

.overlay-card{
  width: min(1100px, calc(100vw - 24px));
  max-height: 90vh;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.overlay-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px 10px;
  background: rgba(0,0,0,.22);
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.overlay-title{
  font-weight: 900;
  font-size: 14px;
  color: var(--text);
}

.icon-btn{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 14px;
  cursor:pointer;
}

.thumbs-grid{
  padding: 12px;
  overflow:auto;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 720px){
  .thumbs-grid{ grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.thumb{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  overflow:hidden;
  cursor:pointer;
}

.thumb img{
  width:100%;
  display:block;
}

.thumb .cap{
  padding: 10px 10px 12px;
}

.thumb .cap .t{
  font-weight: 900;
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
}

.thumb .cap .p{
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* Search modal */
.search-box{
  display:flex;
  gap:10px;
  padding: 12px;
  align-items:center;
}

.search-input{
  flex:1;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 12px;
  color: var(--text);
  outline:none;
  font-size: 16px;
}

.primary-btn{
  background: var(--brand);
  border: none;
  color: #001526;
  font-weight: 900;
  padding: 12px 14px;
  border-radius: 14px;
  cursor:pointer;
}

.chips{
  display:flex;
  gap: 8px;
  padding: 0 12px 12px;
  overflow:auto;
}

.chip{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 12px;
  cursor:pointer;
  white-space: nowrap;
}

.search-meta{
  padding: 0 12px 10px;
  color: var(--muted);
  font-size: 12px;
}

.results{
  padding: 0 12px 14px;
  overflow:auto;
}

.result{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  cursor:pointer;
}

.result .rt{
  font-weight: 900;
  color: var(--text);
  font-size: 13px;
}

.result .rs{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.result mark{
  background: rgba(255, 183, 3, .35);
  color: var(--text);
  border-radius: 4px;
  padding: 0 2px;
}


.topbar-actions{display:flex; align-items:center; gap:10px;}
.focusbar{
  margin: 0 12px 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.focus-left{min-width:0;}
.focus-title{
  font-weight: 900;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.focus-sub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.focus-actions{display:flex; gap:8px; flex-shrink:0;}


/* Flash visual ao trocar de ocorrência/página */
.page-img.flash {
  animation: flashPulse 640ms ease-out;
}
@keyframes flashPulse {
  0%   { filter: brightness(1); transform: scale(1); }
  25%  { filter: brightness(1.12) saturate(1.05); }
  55%  { filter: brightness(1.02); }
  100% { filter: brightness(1); transform: scale(1); }
}


/* v3.2 fullscreen + pinch */
.topbar{
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 50;
}

.stage{
  padding: 0;
}

.page-img{
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  touch-action: none; /* permite swipe/pinch no próprio elemento */
  transform-origin: 50% 50%;
}
.hint{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  padding: 10px 14px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
}


/* v3.3 thumbs carousel (evita sobreposição) */
.thumbs-grid{
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.thumbs-grid::after{
  content:"";
  flex: 0 0 8px;
}
.thumb{
  flex: 0 0 min(72vw, 280px);
  scroll-snap-align: start;
}
@media (min-width: 720px){
  .thumb{ flex-basis: 240px; }
}
.thumb img{
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: rgba(0,0,0,.18);
}

/* v3.3 overlay align */
#thumbs-overlay.overlay{
  align-items: center;
}


/* v3.3 fix miniaturas (sem sobreposição) */
#thumbs-grid.thumbs-grid{
  align-content: start;
}

#thumbs-grid .thumb{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  overflow: hidden;
  display:flex;
  flex-direction: column;
  width: auto;
  aspect-ratio: auto;
}

#thumbs-grid .thumb > img{
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display:block;
}

#thumbs-grid .thumb .cap{
  padding: 10px 10px 12px;
}

#thumbs-grid .thumb .cap .t{
  font-weight: 900;
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
}

#thumbs-grid .thumb .cap .p{
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}


/* v3.4 chip carousel */
.chips{
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px;
}
.chip{
  scroll-snap-align: start;
}
.chips::before,
.chips::after{
  content:"";
  flex: 0 0 8px;
}


/* v3.5 autohide ui (topbar + hint) */
.topbar, .hint{
  transition: opacity 260ms ease, transform 260ms ease;
}

body.ui-hidden .topbar{
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

body.ui-hidden .hint{
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}


/* v3.7 image contain (sem cortar topo/base) */
.page-img{
  object-fit: contain;
  background: #000;
}


/* v3.9 blurred background (sem fundo preto) */
body{ --bg-url: none; }
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background-image: var(--bg-url);
  background-size: cover;
  background-position: center;
  filter: blur(22px) brightness(.78) saturate(1.05);
  transform: scale(1.08);
  z-index: -1;
}
body::after{
  content:"";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.22);
  z-index: -1;
}
.page-img{ background: transparent; }


/* v3.9 thumbs carousel */
#thumbs-grid.thumbs-grid{
  display:flex;
  flex-direction:row;
  gap:14px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  padding:14px 14px 18px;
}
#thumbs-grid .thumb{
  flex:0 0 min(72vw, 420px);
  scroll-snap-align:center;
}
#thumbs-grid::-webkit-scrollbar{ height: 10px; }
#thumbs-grid::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.18);
  border-radius: 999px;
}


/* icon buttons */
.iconbtn{
  width:42px; height:42px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.iconbtn:active{ transform: scale(.98); }


/* v4.0 bottom controls */
.bottombar{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(20,28,38,.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

.bottombar-left{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bbtn{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor:pointer;
  font-weight: 800;
  letter-spacing: .2px;
  user-select: none;
}

.bbtn span{
  font-size: 12px;
  opacity: .95;
}

.bbtn:active{ transform: scale(.98); }
.bbtn:focus-visible{ outline: 2px solid rgba(255,255,255,.35); outline-offset: 2px; }

.bottombar-right{
  display:flex;
  align-items:center;
}

.bottombar .page-badge{
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-weight: 900;
}

/* esconde badge do topo se existir */
.topbar .page-badge{ display:none !important; }

/* autohide também na bottombar */
.bottombar{
  transition: opacity 260ms ease, transform 260ms ease;
}
body.ui-hidden .bottombar{
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* em telas pequenas, some o texto e fica só ícone */
@media (max-width: 520px){
  .bbtn span{ display:none; }
  .bottombar{ left: 10px; right: 10px; bottom: 10px; }
}


/* v4.1 fixes */
.topbar .page-pill{ display:none !important; } /* evita duplicidade */

/* hint não sobrepõe a barra */
.hint{
  bottom: 86px !important;
  padding-bottom: 0;
}
@media (max-width: 520px){
  .hint{ display:none; } /* em telas pequenas some para não poluir */
}

/* centralizar botões */
.bottombar{
  justify-content: center;
}
.bottombar-left{
  flex: 1;
  justify-content: center;
}
.bottombar-right{
  margin-left: auto;
}
.bottombar-right .page-badge{
  min-width: 92px;
  text-align: center;
}

/* botões de navegação nas miniaturas (discretos) */
.tnav{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  margin-right: 8px;
}
.tnav:active{ transform: scale(.98); }
.thumbs-header{ gap: 10px; }


/* v4.3 thumbs hover nav */
.thumbs-nav{ display:flex; gap:8px; }
.tnav{
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.thumbs-panel:hover .tnav,
.thumbs-panel:focus-within .tnav{
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none){
  /* em mobile, mantém escondido (sem hover) */
  .tnav{ display:none; }
}


/* ===== Melhorias: paginação + resultados da busca no modal ===== */
.pager{
  display:flex;
  align-items:center;
  gap:10px;
}
.bbtn.bbtn-icon{
  width:40px;
  justify-content:center;
  padding:10px 0;
}
#page-badge{
  cursor:pointer;
  user-select:none;
}

/* garante scroll dos resultados dentro do modal (sem estourar a tela) */
#search-results{
  padding: 0 12px 12px;
  overflow:auto;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
}

/* cards de resultado (JS usa .result-card) */
.result-card{
  width:100%;
  text-align:left;
  padding:12px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  cursor:pointer;
}
.result-card:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
}
.result-card:active{
  transform: translateY(0px);
}
.result-card:focus-visible{
  outline: 2px solid rgba(94,234,212,.65);
  outline-offset: 2px;
}

.result-head{
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:6px;
}
.result-head strong{
  font-size:13px;
  letter-spacing:.2px;
}
.result-head .muted{
  font-size:12px;
  color: var(--muted);
}
.result-body{
  margin-top:8px;
  color: #d7e4fb;
  font-size:13px;
  line-height:1.35;
}



/* =========================
   Home (index.html)
   ========================= */
body.home {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.home-wrap {
  width: min(1100px, 100%);
}

.home-header {
  margin-bottom: 18px;
}

.home-brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.home-title {
  margin: 10px 0 6px;
  font-size: 28px;
  line-height: 1.15;
}

.home-sub {
  margin: 0;
  opacity: 0.85;
}

.home-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
}

.home-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
}

.home-thumb {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.12);
  display: grid;
  place-items: center;
  height: 230px;
}

.home-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-card-kicker {
  font-weight: 700;
  opacity: .9;
  margin-top: 4px;
}

.home-card-title {
  font-size: 18px;
  font-weight: 800;
  margin: 6px 0 6px;
}

.home-card-meta {
  opacity: .85;
}

.home-footer {
  margin-top: 16px;
  opacity: .85;
}

/* =========================
   Seletor Norma / Acordo (viewer.html)
   ========================= */
.doc-label {
  font-weight: 700;
  opacity: .9;
  margin-left: 10px;
}

.doc-switch {
  display: inline-flex;
  gap: 6px;
  margin-left: 12px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
}

.doc-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  background: transparent;
  color: inherit;
  opacity: .85;
}

.doc-btn.active {
  background: rgba(255,255,255,.14);
  opacity: 1;
}



/* ===== Viewer Topbar Layout (Home + Centered Toggle) ===== */
.topbar{
  align-items: center;
}
.topbar-left, .topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 120px;
}
.topbar-center{
  flex:1;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-align:center;
  min-width: 0;
}
.topbar-title{
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 14px;
  opacity: .95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(720px, 92vw);
}
.home-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  font-weight: 900;
  font-size: 12px;
}
.home-btn:hover{ background: rgba(255,255,255,.12); }
.home-btn:active{ transform: translateY(1px); }

@media (max-width: 560px){
  .topbar-left, .topbar-right{ min-width: 90px; }
  .topbar-title{ font-size: 13px; }
}


/* Zoom/Pan */
.stage{touch-action:none;}
.page-img{touch-action:none;}

.doc-subtitle{margin-top:6px;font-size:12px;color:var(--muted);text-align:center;line-height:1.3;}

.overlay-header{
  gap: 12px;
}
.overlay-tools{
  display:flex;
  align-items:center;
  gap:10px;
  flex: 1;
  justify-content:flex-end;
}
.thumbs-filter{
  width: min(360px, 52vw);
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  font-size: 14px;
}
.thumbs-filter-mode{
  height: 40px;
  padding: 0 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  color: rgba(255,255,255,.92);
  outline: none;
}
.thumbs-filter-mode:focus{
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 0 0 3px rgba(255,255,255,.10);
}

.icon-btn.small{width:36px;height:36px;border-radius:12px;}

.home-footer{
  margin-top: 18px;
  padding: 14px 10px 22px;
  text-align:center;
  color: rgba(255,255,255,.60);
  font-size: 12px;
}


.home-footer-sign{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.65);
}


/* =========================
   Book-like page flip (no libs) - v1
   ========================= */
.stage{
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

.flip-wrap{
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.page-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* next image stays hidden until animation starts */
.page-img-next{
  opacity: 0;
}

body.is-flipping .page-img{
  pointer-events: none;
}

.flip-next #page-img{
  transform-origin: 0% 50%;
  animation: flipOutNext 640ms cubic-bezier(.22,1,.36,1) forwards;
}
.flip-next #page-img-next{
  opacity: 1;
  transform-origin: 100% 50%;
  transform: rotateY(-180deg);
  animation: flipInNext 640ms cubic-bezier(.22,1,.36,1) forwards;
}

.flip-prev #page-img{
  transform-origin: 100% 50%;
  animation: flipOutPrev 640ms cubic-bezier(.22,1,.36,1) forwards;
}
.flip-prev #page-img-next{
  opacity: 1;
  transform-origin: 0% 50%;
  transform: rotateY(180deg);
  animation: flipInPrev 640ms cubic-bezier(.22,1,.36,1) forwards;
}

@keyframes flipOutNext{
  0%   { transform: rotateY(0deg); filter: brightness(1); }
  45%  { filter: brightness(.88); }
  100% { transform: rotateY(-180deg); filter: brightness(.75); }
}
@keyframes flipInNext{
  0%   { transform: rotateY(180deg); filter: brightness(.75); }
  55%  { filter: brightness(.92); }
  100% { transform: rotateY(0deg); filter: brightness(1); }
}

@keyframes flipOutPrev{
  0%   { transform: rotateY(0deg); filter: brightness(1); }
  45%  { filter: brightness(.88); }
  100% { transform: rotateY(180deg); filter: brightness(.75); }
}
@keyframes flipInPrev{
  0%   { transform: rotateY(-180deg); filter: brightness(.75); }
  55%  { filter: brightness(.92); }
  100% { transform: rotateY(0deg); filter: brightness(1); }
}


/* Realismo: sombra dinâmica + curvatura sutil (sem libs) */
.fold-shadow, .mid-curve{
  position:absolute;
  inset:0;
  border-radius: 14px;
  pointer-events:none;
  opacity:0;
  z-index: 4;
  mix-blend-mode: multiply;
}

/* Sombra na dobra: bem sutil */
.fold-shadow{
  background: linear-gradient(90deg,
    rgba(0,0,0,0.00) 0%,
    rgba(0,0,0,0.06) 40%,
    rgba(0,0,0,0.14) 55%,
    rgba(0,0,0,0.00) 70%,
    rgba(0,0,0,0.00) 100%);
  filter: blur(0.2px);
}

/* “Curvatura” simulada no meio da folha (highlight + sombra) */
.mid-curve{
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 50% 50%,
      rgba(255,255,255,0.08) 0%,
      rgba(255,255,255,0.02) 38%,
      rgba(255,255,255,0.00) 62%),
    linear-gradient(90deg,
      rgba(255,255,255,0.00) 0%,
      rgba(255,255,255,0.035) 48%,
      rgba(0,0,0,0.035) 52%,
      rgba(255,255,255,0.00) 100%);
  filter: blur(0.25px);
}

.flip-next .fold-shadow{ opacity:1; animation: foldNext 640ms cubic-bezier(.22,1,.36,1) forwards; }
.flip-prev .fold-shadow{ opacity:1; animation: foldPrev 640ms cubic-bezier(.22,1,.36,1) forwards; }
.flip-next .mid-curve{ opacity:1; animation: curveNext 640ms cubic-bezier(.22,1,.36,1) forwards; }
.flip-prev .mid-curve{ opacity:1; animation: curvePrev 640ms cubic-bezier(.22,1,.36,1) forwards; }

@keyframes foldNext{
  0%   { transform: translateX(-6px); opacity:0.15; }
  35%  { transform: translateX(10px); opacity:0.28; }
  70%  { transform: translateX(18px); opacity:0.18; }
  100% { transform: translateX(26px); opacity:0.0; }
}
@keyframes foldPrev{
  0%   { transform: translateX(6px); opacity:0.15; }
  35%  { transform: translateX(-10px); opacity:0.28; }
  70%  { transform: translateX(-18px); opacity:0.18; }
  100% { transform: translateX(-26px); opacity:0.0; }
}
@keyframes curveNext{
  0%   { transform: translateX(-4px) scale(1.00); opacity:0.10; }
  50%  { transform: translateX(0px)  scale(1.01); opacity:0.14; }
  100% { transform: translateX(4px)  scale(1.00); opacity:0.00; }
}
@keyframes curvePrev{
  0%   { transform: translateX(4px) scale(1.00); opacity:0.10; }
  50%  { transform: translateX(0px) scale(1.01); opacity:0.14; }
  100% { transform: translateX(-4px) scale(1.00); opacity:0.00; }
}
