* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
}

#reader-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#close-reader, #dark-mode-toggle {
  background: none;
  border: none;
  color: white;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  min-width: 44px;
}

#pdf-container {
  background: #e0e0e0;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

#pages-wrapper {
  padding: 8px 0;
  transform-origin: 0 0;
}

.page-wrapper {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.page-canvas {
  display: block;
}

body.dark-mode {
  background: #1a1a1a;
}

body.dark-mode #pdf-container {
  background: #2a2a2a;
}

body.dark-mode .page-wrapper {
  background: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark-mode .page-canvas {
  filter: invert(0.9) hue-rotate(180deg);
}

#pdf-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 20;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
}

#pdf-controls.hidden {
  transform: translateY(100%);
}

#prev-btn, #next-btn {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  min-width: 44px;
}

#page-info {
  color: white;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#page-input {
  width: 3rem;
  padding: 0.5rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
}

#page-total {
  color: rgba(255, 255, 255, 0.6);
}
