/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #222233;
  --bg-elevated: #252538;
  --text-primary: #e8e6f0;
  --text-secondary: #9896a8;
  --text-muted: #5c5a6e;
  --accent-purple: #8b5cf6;
  --accent-purple-dim: rgba(139, 92, 246, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-teal: #14b8a6;
  --accent-teal-dim: rgba(20, 184, 166, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-dim: rgba(244, 63, 94, 0.15);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --gradient-amber: linear-gradient(135deg, #f59e0b, #d97706);
  --gradient-teal: linear-gradient(135deg, #14b8a6, #0d9488);
  --gradient-rose: linear-gradient(135deg, #f43f5e, #e11d48);
  --player-height: 0px;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Pages ===== */
.page {
  display: none;
  min-height: 100vh;
  padding-bottom: calc(var(--player-height) + 20px);
}
.page.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Landing Hero ===== */
.landing-hero {
  position: relative;
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6, #f9a8d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  color: var(--text-muted);
  font-size: 1.5rem;
  animation: bounce 2s infinite;
  z-index: 1;
}

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

/* ===== Stories Grid ===== */
.stories-grid {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.story-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.04);
}
.story-card:hover, .story-card:active {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.story-card-inner {
  display: flex;
  align-items: stretch;
  min-height: 160px;
}

.story-card-cover {
  width: 140px;
  min-height: 160px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.story-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, var(--bg-card) 100%);
}

.story-card-cover .cover-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.9;
}

.story-card-body {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.story-card-genre {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  width: fit-content;
}
.genre-marvel { background: var(--accent-rose-dim); color: var(--accent-rose); }
.genre-noir { background: var(--accent-amber-dim); color: var(--accent-amber); }
.genre-scifi { background: var(--accent-teal-dim); color: var(--accent-teal); }

.story-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.story-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.story-card-footer span { display: flex; align-items: center; gap: 0.3rem; }

/* ===== Story Detail ===== */
.detail-header {
  padding: 1.5rem 1.25rem 0;
  max-width: 700px;
  margin: 0 auto;
}
.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem 0;
  font-family: var(--font-body);
  transition: color 0.2s;
}
.back-btn:hover { color: var(--text-primary); }

.detail-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 0.75rem;
  line-height: 1.2;
}
.detail-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.detail-cover {
  max-width: 700px;
  margin: 1.25rem auto;
  padding: 0 1.25rem;
}
.detail-cover .cover-banner {
  width: 100%;
  height: 180px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.detail-cover .cover-banner .cover-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.detail-synopsis {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.chapters-list {
  max-width: 700px;
  margin: 1.5rem auto 0;
  padding: 0 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chapter-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.04);
}
.chapter-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.08);
}

.chapter-card-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chapter-card-info { flex: 1; min-width: 0; }
.chapter-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.chapter-card-progress {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.chapter-card-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.chapter-card-play {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chapter-card-play:hover { background: rgba(255,255,255,0.08); }

/* Coming Soon */
.chapter-card.coming-soon {
  opacity: 0.55;
  cursor: default;
}
.chapter-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}
.coming-soon-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.08);
}

.empty-state {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text-secondary);
  text-align: center;
}

.autoplay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(244,63,94,0.12), rgba(255,255,255,0.04));
  border: 1px solid rgba(244,63,94,0.2);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.5rem;
}
.autoplay-title { font-weight: 700; font-size: 0.95rem; }
.autoplay-note { color: var(--text-secondary); font-size: 0.75rem; line-height: 1.4; margin-top: 0.15rem; }
.switch { position: relative; display: inline-block; width: 54px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.12);
  transition: 0.25s;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: white;
  transition: 0.25s;
  border-radius: 50%;
}
.switch input:checked + .slider { background: var(--accent-rose); }
.switch input:checked + .slider:before { transform: translateX(24px); }

.video-chapter-card { align-items: stretch; padding: 0.7rem; }
.chapter-poster {
  width: 128px;
  min-height: 78px;
  border-radius: 10px;
  background-size: cover !important;
  background-position: center !important;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.chapter-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.45));
}
.poster-play, .poster-soon {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.poster-play {
  width: 42px;
  height: 42px;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(244,63,94,0.88);
  color: white;
  font-size: 1rem;
}
.poster-soon { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; }
.chapter-kicker {
  font-size: 0.65rem;
  color: var(--accent-rose);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

/* ===== Chapter View ===== */
.chapter-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chapter-story-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}
.chapter-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.chapter-content-wrapper {
  max-width: 700px;
  margin: 0 auto;
}

.chapter-content {
  padding: 2rem 1.25rem 4rem;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-secondary);
}
.chapter-content h1, .chapter-content h2, .chapter-content h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}
.chapter-content h1 { font-size: 1.6rem; }
.chapter-content h2 { font-size: 1.35rem; }
.chapter-content h3 { font-size: 1.15rem; }

.chapter-content p {
  margin-bottom: 1.2rem;
  text-indent: 0;
}
.chapter-content p + p { text-indent: 1.5em; }

.chapter-content em, .chapter-content i {
  font-style: italic;
  color: #b8b4cc;
}
.chapter-content strong, .chapter-content b {
  font-weight: 600;
  color: var(--text-primary);
}
.chapter-content blockquote {
  border-left: 3px solid var(--accent-purple);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}
.chapter-content hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 2rem 0;
}
.chapter-content code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ===== Video Player ===== */
.video-stage {
  padding-bottom: 2rem;
}
.chapter-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 20px 70px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
}
.video-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.primary-action, .secondary-action {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}
.primary-action {
  color: white;
  background: var(--gradient-rose);
  box-shadow: 0 10px 30px rgba(244,63,94,0.22);
}
.secondary-action {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}
.video-meta-panel {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.video-meta-panel span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
}

/* ===== Visual Gallery / Art Book ===== */
.detail-actions {
  max-width: 700px;
  margin: 1.2rem auto 0;
  padding: 0 1.25rem;
}
.art-book-action { width: 100%; }

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 1.25rem 1.2rem;
  background:
    radial-gradient(circle at 20% 0%, rgba(244,63,94,0.18), transparent 34%),
    rgba(10, 10, 15, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.gallery-kicker {
  margin-top: 0.45rem;
  color: var(--accent-rose);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 8vw, 3.2rem);
  line-height: 1.05;
  margin-top: 0.18rem;
}
.gallery-subtitle {
  color: var(--text-secondary);
  font-size: 0.86rem;
  margin-top: 0.45rem;
  max-width: 620px;
}
.gallery-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}
.gallery-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.gallery-tabs {
  display: flex;
  flex: 1;
  gap: 0.55rem;
  padding: 0.25rem 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery-tabs::-webkit-scrollbar { display: none; }
.gallery-tab {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.62rem 0.85rem;
  font-family: var(--font-body);
  font-weight: 800;
  cursor: pointer;
}
.gallery-tab span {
  color: var(--text-muted);
  font-weight: 700;
  margin-left: 0.25rem;
}
.gallery-tab.active {
  color: white;
  background: var(--gradient-rose);
  border-color: rgba(244,63,94,0.55);
  box-shadow: 0 10px 28px rgba(244,63,94,0.18);
}
.gallery-tab.active span { color: rgba(255,255,255,0.75); }
.gallery-storybook-btn {
  flex: 0 0 auto;
  margin-top: 0.25rem;
  white-space: nowrap;
}
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.gallery-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(0,0,0,0.26);
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.gallery-card:hover {
  transform: translateY(-3px);
  border-color: rgba(244,63,94,0.32);
  background: linear-gradient(180deg, rgba(244,63,94,0.09), rgba(255,255,255,0.035));
}
.gallery-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050508;
}
.gallery-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-card:hover .gallery-thumb { transform: scale(1.035); }
.gallery-thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.72));
}
.gallery-time {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.62);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
}
.gallery-card-body { padding: 0.95rem; }
.gallery-card-kicker {
  color: var(--accent-rose);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.gallery-card h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.2;
  margin-top: 0.22rem;
}
.gallery-card p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gallery-card-meta {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.gallery-tags span {
  color: #fbcfe8;
  background: rgba(244,63,94,0.12);
  border: 1px solid rgba(244,63,94,0.18);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 700;
}
.storybook-viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -15%, rgba(244,63,94,0.18), transparent 42%),
    linear-gradient(180deg, #050506 0%, #09090e 42%, #020203 100%);
  color: white;
}
.storybook-viewer.hidden { display: none; }
body.storybook-open { overflow: hidden; }
.storybook-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.storybook-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.7), transparent 18%, transparent 74%, rgba(0,0,0,0.48)),
    linear-gradient(180deg, rgba(0,0,0,0.45), transparent 28%, rgba(0,0,0,0.78));
}
.storybook-image-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.storybook-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 32px 80px rgba(0,0,0,0.62));
}
.storybook-exit,
.storybook-nav {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.44);
  color: white;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.storybook-exit {
  top: max(0.9rem, env(safe-area-inset-top));
  right: max(0.9rem, env(safe-area-inset-right));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.65rem;
  line-height: 1;
}
.storybook-nav {
  top: 50%;
  transform: translateY(-50%);
  width: clamp(56px, 8vw, 84px);
  height: min(42vh, 340px);
  min-height: 96px;
  border-radius: 999px;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 1;
}
.storybook-prev { left: max(0.75rem, env(safe-area-inset-left)); }
.storybook-next { right: max(0.75rem, env(safe-area-inset-right)); }
.storybook-nav:disabled {
  opacity: 0.28;
  cursor: default;
}
.storybook-overlay {
  position: absolute;
  z-index: 2;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 2rem));
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 1.05rem 1.15rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(9,9,14,0.72);
  box-shadow: 0 22px 70px rgba(0,0,0,0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.storybook-topline {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(255,255,255,0.78);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.storybook-kicker {
  color: #fda4af;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.7rem;
}
.storybook-overlay h2 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  line-height: 1.05;
  margin-top: 0.18rem;
}
.storybook-overlay p {
  color: rgba(255,255,255,0.78);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-top: 0.55rem;
}
.storybook-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.storybook-meta-grid div {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.62rem;
}
.storybook-meta-grid span {
  display: block;
  color: rgba(255,255,255,0.5);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.storybook-meta-grid strong {
  display: block;
  color: white;
  font-size: 0.76rem;
  line-height: 1.35;
  margin-top: 0.18rem;
}
.storybook-tags { margin-top: 0.8rem; }
.storybook-prompt {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.09);
}
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.gallery-modal.hidden { display: none; }
body.modal-open { overflow: hidden; }
.gallery-modal-card {
  position: relative;
  width: min(1040px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 22px;
  background: #101018;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 30px 90px rgba(0,0,0,0.65);
}
.gallery-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.62);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}
.gallery-modal-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #050508;
}
.gallery-modal-body { padding: 1.1rem; }
.gallery-modal-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7vw, 2.45rem);
  line-height: 1.08;
  margin-top: 0.2rem;
}
.gallery-modal-beat {
  color: var(--text-secondary);
  margin-top: 0.55rem;
  line-height: 1.6;
}
.gallery-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 1rem;
}
.gallery-detail-grid div {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 13px;
  padding: 0.75rem;
}
.gallery-detail-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  margin-bottom: 0.22rem;
}
.gallery-detail-grid strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.35;
}
.modal-tags { margin-top: 1rem; }
.prompt-details {
  margin-top: 1rem;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 14px;
  padding: 0.85rem;
}
.prompt-details summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 800;
}
.prompt-details p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.6;
  margin-top: 0.7rem;
}
.gallery-notes {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0.85rem 0 0 1.1rem;
}
.gallery-source-path {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  margin-top: 1rem;
  overflow-wrap: anywhere;
}

/* ===== Legacy Audio Player ===== */
.audio-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(18, 18, 26, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.audio-player.hidden {
  transform: translateY(100%);
}

.player-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  position: relative;
  transition: height 0.15s;
}
.player-progress-bar:hover { height: 6px; }
.player-progress-fill {
  height: 100%;
  background: var(--accent-purple);
  border-radius: 0 2px 2px 0;
  width: 0%;
  transition: none;
  position: relative;
}
.player-progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.player-progress-bar:hover .player-progress-handle { opacity: 1; }

.player-main {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem 0.75rem;
  gap: 0.75rem;
  height: var(--player-height);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.player-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.player-text { min-width: 0; }
.player-now-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent-purple);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.player-track-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-story-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.player-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.player-btn-play {
  width: 48px;
  height: 48px;
  background: var(--gradient-purple);
  color: white;
  border-radius: 50%;
  margin: 0 0.25rem;
}
.player-btn-play:hover { background: var(--gradient-purple); box-shadow: 0 0 20px rgba(139,92,246,0.4); }

.player-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
  min-width: 80px;
  text-align: center;
}
.player-time-sep { margin: 0 0.2rem; }

.player-close-btn {
  flex-shrink: 0;
  opacity: 0.5;
}
.player-close-btn:hover { opacity: 1; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Mobile adjustments ===== */
@media (max-width: 640px) {
  .story-card-inner { flex-direction: column; }
  .story-card-cover { width: 100%; min-height: 100px; height: 100px; }
  .story-card-cover::after {
    background: linear-gradient(180deg, transparent 40%, var(--bg-card) 100%);
  }
  .player-time { display: none; }
  .player-close-btn { display: none; }
  .player-main { padding: 0.4rem 0.75rem 0.6rem; gap: 0.5rem; }
  .video-chapter-card { flex-direction: column; }
  .chapter-poster { width: 100%; min-height: 150px; }
  .autoplay-row { align-items: flex-start; }
  .chapter-video { border-radius: 12px; }
  .video-actions { flex-direction: column; }
  .primary-action, .secondary-action { width: 100%; }
  .gallery-toolbar { flex-direction: column; }
  .gallery-tabs { width: 100%; padding-bottom: 0.25rem; }
  .gallery-storybook-btn { width: 100%; margin: 0 0 0.85rem; }
  .storybook-nav {
    top: auto;
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: 76px;
    height: 76px;
    min-height: 76px;
    font-size: 3.6rem;
  }
  .storybook-overlay {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 88px);
    width: auto;
    max-height: 45vh;
    padding: 0.9rem;
  }
  .storybook-stage::after {
    background:
      linear-gradient(180deg, rgba(0,0,0,0.32), transparent 30%, rgba(0,0,0,0.88)),
      linear-gradient(90deg, rgba(0,0,0,0.28), transparent 24%, transparent 76%, rgba(0,0,0,0.28));
  }
  .storybook-meta-grid { grid-template-columns: 1fr; }
  .storybook-topline { font-size: 0.66rem; }
}

@media (min-width: 641px) {
  .art-book-action { width: auto; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-modal-body { padding: 1.4rem 1.6rem 1.6rem; }
}

@media (min-width: 980px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-header { padding-left: calc((100vw - 1120px) / 2 + 1rem); }
}

/* ===== Utility ===== */
.hidden { /* handled by transform for player */ }
.accent-purple { color: var(--accent-purple); }
.accent-amber { color: var(--accent-amber); }
.accent-teal { color: var(--accent-teal); }
.accent-rose { color: var(--accent-rose); }
.bg-gradient-purple { background: var(--gradient-purple); }
.bg-gradient-amber { background: var(--gradient-amber); }
.bg-gradient-teal { background: var(--gradient-teal); }
.bg-gradient-rose { background: var(--gradient-rose); }
