@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700;800&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(15, 15, 46, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent-purple: #7c3aed;
  --accent-purple-light: #a855f7;
  --accent-purple-dark: #5b21b6;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #7c3aed, #3b82f6);
  --gradient-glow: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(59, 130, 246, 0.3));
  --gradient-dark: linear-gradient(180deg, #0a0a1a 0%, #0f0f2e 50%, #0a0a1a 100%);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;
  --font-thai: 'Prompt', 'Sarabun', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-thai);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top right, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at bottom left, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 10px; }

/* ===== SPLASH SCREEN ===== */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 9999;
  animation: splashFade 2.5s ease forwards;
}

.splash-logo {
  text-align: center;
  animation: logoFloat 2s ease-in-out infinite;
}

.splash-logo .logo-icon {
  font-size: 80px;
  margin-bottom: 16px;
  display: inline-block;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logoPulse 2s ease-in-out infinite;
}

.splash-logo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.splash-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.splash-loader {
  margin-top: 32px;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.splash-loader span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: loaderDot 1.4s ease-in-out infinite;
}

.splash-loader span:nth-child(2) { animation-delay: 0.2s; }
.splash-loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes splashFade {
  0%, 60% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

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

@keyframes logoPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@keyframes loaderDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== GLASSMORPHISM ===== */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.glass-card-static {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

/* ===== BUTTONS ===== */
.btn-glow {
  background: var(--gradient-primary);
  border: none;
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: 0.5s;
}

.btn-glow:hover::before { left: 100%; }
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(124, 58, 237, 0.3); }
.btn-glow:active { transform: translateY(0); }

.btn-outline-glow {
  background: transparent;
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple-light);
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-outline-glow:hover {
  background: rgba(124, 58, 237, 0.1);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

/* ===== CARDS ===== */
.novel-card {
  min-width: 160px;
  max-width: 160px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.novel-card:hover { transform: translateY(-4px); }

.novel-card .cover {
  width: 160px;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: var(--gradient-glow);
}

.novel-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.novel-card .cover .play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.novel-card:hover .play-overlay { opacity: 1; }

.novel-card .cover .play-overlay i {
  font-size: 40px;
  color: white;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.5));
}

.novel-card .info { padding: 8px 4px; }

.novel-card .info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.novel-card .info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.novel-card .info .badge-premium {
  font-size: 0.6rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.section-header .see-all {
  color: var(--accent-purple-light);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.section-header .see-all:hover { color: var(--accent-purple); }

/* ===== HORIZONTAL SCROLL ===== */
.scroll-x {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.scroll-x::-webkit-scrollbar { height: 2px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 10px; }
.scroll-x::-webkit-scrollbar-track { background: transparent; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 1000;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  text-decoration: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  position: relative;
}

.bottom-nav .nav-item.active { color: var(--accent-purple-light); }

.bottom-nav .nav-item.active::after {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 4px 4px;
}

.bottom-nav .nav-item i { font-size: 1.3rem; }
.bottom-nav .nav-item span { font-size: 0.65rem; font-weight: 500; }

/* ===== MINI PLAYER ===== */
.mini-player {
  position: fixed;
  bottom: 64px;
  left: 8px;
  right: 8px;
  background: rgba(15, 15, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 999;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.3);
  margin-bottom: max(0px, env(safe-area-inset-bottom));
}

.mini-player.active { display: flex; }

.mini-player .mini-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gradient-glow);
}

.mini-player .mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-player .mini-info {
  flex: 1;
  min-width: 0;
}

.mini-player .mini-info h5 {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.mini-player .mini-info p {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
}

.mini-player .mini-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-player .mini-actions button {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.mini-player .mini-actions button:hover { background: var(--bg-card); }

.mini-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bg-card);
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}

.mini-progress .mini-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  transition: width 0.3s linear;
}

/* ===== TOP HEADER ===== */
.top-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: var(--bg-primary);
}

.top-header .logo {
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

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

.top-header .header-actions button {
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.top-header .header-actions button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===== HERO SECTION ===== */
.hero-section {
  position: relative;
  padding: 20px 16px;
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-section .hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-section .hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-section .hero-bg .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, var(--bg-primary) 100%);
}

.hero-section .hero-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

.hero-section .hero-content .hero-badge {
  font-size: 0.7rem;
  background: var(--gradient-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 8px;
}

.hero-section .hero-content h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.hero-section .hero-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.hero-section .hero-content .hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-section .hero-content .hero-tags span {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 10px;
  border-radius: 12px;
}

.hero-section .hero-content .hero-actions {
  display: flex;
  gap: 12px;
}

/* ===== CATEGORY PILLS ===== */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
}

.category-pills::-webkit-scrollbar { display: none; }

.category-pill {
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.category-pill.active,
.category-pill:hover {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* ===== NOVEL DETAIL ===== */
.detail-header {
  position: relative;
  min-height: 320px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.detail-header .detail-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.detail-header .detail-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(30px) brightness(0.4);
  transform: scale(1.1);
}

.detail-header .detail-bg .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,26,0.2) 0%, rgba(10,10,26,0.95) 100%);
}

.detail-header .detail-content {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.detail-header .detail-cover {
  width: 130px;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  background: var(--gradient-glow);
}

.detail-header .detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-header .detail-meta { flex: 1; }

.detail-header .detail-meta h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.detail-header .detail-meta .author {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
}

.detail-header .detail-meta .stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-header .detail-meta .stats span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-header .detail-meta .stats span i { color: var(--accent-purple-light); }

.detail-tabs {
  display: flex;
  gap: 0;
  margin: 0 16px;
  border-bottom: 1px solid var(--border-glass);
}

.detail-tab {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.detail-tab.active {
  color: var(--accent-purple-light);
  border-bottom-color: var(--accent-purple-light);
}

/* ===== EPISODE LIST ===== */
.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  transition: var(--transition);
  cursor: pointer;
  border-bottom: 1px solid var(--border-glass);
}

.episode-item:hover { background: var(--bg-card); }

.episode-item .ep-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.episode-item .ep-number.playing {
  background: var(--gradient-primary);
  color: white;
}

.episode-item .ep-info { flex: 1; min-width: 0; }

.episode-item .ep-info h5 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-item .ep-info .ep-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.episode-item .ep-action {
  flex-shrink: 0;
}

.episode-item .ep-action .btn-play-ep {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.episode-item .ep-action .btn-play-ep:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.episode-item .ep-action .btn-lock {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.episode-item.premium .ep-info h5::after {
  content: 'PREMIUM';
  font-size: 0.55rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 700;
  vertical-align: middle;
}

/* ===== PLAYER PAGE ===== */
.player-page {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 2000;
  display: none;
  flex-direction: column;
}

.player-page.active { display: flex; }

.player-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.player-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(40px) brightness(0.3);
  transform: scale(1.2);
}

.player-bg .player-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,26,0.3) 0%, rgba(10,10,26,0.95) 100%);
}

.player-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.player-top button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.player-top button:hover { background: rgba(255,255,255,0.2); }

.player-top .player-title {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

.player-top .player-title span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.player-cover-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.player-cover-wrapper {
  width: 280px;
  height: 280px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  background: var(--gradient-glow);
}

.player-cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-cover-wrapper .wave-animation {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 0 20px 16px;
}

.player-cover-wrapper.playing .wave-animation { display: flex; }

.wave-animation .wave-bar {
  width: 4px;
  background: linear-gradient(180deg, var(--accent-purple-light), var(--accent-cyan));
  border-radius: 4px;
  animation: wave 1.2s ease-in-out infinite;
  transform-origin: bottom;
}

.wave-animation .wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.wave-animation .wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.wave-animation .wave-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.wave-animation .wave-bar:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.wave-animation .wave-bar:nth-child(5) { height: 55px; animation-delay: 0.4s; }
.wave-animation .wave-bar:nth-child(6) { height: 30px; animation-delay: 0.5s; }
.wave-animation .wave-bar:nth-child(7) { height: 45px; animation-delay: 0.6s; }
.wave-animation .wave-bar:nth-child(8) { height: 60px; animation-delay: 0.7s; }
.wave-animation .wave-bar:nth-child(9) { height: 35px; animation-delay: 0.8s; }
.wave-animation .wave-bar:nth-child(10) { height: 25px; animation-delay: 0.9s; }
.wave-animation .wave-bar:nth-child(11) { height: 50px; animation-delay: 1.0s; }
.wave-animation .wave-bar:nth-child(12) { height: 40px; animation-delay: 1.1s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

.player-info {
  text-align: center;
  padding: 16px 0;
}

.player-info h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.player-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.player-progress {
  padding: 8px 0;
}

.progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--bg-card);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.progress-bar-container .progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  width: 0%;
  position: relative;
  transition: width 0.1s linear;
}

.progress-bar-container .progress-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: var(--accent-purple-light);
  border-radius: 50%;
  opacity: 0;
  transition: var(--transition);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.progress-bar-container:hover .progress-fill::after { opacity: 1; }

.progress-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 0;
}

.player-controls button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-controls button:hover { color: var(--text-primary); }

.player-controls .btn-prev,
.player-controls .btn-next {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
}

.player-controls .btn-main {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  font-size: 1.6rem;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

.player-controls .btn-main:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.4);
  color: white;
}

.player-extras {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
}

.player-extras button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  padding: 8px;
}

.player-extras button i {
  font-size: 1.2rem;
}

.player-extras button:hover { color: var(--text-primary); }
.player-extras button.active { color: var(--accent-purple-light); }

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
}

.auth-page .auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.auth-page .auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(124,58,237,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(59,130,246,0.08) 0%, transparent 50%);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
}

.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .auth-logo i {
  font-size: 48px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card .auth-logo h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 8px;
}

.auth-card .auth-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-thai);
  transition: var(--transition);
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.auth-input::placeholder {   color: var(--text-muted);
}

/* ===== NOTIFICATIONS ===== */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: white;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 0 8px rgba(239,68,68,0.5);
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border-glass);
  align-items: flex-start;
}

.notif-item:hover {
  background: var(--bg-card);
}

.notif-item.unread {
  background: rgba(59,130,246,0.05);
  border-left: 3px solid #3b82f6;
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.3;
}

.notif-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ===== TOP BAR ===== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,26,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
}

.top-bar-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 4px;
  max-width: 800px;
  margin: 0 auto;
  gap: 4px;
}

.top-bar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
}

.top-bar-logo img {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.top-bar-logo i {
  font-size: 1.4rem;
  color: var(--accent-purple-light);
}

.top-bar-logo span {
  font-size: 1rem;
  font-weight: 700;
}

.top-bar-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.top-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 1.1rem;
  position: relative;
}

.top-bar-icon:hover,
.top-bar-icon:active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Adjust page content to account for top bar + bottom nav */
main#page-content {
  padding-bottom: 72px;
}

/* Responsive */
@media (max-width: 480px) {
  .top-bar-inner {
    padding: 6px 12px 2px;
    gap: 2px;
  }
  .top-bar-logo img {
    height: 28px;
    max-width: 100px;
  }
  .top-bar-logo span {
    font-size: 0.85rem;
  }
  .top-bar-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

/* Desktop: logo left, icons right */
@media (min-width: 768px) {
  .top-bar-inner {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 0;
  }
  .top-bar-logo {
    justify-content: flex-start;
  }
  .top-bar-icons {
    justify-content: flex-end;
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.social-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-thai);
}

.social-btn:hover { background: var(--bg-card-hover); }

/* ===== PROFILE ===== */
.profile-header {
  padding: 32px 16px;
  text-align: center;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

.profile-header h2 { font-size: 1.4rem; font-weight: 700; }
.profile-header p { color: var(--text-muted); font-size: 0.85rem; }

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}

.plan-badge.free { background: rgba(255,255,255,0.1); color: var(--text-secondary); }
.plan-badge.pro { background: rgba(124,58,237,0.15); color: var(--accent-purple-light); }
.plan-badge.creator { background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(217,119,6,0.2)); color: #fbbf24; }

/* ===== RANKING ===== */
.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  transition: var(--transition);
  cursor: pointer;
}

.ranking-item:hover { background: var(--bg-card); }

.ranking-item .rank-num {
  width: 28px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
}

.ranking-item .rank-num.top-1 { color: #fbbf24; }
.ranking-item .rank-num.top-2 { color: #94a3b8; }
.ranking-item .rank-num.top-3 { color: #d97706; }

.ranking-item .rank-cover {
  width: 44px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gradient-glow);
}

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

.ranking-item .rank-info { flex: 1; min-width: 0; }

.ranking-item .rank-info h5 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-item .rank-info p {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ===== SLEEP TIMER MODAL ===== */
.sleep-timer-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sleep-timer-modal.active { display: flex; }

.sleep-timer-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.sleep-timer-modal .modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: rgba(15, 15, 46, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sleep-timer-modal .modal-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.sleep-timer-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sleep-timer-option {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: var(--font-thai);
}

.sleep-timer-option:hover,
.sleep-timer-option.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.sleep-timer-option .timer-label {
  display: block;
  font-weight: 600;
}

.sleep-timer-option .timer-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ===== SPEED CONTROL ===== */
.speed-control {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 8px 0;
}

.speed-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-thai);
}

.speed-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* ===== CONTENT PADDING ===== */
.content-wrap {
  padding: 16px;
  padding-bottom: 140px;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .novel-card { min-width: 180px; max-width: 180px; }
  .novel-card .cover { width: 180px; height: 248px; }
  .player-cover-wrapper { width: 340px; height: 340px; }
  .content-wrap { padding: 24px; padding-bottom: 150px; }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .mini-player { max-width: 480px; left: 50%; transform: translateX(-50%); bottom: 64px; }
  .detail-header .detail-cover { width: 160px; height: 220px; }
}

@media (max-width: 360px) {
  .novel-card { min-width: 140px; max-width: 140px; }
  .novel-card .cover { width: 140px; height: 196px; }
  .player-cover-wrapper { width: 220px; height: 220px; }
  .hero-section .hero-content h1 { font-size: 1.4rem; }
}

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

.slide-in {
  animation: slideIn 0.4s ease forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.2); }
  50% { box-shadow: 0 0 40px rgba(124, 58, 237, 0.4); }
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.85rem;
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}

.toast.error { border-color: #ef4444; }
.toast.success { border-color: #22c55e; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== SHIMMER LOADING ===== */
.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
