* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, #2b2b2b 0%, #161616 45%, #0f0f0f 100%);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(20, 20, 20, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.left-tools,
.center-tools,
.right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar button,
.topbar a {
  background: linear-gradient(180deg, #f04b65, #c61f43);
  color: #fff;
  border: none;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.topbar button:hover,
.topbar a:hover {
  filter: brightness(1.07);
}

.topbar input {
  width: 220px;
  max-width: 60vw;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #1d1d1d;
  color: #fff;
}

#pageInfo {
  min-width: 140px;
  text-align: center;
  font-weight: bold;
  color: #f6d9df;
}

.viewer-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 10px 18px;
  overflow: auto;
}

#book {
  width: 1200px;
  max-width: 96vw;
  height: 780px;
  max-height: calc(100vh - 160px);
  margin: 0 auto;
}

.page {
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.08);
}

.page-inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
}

.page canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.page-number-badge {
  position: absolute;
  right: 10px;
  bottom: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
}

.hotspot {
  position: absolute;
  background: transparent;
  cursor: pointer;
}

.hotspot-homologadas {
  left: 27%;
  top: 38%;
  width: 46%;
  height: 18%;
  border-radius: 10px;
}

.hotspot-homologadas:hover {
  outline: 3px solid rgba(230, 57, 70, 0.45);
  outline-offset: 0;
}

#statusBar {
  min-height: 28px;
  text-align: center;
  padding: 6px 12px 12px;
  color: #ddd;
  font-size: 14px;
}

@media (max-width: 900px) {
  #book {
    width: 96vw;
    height: 72vh;
  }

  .topbar {
    justify-content: center;
  }

  .left-tools,
  .center-tools,
  .right-tools {
    flex-wrap: wrap;
    justify-content: center;
  }

  .topbar input {
    width: 180px;
  }

}
#loadingOverlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 35%),
    linear-gradient(135deg, #120c10 0%, #1d1116 35%, #2c0f19 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#loadingOverlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-card {
  width: min(92vw, 420px);
  padding: 28px 24px;
  border-radius: 24px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  text-align: center;
}

.loader-logo {
  font-size: clamp(42px, 8vw, 74px);
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1;
  margin-bottom: 18px;
  background: linear-gradient(90deg, #ff8a5b, #ff4d6d, #d90452);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tshGlow 1.6s ease-in-out infinite alternate;
}

@keyframes tshGlow {
  from {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(255, 90, 120, 0.25));
  }
  to {
    transform: scale(1.03);
    filter: drop-shadow(0 0 18px rgba(255, 90, 120, 0.5));
  }
}

.loader-ring {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.12);
  border-top-color: #ff5d73;
  border-right-color: #ff8a5b;
  animation: ringSpin 1s linear infinite;
}

@keyframes ringSpin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.loader-subtext {
  font-size: 14px;
  color: #ffd5dd;
  margin-bottom: 16px;
}

.loader-bar {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  overflow: hidden;
}

.loader-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a5b, #ff4d6d, #d90452);
  transition: width 0.25s ease;
}