/* ==========================================
   Dragon Lady — Ebook Reader CSS
   ========================================== */

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

:root {
  --bg: #0d0d14;
  --bg2: #13131f;
  --bg3: #1a1a2e;
  --text: #e8e4d9;
  --text-muted: #8a8090;
  --accent: #e94560;
  --accent-dim: rgba(233, 69, 96, 0.2);
  --border: rgba(255,255,255,0.08);
  --font-serif: 'Noto Serif KR', 'Malgun Gothic', serif;
  --font-deco: 'Cinzel', serif;
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  min-height: 100vh;
  line-height: 1.8;
  transition: background 0.3s, color 0.3s;
}

/* ── 라이트 모드 ──────────────────────── */
body.light-mode {
  --bg: #f5f0e8;
  --bg2: #ede8dc;
  --bg3: #e0d8cc;
  --text: #2a2420;
  --text-muted: #7a706a;
  --border: rgba(0,0,0,0.1);
}

/* ==========================================
   로그인 화면
   ========================================== */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0d0d14 70%);
}

.login-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 56px 48px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
}

.login-dragon {
  font-size: 4rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(233, 69, 96, 0.5));
}

.login-title {
  font-family: var(--font-deco);
  font-size: 2rem;
  letter-spacing: 0.3em;
  color: #fff;
  margin-bottom: 8px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  letter-spacing: 0.1em;
}

.login-error {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.login-box input[type="password"] {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-serif);
  margin-bottom: 14px;
  outline: none;
  transition: border 0.2s;
}

.login-box input:focus {
  border-color: var(--accent);
}

.login-box button {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font-serif);
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: opacity 0.2s;
}

.login-box button:hover { opacity: 0.85; }

/* ==========================================
   메인 페이지
   ========================================== */
.main-wrap {
  min-height: 100vh;
}

/* 헤더 */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 20, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-title {
  font-family: var(--font-deco);
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  color: #fff;
}

.main-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  margin-top: 2px;
}

.logout-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--accent); }

/* 히어로 */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 24px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(233,69,96,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 20%, rgba(100,80,200,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 64px;
  align-items: center;
}

/* 표지 아트 */
.hero-cover {
  flex-shrink: 0;
}

.cover-art {
  width: 220px;
  height: 300px;
  background: linear-gradient(160deg, #1a1a3e 0%, #0d0d14 60%, #1a0a1a 100%);
  border: 1px solid rgba(233,69,96,0.3);
  border-radius: 4px 12px 12px 4px;
  box-shadow:
    -6px 0 16px rgba(0,0,0,0.6),
    0 16px 48px rgba(0,0,0,0.8),
    inset 4px 0 8px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cover-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(233,69,96,0.03) 29px
    );
}

.cover-dragon {
  font-size: 4.5rem;
  margin-bottom: 12px;
  position: relative;
  filter: drop-shadow(0 0 24px rgba(233, 69, 96, 0.6));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.cover-title {
  font-family: var(--font-deco);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  text-align: center;
  color: rgba(255,255,255,0.9);
  line-height: 1.6;
  position: relative;
}

.cover-deco {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233,69,96,0.4), transparent);
}

/* 히어로 정보 */
.hero-info {
  flex: 1;
}

.hero-genre {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero-booktitle {
  font-family: var(--font-deco);
  font-size: 2.8rem;
  letter-spacing: 0.1em;
  color: #fff;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.9;
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 32px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-n {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-l {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.read-btn {
  display: inline-block;
  padding: 14px 32px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 30px;
  font-size: 1rem;
  letter-spacing: 0.05em;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(233,69,96,0.4);
}

.read-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* 권별 목차 */
.volumes {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px;
}

.section-title {
  font-family: var(--font-deco);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.volume-card {
  background: linear-gradient(135deg, var(--from), var(--to));
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.vol-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.vol-number {
  font-family: var(--font-deco);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: rgba(233,69,96,0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(233,69,96,0.2);
  flex-shrink: 0;
}

.vol-title {
  font-size: 1.3rem;
  color: #fff;
  font-weight: 600;
}

.vol-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.vol-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chapter-list {
  padding: 12px 0;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.chapter-item:last-child {
  border-bottom: none;
}

.chapter-item:hover {
  background: rgba(255,255,255,0.05);
}

.ch-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 24px;
  flex-shrink: 0;
  text-align: right;
}

.ch-title {
  flex: 1;
  font-size: 0.95rem;
}

.ch-arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}

.chapter-item:hover .ch-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* 푸터 */
.main-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  border-top: 1px solid var(--border);
}

/* ==========================================
   리더 페이지
   ========================================== */
body.reader-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.reader-header {
  background: rgba(13,13,20,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.reader-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.back-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: color 0.2s;
}
.back-btn:hover { color: var(--accent); }

.reader-title-wrap {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-book-name {
  font-family: var(--font-deco);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.reader-sep {
  margin: 0 8px;
  opacity: 0.4;
}

.reader-settings {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.font-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.font-btn:hover { background: rgba(255,255,255,0.12); }

/* 챕터 히어로 */
.chapter-hero {
  background: linear-gradient(180deg, #1a1a3e 0%, var(--bg) 100%);
  flex-shrink: 0;
  padding: 40px 24px 32px;
}

.chapter-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.chapter-num-badge {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: rgba(233,69,96,0.1);
  border: 1px solid rgba(233,69,96,0.2);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.chapter-heading {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
}

.chapter-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0 auto;
}

/* 본문 */
.reader-main {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.reader-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 40px 80px;
  font-size: 18px;
  line-height: 2.1;
  color: var(--text);
}

.reader-content p {
  margin-bottom: 1.4em;
  word-break: keep-all;
  text-align: justify;
}

/* 하단 네비게이션 */
.chapter-nav {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chapter-nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  flex: 1;
  max-width: 280px;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.nav-prev { justify-content: flex-start; }
.nav-next { justify-content: flex-end; text-align: right; }

.nav-arrow {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nav-label small {
  font-size: 0.75rem;
  opacity: 0.7;
  display: block;
  margin-top: 2px;
}

.nav-home {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.nav-home:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

/* ==========================================
   반응형
   ========================================== */
@media (max-width: 768px) {
  .hero-content {
    flex-direction: column;
    gap: 40px;
    align-items: center;
    text-align: center;
  }

  .hero-stats { justify-content: center; }
  .hero-desc { max-width: none; }

  .hero-booktitle { font-size: 2rem; }

  .cover-art {
    width: 180px;
    height: 240px;
  }

  .reader-content {
    padding: 32px 20px 60px;
    font-size: 16px;
  }

  .chapter-heading { font-size: 1.3rem; }

  .reader-title-wrap { display: none; }

  .nav-label small { display: none; }
}

@media (max-width: 480px) {
  .login-box { padding: 40px 28px; }
  .vol-header { padding: 18px 20px; gap: 12px; }
  .chapter-item { padding: 12px 20px; }
}

/* ==========================================
   스크롤바 커스텀
   ========================================== */
.reader-main::-webkit-scrollbar {
  width: 6px;
}
.reader-main::-webkit-scrollbar-track {
  background: var(--bg);
}
.reader-main::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.reader-main::-webkit-scrollbar-thumb:hover {
  background: rgba(233,69,96,0.4);
}

/* 라이트 모드 오버라이드 */
body.light-mode .main-header {
  background: rgba(245, 240, 232, 0.92);
}
body.light-mode .reader-header {
  background: rgba(245, 240, 232, 0.95);
}
body.light-mode .chapter-hero {
  background: linear-gradient(180deg, #ddd8cc 0%, var(--bg) 100%);
}
body.light-mode .chapter-heading { color: #1a1a1a; }
body.light-mode .login-wrap {
  background: radial-gradient(ellipse at center, #e0d8cc 0%, #c8c0b0 100%);
}
body.light-mode .login-box {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.1);
}
body.light-mode .login-box input[type="password"] {
  background: rgba(0,0,0,0.05);
  color: #2a2420;
}
body.light-mode .volume-card {
  border-color: rgba(0,0,0,0.1);
}
