/* ================================================================
   GocNhoTruyen – Webnovel Style Design System
   Inspired by Webnovel.com (Dark Navy #0E1117, Crimson Red Accent #E84040)
================================================================ */

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

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Brand Webnovel Colors */
  --primary:        #E84040;
  --primary-2:      #FF5C5C;
  --primary-dark:   #C22727;
  --accent:         #F5A623;   /* VIP Gold */
  --accent2:        #3B82F6;   /* Sky Blue */

  /* Dark Navy Backgrounds */
  --bg:             #0E1117;   /* deep charcoal/navy */
  --bg2:            #161B26;   /* navbar, category bar, footer */
  --bg3:            #1E2536;   /* sub-containers, inputs */
  --bg4:            #262F44;   /* borders, hover states */
  --card:           #151B28;   /* card background */
  --card2:          #1A2234;   /* card hover/highlight */

  /* Text Colors */
  --text:           #F1F5F9;   /* high contrast text */
  --text2:          #94A3B8;   /* muted labels, icons */
  --text3:          #64748B;   /* secondary meta, timestamps */
  --text4:          #475569;   /* subtle lines, hints */

  /* Borders & Radius */
  --border:         rgba(255, 255, 255, 0.07);
  --border2:        rgba(255, 255, 255, 0.12);
  --radius-xs:      4px;
  --radius:         6px;       /* Webnovel style: clean, modern square-ish curves */
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  /* Shadows & Glow */
  --glow-primary:   0 4px 20px rgba(232, 64, 64, 0.35);
  --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow:         0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg:      0 16px 48px rgba(0, 0, 0, 0.6);
  --transition:     0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --primary:        #E84040;
  --primary-2:      #FF5C5C;
  --primary-dark:   #C22727;
  --accent:         #D97706;
  --bg:             #F8FAFC;
  --bg2:            #FFFFFF;
  --bg3:            #F1F5F9;
  --bg4:            #E2E8F0;
  --card:           #FFFFFF;
  --card2:          #F8FAFC;
  --text:           #0F172A;
  --text2:          #475569;
  --text3:          #94A3B8;
  --text4:          #CBD5E1;
  --border:         rgba(0, 0, 0, 0.07);
  --border2:        rgba(0, 0, 0, 0.12);
  --shadow:         0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; transition: var(--transition); }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* ── Global Layout Containers ───────────────────────────────── */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}
.main-content {
  min-height: calc(100vh - 100px);
  padding-top: 100px; /* 60px navbar + 40px category bar */
}

/* ── HEADER & 2-TIER NAVBAR ─────────────────────────────────── */
.header-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.navbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
}
.navbar .container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 1.7rem;
  line-height: 1;
}
.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand-accent {
  color: var(--primary);
}

/* Search bar (Webnovel-style capsule) */
.navbar-search {
  flex: 1;
  max-width: 460px;
}
.search-wrapper {
  position: relative;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  transition: var(--transition);
}
.search-wrapper:focus-within {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(232, 64, 64, 0.18);
}
.search-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.9rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 8px 16px 8px 44px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
}
.search-input::placeholder { color: var(--text3); }

/* Nav Menu Right */
.navbar-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text2);
  border-radius: var(--radius);
  transition: var(--transition);
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg3);
}
.nav-vip {
  color: var(--accent) !important;
  font-weight: 700;
}
.nav-vip:hover {
  background: rgba(245, 166, 35, 0.12) !important;
}

/* Category Sub-bar (Webnovel Tier 2) */
.category-bar {
  height: 40px;
  background: var(--bg);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.category-bar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  padding: 0 20px;
}
.category-bar-inner::-webkit-scrollbar { display: none; }
.cat-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.cat-bar-link:hover {
  color: var(--primary);
  background: rgba(232, 64, 64, 0.08);
}
.cat-bar-link.active {
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

/* User & Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: var(--transition);
}
.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.dropdown { position: relative; }
.user-avatar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg3);
  border-radius: 50px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.user-avatar-btn:hover { border-color: var(--primary); }
.avatar-img {
  width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
}
.user-name-short {
  font-size: 0.82rem; font-weight: 600; color: var(--text2);
}
.vip-badge-mini { color: var(--accent); font-size: 0.72rem; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 210px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden; display: none; z-index: 200;
}
.dropdown-menu.active { display: block; }
.dropdown-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.dh-name { font-weight: 700; font-size: 0.9rem; }
.dh-badge { font-size: 0.75rem; color: var(--primary); margin-top: 2px; font-weight: 600; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 0.85rem; font-weight: 600;
  color: var(--text2); width: 100%; text-align: left;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg3); color: var(--text); }
.dropdown-item i { width: 16px; text-align: center; color: var(--text3); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.text-danger { color: #FF4D4D !important; }

/* Mobile Menu */
.mobile-menu-btn {
  display: none; width: 36px; height: 36px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text2);
  align-items: center; justify-content: center;
}
.mobile-menu {
  display: none; flex-direction: column;
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 12px 0;
}
.mobile-menu.open { display: flex; }
.mobile-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; font-weight: 600; color: var(--text2);
  border-left: 3px solid transparent; transition: var(--transition);
}
.mobile-nav-link:hover { color: var(--primary); border-color: var(--primary); background: var(--bg3); }

/* Buttons */
.btn-outline-sm {
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--border2);
  font-size: 0.84rem; font-weight: 600; color: var(--text2);
  transition: var(--transition);
}
.btn-outline-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary-sm {
  padding: 7px 16px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-size: 0.84rem; font-weight: 700;
  box-shadow: 0 2px 10px rgba(232, 64, 64, 0.3);
  transition: var(--transition);
}
.btn-primary-sm:hover { background: var(--primary-2); transform: translateY(-1px); }

/* ── HERO BANNER (Webnovel Large Featured Carousel) ──────────── */
.hero-slider {
  position: relative;
  overflow: hidden;
  height: 380px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.hero-slide {
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
}
.hero-slide.active {
  opacity: 1; pointer-events: auto;
  z-index: 1;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(12px) brightness(0.25);
  transform: scale(1.08);
}
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(14,17,23,0.95) 0%, rgba(14,17,23,0.7) 45%, rgba(14,17,23,0.4) 100%),
              linear-gradient(0deg, rgba(14,17,23,1) 0%, transparent 40%);
}
.hero-content {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  z-index: 2;
}
.hero-content .container {
  display: flex; align-items: center; gap: 36px;
  width: 100%;
}
.hero-cover {
  width: 280px; height: 165px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.12);
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-info { flex: 1; max-width: 680px; }
.hero-category {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(232, 64, 64, 0.15);
  color: var(--primary);
  padding: 4px 10px; border-radius: var(--radius-xs);
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.hero-title {
  font-size: 2.2rem; font-weight: 800;
  line-height: 1.2; color: #fff;
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-desc {
  font-size: 0.92rem; color: var(--text2);
  line-height: 1.6; margin-bottom: 22px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 12px; }
.hero-btn-play {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius);
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 0.92rem;
  box-shadow: var(--glow-primary);
  transition: var(--transition);
}
.hero-btn-play:hover {
  background: var(--primary-2);
  transform: translateY(-2px);
}
.hero-btn-info {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text); font-weight: 600; font-size: 0.92rem;
  transition: var(--transition);
}
.hero-btn-info:hover {
  background: var(--bg4);
  border-color: rgba(255,255,255,0.2);
}
.hero-dots {
  position: absolute; bottom: 18px; right: 30px;
  display: flex; gap: 8px; z-index: 3;
}
.hero-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  cursor: pointer; transition: var(--transition);
}
.hero-dot.active {
  background: var(--primary); width: 22px; border-radius: 4px;
}

/* Hero Fallback */
.hero-fallback {
  height: 340px;
  background: linear-gradient(135deg, #0E1117 0%, #161B26 60%, #1F283D 100%);
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.hero-fallback::before {
  content: '';
  position: absolute; right: -5%; bottom: -10%;
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(232, 64, 64, 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-fallback-inner { width: 100%; position: relative; z-index: 1; }
.hero-fallback-title {
  font-size: 2.5rem; font-weight: 800; line-height: 1.15;
  color: #fff; letter-spacing: -0.02em;
}
.hero-fallback-title span { color: var(--primary); }
.hero-fallback-sub {
  font-size: 1rem; color: var(--text2);
  margin-top: 10px; max-width: 580px;
}
.hero-fallback-cta { display: flex; gap: 12px; margin-top: 24px; }
.floating-icon {
  position: absolute; right: 8%; top: 50%;
  transform: translateY(-50%);
  font-size: 8rem; opacity: 0.05;
}

/* ── STATS STRIP ────────────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 24px 0 32px;
  overflow: hidden;
}
.stat-item {
  padding: 16px 20px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-number {
  font-size: 1.45rem; font-weight: 800;
  color: var(--primary); line-height: 1;
}
.stat-label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text3); margin-top: 4px;
}

/* ── WEBNOVEL 2-COLUMN HOME LAYOUT ──────────────────────────── */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}
.home-main-col { min-width: 0; }
.home-sidebar-col { min-width: 0; }

/* ── SECTION & WEBNOVEL TABS ────────────────────────────────── */
.section { margin-bottom: 36px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 18px;
  background: var(--primary);
  border-radius: 2px;
}
.section-link {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text3); display: flex; align-items: center; gap: 4px;
}
.section-link:hover { color: var(--primary); }

/* Underline Style Tabs (Webnovel Standard) */
.section-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.section-tab {
  padding: 8px 4px 12px;
  font-size: 0.95rem; font-weight: 700;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.section-tab:hover { color: var(--text); }
.section-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── WEBNOVEL STORY CARD ────────────────────────────────────── */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 16px;
}
.story-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}
.story-card:hover {
  transform: translateY(-4px);
  border-color: var(--border2);
  box-shadow: 0 10px 28px rgba(0,0,0,0.5);
  background: var(--card2);
}
.story-card-cover {
  position: relative;
  aspect-ratio: 3/4;
  background: var(--bg3);
  overflow: hidden;
}
.story-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.story-card:hover .story-card-cover img {
  transform: scale(1.05);
}

/* Hover Overlay with Play Button */
.story-card-overlay {
  position: absolute; inset: 0;
  background: rgba(14, 17, 23, 0.65);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: var(--transition);
}
.story-card:hover .story-card-overlay { opacity: 1; }
.story-card-play-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 50px;
  background: var(--primary);
  color: #fff; font-size: 0.78rem; font-weight: 700;
  box-shadow: 0 4px 15px rgba(232, 64, 64, 0.5);
}

/* Genre Tag on Cover (Webnovel bottom-left tag) */
.story-card-genre {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(14, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  color: #E2E8F0;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Badges Top-Right */
.story-card-badges {
  position: absolute; top: 6px; right: 6px;
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
  pointer-events: none;
}
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 3px;
  font-size: 0.65rem; font-weight: 800;
  text-transform: uppercase;
}
.badge-vip  { background: var(--accent); color: #000; font-weight: 900; }
.badge-hot  { background: var(--primary); color: #fff; }
.badge-done { background: #10B981; color: #fff; }
.badge-new  { background: #3B82F6; color: #fff; }
.badge-free { background: var(--bg4); color: var(--text2); }

.story-card-body {
  padding: 10px 10px 12px;
  display: flex; flex-direction: column; flex: 1;
}
.story-card-title {
  font-size: 0.86rem; font-weight: 700;
  line-height: 1.35; color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story-card-meta {
  margin-top: auto;
  font-size: 0.72rem; color: var(--text3);
  display: flex; align-items: center; justify-content: space-between;
}

/* ── SIDEBAR RANKINGS (Webnovel #1 - #10 List) ────────────────── */
.sidebar-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}
.sidebar-box-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.95rem; font-weight: 800;
  color: var(--text);
}
.sidebar-box-header i { color: var(--primary); }
.sidebar-box-body { padding: 8px 12px; }

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: var(--radius);
  transition: var(--transition);
}
.rank-item:hover {
  background: var(--bg3);
}
.rank-num {
  font-size: 1.35rem;
  font-weight: 900;
  width: 24px;
  text-align: center;
  color: var(--text4);
  line-height: 1;
}
.rank-item:nth-child(1) .rank-num { color: #E84040; }
.rank-item:nth-child(2) .rank-num { color: #F5A623; }
.rank-item:nth-child(3) .rank-num { color: #3B82F6; }

.rank-cover {
  width: 42px; height: 56px;
  border-radius: var(--radius-xs);
  overflow: hidden; flex-shrink: 0;
  background: var(--bg4);
}
.rank-cover img { width: 100%; height: 100%; object-fit: cover; }
.rank-body { flex: 1; min-width: 0; }
.rank-title {
  font-size: 0.84rem; font-weight: 700;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-meta {
  font-size: 0.72rem; color: var(--text3);
  margin-top: 3px; display: flex; gap: 8px;
}

/* VIP Promo Card in Sidebar */
.vip-promo-box {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.15) 0%, rgba(232, 64, 64, 0.12) 100%);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}
.vip-promo-title {
  font-size: 1.05rem; font-weight: 800;
  color: #fff; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.vip-promo-title span { color: var(--accent); }
.vip-promo-desc {
  font-size: 0.82rem; color: var(--text2);
  line-height: 1.5; margin-bottom: 14px;
}
.vip-promo-btn {
  display: block; text-align: center;
  padding: 8px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, #F5A623, #E87A15);
  color: #000; font-size: 0.85rem; font-weight: 800;
  box-shadow: 0 4px 14px rgba(245, 166, 35, 0.35);
}

/* ── GENRE GRID ─────────────────────────────────────────────── */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.genre-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  transition: var(--transition);
}
.genre-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--bg3);
}
.genre-emoji { font-size: 1.6rem; margin-bottom: 4px; }
.genre-name { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.genre-count { font-size: 0.7rem; color: var(--text3); margin-top: 2px; }

/* ── RECENT UPDATED LIST (Webnovel row layout) ───────────────── */
.story-list-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.story-list-item:last-child { border-bottom: none; }
.story-list-cover {
  width: 65px; height: 86px;
  border-radius: var(--radius);
  overflow: hidden; flex-shrink: 0;
}
.story-list-cover img { width: 100%; height: 100%; object-fit: cover; }
.story-list-body { flex: 1; min-width: 0; }
.story-list-title {
  font-size: 0.95rem; font-weight: 700;
  color: var(--text); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.story-list-desc {
  font-size: 0.82rem; color: var(--text3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.5;
}
.story-list-meta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 6px; font-size: 0.74rem; color: var(--text3);
}

/* ── GENERAL BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius);
  font-weight: 700; font-size: 0.88rem;
  transition: var(--transition); cursor: pointer; border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(232, 64, 64, 0.3);
}
.btn-primary:hover {
  background: var(--primary-2);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border2);
}
.btn-outline:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--bg3);
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-block { width: 100%; }
.btn-round { border-radius: 50px; }

/* ── CARDS & FORMS ──────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.92rem;
  color: var(--text);
}
.card-body { padding: 20px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.8rem; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 0.88rem; outline: none; transition: var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(232, 64, 64, 0.15);
}
.form-control::placeholder { color: var(--text4); }
.form-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.form-check input[type=checkbox] { accent-color: var(--primary); }
.form-hint { display: block; font-size: 0.75rem; color: var(--text3); margin-top: 4px; }

/* ── PRICING PAGE ───────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px; margin-top: 24px;
}
.pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px; transition: var(--transition);
  position: relative;
}
.pricing-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.pricing-badge {
  display: inline-block; padding: 4px 10px;
  background: rgba(232, 64, 64, 0.15); color: var(--primary);
  border-radius: var(--radius-xs); font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; margin-bottom: 12px;
}
.pricing-name { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.pricing-price { font-size: 2.2rem; font-weight: 900; color: var(--primary); margin: 8px 0 2px; }
.pricing-period { font-size: 0.82rem; color: var(--text3); }
.pricing-divider { height: 1px; background: var(--border); margin: 18px 0; }
.pricing-features { display: flex; flex-direction: column; gap: 10px; }
.pricing-feature { font-size: 0.85rem; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.pricing-feature i { color: var(--primary); }

/* ── AUDIO/VIDEO PLAYER LAYOUT ──────────────────────────────── */
.player-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px; align-items: start;
}
.player-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 24px;
}
.player-artwork {
  width: 180px; height: 240px; margin: 0 auto 20px;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.player-artwork img { width: 100%; height: 100%; object-fit: cover; }
.player-title { font-size: 1.25rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.player-story { text-align: center; font-size: 0.88rem; color: var(--text3); margin-bottom: 16px; }

.playlist-sidebar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); max-height: 640px;
  display: flex; flex-direction: column; overflow: hidden;
}
.playlist-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 800; font-size: 0.92rem;
  display: flex; justify-content: space-between; align-items: center;
}
.playlist-body { overflow-y: auto; flex: 1; padding: 6px; }
.playlist-body::-webkit-scrollbar { width: 4px; }
.playlist-body::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.chapter-list { display: flex; flex-direction: column; gap: 2px; }
.chapter-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-xs);
  font-size: 0.85rem; transition: var(--transition);
}
.chapter-item:hover { background: var(--bg3); }
.chapter-item.active { background: rgba(232, 64, 64, 0.1); border-left: 3px solid var(--primary); }
.chapter-num { font-weight: 700; color: var(--text3); min-width: 28px; }
.chapter-title { flex: 1; font-weight: 600; color: var(--text); }
.chapter-meta { font-size: 0.75rem; color: var(--text3); }
.chapter-vip-tag {
  font-size: 0.65rem; font-weight: 800;
  padding: 2px 5px; background: rgba(245, 166, 35, 0.2);
  color: var(--accent); border-radius: 3px;
}

/* ── COMMENTS & PAGINATION ──────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item {
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid var(--border);
}
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.comment-name { font-weight: 700; font-size: 0.85rem; }
.comment-date { font-size: 0.72rem; color: var(--text3); }
.comment-body { font-size: 0.86rem; color: var(--text2); line-height: 1.5; }
.comment-replies { margin-top: 10px; margin-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.comment-reply { background: var(--bg3); border-radius: var(--radius-xs); padding: 10px 12px; }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 28px 0;
}
.page-link {
  min-width: 34px; height: 34px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--border); font-size: 0.85rem; font-weight: 600;
  color: var(--text2); transition: var(--transition);
}
.page-link:hover, .page-link.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── AUTH PAGES ─────────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 100px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-box {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo-text { font-size: 1.4rem; font-weight: 800; color: #fff; }
.auth-logo-text span { color: var(--primary); }
.auth-title { font-size: 1.15rem; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-subtitle { text-align: center; font-size: 0.82rem; color: var(--text3); margin-bottom: 22px; }

/* ── PERSISTENT MINI PLAYER ─────────────────────────────────── */
.mini-player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 990;
  height: 68px;
  background: rgba(22, 27, 38, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border2);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.mp-cover {
  width: 46px; height: 46px; border-radius: var(--radius-xs);
  overflow: hidden; flex-shrink: 0;
}
.mp-cover img { width: 100%; height: 100%; object-fit: cover; }
.mp-info { flex: 0 0 220px; min-width: 0; }
.mp-title { font-weight: 700; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-story { font-size: 0.72rem; color: var(--text3); margin-top: 1px; }
.mp-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mp-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 0.84rem; transition: var(--transition);
}
.mp-btn:hover { color: var(--text); background: var(--bg3); }
.mp-play {
  background: var(--primary); color: #fff !important;
  box-shadow: 0 2px 10px rgba(232, 64, 64, 0.4);
}
.mp-progress-wrap { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.mp-time { font-size: 0.7rem; color: var(--text3); flex-shrink: 0; }
.mp-bar-container { flex: 1; height: 4px; background: var(--bg4); border-radius: 2px; cursor: pointer; }
.mp-bar { height: 100%; background: var(--primary); border-radius: 2px; width: 0%; }
.mp-close { width: 28px; height: 28px; border-radius: 50%; color: var(--text3); }

/* Scroll-to-Top Button */
.scroll-top {
  position: fixed; bottom: 84px; right: 20px; z-index: 950;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: var(--transition);
  opacity: 0; pointer-events: none;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }
.scroll-top:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── FOOTER ─────────────────────────────────────────────────── */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 40px 0 20px;
  margin-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px; margin-bottom: 32px;
}
.footer-logo {
  font-size: 1.25rem; font-weight: 800; color: #fff;
  margin-bottom: 10px;
}
.footer-desc { font-size: 0.84rem; color: var(--text3); line-height: 1.6; margin-bottom: 16px; }
.footer-social { display: flex; gap: 8px; }
.social-btn {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 0.82rem; transition: var(--transition);
}
.social-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.footer-links h4 { font-size: 0.85rem; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.footer-links ul { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.82rem; color: var(--text3); }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: var(--text3);
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert-container {
  position: fixed; top: 110px; right: 20px; z-index: 1050;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 360px; width: calc(100vw - 40px);
}
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 36px 12px 14px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 600; position: relative;
  box-shadow: var(--shadow);
}
.alert button {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: inherit; opacity: 0.6; font-size: 1rem;
}
.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: #34D399; }
.alert-error   { background: rgba(239, 68, 68, 0.15);  border: 1px solid rgba(239, 68, 68, 0.3);  color: #F87171; }
.alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: #FBBF24; }

/* ── RESPONSIVE DESIGN ──────────────────────────────────────── */
@media (max-width: 1080px) {
  .home-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .player-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .navbar-search { display: none; }
  .navbar-menu .nav-link, .navbar-menu .btn-outline-sm, .navbar-menu .btn-primary-sm { display: none; }
  .mobile-menu-btn { display: flex; }
  .hero-slider, .hero-fallback { height: 300px; }
  .hero-cover { width: 110px; height: 150px; }
  .hero-title { font-size: 1.45rem; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-item:nth-child(2) { border-right: none; }
  .story-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .genre-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .hero-cover { display: none; }
  .hero-slider, .hero-fallback { height: 260px; }
  .hero-title { font-size: 1.25rem; }
  .story-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .story-card-title { font-size: 0.78rem; }
  .mp-info { display: none; }
}


/* ================================================================
   MOBILE-FIRST OPTIMIZATION & STORY DETAIL SYSTEM
================================================================ */

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb-nav a { color: var(--text2); }
.breadcrumb-nav a:hover { color: var(--primary); }
.breadcrumb-nav i.fa-angle-right { font-size: 0.7rem; color: var(--text4); }
.breadcrumb-current { color: var(--text); font-weight: 600; }

/* ── STORY DETAIL LAYOUT ────────────────────────────────────── */
.story-detail-page { padding-top: 16px; padding-bottom: 60px; }
.story-detail-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 24px;
  align-items: start;
}
.story-detail-main { min-width: 0; width: 100%; }
.story-detail-sidebar { min-width: 0; width: 100%; }

/* ── STORY HERO CARD ────────────────────────────────────────── */
.story-hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}
.story-hero-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.story-hero-cover-wrap {
  width: 145px;
  min-width: 145px;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  background: var(--bg3);
}
.story-hero-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-cover-badge {
  position: absolute;
  top: 6px; right: 6px;
}

.story-hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.story-hero-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.story-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 12px;
  word-break: break-word;
}

/* Meta Pills Grid */
.story-hero-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
}
.meta-pill i { color: var(--primary); font-size: 0.75rem; }

/* Hero Actions */
.story-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.btn-play-start {
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius);
}
.btn-bookmark {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius);
}
.btn-bookmark.active {
  background: rgba(232, 64, 64, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* Description Box */
.story-desc-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.story-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.story-section-title i { color: var(--primary); font-size: 0.85rem; }
.story-desc-text {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.65;
}
.btn-readmore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
  margin-left: 6px;
  background: none;
  border: none;
  cursor: pointer;
}

/* ── CHAPTER LIST ───────────────────────────────────────────── */
.story-chapters-card { margin-bottom: 20px; }
.chapter-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ch-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.92rem;
}
.ch-header-title i { color: var(--primary); }
.ch-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
}
.ch-sort-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.ch-sort-btn:hover { background: var(--bg3); color: var(--primary); }

.chapter-scroll-list {
  max-height: 480px;
  overflow-y: auto;
}
.chapter-scroll-list::-webkit-scrollbar { width: 4px; }
.chapter-scroll-list::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.chapter-row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  font-size: 0.85rem;
  transition: background 0.15s;
}
.chapter-row-item:last-child { border-bottom: none; }
.chapter-row-item:hover { background: var(--bg3); color: var(--text); }
.ch-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
}
.ch-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.ch-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text3);
}
.ch-meta i { font-size: 0.8rem; }
.ch-vip-badge { font-size: 0.6rem; padding: 2px 4px; }
.ch-time { min-width: 40px; text-align: right; }

/* ── COMMENTS COMPONENT ─────────────────────────────────────── */
.comment-input-form { margin-bottom: 24px; }
.comment-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.comment-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.comment-input-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.comment-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.comment-login-prompt {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 20px;
}
.comment-login-prompt p { font-size: 0.84rem; color: var(--text2); margin-bottom: 8px; }

/* ── SIDEBAR RELATED STORIES ────────────────────────────────── */
.related-story-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
  align-items: center;
}
.related-story-item:hover { background: var(--bg3); }
.related-story-cover {
  width: 44px;
  height: 58px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}
.related-story-info { flex: 1; min-width: 0; }
.related-story-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.related-story-meta {
  font-size: 0.72rem;
  color: var(--text3);
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── STORIES PAGE LAYOUT ────────────────────────────────────── */
.stories-page { padding-top: 16px; padding-bottom: 60px; }
.stories-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-main-title i { color: var(--primary); }
.page-main-desc { font-size: 0.85rem; color: var(--text3); margin-top: 2px; }
.stories-total-count { font-size: 0.85rem; color: var(--text2); }
.stories-total-count strong { color: var(--primary); }

.stories-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}
.stories-filter-aside { position: sticky; top: 110px; }
.filter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 800;
}
.reset-filter-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}
.empty-state-box, .empty-state-card {
  padding: 40px 20px;
  text-align: center;
  color: var(--text3);
}
.empty-state-card i, .empty-state-box i {
  font-size: 2.2rem;
  margin-bottom: 10px;
  opacity: 0.5;
}
.empty-state-card h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 6px; }
.empty-state-card p { font-size: 0.85rem; margin-bottom: 16px; }

/* ── MOBILE MEDIA QUERIES (< 992px & < 640px) ───────────────── */
@media (max-width: 992px) {
  .story-detail-layout {
    grid-template-columns: 100% !important;
    gap: 20px;
  }
  .stories-layout {
    grid-template-columns: 100% !important;
    gap: 16px;
  }
  .stories-filter-aside {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 12px !important;
  }
  .main-content {
    padding-top: 92px !important;
  }
  .navbar {
    height: 52px !important;
  }
  .category-bar {
    height: 38px !important;
  }
  .brand-text {
    font-size: 1.15rem !important;
  }
  .brand-icon {
    font-size: 1.35rem !important;
  }

  /* Story Hero Mobile */
  .story-hero-card {
    padding: 14px 12px !important;
    margin-bottom: 14px !important;
  }
  .story-hero-inner {
    display: flex !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }
  .story-hero-cover-wrap {
    width: 105px !important;
    min-width: 105px !important;
  }
  .story-hero-title {
    font-size: 1.1rem !important;
    margin-bottom: 6px !important;
  }
  .story-hero-meta-grid {
    gap: 4px !important;
    margin-bottom: 10px !important;
  }
  .meta-pill {
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
  }
  
  /* Hero buttons 100% width on small screens */
  .story-hero-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .btn-play-start, .btn-bookmark {
    flex: 1 !important;
    justify-content: center !important;
    padding: 9px 10px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  /* Chapter Rows Mobile */
  .chapter-row-item {
    padding: 10px 10px !important;
    gap: 8px !important;
  }
  .ch-number {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.7rem !important;
  }
  .ch-title {
    font-size: 0.82rem !important;
  }
  .ch-meta {
    font-size: 0.7rem !important;
    gap: 5px !important;
  }

  /* Story Grid Mobile 3-Col */
  .story-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .story-card-body {
    padding: 6px 6px 8px !important;
  }
  .story-card-title {
    font-size: 0.76rem !important;
  }
}


/* ================================================================
   HOMEPAGE MOBILE & HERO OPTIMIZATION
================================================================ */

/* Hero Fallback Auto-Height */
.hero-fallback {
  min-height: 280px;
  height: auto !important;
  padding: 40px 0 46px;
}

@media (max-width: 768px) {
  /* Ẩn khối thống kê chiếm diện tích trên mobile để thấy truyện ngay */
  .stats-strip {
    display: none !important;
  }

  /* Hero Banner Co Giãn Thông Minh */
  .hero-fallback {
    padding: 24px 0 26px !important;
    min-height: auto !important;
  }
  .hero-fallback-title {
    font-size: 1.45rem !important;
    line-height: 1.25 !important;
    margin-bottom: 8px !important;
  }
  .hero-fallback-sub {
    font-size: 0.84rem !important;
    line-height: 1.5 !important;
    margin-top: 4px !important;
    margin-bottom: 14px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  .hero-fallback-cta {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    margin-top: 12px !important;
    width: 100% !important;
  }
  .hero-fallback-cta .hero-btn-play,
  .hero-fallback-cta .hero-btn-info {
    flex: 1 !important;
    justify-content: center !important;
    padding: 9px 12px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    border-radius: var(--radius) !important;
  }

  /* Slider Banner Mobile */
  .hero-slider {
    height: auto !important;
    min-height: 220px !important;
    padding: 20px 0 !important;
  }

  /* Section Tabs Mobile */
  .section-tabs {
    gap: 16px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
    margin-bottom: 16px !important;
    padding-bottom: 2px !important;
  }
  .section-tabs::-webkit-scrollbar { display: none; }
  .section-tab {
    font-size: 0.88rem !important;
    padding: 6px 2px 10px !important;
    flex-shrink: 0 !important;
  }

  /* Section Titles */
  .section-title {
    font-size: 1.1rem !important;
  }

  /* Genre Grid 2 Cột Gọn Gàng */
  .genre-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .genre-card {
    padding: 10px 8px !important;
  }
  .genre-emoji {
    font-size: 1.35rem !important;
    margin-bottom: 2px !important;
  }
  .genre-name {
    font-size: 0.78rem !important;
  }
  .genre-count {
    font-size: 0.68rem !important;
  }

  /* Recent Updates Row Item Mobile */
  .story-list-item {
    gap: 10px !important;
    padding: 10px 0 !important;
  }
  .story-list-cover {
    width: 52px !important;
    height: 70px !important;
    min-width: 52px !important;
  }
  .story-list-title {
    font-size: 0.86rem !important;
    margin-bottom: 2px !important;
  }
  .story-list-desc {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
  }
  .story-list-meta {
    gap: 8px !important;
    margin-top: 4px !important;
    font-size: 0.68rem !important;
    flex-wrap: wrap !important;
  }

  /* Home Sidebar Mobile (Xếp Gọn Dưới) */
  .home-sidebar-col {
    margin-top: 10px !important;
  }
  .sidebar-box {
    margin-bottom: 16px !important;
  }
}


/* ================================================================
   MOBILE CATEGORY & FILTER CHIPS SYSTEM
================================================================ */

.category-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.cat-title-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cat-page-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-result-count {
  font-size: 0.82rem;
  color: var(--text3);
  font-weight: 600;
}

/* View Switcher */
.view-switcher-wrap {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.view-btn {
  width: 32px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 0.85rem;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.view-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Filter Container */
.mobile-filter-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text3);
  min-width: 65px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-chips-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}
.filter-chips-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
}
.filter-chip:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}
.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(232, 64, 64, 0.35);
}
.filter-reset-chip {
  background: rgba(239, 68, 68, 0.12);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.25);
}

/* Vertical Story List Mode */
.story-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-story-row {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  align-items: flex-start;
  transition: var(--transition);
}
.mobile-story-row:hover {
  background: var(--card2);
  border-color: var(--border2);
}
.m-story-cover-wrap {
  width: 72px;
  min-width: 72px;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--bg3);
  flex-shrink: 0;
}
.m-story-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m-vip-tag {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 0.6rem;
  padding: 1px 4px;
}

.m-story-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.m-story-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-story-desc {
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.45;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-story-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text3);
  flex-wrap: wrap;
  margin-top: auto;
}
.m-badge-cat {
  padding: 2px 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text2);
  font-weight: 600;
}

/* Mobile Adjustments for Chips */
@media (max-width: 640px) {
  .mobile-filter-container {
    padding: 10px 10px;
    gap: 8px;
  }
  .filter-label {
    display: none; /* Ẩn nhãn chữ để các chips full chiều ngang trên mobile */
  }
  .filter-chip {
    padding: 4px 10px;
    font-size: 0.76rem;
  }
  .cat-page-title {
    font-size: 1.15rem;
  }
  .mobile-story-row {
    padding: 10px 10px;
    gap: 10px;
  }
  .m-story-cover-wrap {
    width: 60px;
    min-width: 60px;
  }
  .m-story-title {
    font-size: 0.86rem;
  }
  .m-story-desc {
    font-size: 0.74rem;
  }
}


/* ================================================================
   MODERN MOBILE SIDE-IN DRAWER MENU
================================================================ */

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 315px;
  max-width: 86vw;
  background: var(--bg2);
  z-index: 9999;
  transform: translateX(105%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex !important;
  flex-direction: column;
  box-shadow: -10px 0 36px rgba(0, 0, 0, 0.7);
  overflow-y: auto;
  border-left: 1px solid var(--border);
}
.mobile-menu.open {
  transform: translateX(0) !important;
}

.mobile-drawer-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
}
.drawer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: var(--transition);
}
.drawer-close-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.mobile-drawer-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-search-wrap .search-wrapper {
  background: var(--bg);
}

.drawer-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.drawer-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.drawer-user-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}
.drawer-auth-buttons {
  display: flex;
  gap: 8px;
}

.drawer-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer-group-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  padding-left: 6px;
}
.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text2);
  border-radius: var(--radius);
  transition: var(--transition);
}
.drawer-nav-item:hover, .drawer-nav-item.active {
  background: var(--bg3);
  color: var(--primary);
}
.drawer-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text3);
}
.drawer-nav-item:hover i, .drawer-nav-item.active i {
  color: var(--primary);
}
.drawer-nav-item.vip-link {
  color: var(--accent);
}

.drawer-theme-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
}
.theme-status-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--card);
  border-radius: var(--radius-xs);
  color: var(--primary);
}

.drawer-footer-row {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.drawer-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  color: #F87171;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.drawer-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}


/* ================================================================
   CHAPTER PLAYER & VIDEO 16:9 RESPONSIVE SYSTEM
================================================================ */

.chapter-page { padding-top: 16px; padding-bottom: 60px; }
.chapter-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.chapter-player-main { min-width: 0; width: 100%; }
.chapter-playlist-aside { min-width: 0; width: 100%; }

.chapter-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chapter-info-box { flex: 1; min-width: 0; }
.chapter-story-name a {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chapter-story-name a:hover { color: var(--primary-2); }
.chapter-main-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-top: 2px;
}

.chapter-quick-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chapter-card-body { padding: 20px; }
.media-section { margin-bottom: 16px; }
.media-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.audio-duration-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  margin-left: 4px;
}

/* 16:9 Responsive Video Container */
.video-embed-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow);
}
.video-embed-wrapper iframe,
.video-embed-wrapper embed,
.video-embed-wrapper object,
.video-embed-wrapper video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.audio-player-box {
  background: var(--bg3);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.chapter-desc-box {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--bg3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.chapter-desc-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chapter-desc-text {
  font-size: 0.84rem;
  color: var(--text3);
  line-height: 1.6;
}

/* Bottom Nav Buttons */
.chapter-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--card2);
}
.btn-nav-btn {
  flex: 1;
  text-align: center;
  justify-content: center;
  font-size: 0.84rem;
  padding: 10px 14px;
  white-space: nowrap;
}
.disabled-nav {
  opacity: 0.35 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

/* Playlist Sidebar / Mobile List */
.playlist-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.playlist-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.playlist-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.playlist-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
}

.playlist-items-scroll {
  max-height: 480px;
  overflow-y: auto;
}
.playlist-items-scroll::-webkit-scrollbar { width: 4px; }
.playlist-items-scroll::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  text-decoration: none;
}
.playlist-item:last-child { border-bottom: none; }
.playlist-item:hover {
  background: var(--bg3);
}
.playlist-item.active {
  background: rgba(232, 64, 64, 0.12);
  border-left: 3px solid var(--primary);
}
.playlist-num {
  min-width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
}
.playlist-item.active .playlist-num {
  background: var(--primary);
  color: #fff;
}
.playlist-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}
.playlist-item.active .playlist-item-title {
  color: #fff;
  font-weight: 700;
}
.playlist-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 0.75rem;
}
.playlist-vip-tag {
  font-size: 0.6rem;
  padding: 1px 4px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 992px) {
  .chapter-layout {
    grid-template-columns: 100% !important;
    gap: 18px;
  }
}
@media (max-width: 640px) {
  .chapter-card-header {
    padding: 12px 14px !important;
  }
  .chapter-card-body {
    padding: 14px 12px !important;
  }
  .chapter-main-title {
    font-size: 1.1rem !important;
  }
  .chapter-bottom-nav {
    padding: 12px 10px !important;
    gap: 6px !important;
  }
  .btn-nav-btn {
    font-size: 0.78rem !important;
    padding: 8px 6px !important;
  }
  .d-none-mobile {
    display: none !important;
  }
}

/* ── PLYR AUDIO & VIDEO WEBNOVEL THEMING ─────────────────────── */
:root {
  --plyr-color-main: var(--primary);
  --plyr-video-control-color: #E8E6F0;
  --plyr-video-control-color-hover: #ffffff;
  --plyr-audio-controls-background: var(--card2);
  --plyr-audio-control-color: var(--text2);
  --plyr-audio-control-color-hover: #ffffff;
  --plyr-range-thumb-background: var(--primary);
  --plyr-range-thumb-active-shadow-color: rgba(232, 64, 64, 0.4);
  --plyr-control-radius: 8px;
  --plyr-audio-control-background-hover: rgba(232, 64, 64, 0.15);
}
.plyr--audio .plyr__controls {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  background: var(--card2) !important;
  color: var(--text);
}
.plyr--video {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── PLAYER TOOLBAR: SLEEP TIMER & AUTOPLAY ───────────────────── */
.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.timer-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text2);
}
.timer-select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.timer-select:focus {
  border-color: var(--primary);
}
.timer-countdown {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  background: rgba(247, 186, 42, 0.12);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(247, 186, 42, 0.25);
}
.autoplay-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
}
.autoplay-toggle input {
  accent-color: var(--primary);
  cursor: pointer;
  width: 15px;
  height: 15px;
}
.keyboard-hint {
  font-size: 0.75rem;
  color: var(--text3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.keyboard-hint kbd {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.7rem;
  color: var(--text2);
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}
@media (max-width: 640px) {
  .player-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .keyboard-hint {
    display: none;
  }
}

/* ================================================================
   IN-PLACE AUDIO DISC PLAYER (TRUYENFULLAUDIO STYLE)
================================================================ */
.inplace-player-card {
  background: var(--card, #1A2236);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 18px;
  padding: 26px 20px;
  margin-bottom: 24px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.45);
  position: relative;
  overflow: hidden;
}

.inplace-player-disc-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
  position: relative;
}

.inplace-disc {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7), 0 0 0 6px rgba(255,255,255,0.06);
  overflow: hidden;
  border: 4px solid #161B27;
  animation: disc-rotate 22s linear infinite;
  animation-play-state: paused;
}

.inplace-disc.is-playing {
  animation-play-state: running;
}

.inplace-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inplace-disc-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg, #0E1117);
  border: 3px solid rgba(255,255,255,0.25);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.9);
  z-index: 2;
}

@keyframes disc-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.inplace-chapter-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text, #E8E6F0);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.35;
}

.inplace-chapter-sub {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text3, #5C6480);
  margin-bottom: 18px;
}

.speed-badge-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text2, #9BA3B8);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-badge-btn:hover {
  background: var(--primary, #E84040);
  color: #fff;
  border-color: var(--primary, #E84040);
}

.inplace-scrubber-wrap {
  margin-bottom: 16px;
  padding: 0 4px;
}

.inplace-scrubber {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}

.inplace-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  border: 2px solid var(--primary, #E84040);
  transition: transform 0.1s ease;
}

.inplace-scrubber::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.inplace-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text3, #5C6480);
  font-family: monospace;
  margin-top: 6px;
}

.inplace-controls-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text2, #9BA3B8);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  color: var(--text, #E8E6F0);
  transform: scale(1.12);
}

.ctrl-btn-seek {
  font-size: 0.85rem;
  font-weight: 700;
  gap: 4px;
  color: var(--text2, #9BA3B8);
}

.ctrl-btn-play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B6B 0%, #E84040 100%);
  color: #ffffff;
  font-size: 1.45rem;
  box-shadow: 0 8px 24px rgba(232, 64, 64, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.ctrl-btn-play:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 32px rgba(232, 64, 64, 0.65);
}

.resume-alert-banner {
  background: rgba(247, 186, 42, 0.12);
  border: 1px solid rgba(247, 186, 42, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: #F7BA2A;
  animation: fadeIn 0.3s ease;
}

.resume-alert-btn {
  background: #F7BA2A;
  color: #0E1117;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.resume-alert-btn:hover {
  background: #ffc842;
  transform: translateY(-1px);
}

/* Highlight currently playing chapter in playlist */
.chapter-row-item.is-playing {
  background: rgba(232, 64, 64, 0.14) !important;
  border-left: 3px solid var(--primary, #E84040) !important;
}

.chapter-row-item.is-playing .ch-number {
  background: var(--primary, #E84040) !important;
  color: #fff !important;
  animation: pulse-red 2s infinite;
}

.chapter-row-item.is-playing .ch-title {
  color: var(--primary, #E84040) !important;
  font-weight: 700;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(232, 64, 64, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(232, 64, 64, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 64, 64, 0); }
}



/* ── SOCIAL SHARE DROPDOWN ──────────────────────────────────── */
.share-dropdown-wrap { position: relative; display: inline-block; }

.share-dropdown-menu {
    animation: fadeSlideDown .18s ease;
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.share-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    cursor: pointer;
}
.share-opt:hover { background: var(--bg4); color: #fff; }
.share-opt i { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }

/* Per-network accent colors on hover */
.share-fb:hover  { background: rgba(24,119,242,.18);  color: #4a9cf6; }
.share-zalo:hover{ background: rgba(0,104,255,.18);   color: #3b93ff; }
.share-tw:hover  { background: rgba(15,15,15,.35);    color: #e2e8f0; }
.share-tg:hover  { background: rgba(0,136,204,.18);   color: #36b2e8; }
.share-pt:hover  { background: rgba(230,0,35,.18);    color: #f34b60; }
.share-rd:hover  { background: rgba(255,69,0,.18);    color: #ff6434; }
.share-copy:hover{ background: rgba(99,102,241,.18);  color: #a5b4fc; }

/* Bookmark button active state */
.btn-bookmark.active {
    background: rgba(245,166,35,.12);
    border-color: var(--accent);
    color: var(--accent);
}
.btn-bookmark.active i { color: var(--accent); }

/* ── VIP INLINE BANNER (above chapter list) ──────────────────── */
.vip-inline-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(120deg, rgba(245,166,35,.12) 0%, rgba(232,64,64,.10) 100%);
    border: 1px solid rgba(245,166,35,.30);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 14px;
}
.vip-inline-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.vip-inline-crown {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #F5A623, #E84040);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(245,166,35,.40);
}
.vip-inline-title {
    font-weight: 800;
    font-size: .875rem;
    color: var(--accent);
    letter-spacing: .02em;
}
.vip-inline-desc {
    font-size: .78rem;
    color: var(--text2);
    margin-top: 2px;
    line-height: 1.4;
}
.vip-inline-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #F5A623, #E84040);
    color: #fff;
    font-weight: 800;
    font-size: .82rem;
    padding: 9px 18px;
    border-radius: 50px;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity var(--transition), transform var(--transition);
    box-shadow: 0 4px 16px rgba(245,166,35,.35);
}
.vip-inline-btn:hover { opacity: .88; transform: translateY(-1px); color: #fff; }

@media (max-width: 600px) {
    .vip-inline-banner { flex-direction: column; align-items: flex-start; }
    .vip-inline-btn { width: 100%; justify-content: center; }
}

/* ── CONTENT PROTECTION (ANTI-SELECT / ANTI-COPY) ───────────── */
body:not(.admin-body) {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body:not(.admin-body) input,
body:not(.admin-body) textarea,
body:not(.admin-body) [contenteditable="true"] {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

body:not(.admin-body) img {
    -webkit-user-drag: none;
    user-drag: none;
}
