:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #191816;
  color: #f5f1e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #191816;
}

button {
  font: inherit;
}

.viewer {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.series {
  margin: 0 0 4px;
  color: #d8cbb4;
  font-size: 0.76rem;
}

h1 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 650;
}

#counter {
  flex: none;
  color: #d8cbb4;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 65vh;
  overflow: hidden;
  border-radius: 4px;
  background: #0d0d0c;
}

#page {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  background: white;
  user-select: none;
  -webkit-user-drag: none;
}

.tap-zone {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  width: 36%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tap-next {
  left: 0;
}

.tap-previous {
  right: 0;
}

.controls {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 12px;
}

.control {
  flex: 1;
  min-height: 46px;
  border: 1px solid #625d54;
  border-radius: 8px;
  background: #292724;
  color: #f5f1e8;
  cursor: pointer;
}

.control.primary {
  order: -1;
  background: #f2eadb;
  color: #1a1917;
  font-weight: 650;
}

.control:disabled {
  opacity: 0.35;
  cursor: default;
}

.hint {
  margin: 9px 0 0;
  color: #aaa398;
  font-size: 0.75rem;
  text-align: center;
}

@media (min-width: 720px) {
  .viewer {
    padding-inline: 24px;
  }

  .stage {
    min-height: calc(100vh - 160px);
  }
}

