:root {
  --background: #0d0e10;
  --surface: #181a1d;
  --text: #e5e5e5;
  --muted: #888;
  --border: #2a2d32;
  --accent: #ff4757;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Noto Sans SC", Arial, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* 顶部 Header */
.reader-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: rgba(13, 14, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.reader-header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
}

#archive-label {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
}

h1 {
  font-size: 16px;
  margin: 2px 0 0 0;
}

#chapter-title {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* RTL 常驻 Badge */
.rtl-badge {
  font-size: 12px;
  color: #ff9f43;
  background: rgba(255, 159, 67, 0.1);
  border: 1px solid rgba(255, 159, 67, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 右侧控制区与页码选择器 */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-selector {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

#page-select {
  background: transparent;
  color: var(--text);
  border: none;
  font-size: 13px;
  font-family: "Space Mono", monospace;
  padding: 4px 2px;
  cursor: pointer;
  outline: none;
}

#page-select option {
  background: var(--surface);
  color: var(--text);
}

#total-pages {
  font-size: 12px;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  margin-left: 4px;
}

.controls button {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.controls button:hover {
  background: var(--surface);
}

/* 漫画显示区 */
#comic-container {
  width: 100vw;
  height: 100vh;
  padding-top: 65px;
  display: flex;
  justify-content: center;
  align-items: center;
  direction: ltr !important;
  cursor: pointer;
}

#comic-container img {
  max-width: 96vw;
  max-height: calc(100vh - 85px);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
  border-radius: 2px;
}

/* RTL Toast */
.rtl-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(20, 22, 26, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  padding: 20px 30px;
  border-radius: 8px;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.rtl-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast-arrows {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #fff;
  margin-bottom: 8px;
}

.arrow-next {
  color: #54a0ff;
  font-weight: bold;
}

.arrow-prev {
  color: #888;
}

.toast-content p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

.error {
  color: var(--accent);
  font-size: 14px;
}

/* 移动端/小屏适配 */
@media (max-width: 700px) {
  .reader-header {
    padding: 0 15px;
    height: 55px;
  }

  .rtl-badge {
    display: none;
  }

  #comic-container {
    padding-top: 55px;
  }

  #comic-container img {
    max-width: 98vw;
    max-height: calc(100vh - 65px);
  }

  .toast-arrows {
    flex-direction: column;
    gap: 8px;
  }
}