:root {
  --primary: #0A2342;
  --secondary: #D4AF37;
  --bg: #FFFFFF;
  --bg-alt: #F5F7FA;
  --text: #1a1a2e;
  --text-light: #6c757d;
  --card-bg: #FFFFFF;
  --shadow: 0 4px 20px rgba(10,35,66,0.08);
  --shadow-hover: 0 8px 30px rgba(10,35,66,0.15);
  --shadow-soft: 0 8px 32px rgba(0,0,0,0.06);
  --border: #e8ecf1;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s ease;
  --max-width: 1200px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --gradient-primary: linear-gradient(135deg, #0A2342 0%, #1a3a6a 100%);
}
[data-theme="dark"] {
  --primary: #D4AF37;
  --secondary: #D4AF37;
  --bg: #0f1419;
  --bg-alt: #1a1f2e;
  --text: #e4e6eb;
  --text-light: #b0b3b8;
  --card-bg: #1e2433;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.4);
  --border: #2d3440;
}
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
body{font-family:var(--font);background:var(--bg);color:var(--text);line-height:1.6;min-height:100vh;transition:var(--transition)}
a{text-decoration:none;color:inherit}
img{max-width:100%;height:auto;display:block}
button{cursor:pointer;font-family:var(--font);border:none;outline:none}
input,textarea{font-family:var(--font);outline:none;border:none}
.container{width:100%;max-width:var(--max-width);margin:0 auto;padding:0 20px}

/* Header */
.header{background:var(--card-bg);border-bottom:1px solid var(--border);padding:12px 0;position:sticky;top:0;z-index:1000;transition:var(--transition)}
.header .container{display:flex;align-items:center;justify-content:space-between;gap:20px}
.logo{font-size:28px;font-weight:800;color:var(--primary);letter-spacing:-0.5px;flex-shrink:0}
.logo span{color:var(--secondary)}
.search-bar{flex:1;max-width:500px;position:relative}
.search-bar input{width:100%;padding:10px 16px 10px 42px;background:var(--bg-alt);border:2px solid transparent;border-radius:50px;color:var(--text);font-size:14px;transition:var(--transition)}
.search-bar input:focus{border-color:var(--secondary);background:var(--card-bg)}
.search-bar .search-icon{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--text-light);font-size:18px}
.header-right{display:flex;align-items:center;gap:12px;flex-shrink:0}
.theme-toggle{width:40px;height:40px;border-radius:50%;background:var(--bg-alt);color:var(--text);display:flex;align-items:center;justify-content:center;font-size:18px;transition:var(--transition)}
.theme-toggle:hover{background:var(--secondary);color:#fff}

/* Search Results */
.search-results{position:absolute;top:100%;left:0;right:0;background:var(--card-bg);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-hover);margin-top:8px;max-height:400px;overflow-y:auto;z-index:500;display:none}
.search-results.active{display:block}
.search-result-item{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);transition:var(--transition);cursor:pointer}
.search-result-item:last-child{border-bottom:none}
.search-result-item:hover{background:var(--bg-alt)}
.search-result-item img{width:48px;height:48px;border-radius:8px;object-fit:cover}
.search-result-item .info h4{font-size:14px;font-weight:600;margin-bottom:2px}
.search-result-item .info span{font-size:12px;color:var(--text-light)}

/* Footer */
.footer{background:var(--primary);color:rgba(255,255,255,0.8);padding:40px 0 24px;margin-top:60px}
.footer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:32px;margin-bottom:24px}
.footer h3{color:var(--secondary);font-size:1.1rem;margin-bottom:12px}
.footer p{font-size:14px;line-height:1.8}
.footer a{display:block;font-size:14px;padding:4px 0;transition:var(--transition)}
.footer a:hover{color:var(--secondary)}
.footer-bottom{border-top:1px solid rgba(255,255,255,0.1);padding-top:16px;text-align:center;font-size:13px}

/* Toast */
.toast{position:fixed;bottom:24px;right:24px;padding:16px 28px;border-radius:14px;color:#fff;font-weight:600;font-size:14px;z-index:5000;opacity:0;transform:translateY(20px) scale(0.95);transition:all 0.35s cubic-bezier(0.4,0,0.2,1);pointer-events:none;box-shadow:0 12px 40px rgba(0,0,0,0.2);max-width:400px;backdrop-filter:blur(10px)}
.toast.show{opacity:1;transform:translateY(0) scale(1)}
.toast.success{background:linear-gradient(135deg,#28a745,#20c997)}
.toast.error{background:linear-gradient(135deg,#dc3545,#e74c3c)}

/* Modal base */
.modal-modern{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);z-index:2000;align-items:center;justify-content:center;padding:20px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.modal-modern.active{display:flex}
.modal-modern .modal-card{background:var(--card-bg);border-radius:20px;padding:32px;max-width:500px;width:100%;max-height:80vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,0.15);animation:modalSlideIn 0.3s ease}
.modal-modern .modal-card h3{margin-bottom:16px}
@keyframes modalSlideIn{from{opacity:0;transform:translateY(20px) scale(0.98)}to{opacity:1;transform:translateY(0) scale(1)}}

/* Reduced Motion */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:0.01ms!important;animation-iteration-count:1!important;transition-duration:0.01ms!important;scroll-behavior:auto!important}
}

/* Responsive */
@media(max-width:768px){
  .header .container{flex-wrap:wrap}
  .search-bar{order:3;max-width:100%;flex-basis:100%}
  .logo{font-size:22px}
}
@media(max-width:480px){
  .container{padding:0 14px}
}

/* ─── APP-SPECIFIC STYLES ─── */
html { scroll-behavior: smooth; }
.initial-loader { display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:16px; }
.loader-spinner { width:40px;height:40px;border:4px solid var(--bg-alt);border-top-color:var(--secondary);border-radius:50%;animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
::selection {
  background: var(--secondary);
  color: #0A2342;
}
*:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* ─── MAINTENANCE OVERLAY ─── */
.maintenance-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0A2342 0%, #1a3a6a 40%, #2d1b69 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}
.maintenance-modal {
  text-align: center;
  color: #fff;
  padding: 40px;
  max-width: 480px;
}
.maintenance-modal-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: maintPulse 2s ease-in-out infinite;
}
@keyframes maintPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}
.maintenance-modal h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 12px;
}
.maintenance-modal p {
  font-size: 16px;
  line-height: 1.6;
  opacity: 0.8;
  margin: 0 0 30px;
}
.maintenance-loader {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.maintenance-loader span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--secondary, #d4af37);
  animation: maintBounce 1.4s ease-in-out infinite both;
}
.maintenance-loader span:nth-child(1) { animation-delay: -0.32s; }
.maintenance-loader span:nth-child(2) { animation-delay: -0.16s; }
.maintenance-loader span:nth-child(3) { animation-delay: 0s; }
@keyframes maintBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ─── NOTIFICATION TOAST ─── */
.notif-toast {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 99999;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 380px;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  border-left: 4px solid var(--secondary, #d4af37);
}
.notif-toast.show { transform: translateX(0); }
.notif-toast .notif-toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.notif-toast .notif-toast-content { flex: 1; min-width: 0; }
.notif-toast .notif-toast-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text, #1a1a2e);
}
.notif-toast .notif-toast-desc {
  font-size: 13px;
  color: var(--text-light, #666);
  margin: 0;
  line-height: 1.4;
}

/* ─── STORY GRID ─── */
.story-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

/* ─── STORY CARDS ─── */
.story-card-modern {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.story-card-modern:nth-child(2) { animation-delay: 0.06s; }
.story-card-modern:nth-child(3) { animation-delay: 0.12s; }
.story-card-modern:nth-child(4) { animation-delay: 0.18s; }
.story-card-modern:nth-child(5) { animation-delay: 0.24s; }
.story-card-modern:nth-child(6) { animation-delay: 0.30s; }
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.story-card-modern:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 40px rgba(212,175,55,0.1), var(--shadow-hover);
  border-color: rgba(212,175,55,0.3);
}
.story-card-modern .card-badge {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
}
.story-card-modern .card-badge span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.story-card-modern .card-badge .badge-new {
  background: linear-gradient(135deg, #D4AF37, #f5d06a);
  color: #0A2342;
  box-shadow: 0 2px 8px rgba(212,175,55,0.3);
}
.story-card-modern .card-badge .badge-series {
  background: linear-gradient(135deg, #4fc3f7, #29b6f6);
  color: #fff;
}
.story-card-modern .card-cover-wrapper {
  position: relative;
  overflow: hidden;
}
.story-card-modern .card-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg-alt);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.story-card-modern:hover .card-cover { transform: scale(1.05); }
.story-card-modern .card-body {
  padding: 12px 14px 14px;
  position: relative;
  z-index: 2;
}
.story-card-modern .card-title {
  font-size: 0.9rem; font-weight: 700;
  line-height: 1.3; margin-bottom: 4px;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story-card-modern .card-desc {
  font-size: 11px; color: var(--text-light);
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.5;
}
.story-card-modern .card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.story-card-modern .card-author {
  font-size: 10px; color: var(--text-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%;
}
.story-card-modern .card-author strong { color: var(--secondary); }
.story-card-modern .card-views {
  font-size: 11px; font-weight: 600; color: var(--text-light); white-space: nowrap;
}

/* ─── SECTION TITLE ─── */
.section-modern {
  padding: 50px 0 10px;
}
.section-modern .section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}
.section-modern .section-head h2 {
  font-size: 1.6rem; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.section-modern .section-head h2 .sec-icon {
  font-size: 1.3rem;
}
.section-modern .section-head h2::after {
  content: '';
  height: 3px;
  width: 60px;
  background: linear-gradient(to right, var(--secondary), transparent);
  border-radius: 10px;
  position: absolute;
  bottom: -8px;
  left: 0;
}
.section-modern .section-count {
  font-size: 13px; color: var(--text-light); font-weight: 500;
  background: var(--bg-alt);
  padding: 4px 14px;
  border-radius: 20px;
}

/* ─── EMPTY ─── */
.empty-modern {
  text-align: center; padding: 80px 20px;
}
.empty-modern .empty-icon { font-size: 72px; margin-bottom: 16px; opacity: 0.4; }
.empty-modern h3 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-modern p { color: var(--text-light); font-size: 14px; }

/* ─── READING PROGRESS ─── */
#readingProgress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(to right, var(--secondary), #f5d06a);
  z-index: 10000;
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 3px 3px 0;
}

/* ─── STORY DETAIL ─── */
.detail-modern { padding: 0; }
.detail-modern .detail-header {
  background: linear-gradient(135deg, #0A2342 0%, #1a3a6a 50%, #2d1b69 100%);
  padding: 70px 0 60px;
  color: #fff;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.detail-modern .detail-header::before {
  content: '';
  position: absolute;
  top: -30%; right: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(212,175,55,0.1) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}
.detail-modern .detail-header::after {
  content: '';
  position: absolute;
  bottom: -20%; left: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(79,172,254,0.08) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}
.detail-modern .detail-header .dh-inner {
  position: relative; z-index: 1;
  display: flex; gap: 40px; align-items: flex-start;
  max-width: 920px; margin: 0 auto; padding: 0 20px;
}
.detail-modern .detail-header .dh-cover {
  width: 200px; height: 300px;
  border-radius: 16px; object-fit: cover;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  flex-shrink: 0;
  transition: transform 0.5s ease;
}
.detail-modern .detail-header .dh-cover:hover {
  transform: scale(1.03) rotate(-1deg);
}
.detail-modern .detail-header .dh-info { flex: 1; }
.detail-modern .detail-header .dh-info h1 {
  font-size: 2.2rem; font-weight: 900; line-height: 1.15; margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.detail-modern .detail-header .dh-info .dh-meta {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  font-size: 14px; opacity: 0.8; margin-bottom: 16px;
}
.detail-modern .detail-header .dh-info .dh-meta .dh-type {
  background: rgba(212,175,55,0.2);
  color: var(--secondary);
  padding: 2px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.detail-modern .detail-body {
  max-width: 800px; margin: 0 auto; padding: 40px 20px 60px;
}
.detail-modern .detail-body .story-content {
  font-size: 1.15rem; line-height: 2; color: var(--text);
  user-select: none; -webkit-user-select: none; -ms-user-select: none;
  -webkit-touch-callout: none;
}
.detail-modern .detail-body .story-content p { margin-bottom: 1.5rem; }
.story-content, .ep-body {
  user-select: none; -webkit-user-select: none; -ms-user-select: none;
  -webkit-touch-callout: none;
}

/* ─── EPISODES ─── */
.episode-modern {
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--card-bg);
  transition: all 0.3s ease;
}
.episode-modern:hover { border-color: var(--secondary); }
.episode-modern .ep-head {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  transition: all 0.3s ease;
  user-select: none;
}
.episode-modern .ep-head:hover { background: var(--bg-alt); }
.episode-modern .ep-head .ep-left {
  display: flex; align-items: center; gap: 12px;
}
.episode-modern .ep-head .ep-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--secondary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.episode-modern .ep-head .ep-arrow {
  font-size: 12px; color: var(--text-light);
  transition: transform 0.3s ease;
}
.episode-modern .ep-head .ep-arrow.open { transform: rotate(180deg); }
.episode-modern .ep-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  animation: fadeIn 0.3s ease;
}
.episode-modern.ep-locked { opacity: 0.7; }
.episode-modern.ep-locked .ep-num {
  background: var(--text-light) !important;
  font-size: 14px;
}

/* ─── CHAPTER NAV ─── */
.chapter-nav-modern {
  display: flex; justify-content: space-between; gap: 16px;
  margin: 40px 0; max-width: 800px; margin-left: auto; margin-right: auto;
}
.btn-chapter-modern {
  padding: 14px 28px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-weight: 600; font-size: 14px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-chapter-modern:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212,175,55,0.1);
}
.btn-chapter-modern.disabled {
  opacity: 0.3; pointer-events: none;
}

/* ─── COMMENTS ─── */
.comments-modern {
  max-width: 800px; margin: 0 auto;
  padding: 40px 20px;
}
.comments-modern .cm-title {
  font-size: 1.3rem; font-weight: 700; margin-bottom: 24px;
  display: flex; align-items: center; gap: 8px;
}
.comments-modern .cm-title .cm-count {
  font-size: 13px; font-weight: 600; color: var(--text-light);
  background: var(--bg-alt); padding: 2px 10px; border-radius: 20px;
}
.comments-modern .cm-form {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-soft);
}
.comments-modern .cm-form .cm-input-row {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.comments-modern .cm-form input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}
.comments-modern .cm-form input:focus,
.comments-modern .cm-form textarea:focus {
  border-color: var(--secondary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}
.comments-modern .cm-form textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
  margin-bottom: 12px;
}
.comments-modern .cm-form .btn-submit {
  padding: 12px 28px;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.comments-modern .cm-form .btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(10,35,66,0.2);
}
.comments-modern .cm-list { display: flex; flex-direction: column; gap: 12px; }
.comments-modern .cm-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.3s ease;
}
.comments-modern .cm-item:hover { box-shadow: var(--shadow-soft); }
.comments-modern .cm-item .cm-author {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.comments-modern .cm-item .cm-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #D4AF37, #f5d06a);
  color: #0A2342;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.comments-modern .cm-item .cm-name { font-weight: 600; font-size: 14px; }
.comments-modern .cm-item .cm-date { font-size: 12px; color: var(--text-light); }
.comments-modern .cm-item .cm-text { font-size: 14px; line-height: 1.6; color: var(--text); }

/* ─── HEADER GLASS ─── */
.header-glass {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .header-glass {
  background: rgba(15,20,25,0.8);
}
#mainHeader .header-inner { display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
#mainHeader .header-inner .search-bar { flex: 1; min-width: 0; }
#mainHeader .header-inner .logo { flex-shrink: 0; }
#mainHeader .header-inner .nav-home-btn { flex-shrink: 0; }
#mainHeader .header-inner .nav-access-btn { flex-shrink: 0; }
#mainHeader .header-inner .theme-toggle { flex-shrink: 0; margin-left: auto; }

/* ─── RESPONSIVE ─── */
@media(max-width: 768px) {
  .detail-modern .detail-header { padding: 40px 0 40px; }
  .detail-modern .detail-header .dh-inner { flex-direction: column; align-items: center; text-align: center; }
  .detail-modern .detail-header .dh-cover { width: 160px; height: 240px; }
  .detail-modern .detail-header .dh-info h1 { font-size: 1.5rem; }
  .detail-modern .detail-header .dh-info .dh-meta { justify-content: center; }
  .chapter-nav-modern { flex-direction: column; }
  .btn-chapter-modern { justify-content: center; }
  .comments-modern .cm-form .cm-input-row { flex-direction: column; }
  .story-grid-modern { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .section-modern .section-head h2 { font-size: 1.3rem; }
  .section-modern .section-head h2::after { width: 40px; }
  .notif-toast { max-width: 320px; right: 16px; top: 16px; }
}
@media(max-width: 480px) {
  .story-grid-modern { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .story-card-modern .card-body { padding: 10px 12px 12px; }
  .story-card-modern .card-title { font-size: 0.85rem; }
  .detail-modern .detail-header { padding: 30px 0 30px; }
  .detail-modern .detail-body { padding: 24px 16px 40px; }
  .detail-modern .detail-body .story-content { font-size: 1.05rem; }
  .section-modern { padding: 30px 0 0; }
  .section-modern .section-head { margin-bottom: 20px; }
  .notif-toast { max-width: calc(100% - 32px); right: 16px; top: 16px; padding: 14px 16px; }
}

/* ─── PAYMENT MODAL ─── */
.pay-modal .modal-card {
  max-width: 440px;
  max-height: 90vh;
  text-align: center;
  background: linear-gradient(145deg, var(--card-bg) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow-y: auto;
}
.pay-modal .modal-card > .modal-bg {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(212,175,55,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.pay-modal .pay-top {
  position: relative;
  background: linear-gradient(135deg, #0A2342 0%, #1a3a6a 50%, #2d1b69 100%);
  margin: -32px -32px 24px;
  padding: 28px 32px 24px;
  border-radius: 20px 20px 0 0;
  color: #fff;
  overflow: hidden;
}
.pay-modal .pay-top::before {
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(212,175,55,0.1) 0%, transparent 60%);
  border-radius: 50%;
}
.pay-modal .pay-top::after {
  content: '';
  position: absolute;
  bottom: -20%; left: -10%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 60%);
  border-radius: 50%;
}
.pay-modal .pay-top .pay-icon-wrap {
  width: 56px; height: 56px;
  background: rgba(212,175,55,0.2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  position: relative;
}
.pay-modal .pay-top h3 {
  font-size: 18px; font-weight: 700; margin-bottom: 4px; color: #fff;
}
.pay-modal .pay-top .pay-sub {
  font-size: 13px; opacity: 0.7; margin-bottom: 8px;
}
.pay-modal .pay-top .pay-amount-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 10px 24px;
  margin-top: 4px;
}
.pay-modal .pay-top .pay-amount-wrap .pay-amount {
  font-size: 28px; font-weight: 900; color: var(--secondary);
  letter-spacing: -0.5px;
}
.pay-modal .pay-top .pay-amount-wrap .pay-currency {
  font-size: 13px; opacity: 0.6; font-weight: 500;
}
.pay-modal .pay-secure-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: rgba(255,255,255,0.5);
  margin-top: 12px;
}
.pay-modal .pay-body { position: relative; padding: 0 4px; }

.pay-modal .pay-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.pay-modal .pay-label .label-line {
  flex: 1; height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

.pay-modal .pay-network-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px;
}
.pay-modal .pay-network-btn {
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
  overflow: hidden;
}
.pay-modal .pay-network-btn .net-icon { font-size: 22px; line-height: 1; }
.pay-modal .pay-network-btn .net-name { font-size: 11px; }
.pay-modal .pay-network-btn .net-check {
  position: absolute; top: 6px; right: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  font-size: 9px;
  display: none;
  align-items: center; justify-content: center;
}
.pay-modal .pay-network-btn.active {
  border-color: var(--secondary);
  background: rgba(212,175,55,0.06);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}
.pay-modal .pay-network-btn.active .net-check { display: flex; }
.pay-modal .pay-network-btn:hover:not(.active) {
  border-color: var(--secondary);
  transform: translateY(-1px);
}

.pay-modal .pay-phone-wrap {
  position: relative;
  margin-bottom: 14px;
}
.pay-modal .pay-phone-wrap .pay-prefix {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 13px; font-weight: 700;
  color: var(--text-light);
  pointer-events: none;
}
.pay-modal .pay-phone-input {
  width: 100%;
  padding: 14px 14px 14px 48px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: inherit;
  transition: all 0.3s ease;
}
.pay-modal .pay-phone-input:focus {
  border-color: var(--secondary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}
.pay-modal .pay-phone-input::placeholder {
  font-weight: 400;
  letter-spacing: 0;
  font-size: 14px;
}

.pay-modal .btn-pay {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #D4AF37 0%, #f5d06a 100%);
  color: #0A2342;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}
.pay-modal .btn-pay:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(212,175,55,0.4);
}
.pay-modal .btn-pay:active { transform: translateY(0) scale(0.98); }

.pay-modal .btn-cancel {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}
.pay-modal .btn-cancel:hover {
  border-color: var(--text-light);
  color: var(--text);
}

/* Step 2 */
.pay-modal .pay-step2-anim {
  animation: payStepIn 0.4s ease;
}
@keyframes payStepIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.pay-modal .pay-pulse-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AF37 0%, #f5d06a 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  position: relative;
  box-shadow: 0 0 0 0 rgba(212,175,55,0.5);
  animation: pulseRing 2s infinite;
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(212,175,55,0.5); }
  70% { box-shadow: 0 0 0 20px rgba(212,175,55,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); }
}
.pay-modal .pay-progress {
  display: flex; justify-content: center; gap: 8px;
  margin: 20px 0;
}
.pay-modal .pay-progress .p-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: all 0.5s ease;
}
.pay-modal .pay-progress .p-dot.active { background: var(--secondary); width: 24px; border-radius: 4px; }
.pay-modal .pay-progress .p-dot.done { background: #28a745; }

.pay-modal .pay-info-box {
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--card-bg) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
  text-align: left;
}
.pay-modal .pay-info-box strong { color: var(--text); }
.pay-modal .pay-info-box .info-icon {
  display: inline-block; margin-right: 6px;
}

.pay-modal .btn-result {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pay-modal .btn-result.success {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: #fff;
  box-shadow: 0 4px 20px rgba(40,167,69,0.3);
}
.pay-modal .btn-result.success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(40,167,69,0.4);
}
.pay-modal .btn-result.danger {
  background: linear-gradient(135deg, #dc3545, #e74c3c);
  color: #fff;
  box-shadow: 0 4px 20px rgba(220,53,69,0.3);
}
.pay-modal .btn-result.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(220,53,69,0.4);
}
.pay-modal .btn-result.primary {
  background: linear-gradient(135deg, var(--secondary), #e6c84a);
  color: var(--primary);
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}
.pay-modal .btn-result.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(212,175,55,0.4);
}

.pay-modal .pay-success-card {
  text-align: center;
  padding: 16px 0;
}
.pay-modal .tick-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  animation: tickPop 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  box-shadow: 0 4px 20px rgba(40,167,69,0.4);
}
@keyframes tickPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.pay-modal .pay-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  background: var(--bg-alt);
  padding: 6px 14px;
  border-radius: 50px;
  margin-bottom: 16px;
}
.pay-modal .pay-timer .timer-num {
  font-weight: 800;
  color: var(--text);
  min-width: 20px;
}

.pay-modal .pay-error {
  color: #dc3545;
  font-size: 13px;
  text-align: center;
  margin-bottom: 10px;
  display: none;
  background: rgba(220,53,69,0.08);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 500;
}
[data-theme="dark"] .pay-modal .pay-top {
  background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #162033 100%);
}
[data-theme="dark"] .pay-modal .modal-card::before {
  background: radial-gradient(circle at 30% 20%, rgba(212,175,55,0.08) 0%, transparent 60%);
}

/* ─── ACCESS MODAL ─── */
.access-modal .modal-card { max-width: 440px; }
.access-modal .access-icon { font-size: 48px; text-align: center; margin-bottom: 12px; }
.access-modal h3 { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.access-modal .access-sub { font-size: 13px; color: var(--text-light); text-align: center; margin-bottom: 20px; }
.access-modal .access-phone-wrap {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-alt); border: 2px solid var(--border);
  border-radius: 14px; padding: 4px; margin-bottom: 12px;
}
.access-modal .access-phone-wrap:focus-within { border-color: var(--secondary); }
.access-modal .access-prefix {
  padding: 10px 8px 10px 14px; font-size: 15px; font-weight: 700;
  color: var(--text-light); white-space: nowrap;
}
.access-modal .access-phone-input {
  flex: 1; border: none; background: transparent;
  padding: 10px 12px 10px 4px; font-size: 15px;
  color: var(--text); font-family: var(--font); outline: none;
}
.access-modal .access-error { color: #dc3545; font-size: 13px; text-align: center; margin-bottom: 10px; display: none; }
.access-modal .access-empty { text-align: center; padding: 30px 0; color: var(--text-light); }
.access-modal .access-empty .empty-icon { font-size: 40px; margin-bottom: 8px; }
.access-modal .access-empty h4 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.access-modal .access-empty p { font-size: 13px; }
.access-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px;
  background: var(--bg-alt); margin-bottom: 8px;
  cursor: pointer; transition: all 0.2s ease;
}
.access-list-item:hover { background: var(--border); transform: translateX(2px); }
.access-list-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.access-list-item .info { flex: 1; min-width: 0; }
.access-list-item .info .title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-list-item .info .meta { font-size: 12px; color: var(--text-light); }
.access-list-item .arrow { font-size: 18px; color: var(--text-light); flex-shrink: 0; }
.btn-access-check {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark, #b8942e) 100%);
  color: #0A2342; font-family: inherit; transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}
.btn-access-check:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(212,175,55,0.4); }
.btn-access-check:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.nav-access-btn {
  background: linear-gradient(135deg, var(--secondary) 0%, #c9a535 100%);
  color: #0A2342; border: none; padding: 8px 16px; border-radius: 50px;
  font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all 0.3s ease; white-space: nowrap;
}
.nav-access-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,175,55,0.3); }
.nav-home-btn {
  background: var(--bg-alt); color: var(--text); border: 2px solid var(--border);
  padding: 8px 12px; border-radius: 50px; font-size: 18px; cursor: pointer;
  text-decoration: none; transition: all 0.3s ease; display: inline-flex;
  align-items: center; justify-content: center; line-height: 1;
}
.nav-home-btn:hover { border-color: var(--secondary); color: var(--secondary); transform: translateY(-1px); }
.access-gate-banner {
  text-align: center; padding: 60px 20px;
  background: var(--bg-alt); border-radius: 16px; margin: 40px 0;
}
.access-gate-banner .lock-icon { font-size: 48px; margin-bottom: 12px; }
.access-gate-banner h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.access-gate-banner p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }
.access-gate-banner .btn-gate { padding: 14px 32px; border: none; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all 0.3s ease; }
.access-gate-banner .btn-gate.unlock { background: linear-gradient(135deg, var(--secondary) 0%, #c9a535 100%); color: #0A2342; }
.access-gate-banner .btn-gate.pay { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: #0A2342; }
.access-gate-banner .btn-gate:hover { transform: translateY(-2px); }

@media(max-width: 640px) {
  #mainHeader .header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; }
  #mainHeader .header-inner .logo { order: 0; }
  #mainHeader .header-inner .theme-toggle { order: 1; margin-left: auto; }
  #mainHeader .header-inner .nav-home-btn { order: 3; }
  #mainHeader .header-inner .search-bar { order: 4; flex: 1; min-width: 80px; }
  #mainHeader .header-inner .nav-access-btn { order: 5; padding: 6px 10px; font-size: 14px; }
  #mainHeader .header-inner::after { content: ''; order: 2; width: 100%; height: 0; }
  #zanguLabel { display: none; }
}

/* ─── CUSTOM SCROLLBAR ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}
.modal-card {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-card::-webkit-scrollbar {
  width: 6px;
}
.modal-card::-webkit-scrollbar-thumb {
  border-width: 0;
}
.admin-sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.admin-sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.admin-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  border: none;
}
