:root {
  --bg: #050505;
  --fg: #f0f0f0;
  --muted: #a6a6a6;
  --line: #2e2e2e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
}

.reader {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.reader-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

.back-link {
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.26rem 0.42rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.meta h1 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.meta p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.reader-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.reader-controls button,
.reader-controls input {
  border: 1px solid var(--line);
  background: #0e0e0e;
  color: var(--fg);
  font: inherit;
  font-size: 0.74rem;
  padding: 0.24rem 0.42rem;
}

.reader-controls button {
  cursor: pointer;
  text-transform: uppercase;
}

.nav-arrow {
  min-width: 2.05rem;
  padding: 0.22rem 0.3rem;
  font-size: 1rem;
  line-height: 1;
}

.reader-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reader-controls input {
  width: 4.2rem;
}

.page-total {
  font-size: 0.72rem;
  color: var(--muted);
}

.status {
  min-height: 1.1em;
  margin: 0;
  padding: 0.22rem 0.7rem 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.status.error {
  color: #f08d8d;
}

.spread {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.page-frame {
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: auto;
  background: #111;
}

.spread:not(.is-single) #page-left {
  justify-items: end;
}

.spread:not(.is-single) #page-right {
  justify-items: start;
}

.page-frame canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
}

.page-frame.is-hidden {
  display: none;
}

.seo-layer {
  position: absolute;
  left: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: normal;
}

@media (max-width: 860px) {
  .reader-top {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .reader-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .spread {
    grid-template-columns: 1fr;
  }
}
