:root {
  color-scheme: light;
  --paper: #f1f0e8;
  --ink: #344431;
  --bar: calc(76px + env(safe-area-inset-bottom, 0px));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--paper); color: var(--ink); }
button { font: inherit; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.stage {
  position: fixed;
  inset: 0 0 var(--bar);
  height: calc(100vh - var(--bar));
  height: calc(100dvh - var(--bar));
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
#book-page {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}
.controls {
  position: fixed;
  inset: auto 0 0;
  height: var(--bar);
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #fbfaf5;
  border-top: 1px solid #d8ddcf;
}
.controls-inner { display: grid; grid-template-columns: 1fr 74px 1fr; align-items: center; gap: 12px; max-width: 540px; height: 100%; margin: 0 auto; }
.controls button { min-height: 48px; border: 1px solid #344431; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.back { color: var(--ink); background: transparent; }
.next { color: #fff; background: var(--ink); }
.controls button:disabled { opacity: .28; cursor: default; }
.controls button:active:not(:disabled) { transform: translateY(1px); }
.controls button:focus-visible { outline: 3px solid #b7934b; outline-offset: 3px; }
.controls button span { padding: 0 4px; }
.position { position: relative; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: #65705e; }
.loading-dot { display: none; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #65705e; left: calc(50% - 2.5px); bottom: -10px; }
body.is-turning .loading-dot { display: block; animation: pulse 1s ease-in-out infinite alternate; }
.notice { position: fixed; z-index: 2; left: 24px; right: 24px; bottom: calc(var(--bar) + 12px); width: fit-content; max-width: calc(100% - 48px); margin: 0 auto; padding: 12px 18px; border: 1px solid #c9cdbc; border-radius: 12px; background: #fffdf4; color: var(--ink); box-shadow: 0 4px 20px #30372f18; font-size: 14px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes pulse { to { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
@media (max-height: 480px) { :root { --bar: calc(60px + env(safe-area-inset-bottom, 0px)); } .controls { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); } }
