@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

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

:root {
  --bg:         #FFFDF7;
  --primary:    #FF85A1;
  --primary-dk: #CC5580;
  --accent:     #C9B8FF;
  --accent2:    #FFD166;
  --mint:       #B8F0E0;
  --text:       #3A2A3A;
  --muted:      #999;
  --error:      #FF4D6D;
  --navy:       #1a1a2e;
  --radius-card: 20px;
  --radius-btn:  50px;
  --shadow:      0 4px 24px rgba(58,42,58,0.08);
  --shadow-lg:   0 12px 48px rgba(58,42,58,0.14);
  --font:        'Noto Sans KR', -apple-system, sans-serif;
  --secondary:   #C9B8FF;
  --text-muted:  #999;
  --border:      #efe8f0;
  --card-bg:     #fff;
}

body { font-family: var(--font); background: #0a0818; color: var(--text); line-height: 1.6; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 12px 28px; border-radius: var(--radius-btn); font-size: 15px; font-weight: 700; cursor: pointer; border: none; transition: transform 0.15s, box-shadow 0.15s; text-decoration: none; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dk)); color: #fff; }
.btn-ghost { background: transparent; border: 2px solid var(--primary); color: var(--primary-dk); }
.btn-sm { padding: 8px 18px; font-size: 13px; }

/* Cards */
.card { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 24px; }
.card-hover { transition: transform 0.2s, box-shadow 0.2s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* Role badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 50px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-free     { background: #f0f0f0; color: var(--muted); }
.badge-premium  { background: #fff3cd; color: #b8860b; }
.badge-premium2 { background: #ffecd2; color: #c76e00; }
.badge-premium3 { background: #ffe0e0; color: #b83030; }
.badge-enterprise { background: #d4edda; color: #155724; }
.badge-admin    { background: #cce5ff; color: #004085; }
.badge-fairytale { background: #d4f5e9; color: #1a6b4a; }
.badge-inkwash   { background: #fff3cd; color: #b8860b; }
.badge-classic  { background: #f5e6d3; color: #7a4a1e; }
.badge-realistic{ background: #e8d5f5; color: #5a2d82; }

/* Error banner */
.error-banner { background: #fff5f7; border: 1px solid var(--error); border-radius: 12px; color: var(--error); padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }

/* Toast */
.toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 24px; border-radius: 50px; font-size: 14px; z-index: 9999; pointer-events: none; animation: fadeInUp 0.3s ease; }
@keyframes fadeInUp { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* Sparkle decoration */
.sparkle-bg { background-image: radial-gradient(circle, var(--accent) 1px, transparent 1px); background-size: 40px 40px; background-position: 0 0; opacity: 0.18; pointer-events: none; }

/* Page wrapper */
.page { min-height: 100vh; padding-top: 64px; position: relative; z-index: 1; }
.page-center { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 64px); }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* NavBar */
.navbar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: calc(100% - 48px); max-width: 1200px; height: 56px; background: rgba(18, 12, 40, 0.75); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(180, 130, 255, 0.15); border-radius: 50px; z-index: 1000; box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
.navbar-inner { padding: 0 28px; height: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.navbar-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.navbar-brand-icon { flex-shrink: 0; }
.navbar-brand span { font-size: 18px; font-weight: 900; color: var(--primary-dk); letter-spacing: -0.3px; }
.navbar-center { display: flex; align-items: center; gap: 32px; justify-self: center; }
.navbar-link { font-size: 12px; font-weight: 500; color: var(--text-muted); text-decoration: none; padding: 6px 4px; letter-spacing: 1.5px; transition: color 0.15s; }
.navbar-link:hover { color: var(--secondary); }
.navbar-right { display: flex; align-items: center; gap: 12px; justify-self: end; }
.btn-login-pill { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff !important; padding: 8px 22px; border-radius: 50px; font-size: 13px; font-weight: 700; border: none; cursor: pointer; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
.btn-login-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4); }
.quota-badge { font-size: 12px; font-weight: 700; background: #fff0f3; color: var(--primary-dk); padding: 4px 12px; border-radius: 50px; border: 1px solid var(--primary); }
.avatar-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 12px; border-radius: 50px; transition: background 0.15s; position: relative; }
.avatar-wrap:hover { background: rgba(140, 80, 255, 0.12); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.avatar-name { font-size: 14px; font-weight: 700; }
.chevron { font-size: 11px; color: var(--muted); }
.dropdown { position: absolute; top: 56px; right: 0; background: rgba(20, 12, 40, 0.95); backdrop-filter: blur(16px); border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); padding: 8px; min-width: 160px; border: 1px solid rgba(140, 80, 255, 0.25); z-index: 100; }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; color: rgba(220, 200, 255, 0.9); text-decoration: none; cursor: pointer; background: none; border: none; transition: background 0.1s; }
.dropdown-item:hover { background: rgba(140, 80, 255, 0.15); }
.dropdown-divider { height: 1px; background: rgba(140, 80, 255, 0.2); margin: 6px 0; }

/* StepIndicator */
.step-indicator { display: flex; align-items: center; gap: 0; margin-bottom: 40px; justify-content: center; }
.step-item { display: flex; align-items: center; gap: 8px; }
.step-circle { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; transition: all 0.2s; flex-shrink: 0; }
.step-circle.done   { background: var(--primary); color: #fff; }
.step-circle.active { background: #fff; border: 2.5px solid var(--primary); color: var(--primary-dk); box-shadow: 0 0 0 4px rgba(255,133,161,0.15); }
.step-circle.pending{ background: #f0f0f0; color: var(--muted); }
.step-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.step-label.active { color: var(--primary-dk); }
.step-line { width: 48px; height: 2px; background: #f0f0f0; margin: 0 4px; }
.step-line.done { background: var(--primary); }

/* Landing (legacy — kept for reference) */
.landing { padding-top: 64px; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }

/* =====================================================
   Landing Dark — Magic Night Sky Theme
   ===================================================== */

/* Navbar override when on landing */
.is-landing .navbar {
  background: rgba(10, 8, 28, 0.65);
  border-color: rgba(180, 130, 255, 0.2);
}
.is-landing .navbar-brand span { color: #f5d97a; }
.is-landing .navbar-link { color: rgba(220, 200, 255, 0.75); }
.is-landing .navbar-link:hover { color: #f5d97a; }
.is-landing .avatar-name { color: rgba(220, 200, 255, 0.9); }
.is-landing .chevron { color: rgba(180, 130, 255, 0.6); }

/* Page base */
.landing-dark {
  position: relative;
  min-height: 100vh;
  background: transparent;
  overflow-x: hidden;
  margin-top: -64px;
  padding-top: 0;
}

/* Hero video background */
.hero-video-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

/* Hero */
.hero-dark {
  position: relative;
  z-index: 0;
  padding: 0 0 16px;
  margin-top: 0;
  padding-top: 0;
}
.hero-scene {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-dark-text {
  position: relative;
  z-index: 2;
  max-width: 600px;
  text-align: center;
  padding: 0 24px;
}
.hero-dark-headline {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 900;
  line-height: 1.18;
  background: linear-gradient(135deg, #f5d97a 0%, #ffb3c8 50%, #c9b8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 24px rgba(245, 217, 122, 0.3));
}
.hero-dark-sub {
  font-size: 16px;
  color: rgba(210, 195, 240, 0.85);
  line-height: 1.7;
}

.btn-magic-primary {
  background: linear-gradient(135deg, #ff6b9d, #c44dff);
  color: #fff;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(196, 77, 255, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-magic-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(196, 77, 255, 0.6); }

.btn-magic-ghost {
  background: transparent;
  color: rgba(220, 200, 255, 0.9);
  padding: 13px 32px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  border: 1.5px solid rgba(180, 130, 255, 0.45);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-magic-ghost:hover { transform: translateY(-2px); background: rgba(180, 130, 255, 0.12); border-color: rgba(180, 130, 255, 0.7); }

/* CTA */
.cta-dark {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px 32px;
}
.btn-cta-large {
  background: linear-gradient(135deg, #7c3aed, #a855f7, #c44dff);
  color: #fff;
  padding: 18px 56px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 32px rgba(124, 58, 237, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.5px;
}
.btn-cta-large:hover { transform: translateY(-3px); box-shadow: 0 10px 40px rgba(124, 58, 237, 0.65); }

/* Feature cards */
.features-dark {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 0 24px 32px;
}
.feature-glass-card {
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(180, 130, 255, 0.22);
  border-radius: 24px;
  padding: 36px 24px 28px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 48px rgba(130, 60, 200, 0.3);
  border-color: rgba(180, 130, 255, 0.45);
}
.feature-icon-wrap {
  width: 90px;
  height: 90px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  overflow: hidden;
}
.feature-dark-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  mix-blend-mode: screen;
}
.feature-dark-title {
  font-size: 17px;
  font-weight: 800;
  color: #f0e8ff;
  margin-bottom: 8px;
}
.feature-dark-desc {
  font-size: 13px;
  color: rgba(190, 170, 230, 0.7);
  line-height: 1.65;
}

/* Sample books (dark) */
.samples-dark {
  position: relative;
  z-index: 1;
  padding: 0 24px 60px;
}

/* Community popular section on landing */
.community-popular-dark { position: relative; z-index: 1; padding: 0 24px 80px; }
.community-grid-dark { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.community-card-dark {
  border-radius: 16px; overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(180,130,255,0.15);
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.community-card-dark:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(130,60,200,0.25); }
.community-card-cover { aspect-ratio: 4/3; overflow: hidden; background: linear-gradient(135deg, #2a1060, #1a0a3d); }
.community-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.community-card-info { padding: 12px 14px 14px; }
.community-card-title { font-size: 14px; font-weight: 800; color: #e8d8ff; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.community-card-author { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; color: rgba(200,170,255,0.6); }
.community-card-avatar { width: 18px; height: 18px; border-radius: 50%; }
.community-card-meta { display: flex; align-items: center; gap: 8px; }
.community-card-likes, .community-card-comments { display: flex; align-items: center; gap: 3px; font-size: 12px; color: rgba(200,170,255,0.5); }
.community-more { text-align: center; margin-top: 24px; }
@media (max-width: 768px) { .community-grid-dark { grid-template-columns: repeat(2, 1fr); } }
.section-title-dark {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 28px;
  text-align: center;
  background: linear-gradient(135deg, #f5d97a, #c9b8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.samples-grid-dark { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.sample-dark-card {
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(180, 130, 255, 0.18);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.sample-dark-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(130, 60, 200, 0.3); }
.sample-dark-cover {
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #2a1060, #1a0a3d);
  position: relative;
  overflow: hidden;
}
.sample-dark-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sample-dark-info { padding: 14px 16px; }
.sample-dark-title { font-size: 14px; font-weight: 700; color: #e8deff; margin: 7px 0 3px; }
.sample-dark-pages { font-size: 12px; color: rgba(180, 160, 220, 0.6); }

/* =====================================================
   Library Dark — Enchanted Archive Theme
   ===================================================== */

/* Responsive: landing hero */
@media (max-width: 768px) {
  .hero-dark { padding: 74px 12px 32px; }
  .hero-dark-text { max-width: 280px; }
  .hero-dark-headline { font-size: clamp(28px, 6vw, 42px); }
  .hero-dark-sub { font-size: 13px; }
  .features-dark { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 48px; }
  .btn-cta-large { padding: 16px 40px; font-size: 16px; }
}
@media (max-width: 480px) {
  .hero-scene { border-radius: 16px; }
  .hero-dark-text { max-width: 220px; }
}

/* Navbar override for all dark pages (landing + library) */
.is-dark-page .navbar,
.is-landing .navbar {
  background: rgba(10, 8, 28, 0.65);
  border-color: rgba(180, 130, 255, 0.2);
}
.is-dark-page .navbar-brand span, .is-landing .navbar-brand span { color: #f5d97a; }
.is-dark-page .navbar-link, .is-landing .navbar-link { color: rgba(220, 200, 255, 0.75); }
.is-dark-page .navbar-link:hover, .is-landing .navbar-link:hover { color: #f5d97a; }
.is-dark-page .avatar-name, .is-landing .avatar-name { color: rgba(220, 200, 255, 0.9); }
.is-dark-page .chevron, .is-landing .chevron { color: rgba(180, 130, 255, 0.6); }

.library-dark {
  position: relative;
  min-height: 100vh;
  background: transparent;
  overflow-x: hidden;
}


.lib-dark-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

/* Header */
.lib-dark-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
}
.lib-dark-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 900;
  background: linear-gradient(135deg, #f5d97a 0%, #ffb3c8 60%, #c9b8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 16px rgba(245, 217, 122, 0.25));
}
.lib-dark-quota {
  font-size: 13px;
  color: rgba(200, 170, 240, 0.6);
  font-weight: 500;
}

/* Enchanted buttons */
.btn-enchant-primary {
  background: linear-gradient(135deg, #e040a0, #9c27b0, #f5c842);
  color: #fff;
  padding: 11px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(200, 50, 180, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-enchant-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(200, 50, 180, 0.55); }

.btn-enchant-read {
  background: linear-gradient(135deg, #c0392b, #e040a0);
  color: #fff;
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(200, 50, 120, 0.4);
  transition: transform 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-enchant-read:hover { transform: translateY(-1px); }

.btn-enchant-progress {
  background: rgba(245, 200, 66, 0.18);
  color: #f5c842;
  border: 1.5px solid rgba(245, 200, 66, 0.4);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-enchant-fail {
  background: rgba(255, 100, 100, 0.15);
  color: #ffb3b3;
  border: 1.5px solid rgba(255, 100, 100, 0.3);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Loading */
.lib-dark-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 0;
  color: rgba(200, 170, 240, 0.6);
  font-size: 14px;
}
.lib-loading-ring {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(200, 150, 255, 0.2);
  border-top-color: #c9b8ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.lib-dark-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 0 80px;
}
.lib-empty-img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  mix-blend-mode: screen;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(245, 200, 100, 0.4));
  animation: float 3.5s ease-in-out infinite;
}
.lib-empty-title {
  font-size: 20px;
  font-weight: 800;
  color: #e8d8ff;
  margin-bottom: 8px;
}
.lib-empty-sub {
  color: rgba(190, 160, 230, 0.65);
  font-size: 14px;
  margin-bottom: 28px;
}

/* Book grid */
.lib-dark-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 768px) { .lib-dark-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .lib-dark-grid { grid-template-columns: 1fr; } }

.lib-dark-card {
  position: relative;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(220, 150, 100, 0.22);
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 4px 24px rgba(180, 60, 100, 0.12);
}
.lib-dark-card.lib-selected {
  border-color: rgba(245,200,120,0.7);
  box-shadow: 0 0 16px rgba(245,200,120,0.2);
}
.lib-select-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(200,168,255,0.4);
  background: rgba(20,10,50,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  color: rgba(200,168,255,0.5);
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.lib-select-check.checked {
  border-color: rgba(245,200,120,0.8);
  background: rgba(245,200,120,0.2);
  color: rgba(245,200,120,0.95);
}
.lib-dark-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(200, 80, 140, 0.3);
  border-color: rgba(245, 150, 120, 0.45);
}

.lib-dark-cover {
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #1a0830, #2a0e3a);
  position: relative;
  overflow: hidden;
}
.lib-dark-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lib-dark-cover-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Overlays */
.lib-dark-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 25, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  backdrop-filter: blur(4px);
}
.lib-dark-overlay-fail { background: rgba(80, 10, 20, 0.72); }
.lib-dark-overlay-queue { background: rgba(30, 10, 50, 0.72); }
.lib-dark-overlay-label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(220, 200, 255, 0.85);
}
.lib-dark-ring {
  position: relative;
  width: 64px;
  height: 64px;
}
.lib-dark-ring svg { width: 64px; height: 64px; }
.lib-dark-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #f5c878;
}

/* Card body */
.lib-dark-body { padding: 16px; }
.lib-dark-book-title {
  font-size: 15px;
  font-weight: 700;
  color: #ede0ff;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-dark-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.lib-dark-pages, .lib-dark-date { font-size: 12px; color: rgba(180, 150, 220, 0.6); }
.lib-dark-synopsis { font-size: 13px; color: rgba(210,185,255,0.5); line-height: 1.4; margin-top: 4px; }
.lib-scenario-edit-input {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(245,200,120,0.4);
  border-radius: 6px; padding: 4px 8px; color: #fff; font-size: 14px; font-weight: 700;
  font-family: var(--font); width: 100%; outline: none;
}
.lib-dark-dot { color: rgba(180, 150, 220, 0.35); font-size: 11px; }
.lib-dark-actions { display: flex; align-items: center; gap: 8px; }
.lib-dark-share {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(200, 150, 255, 0.3);
  background: rgba(200, 150, 255, 0.08);
  color: rgba(200, 150, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lib-dark-share:hover { background: rgba(200, 150, 255, 0.18); border-color: rgba(200, 150, 255, 0.55); }

/* Login */
.login-card { max-width: 420px; width: 100%; padding: 48px 40px; text-align: center; }
.login-emoji { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 32px; font-weight: 900; color: var(--primary-dk); margin-bottom: 8px; }
.login-sub { font-size: 15px; color: var(--muted); margin-bottom: 32px; }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 24px; border: 2px solid #e0e0e0; border-radius: var(--radius-btn); background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s; margin-bottom: 20px; font-family: var(--font); }
.btn-google:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.login-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.login-hint a { color: var(--primary-dk); }

/* Create Flow */
.create-container { max-width: 640px; padding: 48px 24px; margin: 0 auto; }
.create-title { font-size: 28px; font-weight: 900; margin-bottom: 8px; }
.create-sub { font-size: 15px; color: var(--muted); margin-bottom: 32px; }
.create-actions { display: flex; justify-content: flex-end; margin-top: 32px; gap: 12px; }
.upload-zone { border: 2.5px dashed var(--primary); border-radius: var(--radius-card); padding: 48px 24px; text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.upload-zone:hover, .upload-zone.dragover { background: #fff0f3; border-color: var(--primary-dk); }
.upload-zone.has-file { padding: 16px; }
.upload-icon { font-size: 52px; }
.upload-text { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.6; }
.upload-text span { color: var(--primary-dk); text-decoration: underline; }
.upload-hint { font-size: 13px; color: var(--muted); }
.upload-preview { max-height: 320px; max-width: 100%; border-radius: 16px; object-fit: cover; }
.upload-change { font-size: 13px; color: var(--primary-dk); font-weight: 600; margin-top: 8px; }
.style-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.style-card { padding: 24px; cursor: pointer; border: 2.5px solid transparent; position: relative; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.style-card.selected { box-shadow: 0 0 0 3px rgba(255,133,161,0.35), var(--shadow-lg); }
.style-emoji { font-size: 36px; margin-bottom: 10px; }
.style-name { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.style-desc { font-size: 13px; color: var(--muted); }
.style-check { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.story-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.story-pill { padding: 10px 20px; border-radius: 50px; border: 2px solid #e8e8e8; background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: var(--font); }
.story-pill:hover { border-color: var(--primary); color: var(--primary-dk); }
.story-pill.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.name-input { width: 100%; padding: 16px 20px; border: 2px solid #e8e8e8; border-radius: 16px; font-size: 20px; font-weight: 700; font-family: var(--font); transition: border-color 0.15s; outline: none; margin-bottom: 6px; }
.name-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,133,161,0.15); }
.name-hint { text-align: right; font-size: 12px; color: var(--muted); margin-bottom: 24px; }
.summary-card { display: flex; gap: 16px; align-items: center; padding: 20px; background: #fff0f3; border: 1px solid var(--primary); border-radius: var(--radius-card); }
.summary-photo { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: linear-gradient(135deg,var(--accent),var(--primary)); display: flex; align-items: center; justify-content: center; }
.summary-photo img { width: 100%; height: 100%; object-fit: cover; }
.summary-photo-placeholder { font-size: 32px; }
.summary-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }

/* =====================================================
   Enchanted Workflow — Create Steps + Generating
   ===================================================== */

/* Body override for dark pages */
body.is-dark-page {
  background: #0a0818;
}

/* Shared dark page background */
.enchanted-page {
  background: transparent;
  min-height: 100vh;
}

/* StepIndicator dark overrides */
.is-dark-page .step-circle.done   { background: linear-gradient(135deg, #e040a0, #f5c842); }
.is-dark-page .step-circle.active { background: transparent; border-color: #f5c842; color: #f5c842; box-shadow: 0 0 0 4px rgba(245,200,66,0.15); }
.is-dark-page .step-circle.pending{ background: rgba(255,255,255,0.06); border: 2px solid rgba(200,150,100,0.25); color: rgba(180,150,220,0.5); }
.is-dark-page .step-label         { color: rgba(180,150,220,0.55); }
.is-dark-page .step-label.active  { color: #f5c842; }
.is-dark-page .step-line          { background: rgba(200,150,100,0.2); }
.is-dark-page .step-line.done     { background: linear-gradient(90deg, #e040a0, #f5c842); }

/* Titles & sub */
/* Narration style selector */
.narration-style-section { margin: 24px 0 16px; }
.create-dark-subtitle {
  font-size: 16px; font-weight: 700; color: rgba(230,220,255,0.85); margin-bottom: 12px;
}
.narration-style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.narration-style-card {
  position: relative; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid rgba(140,80,255,0.2); background: rgba(255,255,255,0.04);
  cursor: pointer; transition: all 0.2s; text-align: left;
}
.narration-style-card:hover { border-color: rgba(140,80,255,0.5); background: rgba(255,255,255,0.06); }
.narration-style-card.active { border-color: rgba(245,200,120,0.7); background: rgba(245,200,120,0.08); }
.narration-style-card.locked { opacity: 0.6; cursor: default; }
.ns-label { display: block; font-size: 13px; font-weight: 700; color: rgba(230,220,255,0.9); margin-bottom: 4px; }
.ns-desc { display: block; font-size: 11px; color: rgba(200,180,255,0.5); }
.narration-style-card.active .ns-label { color: rgba(245,200,120,0.95); }
.narration-style-card.active .ns-desc { color: rgba(245,200,120,0.6); }

.create-dark-title {
  font-size: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, #f5d97a 0%, #ffb3c8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(245,217,122,0.2));
}
.create-dark-sub { font-size: 14px; color: rgba(190,160,230,0.65); margin-bottom: 28px; }
.create-dark-actions { display: flex; justify-content: flex-end; margin-top: 32px; gap: 12px; }

/* Error banner dark */
.error-banner-dark {
  background: rgba(255,80,80,0.12);
  border: 1px solid rgba(255,120,100,0.35);
  border-radius: 12px;
  color: #ffb3b3;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Ghost button for dark */
.btn-enchant-ghost {
  background: transparent;
  color: rgba(200,160,240,0.8);
  padding: 11px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid rgba(180,130,255,0.35);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-enchant-ghost:hover { background: rgba(180,130,255,0.1); border-color: rgba(180,130,255,0.6); }

/* Upload zone dark */
.upload-zone-dark {
  border: 2px dashed rgba(245,200,120,0.35);
  border-radius: 20px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: rgba(245,200,120,0.04);
  transition: background 0.15s, border-color 0.15s;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.upload-zone-dark:hover,
.upload-zone-dark.dragover { background: rgba(245,200,120,0.09); border-color: rgba(245,200,120,0.7); }
.upload-zone-dark.has-file { padding: 24px; }
.upload-dark-icon { animation: float 3s ease-in-out infinite; }
.upload-dark-text { font-size: 16px; font-weight: 600; color: rgba(220,200,255,0.85); line-height: 1.7; }
.upload-dark-text span { color: #f5c878; text-decoration: underline; text-underline-offset: 3px; }
.upload-dark-hint { font-size: 13px; color: rgba(180,150,220,0.5); }
.upload-preview-dark { max-height: 320px; max-width: 100%; border-radius: 16px; object-fit: cover; box-shadow: 0 8px 32px rgba(0,0,0,0.4); border: 2px solid rgba(245,200,120,0.3); }
.upload-dark-change { font-size: 13px; color: #f5c878; font-weight: 600; margin-top: 6px; }

/* Style grid dark */
.style-grid-dark { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 680px; margin: 0 auto; }
.style-card-dark {
  padding: 0;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.style-card-dark:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.style-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.style-card-dark:hover .style-card-img { transform: scale(1.05); }
.style-card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 12px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  pointer-events: none;
}
.style-dark-name { font-size: 14px; font-weight: 800; color: #fff; margin-bottom: 2px; text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.style-dark-desc { font-size: 11px; color: rgba(255,255,255,0.75); text-shadow: 0 1px 3px rgba(0,0,0,0.5); line-height: 1.4; }
@media (max-width: 600px) {
  .style-grid-dark { grid-template-columns: repeat(2, 1fr); }
}
.style-premium-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #c8a840, #f5d060);
  color: #1a1a2e; border-radius: 4px;
  font-size: 9px; font-weight: 900; letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(200,168,64,0.4);
}
.style-card-dark.locked { opacity: 0.45; cursor: not-allowed; }
.style-card-dark.locked:hover { transform: none; border-color: transparent; }
.style-locked-badge {
  background: linear-gradient(135deg, #555, #777) !important;
  color: #ddd !important;
  box-shadow: none !important;
}
.style-dark-check {
  position: absolute; top: 12px; right: 12px;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #e040a0, #f5c842);
  color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}

/* Story pills dark */
.story-pills-dark { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.story-pill-dark {
  padding: 9px 18px;
  border-radius: 50px;
  border: 1.5px solid rgba(200,150,100,0.25);
  background: rgba(255,255,255,0.04);
  color: rgba(210,185,255,0.75);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.story-pill-dark:hover { border-color: rgba(245,200,120,0.5); color: #f5c878; background: rgba(245,200,120,0.08); }
.story-pill-dark.selected { background: linear-gradient(135deg, #e040a0, #9c27b0); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(200,50,180,0.35); }

/* Story tabs */
.story-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.story-tab {
  flex: 1; padding: 12px 0; border: 1.5px solid rgba(200,150,100,0.25);
  border-radius: 12px; background: rgba(255,255,255,0.04);
  color: rgba(210,185,255,0.6); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.story-tab:hover { border-color: rgba(245,200,120,0.4); color: #f5c878; }
.story-tab.active {
  background: linear-gradient(135deg, rgba(224,64,160,0.2), rgba(156,39,176,0.2));
  border-color: #e040a0; color: #fff;
}

/* Custom story question slides */
.custom-slide-container { position: relative; overflow: hidden; min-height: 320px; }
.custom-slide { text-align: center; padding: 20px 0; }
.custom-q-progress { font-size: 13px; color: rgba(245,200,120,0.6); margin-bottom: 12px; }
.custom-q-text { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 24px; }
.custom-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 480px; margin: 0 auto 20px; }
.custom-choice-btn {
  padding: 14px 8px; border-radius: 14px;
  border: 1.5px solid rgba(200,150,100,0.25);
  background: rgba(255,255,255,0.04);
  color: rgba(210,185,255,0.8); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
/* Choice button with full-bleed image (Q1/Q2) */
.custom-choice-img-btn {
  position: relative; padding: 0; overflow: hidden; aspect-ratio: 3/2; border-radius: 14px;
}
.custom-choice-cover {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.3s;
}
.custom-choice-img-btn:hover .custom-choice-cover { transform: scale(1.05); }
.custom-choice-label-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 6px 6px; font-size: 13px; font-weight: 800;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
}
/* Q4 color gradient cards */
.custom-choice-color-btn {
  padding: 16px 8px; border-radius: 14px; color: #fff;
  font-size: 14px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border: 2px solid transparent;
}
.custom-choice-btn:hover { border-color: rgba(245,200,120,0.5); color: #f5c878; background: rgba(245,200,120,0.08); }
.custom-choice-btn.selected {
  background: linear-gradient(135deg, rgba(224,64,160,0.25), rgba(156,39,176,0.25));
  border-color: #e040a0; color: #fff;
}
.custom-free-input {
  display: block; width: 100%; max-width: 420px; margin: 0 auto;
  padding: 12px 16px; border-radius: 12px;
  border: 1.5px solid rgba(200,150,100,0.25);
  background: rgba(255,255,255,0.04);
  color: #fff; font-size: 14px; font-family: var(--font);
  outline: none; transition: border-color 0.15s;
}
.custom-free-input::placeholder { color: rgba(210,185,255,0.35); }
.custom-free-input:focus { border-color: rgba(245,200,120,0.5); }
.custom-level-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* Synopsis preview card */
.synopsis-card {
  max-width: 520px; margin: 20px auto; padding: 24px; border-radius: 20px;
  background: rgba(245,200,120,0.06); border: 1px solid rgba(245,200,120,0.2); text-align: left;
}
.synopsis-thumb { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; float: right; margin: 0 0 12px 16px; border: 2px solid rgba(245,200,120,0.3); }
.synopsis-title { font-size: 22px; font-weight: 900; color: #f5c878; margin-bottom: 12px; }
.synopsis-text { font-size: 15px; color: rgba(210,185,255,0.85); line-height: 1.7; margin-bottom: 16px; }
.synopsis-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.synopsis-retry-count { font-size: 12px; color: rgba(210,185,255,0.4); margin-left: auto; }
.synopsis-loading { text-align: center; padding: 60px 20px; color: rgba(245,200,120,0.7); font-size: 16px; font-weight: 600; }
.synopsis-loading .spinner {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid rgba(245,200,120,0.2); border-top-color: #f5c878;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Premium gate modal */
.premium-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.premium-modal {
  background: #1e1e3a; border-radius: 24px; padding: 36px;
  max-width: 400px; text-align: center;
  border: 1px solid rgba(245,200,120,0.2); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.premium-modal h3 { font-size: 20px; font-weight: 900; color: #f5c878; margin-bottom: 12px; }
.premium-modal p { font-size: 14px; color: rgba(210,185,255,0.7); line-height: 1.6; margin-bottom: 20px; }
.premium-modal .btn { width: 100%; justify-content: center; }

/* Story section with banners and thumbnails */
.story-section { margin-bottom: 8px; }
.story-banner {
  position: relative; border-radius: 16px; overflow: hidden;
  margin-bottom: 16px; height: 100px;
}
.story-banner-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: brightness(0.6);
}
.story-banner-label {
  position: absolute; bottom: 14px; left: 20px;
  font-size: 20px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.story-thumb-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
}
.story-thumb-card {
  cursor: pointer; border-radius: 14px; overflow: hidden;
  border: 2px solid transparent; background: rgba(255,255,255,0.04);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.story-thumb-card:hover {
  transform: translateY(-2px); border-color: rgba(245,200,120,0.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.story-thumb-card.selected {
  border-color: #e040a0;
  box-shadow: 0 0 16px rgba(224,64,160,0.4), 0 0 0 2px #e040a0;
}
.story-thumb-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.story-thumb-name {
  padding: 6px 4px 8px; font-size: 12px; font-weight: 700;
  color: rgba(210,185,255,0.85); line-height: 1.3;
}
.story-thumb-card.selected .story-thumb-name { color: #f5c878; }

/* Story info panel */
.story-info-panel {
  margin-top: 20px; padding: 18px 22px;
  background: rgba(245,200,120,0.06);
  border: 1px solid rgba(245,200,120,0.2);
  border-radius: 16px;
}
.story-info-title { font-size: 18px; font-weight: 800; color: #f5c878; }
.story-info-en { font-size: 13px; color: rgba(210,185,255,0.5); margin-bottom: 8px; }
.story-info-theme { font-size: 14px; color: rgba(210,185,255,0.8); line-height: 1.5; margin-bottom: 10px; }
.story-info-meta { display: flex; gap: 8px; }
.story-info-tag {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  background: rgba(200,150,100,0.15); color: rgba(245,200,120,0.7);
}
.fade-enter-active, .fade-leave-active { transition: opacity 0.25s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

@media (max-width: 600px) {
  .story-thumb-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Name input dark */
.name-wrap-dark { position: relative; margin-bottom: 20px; }
.name-input-dark {
  width: 100%;
  padding: 16px 60px 16px 20px;
  border: 1.5px solid rgba(200,150,100,0.3);
  border-radius: 16px;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font);
  background: rgba(255,255,255,0.045);
  color: #ede0ff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.name-input-dark::placeholder { color: rgba(180,150,220,0.4); font-weight: 400; }
.name-input-dark:focus {
  border-color: rgba(245,200,120,0.6);
  box-shadow: 0 0 0 3px rgba(245,200,120,0.12);
}
.name-count-dark {
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: rgba(180,150,220,0.45);
  font-weight: 600;
}

/* Summary card dark */
.summary-dark {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(220,150,100,0.22);
  border-radius: 16px;
  padding: 4px 0;
  margin-bottom: 16px;
}
.summary-dark-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(200,150,100,0.1);
}
.summary-dark-row:last-child { border-bottom: none; }
.summary-dark-icon { display: flex; align-items: center; flex-shrink: 0; }
.summary-dark-label { font-size: 13px; color: rgba(180,150,220,0.55); font-weight: 600; width: 52px; flex-shrink: 0; }
.summary-dark-val { font-size: 14px; font-weight: 700; color: #e8d8ff; }

/* Generating enchanted */
.generating-enchanted {
  background: transparent;
}
.gen-dark-content { text-align: center; padding: 48px 24px; }
.gen-dark-title {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, #f5d97a 0%, #ffb3c8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.gen-dark-sub { color: rgba(190,160,230,0.6); margin-bottom: 40px; }
.gen-dark-pct { font-size: 36px; font-weight: 900; color: #f5c842; }
.gen-dark-step-name { font-size: 12px; color: rgba(190,160,230,0.6); font-weight: 600; max-width: 200px; text-align: center; }

.gen-dark-steps { display: flex; flex-direction: column; gap: 0; max-width: 260px; margin: 0 auto 32px; text-align: left; }
.gen-dark-step-row { display: flex; flex-direction: column; align-items: flex-start; }
.gen-dark-connector { width: 2px; height: 12px; background: rgba(200,150,100,0.2); margin-left: 15px; transition: background 0.3s; }
.gen-dark-connector.active { background: linear-gradient(180deg, #e040a0, #f5c842); }
.gen-dark-step { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; padding: 4px 0; }
.gen-dark-step-label { color: rgba(180,150,220,0.5); transition: color 0.3s; }
.gen-dark-step.done .gen-dark-step-label { color: #f5d97a; }
.gen-dark-step.current .gen-dark-step-label { color: #ffb3c8; }

.gen-dark-indicator {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.3s;
}
.gen-dark-indicator.done    { background: linear-gradient(135deg, #e040a0, #f5c842); }
.gen-dark-indicator.current { background: rgba(255,255,255,0.06); border: 2px solid #f5c842; box-shadow: 0 0 0 4px rgba(245,200,66,0.15); }
.gen-dark-indicator.pending { background: rgba(255,255,255,0.04); border: 2px solid rgba(200,150,100,0.2); }
.gen-dark-pulse { width: 10px; height: 10px; border-radius: 50%; background: #f5c842; animation: pulse 1.4s ease-in-out infinite; }

.gen-dark-thumbs { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.gen-dark-thumb { width: 80px; height: 80px; border-radius: 12px; overflow: hidden; border: 2px solid rgba(245,200,120,0.4); animation: popIn 0.4s ease; background: rgba(0,0,0,0.3); }
.gen-dark-thumb img { width: 100%; height: 100%; object-fit: cover; }

.gen-error-dark { text-align: center; max-width: 400px; padding: 48px 40px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,120,100,0.2); border-radius: 24px; }
.gen-error-icon-dark { margin-bottom: 20px; }

/* Generating (legacy) */
.generating-page { background: linear-gradient(135deg, #fff0f8, #f5f0ff); }
.gen-content { text-align: center; padding: 48px 24px; }
.gen-title { font-size: 24px; font-weight: 900; margin-bottom: 8px; }
.gen-sub { color: var(--muted); margin-bottom: 40px; }
.gen-ring-wrap { position: relative; width: 200px; height: 200px; margin: 0 auto 40px; }
.gen-ring { width: 200px; height: 200px; }
.gen-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.gen-pct { font-size: 36px; font-weight: 900; color: var(--primary-dk); }
.gen-step-name { font-size: 12px; color: var(--muted); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-steps { display: flex; flex-direction: column; gap: 0; max-width: 280px; margin: 0 auto 32px; text-align: left; }
.gen-step-row { display: flex; flex-direction: column; align-items: flex-start; }
.gen-connector { width: 2px; height: 12px; background: #e8e0f0; margin-left: 15px; transition: background 0.3s; }
.gen-connector.active { background: var(--primary); }
.gen-step { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.gen-step.done { color: var(--text); }
.gen-step.current { color: var(--primary-dk); }
.gen-indicator { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.3s; }
.gen-indicator.done { background: #4caf50; }
.gen-indicator.current { background: #fff; border: 2.5px solid var(--primary); box-shadow: 0 0 0 4px rgba(255,133,161,0.15); }
.gen-indicator.pending { background: #f0edf5; border: 2px solid #e0d8ea; }
.gen-pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.7); } }
.gen-step-label { line-height: 1; }
.gen-thumbs { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.gen-thumb { width: 80px; height: 80px; border-radius: 12px; overflow: hidden; border: 2px solid var(--primary); animation: popIn 0.4s ease; }
.gen-thumb img { width: 100%; height: 100%; object-fit: cover; }
@keyframes popIn { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }
.gen-error { text-align: center; max-width: 400px; padding: 48px 40px; }
.gen-error-icon { margin-bottom: 20px; }

/* Viewer */
.viewer-page { display: flex; flex-direction: column; height: 100vh; padding-top: 64px; background: #1a1010; }
.viewer-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: rgba(26,16,16,0.8); border-bottom: 1px solid #3a2020; }
.viewer-title { font-size: 15px; font-weight: 700; color: #fff; }
.viewer-actions { display: flex; gap: 8px; }
.viewer-spread { flex: 1; display: flex; align-items: center; justify-content: center; gap: 24px; padding: 24px; overflow: hidden; }
.viewer-book { display: grid; grid-template-columns: 1fr 1fr; max-width: 900px; width: 100%; background: #fff; border-radius: 4px 20px 20px 4px; box-shadow: 0 32px 80px rgba(0,0,0,0.5); overflow: hidden; max-height: calc(100vh - 220px); }
.viewer-page-left { background: #f5f0eb; display: flex; align-items: center; justify-content: center; border-right: 2px solid #e8e0d0; }
.viewer-illustration { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-page-right { padding: 40px 36px; display: flex; flex-direction: column; justify-content: space-between; overflow-y: auto; }
.viewer-page-num { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 24px; }
.viewer-narration { font-size: 20px; line-height: 2.0; color: var(--text); font-weight: 500; flex: 1; }
.viewer-audio-btn { margin-top: 24px; padding: 10px 20px; border-radius: 50px; background: #fff0f3; border: none; color: var(--primary-dk); font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.viewer-audio-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.viewer-arrow { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.1); border: none; color: #fff; font-size: 32px; cursor: pointer; transition: background 0.15s; flex-shrink: 0; }
.viewer-arrow:hover:not(:disabled) { background: rgba(255,255,255,0.2); }
.viewer-arrow:disabled { opacity: 0.2; cursor: not-allowed; }
.viewer-scrubber { display: flex; gap: 6px; padding: 12px 24px; overflow-x: auto; background: rgba(26,16,16,0.9); border-top: 1px solid #3a2020; justify-content: center; }
.scrubber-thumb { position: relative; width: 52px; height: 52px; flex-shrink: 0; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; background: #333; }
.scrubber-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scrubber-thumb span { position: absolute; bottom: 2px; right: 4px; font-size: 10px; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }
.scrubber-thumb.active { border-color: var(--primary); }

/* Library */
.library-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.library-title { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.quota-info { font-size: 13px; color: var(--muted); }
.library-empty { text-align: center; padding: 80px 24px; }
.empty-illust { margin-bottom: 20px; }
.library-empty h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.library-empty p { color: var(--muted); }
.library-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
@media (max-width: 860px) { .library-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 520px) { .library-grid { grid-template-columns: 1fr; } }

/* Library Card */
.lib-card { background: #fff; border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.lib-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.lib-cover { aspect-ratio: 3/2; background: linear-gradient(135deg,#f5f0ff,#ffe8f0); position: relative; overflow: hidden; }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-cover-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

/* Library overlays */
.lib-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(40,15,60,0.6); backdrop-filter: blur(3px); }
.lib-overlay-fail { background: rgba(100,20,20,0.6); }
.lib-overlay-queue { background: rgba(40,40,40,0.5); }
.lib-overlay-label { color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0.3px; }
.lib-progress-ring { position: relative; width: 64px; height: 64px; }
.lib-progress-ring svg { width: 100%; height: 100%; }
.lib-progress-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 800; }

/* Library card body */
.lib-body { padding: 16px 18px 18px; }
.lib-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.lib-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.lib-pages { font-size: 12px; color: var(--muted); }
.lib-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.lib-date { font-size: 12px; color: var(--muted); }
.lib-actions { display: flex; align-items: center; gap: 8px; }
.lib-btn-progress { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-btn); font-size: 13px; font-weight: 700; cursor: pointer; border: 2px solid var(--accent); color: var(--accent); background: transparent; text-decoration: none; transition: background 0.15s; }
.lib-btn-progress:hover { background: #f5f0ff; }
.lib-btn-fail { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-btn); font-size: 13px; font-weight: 700; cursor: pointer; border: 2px solid var(--error); color: var(--error); background: transparent; text-decoration: none; transition: background 0.15s; }
.lib-btn-fail:hover { background: #fff5f7; }
.lib-share-btn { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #e8e0f0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: border-color 0.15s, color 0.15s; }
.lib-share-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Admin (light theme — matches homepage) */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; padding-top: 64px; background: var(--bg); color: var(--text); }
.admin-sidebar { background: #fff; border-right: 1px solid #eee; padding: 32px 16px; }
.admin-sidebar-logo { font-size: 14px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 24px; padding: 0 12px; }
.admin-nav-item { display: block; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 4px; transition: background 0.1s, color 0.1s; }
.admin-nav-item:hover, .admin-nav-item.active { background: rgba(201,184,255,0.15); color: var(--text); }
.admin-main { padding: 40px; overflow-y: auto; }
.admin-heading { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.admin-sub { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.admin-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border: 1px solid #eee; border-radius: 16px; padding: 20px 24px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 900; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 10px 16px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #eee; }
.admin-table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.admin-table tr:hover td { background: rgba(201,184,255,0.06); }
.admin-section { background: #fff; border: 1px solid #eee; border-radius: 16px; padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.admin-section-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.pipeline-steps { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; margin-bottom: 24px; }
.pipeline-card { padding: 20px 24px; }
.pipeline-step-label { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.pipeline-step-model { font-size: 12px; color: var(--accent); margin-bottom: 16px; font-family: monospace; }
.pipeline-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.metric { text-align: center; }
.metric-val { font-size: 20px; font-weight: 800; color: var(--text); }
.metric-val.success { color: #6fcf97; }
.metric-val.fail    { color: #ff6b6b; }
.metric-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.prompt-textarea { width: 100%; background: #faf9f6; border: 1px solid #ddd; border-radius: 10px; color: var(--text); padding: 14px; font-size: 13px; font-family: 'Monaco', 'Menlo', monospace; line-height: 1.6; resize: vertical; }
.admin-select { background: #fff; border: 1px solid #ddd; border-radius: 8px; color: var(--text); padding: 6px 10px; font-size: 13px; font-family: var(--font); }
.admin-search { flex: 1; background: #fff; border: 1px solid #ddd; border-radius: 10px; color: var(--text); padding: 10px 16px; font-size: 14px; font-family: var(--font); }
.admin-search::placeholder { color: var(--muted); }
.user-avatar-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }

.btn-github { background: #24292e; color: #fff; border-color: #24292e; }
.btn-github:hover { background: #1a1f24; }
.btn-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; font-weight: 500; }
.btn-google:hover { background: #f7f8f8; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

/* Admin Settings */
.settings-key-row { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.settings-label { width:160px; font-size:13px; font-weight:600; color:var(--muted); flex-shrink:0; }
.settings-input-wrap { display:flex; align-items:center; gap:6px; flex:1; }
.settings-input { flex:1; background:#fff; border:1px solid #ddd; border-radius:10px; color:var(--text); padding:10px 14px; font-size:13px; font-family:monospace; }
.settings-eye { background:transparent; border:none; cursor:pointer; font-size:18px; padding:4px 8px; }
.settings-model-row { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid #eee; }
.settings-model-row:last-child { border-bottom:none; }
.settings-model-label { display:flex; align-items:center; gap:8px; font-size:14px; font-weight:600; }
.settings-model-controls { display:flex; align-items:center; gap:8px; }
.settings-select { background:#fff; border:1px solid #ddd; border-radius:10px; color:var(--text); padding:8px 12px; font-size:13px; min-width:280px; }
.settings-cost-card { margin-top:20px; background:linear-gradient(135deg,#f5f0ff,#ece6ff); border:1px solid var(--accent); border-radius:16px; padding:20px 28px; display:inline-flex; flex-direction:column; gap:4px; }
.settings-cost-label { font-size:12px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
.settings-cost-value { font-size:28px; font-weight:900; color:var(--accent); font-family:monospace; }
.settings-cost-sub { font-size:11px; color:#999; }
.settings-param-grid { display:flex; flex-direction:column; gap:12px; }
.settings-param-row { display:flex; align-items:center; gap:16px; }
.settings-param-row .settings-label { min-width:200px; }
.settings-input-sm { background:#fff; border:1px solid #ddd; border-radius:10px; color:var(--text); padding:8px 12px; font-size:13px; width:180px; }

/* ── Workflow ── */
.wf-pipeline { max-width: 860px; margin: 0 auto; }
.wf-step { display: grid; grid-template-columns: 56px 1fr; gap: 0 20px; position: relative; }
.wf-step:not(:last-child) .wf-line {
  position: absolute; left: 28px; top: 56px; bottom: -24px;
  width: 2px; background: var(--border); transform: translateX(-50%); z-index: 0;
}
.wf-num {
  width: 48px; height: 48px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 15px;
  font-weight: 700; border: 2px solid; z-index: 1; background: var(--bg);
  flex-shrink: 0;
}
.wf-num.done { border-color: #4caf50; color: #4caf50; background: #f0faf0; }
.wf-num.todo { border-color: #ff5252; color: #ff5252; background: #fef0f0; }
.wf-num.input { border-color: var(--secondary); color: var(--secondary); background: #f5f0ff; }
.wf-card { margin-bottom: 24px; }
.badge-done { background: #e8f5e9; color: #2e7d32; }
.badge-todo { background: #ffebee; color: #c62828; }
.badge-input { background: #f3e8ff; color: #7c3aed; }
.badge-short { background: #e8f5e9; color: #2e7d32; }
.badge-medium { background: #fff8e1; color: #f57f17; }
.badge-long { background: #ffebee; color: #c62828; }
.wf-io-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.wf-io-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; line-height: 1.5; flex: 1; min-width: 170px;
}
.wf-io-box.input-box { border-left: 3px solid var(--secondary); }
.wf-io-box.output-box { border-left: 3px solid #4caf50; }
.wf-io-box.api-box { border-left: 3px solid #ff9800; }
.wf-error-box {
  background: #fff5f5; border: 1px solid #fecdd3; border-left: 3px solid var(--error);
  border-radius: 8px; padding: 8px 12px; margin-top: 8px;
}
.wf-io-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; margin-bottom: 4px; color: var(--text-muted);
}
.wf-cost {
  display: inline-block; font-size: 11px; color: #e65100;
  background: #fff3e0; border: 1px solid #ffe0b2; border-radius: 6px; padding: 2px 8px; margin-top: 4px;
}
.wf-story-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.wf-story-tab {
  padding: 6px 16px; border-radius: 100px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.wf-story-tab:hover { border-color: var(--secondary); }
.wf-story-tab.active { background: #f0edff; border-color: var(--secondary); color: var(--secondary); }
.wf-story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.wf-tmpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 860px; }
@media (max-width: 600px) { .wf-tmpl-grid { grid-template-columns: 1fr; } }
.wf-cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wf-cost-table thead th {
  background: var(--bg); padding: 10px 16px; text-align: left;
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.wf-cost-table tbody td { padding: 10px 16px; border-top: 1px solid var(--border); }
.wf-cost-total td {
  font-weight: 700; color: #e65100; background: #fff8f0;
  border-top: 2px solid var(--border);
}

/* ═══════════════════════════════════════════════════════
   VIEWER — Moonlit Theater Theme
   ═══════════════════════════════════════════════════════ */

/* Full-screen dark stage */
body.viewer-open {
  overflow: hidden;
  background: #0a0818;
}
body.viewer-open .navbar {
  display: none;
}

.viewer-moonlit {
  position: fixed;
  inset: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

/* ── Top Bar (overlay) ── */
.viewer-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px; height: 48px;
  background: linear-gradient(180deg, rgba(8,5,21,0.9) 0%, rgba(8,5,21,0.4) 70%, transparent 100%);
}
.viewer-bar-back:hover { color: #f5c842; }
.viewer-bar-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 15px; font-weight: 700; color: rgba(245,200,120,0.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%;
}
.viewer-bar-actions { display: flex; gap: 8px; }
.viewer-bar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.08); color: rgba(200,180,255,0.7);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.viewer-bar-btn:hover { background: rgba(255,255,255,0.15); color: #f5c842; }

/* ── Main content ── */
.viewer-content {
  flex: 1; display: flex; align-items: stretch;
  position: relative; min-height: 0; padding: 48px 0 0;
}

/* ── Right sidebar: comments ── */
.viewer-sidebar {
  width: 300px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(10, 8, 24, 0.85); backdrop-filter: blur(12px);
  border-left: 1px solid rgba(140, 80, 255, 0.15);
  padding: 16px; z-index: 10;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid rgba(140, 80, 255, 0.15);
}
.sidebar-title { flex: 1; font-size: 0.9rem; font-weight: 700; color: #e0d0ff; }
.sidebar-comments-title {
  font-size: 0.8rem; font-weight: 600; color: rgba(200, 170, 255, 0.5);
  padding: 12px 0 8px;
}
.sidebar-comments-list { flex: 1; overflow-y: auto; padding-right: 4px; }
.sidebar-comment-input {
  padding-top: 12px; border-top: 1px solid rgba(140, 80, 255, 0.15);
  margin-top: auto;
}
.sidebar-comment-input .comment-input-wrap { flex-direction: column; gap: 8px; }
.sidebar-comment-input .comment-input { width: 100%; }
.sidebar-gallery-link {
  display: block; text-align: center; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(140, 80, 255, 0.1);
  font-size: 0.75rem; color: rgba(200, 170, 255, 0.4); text-decoration: none;
}
.sidebar-gallery-link:hover { color: #c0a0ff; }
@media (max-width: 900px) { .viewer-sidebar { display: none; } }

/* ── Nav arrows (overlay) ── */
.viewer-nav-btn {
  position: absolute; z-index: 20;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.4); color: rgba(255,255,255,0.6);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; backdrop-filter: blur(8px);
}
.viewer-nav-left { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer-nav-right { right: 316px; top: 50%; transform: translateY(-50%); }
@media (max-width: 900px) { .viewer-nav-right { right: 16px; } }
.viewer-nav-btn:hover:not(:disabled) { background: rgba(245,200,120,0.2); color: #f5c842; }
.viewer-nav-btn:disabled { opacity: 0.15; cursor: not-allowed; }

/* ── CINEMATIC MODE (B: frosted glass overlay) ── */
.viewer-cinema {
  position: relative; flex: 1; min-width: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; overflow: hidden;
}
.cinema-img {
  width: 100%; height: 100%; object-fit: contain;
  animation: cinemaFadeIn 0.4s ease;
}
@keyframes cinemaFadeIn { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: scale(1); } }

/* Frosted glass panel */
.cinema-glass {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(15,10,30,0.65);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 16px 32px 20px;
  display: flex; flex-direction: column; align-items: center;
}
.cinema-glass-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.2); margin-bottom: 12px;
}
.cinema-glass-text {
  text-align: center; font-size: 1.1rem; font-weight: 500;
  line-height: 1.8; color: rgba(255,255,255,0.85);
  max-width: 680px; word-break: keep-all; width: 100%;
}
/* 라틴 계열 언어 (en/vi) — 단어 단위 줄바꿈, 더 넓은 텍스트 */
[lang="en"] .cinema-glass-text,
[lang="vi"] .cinema-glass-text { word-break: normal; overflow-wrap: break-word; max-width: 760px; font-size: 1rem; line-height: 1.7; }
/* 일본어 — 자연 줄바꿈 */
[lang="ja"] .cinema-glass-text { word-break: normal; overflow-wrap: break-word; }
.cinema-seg, .split-seg { margin-bottom: 1em; }
.split-seg:first-child { margin-bottom: 1.4em; }
.seg-dialogue { font-style: normal; color: rgba(255,220,150,0.95); }
.seg-speaker {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  color: rgba(255,190,80,0.85); margin-right: 0.5em;
  background: rgba(255,190,80,0.1); padding: 0.15em 0.6em;
  border-radius: 6px; vertical-align: baseline;
  letter-spacing: 0.05em;
}
.seg-text { display: inline; }
.split-seg .seg-dialogue { color: rgba(245,215,140,0.95); padding-left: 0; }
.split-seg .seg-speaker { color: rgba(220,180,80,0.85); background: rgba(220,180,80,0.08); }
.split-seg:not(.seg-dialogue) .seg-text { color: rgba(230,220,255,0.8); font-size: 1.05rem; }
.cinema-glass-page {
  margin-top: 8px; font-size: 11px; color: rgba(255,255,255,0.35);
  font-weight: 600; letter-spacing: 1px;
}
.cinema-word {
  display: inline; margin: 0 2px; padding: 2px 4px; border-radius: 4px;
  cursor: pointer; transition: color 0.12s, text-shadow 0.12s, background 0.12s;
}
.cinema-word:hover { color: #fff; background: rgba(255,255,255,0.08); }
.cinema-word.cw-active {
  color: #f5c842; font-weight: 700;
  text-shadow: 0 0 16px rgba(245,200,66,0.6), 0 0 4px rgba(245,200,66,0.4);
  background: rgba(245,200,66,0.1);
}
.cinema-word.cw-done { color: rgba(255,255,255,0.35); }

/* ── BOOK MODE (A: left image + right text) ── */
.viewer-split {
  position: relative; flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: row; overflow: hidden;
}
.split-left {
  flex: 1; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
}
.split-img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  animation: cinemaFadeIn 0.4s ease;
}
.split-right {
  width: 380px; flex-shrink: 0;
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: 32px 28px; overflow-y: auto;
  background: rgba(10, 6, 20, 0.92);
  border-left: 1px solid rgba(140,80,255,0.1);
}
@media (max-width: 768px) {
  .viewer-split { flex-direction: column; }
  .split-left { flex: 1; width: 100%; }
  .split-right {
    width: 100%; max-height: 40%;
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(10, 6, 20, 0.9) 20%, rgba(10, 6, 20, 0.95));
    align-items: center; justify-content: flex-end;
    border-left: none;
  }
}
.split-page {
  font-size: 11px; color: rgba(200,180,255,0.35); font-weight: 600;
  letter-spacing: 1px; margin-bottom: 20px; text-align: center; width: 100%;
}
.split-text {
  font-size: 1.05rem; line-height: 2; color: rgba(230,220,255,0.85);
  font-weight: 400; text-align: left; max-width: 520px; width: 100%;
  word-break: keep-all; overflow-wrap: break-word;
  letter-spacing: 0.02em;
}
.sp-word {
  display: inline; padding: 2px 3px; border-radius: 4px; cursor: pointer;
  transition: background 0.15s, color 0.12s;
}
.sp-word:hover { background: rgba(245,200,120,0.08); }
.sp-word.sp-active {
  color: #f5c842; font-weight: 700;
  background: rgba(245,200,120,0.12);
  text-shadow: 0 0 12px rgba(245,200,66,0.4);
}
.sp-word.sp-done { color: rgba(200,180,255,0.35); }

/* ── BOTTOM CONTROL BAR ── */
.viewer-controls {
  position: relative; z-index: 25; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; height: 48px;
  background: rgba(8,5,21,0.92); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(140,80,255,0.12);
}
.vc-left { display: flex; align-items: center; gap: 12px; }
.vc-right { display: flex; align-items: center; gap: 6px; }
.vc-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.08); color: rgba(200,180,255,0.8);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.vc-btn:hover { background: rgba(245,200,120,0.15); color: #f5c842; }
.vc-page { font-size: 12px; color: rgba(200,180,255,0.5); font-weight: 600; }
.vc-divider { width: 1px; height: 20px; background: rgba(140,80,255,0.2); margin: 0 4px; }
.vc-toggle {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: rgba(200,180,255,0.45);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; font-family: var(--font);
}
.vc-toggle:hover { color: rgba(200,180,255,0.8); background: rgba(255,255,255,0.05); }
.vc-toggle.active {
  color: rgba(245,200,120,0.95); border-color: rgba(245,200,120,0.3);
  background: rgba(245,200,120,0.08);
}
.vc-exit {
  text-decoration: none; color: rgba(255,255,255,0.5);
  border-color: rgba(255,100,100,0.3);
}
.vc-exit:hover { color: #ff8a8a; border-color: rgba(255,100,100,0.5); background: rgba(255,100,100,0.08); }

/* ── Thumbnail Scrubber ── */
.viewer-scrubber {
  position: relative; z-index: 25; flex-shrink: 0;
  width: 100%; display: flex; gap: 4px;
  padding: 6px 20px; overflow-x: auto;
  background: rgba(8,5,21,0.95);
  scrollbar-width: thin; scrollbar-color: rgba(140,80,255,0.2) transparent;
  justify-content: center;
}
.scrubber-thumb {
  flex-shrink: 0; width: 48px; height: 36px; border-radius: 4px;
  border: 2px solid transparent; cursor: pointer; overflow: hidden; padding: 0;
  transition: border-color 0.15s, transform 0.15s; background: #111;
}
.scrubber-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scrubber-thumb:hover { border-color: rgba(200,180,255,0.4); transform: translateY(-2px); }
.scrubber-thumb.active { border-color: #f5c842; box-shadow: 0 0 8px rgba(245,200,120,0.4); }

/* Not found */
.viewer-not-found {
  position: relative; z-index: 2; text-align: center;
  color: rgba(200,168,255,0.7); margin-top: 80px;
}
.viewer-not-found p { font-size: 18px; margin-bottom: 16px; }

@media (max-width: 700px) {
  .viewer-bar-title { display: none; }
  .viewer-nav-btn { width: 36px; height: 36px; }
  .book-right-text { font-size: 14px; }
  .viewer-book { padding: 8px 40px; }
}

/* ── Dev Lab ────────────────────────────────────────── */
.dev-page { max-width: 1200px; margin: 0 auto; padding: 40px 20px 80px; }
.dev-header { margin-bottom: 32px; }
.dev-header h1 { font-size: 1.8rem; font-weight: 900; color: #e0e0e0; }
.dev-header p { color: #888; margin-top: 4px; }
.dev-section { margin-bottom: 40px; }
.dev-section h2 { font-size: 1.1rem; font-weight: 700; color: #ccc; margin-bottom: 16px; border-bottom: 1px solid #333; padding-bottom: 8px; }
.dev-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.dev-select { background: #1a1a2e; color: #e0e0e0; border: 1px solid #333; border-radius: 8px; padding: 8px 16px; font-size: 0.9rem; }
.dev-status { margin-top: 12px; color: #aaa; font-size: 0.85rem; }
.dev-link { color: #4caf50 !important; font-size: 0.85rem; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.char-card { background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 12px; padding: 16px; }
.char-role { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; padding: 2px 8px; border-radius: 4px; display: inline-block; }
.char-role.protagonist { background: #2a1a3e; color: #b388ff; }
.char-role.antagonist { background: #3e1a1a; color: #ff8a80; }
.char-role.magical { background: #1a3e2a; color: #80ffb3; }
.char-role.supporting { background: #2a2a1a; color: #ffe082; }
.char-role.animal { background: #1a2a3e; color: #80d8ff; }
.char-name { font-size: 1rem; font-weight: 700; color: #e0e0e0; margin: 8px 0 4px; }
.char-desc { font-size: 0.8rem; color: #999; line-height: 1.5; }
.char-gender { font-size: 0.75rem; color: #666; margin-top: 8px; }
.ref-sheet { width: 100%; max-width: 900px; border-radius: 12px; border: 1px solid #333; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.page-card { background: #1a1a2e; border-radius: 12px; overflow: hidden; border: 1px solid #2a2a3e; }
.page-img { width: 100%; aspect-ratio: 3/2; object-fit: cover; }
.page-info { padding: 12px; }
.page-num { font-size: 0.75rem; color: #888; }
.page-narr { display: block; font-size: 0.85rem; color: #ccc; margin-top: 4px; line-height: 1.5; }
.dev-log { background: #0d0d1a; border: 1px solid #222; border-radius: 8px; padding: 12px; max-height: 300px; overflow-y: auto; font-family: monospace; font-size: 0.8rem; }
.log-line { color: #888; padding: 2px 0; }
.log-line.error { color: #ff6b6b; }
.log-line.success { color: #4caf50; }
.dev-input-row { display: flex; gap: 24px; align-items: flex-start; }
.dev-input-photo { flex: 0 0 200px; }
.source-photo { width: 200px; height: 200px; object-fit: cover; border-radius: 12px; border: 2px solid #333; }
.source-label { font-size: 0.8rem; color: #888; margin-top: 8px; text-align: center; }
.source-desc { font-size: 0.75rem; color: #aaa; margin-top: 4px; line-height: 1.4; }
.dev-input-chars { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.page-fail .page-card { border-color: #5a2a2a; }
.page-fail-box { width: 100%; aspect-ratio: 3/2; display: flex; align-items: center; justify-content: center; background: #1a0d0d; color: #ff6b6b; font-size: 0.85rem; text-align: center; }
.page-ok { color: #4caf50; font-size: 0.7rem; margin-left: 6px; }
.page-ng { color: #ff6b6b; font-size: 0.7rem; margin-left: 6px; }
.runs-list { display: flex; flex-wrap: wrap; gap: 8px; }
.run-item { background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: all 0.2s; }
.run-item:hover { border-color: #6c5ce7; }
.run-item.active { border-color: #6c5ce7; background: #2a1a3e; }
.run-title { font-size: 0.85rem; color: #e0e0e0; font-weight: 600; }
.run-meta { font-size: 0.7rem; color: #888; margin-left: 8px; }

/* ── Community Page ─────────────────────────────────── */
.community-dark { min-height: 100vh; }
.community-container { max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }
.community-header { margin-bottom: 24px; }
.community-title { font-size: 1.8rem; font-weight: 900; color: #e0d0ff; margin: 0 0 6px; }
.community-sub { color: rgba(200,170,255,0.5); font-size: 0.9rem; margin: 0; }
.community-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.community-tab {
  background: rgba(140,80,255,0.1); border: 1px solid rgba(140,80,255,0.2);
  border-radius: 8px; padding: 6px 16px; color: rgba(200,170,255,0.7);
  font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.community-tab:hover { background: rgba(140,80,255,0.2); color: #fff; }
.community-tab.active { background: rgba(140,80,255,0.3); border-color: rgba(140,80,255,0.5); color: #fff; }
.community-loading { text-align: center; padding: 60px 0; color: rgba(200,170,255,0.5); }
.community-sentinel { height: 1px; }

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.masonry-card {
  background: rgba(20,12,50,0.8);
  border: 1px solid rgba(140,80,255,0.15);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.masonry-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(100,40,200,0.25);
}
.masonry-cover {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, #2a1060, #1a0a3d);
}
.masonry-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.masonry-body { padding: 12px 14px 14px; }
.masonry-title {
  font-size: 0.95rem; font-weight: 700; color: #e8d8ff;
  margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.masonry-author {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: rgba(200,170,255,0.6); margin-bottom: 10px;
}
.masonry-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(140,80,255,0.25); color: #c0a0ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.masonry-footer {
  display: flex; justify-content: space-between; align-items: center;
}
.masonry-stats { display: flex; gap: 10px; }
.masonry-stat {
  display: flex; align-items: center; gap: 3px;
  font-size: 0.75rem; color: rgba(200,170,255,0.5);
}

@media (max-width: 900px) { .masonry-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .masonry-grid { grid-template-columns: 1fr; } }

/* ── Book Detail ────────────────────────────────────── */
.book-detail-page { min-height: 100vh; }
.book-detail-container { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.book-detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px;
  background: rgba(255,255,255,0.1);
  margin-bottom: 24px; transition: all 0.15s;
}
.book-detail-back:hover { background: rgba(255,255,255,0.18); color: #f5c842; }
.book-detail-main { display: flex; gap: 32px; margin-bottom: 40px; }
.book-detail-cover { flex-shrink: 0; width: 240px; }
.book-detail-cover img { width: 100%; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.book-detail-info { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.book-detail-title { font-size: 24px; font-weight: 800; color: #fff; }
.book-detail-author { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.7); font-size: 14px; }
.book-detail-meta { display: flex; align-items: center; gap: 8px; }
.book-detail-pages { color: rgba(255,255,255,0.5); font-size: 13px; }
.book-detail-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.book-detail-like-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7);
  cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.book-detail-like-btn.liked { border-color: #ff6b9d; color: #ff6b9d; }
.book-detail-like-btn:hover { background: rgba(255,255,255,0.1); }
.book-detail-comments { margin-top: 24px; }
.comments-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 16px; }
.comment-item { display: flex; gap: 12px; margin-bottom: 16px; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6b4fa2, #8b6fc0); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.8); }
.comment-date { font-size: 12px; color: rgba(255,255,255,0.4); }
.comment-text { font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.5; margin: 0; }
.comment-input-wrap { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.comment-input {
  flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: #fff; font-size: 14px; outline: none;
}
.comment-input:focus { border-color: rgba(167,139,250,0.5); }
.comment-submit {
  padding: 8px 16px; border-radius: 8px; border: none;
  background: #a78bfa; color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.comment-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.comment-submit:hover:not(:disabled) { background: #8b6fc0; }
.comment-login-hint { color: rgba(255,255,255,0.5); font-size: 13px; margin-top: 16px; }
.comment-login-hint a { color: #a78bfa; }
@media (max-width: 640px) {
  .book-detail-main { flex-direction: column; }
  .book-detail-cover { width: 100%; max-width: 300px; margin: 0 auto; }
}

/* ── Admin Modal ────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #12122a; border: 1px solid #3a3a5a; border-radius: 16px;
  padding: 28px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid #2a2a4a;
}
.modal-close {
  background: none; border: none; color: #888; font-size: 24px;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: #fff; }

/* ── Pricing Page ──────────────────────────────────── */
.pricing-container {
  max-width: 520px; margin: 0 auto; padding: 60px 24px 80px;
  text-align: center;
}
.pricing-wide { max-width: 820px; }
.pricing-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
.pricing-grid-single { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }
@media (max-width: 640px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
.pricing-card-free {
  border-color: rgba(100,116,139,0.3);
  box-shadow: none;
}
.pricing-card-premium {
  border-color: rgba(140,80,255,0.5);
  box-shadow: 0 0 40px rgba(140,80,255,0.15), 0 0 80px rgba(140,80,255,0.05);
}
.pricing-plan-free { color: rgba(200,200,220,0.7); }
.pricing-popular-tag {
  position: absolute; top: -12px; right: 24px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff; font-size: 0.7rem; font-weight: 800;
  padding: 4px 14px; border-radius: 20px;
  letter-spacing: 1px;
}
.pricing-feature-disabled { opacity: 0.35; text-decoration: line-through; }
.pricing-cta-free {
  display: block; text-align: center; text-decoration: none;
  background: rgba(100,116,139,0.2); border: 1px solid rgba(100,116,139,0.3);
  color: #c0c8d8;
}
.pricing-cta-free:hover { background: rgba(100,116,139,0.3); }
.pricing-banner-upgrade {
  background: rgba(140,80,255,0.12); border: 1px solid rgba(140,80,255,0.3);
  color: #d4b8ff; padding: 14px 20px; border-radius: 12px;
  margin-bottom: 24px; font-size: 0.95rem; font-weight: 500;
}
.pricing-title {
  font-size: 2rem; font-weight: 900; color: #e0d0ff;
  margin: 0 0 8px;
}
.pricing-sub {
  color: rgba(200,170,255,0.5); font-size: 1rem; margin: 0 0 40px;
}
.pricing-card {
  background: rgba(20,12,50,0.85);
  border: 2px solid rgba(140,80,255,0.4);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow: 0 0 40px rgba(140,80,255,0.15), 0 0 80px rgba(140,80,255,0.05);
  position: relative;
}
.pricing-card-header {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.pricing-plan-name {
  font-size: 1.1rem; font-weight: 700; color: #c0a0ff;
}
.pricing-trial-badge {
  background: rgba(140,80,255,0.25); color: #e0d0ff;
  padding: 4px 12px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 700;
  border: 1px solid rgba(140,80,255,0.4);
}
.pricing-price {
  display: flex; align-items: baseline; justify-content: center; gap: 2px;
  margin-bottom: 4px;
}
.pricing-currency { font-size: 1.5rem; color: #c0a0ff; font-weight: 700; }
.pricing-amount { font-size: 3rem; font-weight: 900; color: #fff; letter-spacing: -1px; }
.pricing-period { font-size: 1rem; color: rgba(200,170,255,0.5); margin-left: 2px; }
.pricing-billing-note {
  font-size: 0.8rem; color: rgba(200,170,255,0.4); margin-bottom: 24px;
}
.pricing-divider {
  height: 1px; background: rgba(140,80,255,0.2); margin: 0 0 24px;
}
.pricing-features {
  list-style: none; padding: 0; margin: 0 0 28px;
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
}
.pricing-feature {
  display: flex; align-items: center; gap: 10px;
  color: rgba(230,210,255,0.85); font-size: 0.95rem;
}
.pricing-cta {
  width: 100%; padding: 14px 0;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff; border: none; border-radius: 12px;
  font-size: 1.05rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.pricing-cta:hover { background: linear-gradient(135deg, #a78bfa, #7c3aed); transform: translateY(-1px); }
.pricing-cta:disabled { opacity: 0.5; cursor: default; transform: none; }
.pricing-cta-manage {
  background: rgba(140,80,255,0.15); border: 1px solid rgba(140,80,255,0.3);
}
.pricing-cta-manage:hover { background: rgba(140,80,255,0.25); }
.pricing-current-badge {
  margin-top: 10px; font-size: 0.8rem; color: #4ade80; font-weight: 600;
}
.pricing-login-hint {
  margin-top: 12px; font-size: 0.8rem; color: rgba(200,170,255,0.5);
}
.pricing-login-hint a { color: #a78bfa; text-decoration: underline; }
.pricing-free-note {
  margin-top: 32px; padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}
.pricing-free-title { font-size: 0.85rem; font-weight: 700; color: rgba(200,170,255,0.6); margin-bottom: 4px; }
.pricing-free-desc { font-size: 0.8rem; color: rgba(200,170,255,0.4); }
.pricing-error {
  margin-top: 16px; padding: 10px 16px;
  background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3);
  border-radius: 8px; color: #f87171; font-size: 0.85rem;
}
.pricing-banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 10px; margin-bottom: 24px;
  font-size: 0.9rem;
}
.pricing-banner-success {
  background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); color: #4ade80;
}
.pricing-banner-cancel {
  background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); color: #fbbf24;
}

/* ── Legal Pages (ToS, Privacy) ────────────────────── */
.legal-container { max-width: 760px; margin: 0 auto; padding: 48px 24px 80px; }
.legal-title { font-size: 2rem; font-weight: 900; color: #e0d0ff; margin: 0 0 4px; }
.legal-updated { font-size: 0.8rem; color: rgba(200,170,255,0.4); margin: 0 0 36px; }
.legal-section { margin-bottom: 32px; }
.legal-section h2 { font-size: 1.1rem; font-weight: 700; color: #c0a0ff; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(140,80,255,0.15); }
.legal-section h3 { font-size: 0.95rem; font-weight: 600; color: rgba(200,170,255,0.8); margin: 16px 0 8px; }
.legal-section p { font-size: 0.9rem; color: rgba(220,200,255,0.7); line-height: 1.7; margin: 0 0 10px; }
.legal-section ul { padding-left: 20px; margin: 0 0 12px; }
.legal-section li { font-size: 0.9rem; color: rgba(220,200,255,0.7); line-height: 1.7; margin-bottom: 4px; }
.legal-section code { background: rgba(140,80,255,0.1); padding: 1px 6px; border-radius: 4px; font-size: 0.85rem; color: #c0a0ff; }
.legal-info-box { background: rgba(140,80,255,0.08); border: 1px solid rgba(140,80,255,0.15); border-radius: 10px; padding: 14px 18px; margin: 12px 0; font-size: 0.85rem; color: rgba(200,170,255,0.7); line-height: 1.8; }
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.85rem; }
.legal-table th { text-align: left; padding: 8px 10px; background: rgba(140,80,255,0.1); color: #c0a0ff; border-bottom: 1px solid rgba(140,80,255,0.2); }
.legal-table td { padding: 8px 10px; color: rgba(220,200,255,0.7); border-bottom: 1px solid rgba(255,255,255,0.04); }

/* ── Site Footer ───────────────────────────────────── */
.site-footer { text-align: center; padding: 24px 16px 32px; font-size: 0.75rem; color: rgba(200,170,255,0.3); background: #0a0a1a; }
.site-footer a { color: rgba(200,170,255,0.4); text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: rgba(200,170,255,0.7); }
.footer-sep { margin: 0 8px; }

/* ── Login Modal ───────────────────────────────────── */
.login-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(5, 3, 15, 0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.login-modal-card {
  position: relative;
  background: rgba(20, 12, 40, 0.85); backdrop-filter: blur(24px);
  border: 1px solid rgba(180, 130, 255, 0.2);
  border-radius: 24px; padding: 48px 40px 36px;
  max-width: 420px; width: 90%;
  box-shadow: 0 0 60px rgba(124, 58, 237, 0.15), 0 0 120px rgba(212, 168, 83, 0.08);
  text-align: center;
  animation: slideUp 0.3s ease;
}
.login-modal-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: rgba(200, 170, 255, 0.5);
  font-size: 28px; cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
.login-modal-close:hover { color: #fff; }
.login-modal-logo img { width: 72px; height: 72px; object-fit: contain; }
.login-modal-brand {
  font-size: 28px; font-weight: 900; margin-top: 12px;
  background: linear-gradient(135deg, #d4a853, #f5d97a, #d4a853);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-modal-title { font-size: 16px; color: rgba(220, 200, 255, 0.9); margin-top: 8px; font-weight: 600; }
.login-modal-sub { font-size: 14px; color: rgba(180, 160, 220, 0.7); margin-top: 4px; }
.login-modal-divider {
  height: 1px; margin: 24px 0;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.3), transparent);
}
.login-modal-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 24px; border-radius: 50px;
  background: rgba(30, 20, 50, 0.8);
  border: 1px solid rgba(212, 168, 83, 0.3);
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  font-family: var(--font);
}
.login-modal-google:hover {
  border-color: rgba(212, 168, 83, 0.6);
  box-shadow: 0 0 20px rgba(212, 168, 83, 0.15);
  transform: translateY(-1px);
}
.login-modal-agree {
  margin-top: 20px; font-size: 12px; color: rgba(180, 160, 220, 0.4); line-height: 1.6;
}
.login-modal-agree a { color: rgba(180, 130, 255, 0.6); text-decoration: none; }
.login-modal-agree a:hover { color: #a78bfa; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) } to { opacity: 1; transform: translateY(0) } }

/* ── Dropdown danger item ──────────────────────────── */
.dropdown-item-danger { color: #f87171 !important; font-size: 0.8rem; }
.dropdown-item-danger:hover { background: rgba(248,113,113,0.1); }

/* ── Viewer blurred background ─────────────────────── */
.viewer-blur-bg {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(40px) brightness(0.3); transform: scale(1.2);
  pointer-events: none; transition: background-image 0.5s ease;
}

/* ── Viewer Social — collapsible panel ──────────────── */
.viewer-social-bar {
  position: relative; z-index: 20; flex-shrink: 0;
  background: rgba(10, 8, 24, 0.9); backdrop-filter: blur(16px);
  border-top: 1px solid rgba(140, 80, 255, 0.2);
  transition: max-height 0.3s ease;
  max-height: 48px; overflow: hidden;
}
.viewer-social-bar.expanded { max-height: 50vh; overflow-y: auto; }
.social-bar-toggle {
  width: 100%; display: flex; flex-direction: column; align-items: center;
  background: none; border: none; cursor: pointer; padding: 6px 16px 8px;
}
.social-bar-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(200, 170, 255, 0.3); margin-bottom: 6px;
}
.social-bar-summary {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 720px;
}
.social-bar-title { flex: 1; font-size: 0.85rem; font-weight: 600; color: #e0d0ff; text-align: left; }
.social-bar-comments { font-size: 0.8rem; color: rgba(200, 170, 255, 0.5); }
.social-panel { max-width: 720px; margin: 0 auto; padding: 8px 20px 24px; }
.social-panel-gallery {
  display: block; text-align: center; margin-top: 12px;
  font-size: 0.8rem; color: rgba(200, 170, 255, 0.5); text-decoration: none;
}
.social-panel-gallery:hover { color: #c0a0ff; }
.viewer-like-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(140,80,255,0.1); border: 1px solid rgba(140,80,255,0.2);
  border-radius: 20px; padding: 8px 16px;
  color: rgba(200,170,255,0.7); font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
}
.viewer-like-btn:hover { background: rgba(140,80,255,0.2); }
.viewer-like-btn.liked { border-color: #ff6b9d; color: #ff6b9d; }
.viewer-social-title { flex: 1; font-size: 1rem; font-weight: 700; color: #e0d0ff; }
.viewer-social-back {
  font-size: 0.8rem; color: rgba(200,170,255,0.5);
  text-decoration: none; transition: color 0.2s;
}
.viewer-social-back:hover { color: #c0a0ff; }

/* ── Comments (shared between BookDetail and Viewer) ── */
.viewer-comments { max-width: 720px; }
.viewer-comments-title { font-size: 0.9rem; font-weight: 700; color: rgba(200,170,255,0.6); margin-bottom: 12px; }
.comment-item { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: rgba(140,80,255,0.2); color: #c0a0ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.comment-name { font-size: 0.8rem; font-weight: 600; color: rgba(200,170,255,0.8); }
.comment-date { font-size: 0.7rem; color: rgba(200,170,255,0.3); }
.comment-text { font-size: 0.85rem; color: rgba(220,200,255,0.7); line-height: 1.5; margin: 0; word-break: break-word; }
.comment-input-wrap {
  display: flex; gap: 8px; align-items: center; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.06);
}
.comment-input {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 8px 16px; color: #e0e0e0; font-size: 0.85rem; outline: none;
}
.comment-input:focus { border-color: rgba(140,80,255,0.4); }
.comment-submit {
  background: rgba(140,80,255,0.2); border: 1px solid rgba(140,80,255,0.3);
  border-radius: 8px; padding: 8px 16px; color: #c0a0ff;
  font-size: 0.8rem; cursor: pointer;
}
.comment-submit:disabled { opacity: 0.3; cursor: default; }
.comment-submit:not(:disabled):hover { background: rgba(140,80,255,0.3); }
.comment-login-hint { font-size: 0.8rem; color: rgba(200,170,255,0.4); margin-top: 12px; }
.comment-login-hint a { color: #a78bfa; }

/* ═══ A/B Test Page ═══ */
.ab-test-page { max-width: 1200px; margin: 0 auto; padding: 24px; }
.ab-test-page h2 { text-align: center; margin-bottom: 4px; color: #333; }
.ab-desc { text-align: center; font-size: 0.85rem; color: rgba(0,0,0,0.4); margin-bottom: 24px; }
.ab-controls { display: flex; gap: 24px; margin-bottom: 24px; }
.ab-upload {
  width: 200px; height: 200px; border: 2px dashed rgba(0,0,0,0.2);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; overflow: hidden;
  color: rgba(0,0,0,0.35); font-size: 0.85rem; text-align: center;
  background: rgba(0,0,0,0.03);
}
.ab-upload:hover { border-color: rgba(0,0,0,0.4); background: rgba(0,0,0,0.05); }
.ab-preview { width: 100%; height: 100%; object-fit: cover; }
.ab-options { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ab-options label { font-size: 0.8rem; color: rgba(0,0,0,0.5); }
.ab-options select, .ab-options textarea {
  background: rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px; padding: 8px 12px; color: #333; font-size: 0.9rem;
}
.ab-options button {
  background: linear-gradient(135deg, #7c3aed, #a855f7); border: none;
  border-radius: 8px; padding: 12px; color: white; font-weight: 600;
  cursor: pointer; margin-top: auto;
}
.ab-options button:disabled { opacity: 0.4; cursor: default; }
.ab-logs { margin-bottom: 16px; font-size: 0.8rem; }
.ab-log-info { color: rgba(0,0,0,0.45); }
.ab-log-error { color: #dc2626; }
.ab-results { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ab-col h3 { text-align: center; margin-bottom: 12px; font-size: 1rem; color: #333; }
.ab-result-img { width: 100%; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.ab-placeholder { height: 300px; display: flex; align-items: center; justify-content: center; color: rgba(0,0,0,0.25); border: 1px dashed rgba(0,0,0,0.15); border-radius: 12px; }
.ab-prompt { font-size: 0.7rem; color: rgba(0,0,0,0.6); white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; background: rgba(0,0,0,0.04); padding: 12px; border-radius: 8px; }
.ab-test-page details summary { cursor: pointer; font-size: 0.8rem; color: rgba(0,0,0,0.4); margin-top: 8px; }

/* ── MyPage ────────────────────────────────────────── */
.mypage-container { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.mypage-title { font-size: 1.8rem; font-weight: 900; color: #e0d0ff; margin: 0 0 24px; }
.mypage-tabs { display: flex; gap: 4px; margin-bottom: 28px; border-bottom: 1px solid rgba(140,80,255,0.15); }
.mypage-tab {
  background: none; border: none; padding: 10px 20px; color: rgba(200,170,255,0.5);
  font-size: 0.9rem; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.mypage-tab:hover { color: rgba(200,170,255,0.8); }
.mypage-tab.active { color: #c0a0ff; border-bottom-color: #8b5cf6; }
.mypage-section { margin-bottom: 32px; }
.mypage-section-title { font-size: 1.1rem; font-weight: 700; color: #c0a0ff; margin: 0 0 16px; display: none; }

/* Profile */
.mypage-profile { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.mypage-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: rgba(140,80,255,0.2); color: #c0a0ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
.mypage-name { font-size: 1.2rem; font-weight: 700; color: #e0d0ff; }
.mypage-email { font-size: 0.85rem; color: rgba(200,170,255,0.5); margin-top: 2px; }
.mypage-badges { display: flex; gap: 8px; margin-top: 8px; }
.mypage-badge { padding: 3px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.mypage-badge-github { background: rgba(255,255,255,0.08); color: rgba(200,170,255,0.7); }
.mypage-badge-free { background: rgba(255,255,255,0.05); color: rgba(200,170,255,0.4); }
.mypage-badge-premium { background: rgba(140,80,255,0.2); color: #c0a0ff; }

/* Danger zone */
.mypage-danger {
  margin-top: 24px; padding: 20px;
  background: rgba(248,113,113,0.04); border: 1px solid rgba(248,113,113,0.15);
  border-radius: 12px;
}
.mypage-danger-title { font-size: 0.9rem; font-weight: 700; color: rgba(248,113,113,0.8); margin-bottom: 10px; }
.mypage-danger-btn {
  background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3);
  border-radius: 8px; padding: 8px 20px; color: #f87171; font-size: 0.85rem; cursor: pointer;
}
.mypage-danger-btn:hover { background: rgba(248,113,113,0.2); }
.mypage-danger-btn:disabled { opacity: 0.3; cursor: default; }
.mypage-danger-hint { font-size: 0.75rem; color: rgba(248,113,113,0.5); margin-top: 8px; }

/* 4-step confirm */
.mypage-confirm-steps { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.mypage-confirm-step {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 12px 16px;
  font-size: 0.85rem; color: rgba(220,200,255,0.7);
}
.mypage-confirm-btns { display: flex; gap: 8px; margin-top: 8px; }
.mypage-btn-yes {
  background: rgba(140,80,255,0.15); border: 1px solid rgba(140,80,255,0.3);
  border-radius: 6px; padding: 6px 16px; color: #c0a0ff; font-size: 0.8rem; cursor: pointer;
}
.mypage-btn-yes:hover { background: rgba(140,80,255,0.25); }
.mypage-btn-no {
  background: none; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 6px 16px; color: rgba(200,170,255,0.5); font-size: 0.8rem; cursor: pointer;
}
.mypage-btn-final {
  background: rgba(248,113,113,0.2); border: 1px solid rgba(248,113,113,0.4);
  border-radius: 6px; padding: 6px 16px; color: #f87171; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.mypage-btn-final:hover { background: rgba(248,113,113,0.3); }

/* Subscription card */
.mypage-sub-card {
  background: rgba(20,12,50,0.6); border: 1px solid rgba(140,80,255,0.2);
  border-radius: 14px; padding: 24px;
}
.mypage-sub-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mypage-sub-plan { font-size: 1rem; font-weight: 700; color: #e0d0ff; }
.mypage-sub-status { padding: 3px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.mypage-sub-active { background: rgba(74,222,128,0.15); color: #4ade80; }
.mypage-sub-trialing { background: rgba(251,191,36,0.15); color: #fbbf24; }
.mypage-sub-canceled { background: rgba(248,113,113,0.15); color: #f87171; }
.mypage-sub-past_due { background: rgba(248,113,113,0.15); color: #f87171; }
.mypage-sub-price { margin-bottom: 12px; }
.mypage-sub-amount { font-size: 1.8rem; font-weight: 900; color: #fff; }
.mypage-sub-period { font-size: 0.9rem; color: rgba(200,170,255,0.5); }
.mypage-sub-detail { font-size: 0.85rem; color: rgba(200,170,255,0.6); line-height: 1.8; margin-bottom: 16px; }
.mypage-sub-upgrade {
  display: inline-block; margin-top: 8px; padding: 8px 20px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #fff;
  border-radius: 8px; text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.mypage-sub-cancel-btn {
  background: none; border: 1px solid rgba(248,113,113,0.3);
  border-radius: 8px; padding: 8px 20px; color: rgba(248,113,113,0.7);
  font-size: 0.8rem; cursor: pointer; margin-top: 8px;
}
.mypage-sub-cancel-btn:hover { background: rgba(248,113,113,0.1); color: #f87171; }

/* Books grid */
.mypage-books-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.mypage-books-count { font-size: 0.85rem; color: rgba(200,170,255,0.5); }
.mypage-books-create {
  padding: 6px 16px; background: rgba(140,80,255,0.15); border: 1px solid rgba(140,80,255,0.3);
  border-radius: 8px; color: #c0a0ff; font-size: 0.8rem; text-decoration: none;
}
.mypage-books-create:hover { background: rgba(140,80,255,0.25); }
.mypage-books-empty { text-align: center; padding: 40px 0; color: rgba(200,170,255,0.4); font-size: 0.9rem; }
.mypage-books-empty a { color: #a78bfa; }
.mypage-books-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mypage-book-card {
  background: rgba(20,12,50,0.6); border: 1px solid rgba(140,80,255,0.1);
  border-radius: 12px; overflow: hidden; cursor: pointer; transition: all 0.2s;
}
.mypage-book-card:hover { transform: translateY(-3px); border-color: rgba(140,80,255,0.3); }
.mypage-book-cover { aspect-ratio: 1; overflow: hidden; position: relative; background: rgba(20,12,50,0.8); }
.mypage-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.mypage-book-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); color: #f5c878; font-size: 1.2rem; font-weight: 700;
}
.mypage-book-fail { color: #f87171; }
.mypage-book-title {
  padding: 10px 12px 4px; font-size: 0.85rem; font-weight: 600; color: #e0d0ff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mypage-book-meta { padding: 0 12px 10px; display: flex; gap: 8px; align-items: center; }
.mypage-book-date { font-size: 0.7rem; color: rgba(200,170,255,0.3); }

/* Mobile: show all sections stacked, hide tabs */
@media (max-width: 767px) {
  .mypage-tabs { display: none; }
  .mypage-section-title { display: block; }
  .mypage-books-grid { grid-template-columns: repeat(2, 1fr); }
  .mypage-profile { flex-direction: column; text-align: center; }
}

/* ── Profile Setup Modal ── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: #1a1030; border: 1px solid rgba(140,80,255,0.3);
  border-radius: 20px; padding: 36px 32px; max-width: 420px; width: 90%;
  box-shadow: 0 0 60px rgba(140,80,255,0.2);
}
.modal-title { font-size: 1.4rem; font-weight: 800; color: #e0d0ff; margin: 0 0 8px; text-align: center; }
.modal-sub { font-size: 0.9rem; color: rgba(200,170,255,0.5); text-align: center; margin: 0 0 28px; }
.modal-field { margin-bottom: 20px; }
.modal-label { display: block; font-size: 0.85rem; font-weight: 600; color: rgba(200,170,255,0.7); margin-bottom: 8px; }
.modal-input {
  width: 100%; padding: 12px 16px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(140,80,255,0.25); border-radius: 10px;
  color: #fff; font-size: 1rem; outline: none; box-sizing: border-box;
}
.modal-input:focus { border-color: rgba(140,80,255,0.5); }
.modal-country-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.modal-country-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; background: rgba(255,255,255,0.04);
  border: 2px solid transparent; border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
}
.modal-country-btn:hover { background: rgba(140,80,255,0.1); }
.modal-country-btn.active { border-color: #8b5cf6; background: rgba(140,80,255,0.15); }
.modal-country-flag { font-size: 24px; }
.modal-country-name { font-size: 0.7rem; color: rgba(200,170,255,0.6); }
.modal-error { color: #ff6b6b; font-size: 0.85rem; margin-bottom: 12px; text-align: center; }
.modal-submit { width: 100%; margin-top: 8px; }
@media (max-width: 480px) {
  .modal-country-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── MyPage Profile Edit ── */
.mypage-edit-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(140,80,255,0.15); }
.mypage-edit-row { margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.mypage-edit-label { width: 60px; font-size: 0.85rem; font-weight: 600; color: rgba(200,170,255,0.6); flex-shrink: 0; }
.mypage-edit-input {
  flex: 1; padding: 10px 14px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(140,80,255,0.2); border-radius: 8px;
  color: #fff; font-size: 0.95rem; outline: none;
}
.mypage-edit-input:focus { border-color: rgba(140,80,255,0.5); }
select.mypage-edit-input { appearance: auto; }
.mypage-edit-save { margin-top: 8px; padding: 10px 24px; font-size: 0.9rem; }
.mypage-edit-msg { margin-top: 8px; font-size: 0.85rem; color: #4ade80; }

/* Country flags in community */
.masonry-flag, .community-card-flag { font-size: 16px; margin-right: 4px; }

/* Language Switcher — single button + dropdown */
.lang-switcher { position: relative; margin-right: 8px; }
.lang-btn { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.7; transition: opacity 0.15s, background 0.15s; padding: 4px 6px; border-radius: 6px; display: block; }
.lang-btn:hover { opacity: 1; background: rgba(140,80,255,0.15); }
.lang-btn-current { opacity: 1; }
.lang-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: rgba(18,12,40,0.95); backdrop-filter: blur(16px);
  border: 1px solid rgba(140,80,255,0.25); border-radius: 10px;
  padding: 4px; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 2px;
}

/* ── Mobile Hamburger Menu ── */
.navbar-hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; color: rgba(220,200,255,0.9); line-height: 0;
}
.navbar-mobile-menu {
  display: none; position: fixed; top: 70px; left: 16px; right: 16px;
  background: rgba(18,12,40,0.95); backdrop-filter: blur(20px);
  border: 1px solid rgba(140,80,255,0.25); border-radius: 16px;
  padding: 16px; z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.navbar-mobile-menu.open { display: flex; flex-direction: column; gap: 4px; }
.navbar-mobile-link {
  display: block; padding: 12px 16px; border-radius: 10px;
  font-size: 15px; font-weight: 600; color: rgba(220,200,255,0.85);
  text-decoration: none; transition: background 0.15s;
}
.navbar-mobile-link:hover { background: rgba(140,80,255,0.15); }
.navbar-mobile-divider { height: 1px; background: rgba(140,80,255,0.2); margin: 4px 0; }

/* ── Comprehensive Mobile Optimization ── */
@media (max-width: 768px) {
  /* Navbar: hide center links, show hamburger */
  .navbar-center { display: none; }
  .navbar-hamburger { display: block; }
  .navbar-inner { grid-template-columns: auto 1fr auto; }
  .navbar-right { gap: 4px; }
  .avatar-name { display: none; }
  .chevron { display: none; }

  /* Page padding */
  .page { padding-top: 56px; }
  .container { padding: 0 16px; }

  /* Create flow */
  .create-container { padding: 24px 16px 40px !important; }
  .create-dark-title { font-size: 20px !important; }
  .create-dark-sub { font-size: 13px; }
  .step-indicator { gap: 0; margin-bottom: 24px; }
  .step-circle { width: 30px; height: 30px; font-size: 12px; }
  .step-label { display: none; }
  .step-line { width: 28px; }

  /* Upload zone */
  .upload-zone-dark { min-height: 180px; }
  .upload-dark-text { font-size: 14px; }

  /* Create actions */
  .create-dark-actions { flex-direction: column; gap: 8px; }
  .create-dark-actions .btn { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }

  /* Story tabs */
  .story-tabs { flex-wrap: wrap; }
  .story-tab { font-size: 13px; padding: 10px 0; }

  /* Story thumb grid */
  .story-thumb-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
  .story-thumb-name { font-size: 11px; }

  /* Summary (Step 4) */
  .summary-dark { padding: 16px; }
  .name-wrap-dark { margin-bottom: 16px; }
  .name-input-dark { font-size: 16px; /* prevent iOS zoom */ }

  /* Narration style grid */
  .narration-style-grid { grid-template-columns: 1fr; }

  /* Library */
  .lib-dark-container { padding: 80px 16px 60px; }
  .lib-dark-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .lib-dark-header > div:last-child { width: 100%; display: flex; }
  .lib-dark-header .btn { flex: 1; justify-content: center; font-size: 13px; padding: 10px 12px; }

  /* Generating */
  .gen-dark-content { padding: 24px 16px; }
  .gen-dark-title { font-size: 18px !important; }
  .gen-ring-wrap { transform: scale(0.85); }

  /* Viewer */
  .viewer-bar { padding: 0 8px; }
  .viewer-nav-btn { width: 32px; height: 32px; }
  .viewer-social-bar { flex-wrap: wrap; gap: 8px; padding: 12px; }

  /* Community */
  .community-container { padding: 24px 16px 60px; }
  .community-title { font-size: 1.4rem; }

  /* Pricing */
  .pricing-container { padding: 32px 16px 60px; }
  .pricing-title { font-size: 1.5rem; }
  .pricing-card { padding: 24px 20px 20px; }

  /* MyPage */
  .mypage-container { padding: 24px 16px; }

  /* Book Detail */
  .book-detail-container { padding: 0 16px; }

  /* Footer */
  .site-footer { font-size: 12px; padding: 20px 16px; }

  /* Toast — above bottom nav if present */
  .toast { bottom: 24px; font-size: 13px; padding: 10px 20px; max-width: 90vw; }

  /* Touch-friendly: minimum tap targets */
  .btn { min-height: 44px; }
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .navbar { width: calc(100% - 24px); top: 8px; height: 50px; }
  .navbar-inner { padding: 0 16px; }
  .navbar-brand-icon { width: 24px; height: 24px; }
  .navbar-brand span { display: none; }

  .hero-dark-headline { font-size: 24px !important; }
  .hero-dark-sub { font-size: 12px; }

  .style-grid-dark { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .style-dark-name { font-size: 12px; }
  .style-dark-desc { font-size: 10px; }

  .story-thumb-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .gen-ring-wrap { transform: scale(0.75); }
  .gen-dark-steps { gap: 4px; }
  .gen-dark-step-label { font-size: 12px; }

  .pricing-sub { font-size: 0.85rem; margin-bottom: 24px; }
}

/* Avatar picker */
.mypage-avatar-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(140,80,255,0.3); }
.avatar-picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-top: 16px; max-width: 500px; }
.avatar-picker-item { width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; opacity: 0.6; }
.avatar-picker-item:hover { opacity: 1; border-color: rgba(140,80,255,0.4); }
.avatar-picker-item.selected { opacity: 1; border-color: #8b5cf6; box-shadow: 0 0 12px rgba(140,80,255,0.4); }
@media (max-width: 480px) { .avatar-picker-grid { grid-template-columns: repeat(5, 1fr); } }

/* NavBar avatar image support */
.avatar img, img.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(140,80,255,0.4); }

/* Safety filter notice in library */
.lib-dark-overlay-safety { background: rgba(80,60,10,0.75); padding: 16px; text-align: center; }
.lib-safety-cover-text { font-size: 11px; color: rgba(245,200,120,0.85); line-height: 1.6; margin-top: 10px; max-width: 200px; text-align: center; }
.lib-safety-notice { padding: 4px 0; }

/* Warning banner */
.warning-banner-dark { background: rgba(245,200,120,0.12); border: 1px solid rgba(245,200,120,0.3); border-radius: 12px; color: #f5c878; padding: 12px 16px; font-size: 13px; margin-bottom: 16px; }
