:root {
  --bg: #090b10;
  --header-bg: rgba(14, 18, 27, 0.85);
  --border: rgba(255, 255, 255, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #f472b6;
  --accent-glow: rgba(244, 114, 182, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
}

/* 顶部栏 */
.header {
  height: 56px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.book-title {
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-indicator {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

/* 阅读器主区域 */
.reader-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: calc(100vh - 56px);
}

.reader-main {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 10px;
}

.image-wrapper {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-wrapper img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: opacity 0.15s ease;
}

/* 导航箭头 */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  z-index: 10;
}

.nav-arrow:hover {
  background: rgba(244, 114, 182, 0.6);
}

.nav-arrow.left {
  left: 16px;
}

.nav-arrow.right {
  right: 16px;
}

/* 底部滑块控制 */
.reader-footer {
  width: 100%;
  max-width: 600px;
  padding: 12px 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.reader-footer input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.btn-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* 画廊模式 */
.gallery-container {
  padding: 24px 20px 80px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .book-title {
    font-size: 0.95rem;
  }
  .nav-arrow {
    width: 36px;
    height: 60px;
    font-size: 1.8rem;
  }
  .nav-arrow.left { left: 4px; }
  .nav-arrow.right { right: 4px; }
}
