body {
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-paper);
}

main {
    padding: 80px 0px;
    display: flex;
    flex-direction: column;
}

/* EPUB */
#viewer {
  width: 100%;
  height: 100vh;
  margin: 10px;
}

.chapter {
  page-break-before: always;
  break-before: page;
}

@media print {
  /* Força uma nova página ANTES de cada título de capítulo */
  h1 {
    page-break-before: always;
    break-before: page; /* Sintaxe moderna */
  }
}


/* ___________ Funcionalidades _____________ */

/* Em cima */
#toggleToc {
  display: flex;
  width: 180px;
  justify-content: center;
  align-self: end;
  margin: 0px 30px 0px 0px;
  color: var(--bg-paper);
  padding: 4px;
  background-color: var(--bg-marca);
  border: 2px solid var(--bg-marca);
  border-radius: 7px;
}

#toggleToc:hover {
  background-color: var(--bg-marca-ativo);
}

#toc {
  position: absolute;
  top: 110px; /* abaixo do botão */
  left: 116.5dvh;

  width: 190px;
  height: 320px;

  background: var(--bg-white);
  border: 1px solid var(--bg-paper);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);

  z-index: 1000; /* garante que fique por cima */

  overflow-y: auto; /* 👈 ativa scroll vertical */
  overflow-x: hidden;

  display: flex;
  margin: 0px 0px 0px 0px;
  align-self: end;
  padding: 4px;
}

#toc div:nth-child(odd) {
  background-color: var(--bg-paper);
}
#toc div:nth-child(even) {
  background-color: var(--bg-header);
}
#toc div {
  padding: 8px;
  cursor: pointer;
}
#toc div:hover {
  background-color: var(--cl-paper-ativo);
}

/* Roda pé */
#controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.passador-livro {
  display: flex;
  color: var(--bg-paper);
  background-color: var(--bg-marca);
  border-radius: 7px;

  align-items: center;
  justify-content: center;

  height: 30px;
  width: 120px;
}

@media (max-width: 768px) {
  #viewer {
    width: 100%;
    height: 70vh;
    margin: 2px;
  }

  #toggleToc {
    display: flex;
    width: 180px;
    justify-content: center;
    align-self: end;
    margin: 0px 5px 0px 0px;
    color: var(--bg-paper);
    padding: 4px;
    background-color: var(--bg-marca);
    border: 2px solid var(--bg-marca);
    border-radius: 7px;
  }

  #toc {
    position: absolute;
    top: 113px; /* abaixo do botão */
    left: 175px;

    width: 180px;
    max-height: 80dvh;

    background: var(--bg-white);
    border: 1px solid var(--bg-paper);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);

    z-index: 1000; /* garante que fique por cima */

    overflow-y: auto; /* 👈 ativa scroll vertical */
    overflow-x: hidden;

    display: flex;
    margin: 0px 10px 0px 0px;
    align-self: end;
    padding: 4px;
  }
}