:root {
  --brand: #006747;
  --bg: #2b2b2b;
  --toolbar: #1c1c1c;
  --ink: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

header {
  background: var(--brand);
  padding: 0.6rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
header span { font-size: 0.9rem; opacity: 0.9; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; }

#stage { display: flex; justify-content: center; }
#book { margin: 0 auto; }

#book .page {
  background: #ffffff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
}

#book .page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#toolbar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  background: transparent;
}

#toolbar button,
#toolbar a {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

#toolbar button:hover:not(:disabled),
#toolbar a:hover { background: rgba(255, 255, 255, 0.22); }

#toolbar button:disabled { opacity: 0.35; cursor: default; }

#toolbar button:focus-visible,
#toolbar a:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

#counter {
  min-width: 7ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#error {
  display: none;
  background: #fff3cd;
  color: #1a1a1a;
  border: 1px solid #e0c97f;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.failed #error { display: block; }
.failed #stage, .failed #toolbar { display: none; }

/* Only does anything if you added the clickable link hotspots. Harmless otherwise. */

.hotspot {
  position: absolute;
  display: block;
  z-index: 5;
}

.show-hotspots .hotspot {
  outline: 2px solid red;
  background: rgba(255, 0, 0, 0.15);
}

#coords {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 999;
  background: #000000;
  color: #00ff88;
  font-family: monospace;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}