:root {
  --stage: #e6e6e6;
  --bar: #4a4a4a;
  --ink: #f5f5f5;
  --muted: #c8c8c8;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--stage);
  color: #222;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  overflow: hidden;
}
.app { display: flex; flex-direction: column; height: 100%; min-height: 100dvh; }
.topbar {
  display: none; /* Flipso-style: controls live in bottom bar */
}
#stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 56px 16px;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--stage);
}
#book {
  margin: 0 auto;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
#book .page {
  background: #fff;
  overflow: hidden;
}
#book .page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
}
body.zoomed #book { transform: scale(1.08); transform-origin: center center; }
.nav-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.85);
  color: #333;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
}
.nav-side:hover { background: #fff; }
.nav-side:disabled { opacity: 0.35; cursor: default; }
#btnPrevSide { left: 10px; }
#btnNextSide { right: 10px; }
.bottombar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bar);
  color: var(--ink);
  z-index: 20;
  flex-wrap: wrap;
}
.bottombar a.back {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  white-space: nowrap;
}
.bottombar a.back:hover { background: rgba(255,255,255,0.12); }
.bottombar .title {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  min-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls button {
  background: rgba(255,255,255,0.1);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.controls button:hover { background: rgba(255,255,255,0.18); }
#pageInfo {
  min-width: 72px; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px;
}
.hint { display: none; }
@media (max-width: 640px) {
  #stage { padding: 8px 48px 8px; }
  .bottombar .title { display: none; }
  .controls button { padding: 7px 9px; font-size: 12px; }
}
