:root {
  --bg: #111214;
  --panel: #1a1c20;
  --text: #f2f2f2;
  --muted: #bfc3c9;
  --line: rgba(255,255,255,0.08);
  --accent: #d8d8d8;
  --shadow: 0 18px 40px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #141518 0%, #0f1012 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(17,18,20,0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08);
}

.controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.controls button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
}

.controls button:hover { transform: translateY(-1px); }
.controls button:disabled { opacity: 0.4; cursor: default; transform: none; }

#pageIndicator {
  min-width: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.viewer-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px 28px;
}

.status {
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 14px 18px;
}

.hidden { display: none !important; }

.book-container {
  width: min(96vw, 1400px);
  height: calc(100vh - 120px);
  max-height: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#book {
  margin: 0 auto;
  filter: drop-shadow(var(--shadow));
}

.page {
  background: #fff;
  overflow: hidden;
}

.page-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.page canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-direction: column;
  }

  .book-container {
    width: 100%;
    height: calc(100vh - 150px);
  }
}
