/* ============================================================
   NASJ Platform — main.css
   Cloudflare Static Assets | nasjai.com
   Mobile-First | Dual Theme (dark/light) | RTL/LTR
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;600;700;900&family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── CSS Variables — Dark Theme (default) ─────────────────── */
:root {
  /* Brand Colors */
  --c-bg:        #09090F;
  --c-bg2:       #0F0F18;
  --c-bg3:       #141420;
  --c-surface:   rgba(255,255,255,0.04);
  --c-surface2:  rgba(255,255,255,0.07);
  --c-border:    rgba(255,255,255,0.08);
  --c-border2:   rgba(255,255,255,0.14);

  /* Text */
  --c-text:      #F0EAE0;
  --c-text2:     rgba(240,234,224,0.60);
  --c-text3:     rgba(240,234,224,0.38);

  /* Accent — from nasj doc3 */
  --c-primary:   #080812;
  --c-purple:    #2D1B69;
  --c-gold:      #B8860B;
  --c-gold-hover:#D4A012;
  --c-gold-dim:  rgba(184,134,11,0.15);

  /* Status */
  --c-success:   #4ADE80;
  --c-error:     #F87171;
  --c-warning:   #FBBF24;
  --c-info:      #60A5FA;

  /* Typography */
  --font-ar:     'Cairo', sans-serif;
  --font-ar-body:'Amiri', serif;
  --font-en:     'Inter', sans-serif;
  --font-en-body:'Playfair Display', serif;

  /* Spacing */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  40px;
  --sp-2xl: 64px;

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-full:100px;

  /* Nav height */
  --nav-h: 60px;

  /* Transition */
  --t-fast:  0.15s ease;
  --t-base:  0.2s ease;
  --t-slow:  0.35s ease;

  /* Shadow */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.5);
}

/* ── Light Theme ───────────────────────────────────────────── */
[data-theme="light"] {
  --c-bg:       #F4EFE6;
  --c-bg2:      #EDE8DF;
  --c-bg3:      #E5DFD5;
  --c-surface:  rgba(0,0,0,0.04);
  --c-surface2: rgba(0,0,0,0.07);
  --c-border:   rgba(0,0,0,0.10);
  --c-border2:  rgba(0,0,0,0.18);

  --c-text:     #12100A;
  --c-text2:    rgba(18,16,10,0.65);
  --c-text3:    rgba(18,16,10,0.45);

  --c-gold:     #B8860B;
  --c-gold-hover:#D4A012;
  --c-gold-dim: rgba(184,134,11,0.12);

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.12);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.15);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ar);
  direction: rtl;
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  transition: background var(--t-slow), color var(--t-slow);
  overflow-x: hidden;
}
body[lang="en"] {
  font-family: var(--font-en);
  direction: ltr;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
}
ul, ol { list-style: none; }

/* ── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
}
h1 { font-size: clamp(32px, 5vw, 60px); letter-spacing: -0.5px; }
h2 { font-size: clamp(22px, 3.2vw, 38px); letter-spacing: -0.3px; }
h3 { font-size: clamp(17px, 2.2vw, 26px); }
h4 { font-size: clamp(15px, 1.8vw, 21px); }

p { color: var(--c-text2); line-height: 1.85; }

.text-ar { font-family: var(--font-ar); }
.text-en { font-family: var(--font-en); }
.prose-ar { font-family: var(--font-ar-body); font-size: 19px; line-height: 2.1; }
.prose-en { font-family: var(--font-en-body); font-size: 18px; line-height: 1.9; }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
}
@media (min-width: 768px) {
  .container { padding: 0 var(--sp-xl); }
}
.section { padding: var(--sp-2xl) 0; }
.section-sm { padding: var(--sp-xl) 0; }

/* ── NAV ───────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-lg);
  background: rgba(9,9,15,0.88);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--t-slow);
}
[data-theme="light"] .nav {
  background: rgba(244,239,230,0.88);
}
.nav-logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}
.nav-logo-ar {
  font-size: 21px;
  font-weight: 900;
  color: var(--c-text);
  letter-spacing: 1px;
}
.nav-logo-en {
  font-size: 10px;
  font-weight: 400;
  color: var(--c-text3);
  letter-spacing: 4px;
  font-family: var(--font-en);
}
.nav-links {
  display: none;
  gap: var(--sp-xl);
}
@media (min-width: 768px) {
  .nav-links { display: flex; }
}
.nav-links a {
  font-size: 14px;
  font-weight: 400;
  color: var(--c-text3);
  letter-spacing: 0.3px;
  transition: color var(--t-base);
  padding: var(--sp-sm) 0;
}
.nav-links a:hover { color: var(--c-text); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.nav-mobile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text2);
  transition: all var(--t-base);
}
@media (min-width: 768px) {
  .nav-mobile-btn { display: none; }
}
.nav-mobile-btn:hover { background: var(--c-surface2); color: var(--c-text); }

/* Mobile menu */
.mobile-menu {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--c-bg2);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-lg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform var(--t-slow), opacity var(--t-slow);
  pointer-events: none;
}
.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.mobile-menu a {
  font-size: 16px;
  color: var(--c-text2);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--c-border);
  transition: color var(--t-base);
}
.mobile-menu a:hover { color: var(--c-text); }

/* ── Theme Toggle ──────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text3);
  font-size: 12px;
  transition: all var(--t-base);
  white-space: nowrap;
}
.theme-toggle:hover { background: var(--c-surface2); color: var(--c-text2); }
.theme-toggle-track {
  width: 26px; height: 15px;
  border-radius: 100px;
  background: var(--c-border2);
  position: relative;
  transition: background var(--t-base);
}
.theme-toggle-thumb {
  position: absolute;
  top: 2px; right: 2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--c-text3);
  transition: all var(--t-base);
}
[data-theme="light"] .theme-toggle-thumb {
  right: auto;
  left: 2px;
  background: var(--c-gold);
}

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 12px 28px;
  border-radius: var(--r-md);
  font-family: var(--font-ar);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--t-base);
  white-space: nowrap;
  min-height: 44px;
  border: 1px solid transparent;
  position: relative;
}
.btn:active { transform: scale(0.97) !important; }
.btn-primary {
  background: var(--c-text);
  color: var(--c-bg);
  border-color: var(--c-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.btn-primary:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.btn-ghost {
  background: var(--c-surface);
  color: var(--c-text2);
  border-color: var(--c-border);
}
.btn-ghost:hover {
  background: var(--c-surface2);
  color: var(--c-text);
  border-color: var(--c-border2);
}
.btn-gold {
  background: var(--c-gold);
  color: #09090F;
  border-color: var(--c-gold);
  font-weight: 700;
}
.btn-gold:hover {
  background: var(--c-gold-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(184,134,11,0.25);
}
.btn-outline-gold {
  background: transparent;
  color: var(--c-gold);
  border-color: rgba(184,134,11,0.4);
}
.btn-outline-gold:hover {
  background: var(--c-gold-dim);
  border-color: var(--c-gold);
}
.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
  min-height: 36px;
}
.btn-lg {
  padding: 15px 40px;
  font-size: 16px;
  min-height: 52px;
}
.btn-full { width: 100%; }
.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}
.btn-loading {
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--c-bg);
}

/* ── FORM ELEMENTS ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-xs); }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text2);
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  font-size: 15px;
  transition: all var(--t-base);
  min-height: 44px;
  outline: none;
  direction: inherit;
}
.form-input::placeholder { color: var(--c-text3); }
.form-input:focus {
  border-color: var(--c-border2);
  background: var(--c-surface2);
  box-shadow: 0 0 0 3px rgba(240,234,224,0.06);
}
.form-input:focus[data-theme="light"] {
  box-shadow: 0 0 0 3px rgba(18,16,10,0.06);
}
.form-error {
  font-size: 12px;
  color: var(--c-error);
  display: none;
}
.form-group.has-error .form-input {
  border-color: var(--c-error);
}
.form-group.has-error .form-error { display: block; }
.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* Password toggle */
.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-left: 44px; }
.input-toggle {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--c-text3);
  transition: color var(--t-base);
  line-height: 1;
  font-size: 16px;
}
.input-toggle:hover { color: var(--c-text2); }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-base);
}
.card:hover {
  border-color: var(--c-border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card-body { padding: var(--sp-lg); }

/* Story Cover Card */
.story-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--t-base);
}
.story-card:hover { transform: translateY(-4px); }
.story-card-cover {
  width: 100%;
  aspect-ratio: 341 / 512;
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-sm);
  position: relative;
  overflow: hidden;
  box-shadow:
    -5px 0 10px rgba(0,0,0,0.4),
    0 10px 30px rgba(0,0,0,0.4),
    inset -1px 0 0 rgba(255,255,255,0.05);
  transition: box-shadow var(--t-base);
}
.story-card:hover .story-card-cover {
  box-shadow:
    -7px 0 14px rgba(0,0,0,0.55),
    0 16px 48px rgba(0,0,0,0.55);
}
/* Pages edge illusion */
.story-card-cover::after {
  content: '';
  position: absolute;
  top: 3px; bottom: 3px;
  right: -6px;
  width: 9px; z-index: 1;
  background: linear-gradient(90deg, #c4bca8, #ddd4c0, #c8c0ac);
  border-radius: 0 2px 2px 0;
}
/* Spine */
.story-card-cover::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 12px; z-index: 6;
  background: linear-gradient(90deg, rgba(0,0,0,0.6), rgba(0,0,0,0.08));
}
.story-card-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; z-index: 2;
}
.story-card-overlay {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.25) 50%, transparent 100%);
}
.story-card-genre {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  font-size: 10px; letter-spacing: 1.5px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.9);
  padding: 4px 10px;
  border-radius: var(--r-full);
  backdrop-filter: blur(4px);
  font-weight: 500;
}
.story-card-info {
  position: absolute; bottom: 0; left: 12px; right: 12px;
  z-index: 5; padding-bottom: 14px;
}
.story-card-genre-en {
  font-size: 9px; letter-spacing: 3px;
  color: rgba(255,255,255,0.45);
  display: block; margin-bottom: 5px;
  font-family: var(--font-en);
  font-weight: 400;
}
.story-card-title {
  font-family: 'Amiri', serif;
  font-size: 17px; font-weight: 700;
  line-height: 1.35; color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.9);
  margin-bottom: 6px;
}
.story-card-price {
  font-size: 13px; font-weight: 700;
  color: rgba(184,134,11,0.9);
  letter-spacing: 0.3px;
}
.story-card-badge-new {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  font-size: 10px; letter-spacing: 0.5px;
  background: var(--c-gold);
  color: #09090F;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(184,134,11,0.5);
}
.story-card-label {
  margin-top: 10px; text-align: center;
  padding: 0 4px;
  transition: opacity var(--t-base);
}
.story-card:hover .story-card-label { opacity: 0.85; }
.story-card-label-title {
  font-size: 13px; font-weight: 600;
  color: var(--c-text);
  line-height: 1.4;
  display: block;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.story-card-label-genre {
  font-size: 11px; font-weight: 400;
  color: var(--c-text2);
  display: block;
  margin-top: 2px;
}

/* ── BADGES / TAGS ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 400;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text2);
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
.badge-gold {
  background: var(--c-gold-dim);
  border-color: rgba(184,134,11,0.3);
  color: var(--c-gold);
}

/* ── GENRE FILTER CHIPS ────────────────────────────────────── */
.genre-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 13px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text2);
  transition: all var(--t-base);
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
}
@media (max-width: 640px) {
  .genre-chip {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 36px;
  }
}
.genre-chip:hover {
  background: var(--c-surface2);
  color: var(--c-text);
  border-color: var(--c-border2);
}
.genre-chip.active {
  background: var(--c-gold-dim);
  border-color: rgba(184,134,11,0.4);
  color: var(--c-gold);
}

/* ── STATS STRIP ───────────────────────────────────────────── */
.stats-strip {
  display: flex;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.stats-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-lg) var(--sp-sm);
  border-right: 1px solid var(--c-border);
  text-align: center;
}
.stats-item:last-child { border-right: none; }
.stats-num {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  color: var(--c-text);
  line-height: 1;
  margin-bottom: 4px;
}
.stats-label {
  font-size: 12px;
  font-weight: 300;
  color: var(--c-text3);
}

/* ── PROOF ROW ─────────────────────────────────────────────── */
.proof-row {
  display: flex;
  gap: var(--sp-xl);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.proof-item {
  display: flex; flex-direction: column; gap: 3px;
  position: relative;
}
.proof-item + .proof-item::before {
  content: '';
  position: absolute;
  right: calc(var(--sp-xl) / -2);
  top: 4px; bottom: 4px;
  width: 1px;
  background: var(--c-border);
}
[dir="ltr"] .proof-item + .proof-item::before {
  right: auto;
  left: calc(var(--sp-xl) / -2);
}
.proof-num {
  font-size: 24px; font-weight: 700;
  color: var(--c-text); line-height: 1;
}
.proof-lbl {
  font-size: 12px; font-weight: 400;
  color: var(--c-text3);
}

/* ── SCROLL MARGIN (for fixed nav) ────────────────────────── */
[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* ── NOTIFICATION DOT ──────────────────────────────────────── */
.notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 8px rgba(184,134,11,0.6);
}

/* ── ALERTS / TOASTS ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-lg); right: var(--sp-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  max-width: 340px;
}
.toast {
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-bg2);
  font-size: 14px;
  color: var(--c-text);
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.25s ease;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.toast-success { border-color: rgba(74,222,128,0.3); }
.toast-error   { border-color: rgba(248,113,113,0.3); }
.toast-info    { border-color: rgba(96,165,250,0.3); }

/* Alert inline */
.alert {
  padding: var(--sp-md);
  border-radius: var(--r-md);
  font-size: 14px;
  border: 1px solid;
}
.alert-success {
  background: rgba(74,222,128,0.06);
  border-color: rgba(74,222,128,0.2);
  color: var(--c-success);
}
.alert-error {
  background: rgba(248,113,113,0.06);
  border-color: rgba(248,113,113,0.2);
  color: var(--c-error);
}
.alert-warning {
  background: rgba(251,191,36,0.06);
  border-color: rgba(251,191,36,0.2);
  color: var(--c-warning);
}

/* ── SKELETON LOADING ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--c-surface) 25%,
    rgba(184,134,11,0.06) 50%,
    var(--c-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--r-md);
}

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl) var(--sp-lg);
  text-align: center;
  gap: var(--sp-lg);
}
.empty-state-icon {
  font-size: 48px;
  opacity: 0.4;
}
.empty-state-title {
  font-size: 18px; font-weight: 600;
  color: var(--c-text);
}
.empty-state-desc {
  font-size: 14px;
  color: var(--c-text3);
  max-width: 300px;
}

/* ── MODAL / OVERLAY ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--c-bg2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--t-base);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}
.modal-title {
  font-size: 18px; font-weight: 700;
  color: var(--c-text);
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--t-base);
}
.modal-close:hover {
  background: var(--c-surface2);
  color: var(--c-text);
}

/* ── PROGRESS BAR ──────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--c-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--c-gold);
  border-radius: var(--r-full);
  transition: width 0.3s ease;
}

/* ── TABS ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  padding: 3px;
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px; font-weight: 500;
  color: var(--c-text3);
  transition: all var(--t-base);
  white-space: nowrap;
  min-height: 36px;
}
.tab-btn.active {
  background: var(--c-bg);
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--c-text2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── GENRE STRIP (bottom) ──────────────────────────────────── */
.genre-strip {
  display: flex;
  border-top: 1px solid var(--c-border);
  background: rgba(9,9,15,0.9);
  backdrop-filter: blur(10px);
}
[data-theme="light"] .genre-strip {
  background: rgba(244,239,230,0.9);
}
.genre-strip-item {
  flex: 1;
  padding: 14px 4px;
  text-align: center;
  border-right: 1px solid var(--c-border);
  cursor: pointer;
  transition: background var(--t-base);
  text-decoration: none;
  display: block;
}
.genre-strip-item:last-child { border-right: none; }
.genre-strip-item:hover { background: var(--c-surface); }
.genre-strip-ic {
  font-size: 16px;
  display: block;
  margin-bottom: 4px;
}
.genre-strip-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── FOOTER ────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--c-border);
  padding: calc(var(--sp-2xl) * 1.2) 0 var(--sp-xl);
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-xl);
}
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.footer-brand {}
.footer-logo {
  font-size: 20px; font-weight: 900;
  color: var(--c-text);
  letter-spacing: 1px;
  display: block;
  margin-bottom: var(--sp-sm);
}
.footer-tagline {
  font-size: 14px;
  color: var(--c-text3);
  line-height: 1.7;
  max-width: 260px;
}
.footer-col-title {
  font-size: 12px; font-weight: 600;
  color: var(--c-text2);
  letter-spacing: 1px;
  margin-bottom: var(--sp-md);
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.footer-links a {
  font-size: 14px;
  color: var(--c-text3);
  transition: color var(--t-base);
}
.footer-links a:hover { color: var(--c-text); }
.footer-bottom {
  margin-top: var(--sp-xl);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
.footer-copy {
  font-size: 13px;
  color: var(--c-text3);
}

/* ── PAGE WRAPPER ──────────────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--nav-h);
}

/* ── DIVIDER ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--c-border); }
.divider-with-text {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  color: var(--c-text3);
  font-size: 13px;
}
.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* ── SEARCH BAR ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 0 var(--sp-md);
  transition: all var(--t-base);
}
.search-bar:focus-within {
  border-color: var(--c-border2);
  background: var(--c-surface2);
  box-shadow: 0 0 0 3px rgba(240,234,224,0.05);
}
.search-bar input {
  flex: 1;
  padding: 10px 0;
  font-size: 15px;
  color: var(--c-text);
  border: none;
  outline: none;
  background: transparent;
  min-height: 44px;
}
.search-bar input::placeholder { color: var(--c-text3); }

/* ── GRID HELPERS ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--sp-lg); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--sp-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-md); }
.grid-5 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-md); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-5 { grid-template-columns: repeat(5, 1fr); }
}

/* ── STORY GALLERY (scrolling columns) ────────────────────── */
.gallery-cols {
  display: flex;
  gap: 14px;
  padding: 0 12px;
  height: 100%;
  overflow: hidden;
}
.gallery-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: calc(50% - 7px);
  flex-shrink: 0;
}
.gallery-col-1 { animation: scrollUp 28s linear infinite; }
.gallery-col-2 { animation: scrollDown 34s linear infinite; margin-top: -80px; }

/* ── FADE MASKS ────────────────────────────────────────────── */
.fade-top {
  position: absolute;
  top: 0; left: 0; right: 0; height: 130px;
  background: linear-gradient(180deg, var(--c-bg) 20%, transparent 100%);
  pointer-events: none; z-index: 10;
}
.fade-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 180px;
  background: linear-gradient(0deg, var(--c-bg) 20%, transparent 100%);
  pointer-events: none; z-index: 10;
}
.fade-right {
  position: absolute;
  top: 0; bottom: 0; right: 0; width: 40px;
  background: linear-gradient(270deg, var(--c-bg), transparent);
  pointer-events: none; z-index: 10;
}
.fade-left {
  position: absolute;
  top: 0; bottom: 0; left: 0; width: 40px;
  background: linear-gradient(90deg, var(--c-bg), transparent);
  pointer-events: none; z-index: 10;
}

/* ── PRICING CARDS ─────────────────────────────────────────── */
.pricing-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  transition: all var(--t-base);
  position: relative;
}
.pricing-card:hover {
  border-color: var(--c-border2);
  box-shadow: var(--shadow-md);
}
.pricing-card.popular {
  border-color: rgba(184,134,11,0.5);
  background: linear-gradient(145deg, rgba(184,134,11,0.06) 0%, var(--c-surface) 100%);
  box-shadow: 0 0 0 1px rgba(184,134,11,0.15), 0 8px 32px rgba(184,134,11,0.08);
}
.pricing-card.popular::before {
  content: 'الأكثر طلباً';
  position: absolute;
  top: -12px; right: 50%;
  transform: translateX(50%);
  background: var(--c-gold);
  color: #09090F;
  font-size: 11px; font-weight: 700;
  padding: 3px 14px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.pricing-name {
  font-size: 16px; font-weight: 600;
  color: var(--c-text);
}
.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.pricing-amount {
  font-size: 42px; font-weight: 900;
  color: var(--c-text);
  line-height: 1;
}
.pricing-currency {
  font-size: 18px;
  color: var(--c-text2);
}
.pricing-period {
  font-size: 14px;
  color: var(--c-text3);
}
.pricing-features {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  flex: 1;
}
.pricing-feature {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 14px;
  color: var(--c-text2);
}
.pricing-feature-icon {
  color: var(--c-success);
  flex-shrink: 0;
  font-size: 14px;
}

/* ── MODIFICATION ENGINE ───────────────────────────────────── */
.mod-engine {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
}
.mod-engine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
}
.mod-engine-title {
  font-size: 13px; font-weight: 600;
  color: var(--c-text2);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.mod-engine-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-gold);
}
.mod-counter {
  font-size: 12px;
  color: var(--c-text3);
}
.mod-counter strong { color: var(--c-gold); }
.mod-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-md);
}
.mod-suggestion-chip {
  background: rgba(45,27,105,0.2);
  border: 1px solid rgba(45,27,105,0.4);
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--c-text2);
  cursor: pointer;
  transition: all var(--t-base);
}
.mod-suggestion-chip:hover {
  background: rgba(45,27,105,0.35);
  color: var(--c-text);
}
.mod-input-wrap { position: relative; }
.mod-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  padding-bottom: 44px;
  font-family: var(--font-ar);
  font-size: 14px;
  color: var(--c-text);
  resize: none;
  outline: none;
  transition: border-color var(--t-base);
  direction: rtl;
}
.mod-textarea:focus { border-color: var(--c-border2); }
.mod-textarea::placeholder { color: var(--c-text3); }
.mod-actions {
  position: absolute;
  bottom: 10px; left: 10px; right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mod-word-count {
  font-size: 11px;
  color: var(--c-text3);
}
.mod-word-count.over-limit { color: var(--c-error); }

/* ── CERTIFICATE ───────────────────────────────────────────── */
.cert-card {
  background: linear-gradient(135deg, var(--c-bg2) 0%, var(--c-bg3) 100%);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-2xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cert-card::before {
  content: '';
  position: absolute; inset: 8px;
  border: 1px solid var(--c-border);
  border-radius: calc(var(--r-xl) - 4px);
  pointer-events: none;
}

/* ── ANIMATIONS ────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes scrollUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
@keyframes scrollDown {
  0% { transform: translateY(-50%); }
  100% { transform: translateY(0); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

/* ── UTILITIES ─────────────────────────────────────────────── */
.hidden    { display: none !important; }
.sr-only   {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.mt-auto { margin-top: auto; }
.gap-sm  { gap: var(--sp-sm); }
.gap-md  { gap: var(--sp-md); }
.gap-lg  { gap: var(--sp-lg); }
.flex    { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full  { width: 100%; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text3); }

/* ── SELECTION ─────────────────────────────────────────────── */
::selection {
  background: rgba(184,134,11,0.25);
  color: var(--c-text);
}

/* ── FOCUS VISIBLE ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: 3px;
}
/* لا outline على الماوس — فقط للكيبورد واللمس */
:focus:not(:focus-visible) { outline: none; }

/* ══════════════════════════════════════════════════════════════
   STORY PAGE — صفحة القصة كصفحة هبوط احترافية
   ══════════════════════════════════════════════════════════════ */

/* Hero: صورة الغلاف بالخلفية */
.story-page-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding-top: var(--nav-h);
}

.story-hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
.story-hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(2px) brightness(0.35) saturate(1.2);
  transform: scale(1.05);
}
.story-hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(9,9,15,0.3) 0%,
    rgba(9,9,15,0.5) 40%,
    rgba(9,9,15,0.95) 80%,
    rgba(9,9,15,1) 100%
  );
}

.story-hero-content {
  position: relative; z-index: 2;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-2xl) var(--sp-xl);
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-2xl);
  align-items: flex-end;
}
@media (max-width: 768px) {
  .story-hero-content {
    grid-template-columns: 1fr;
    padding: var(--sp-xl) var(--sp-md);
  }
}

/* كرت الغلاف الأمامي */
.story-cover-card {
  flex-shrink: 0;
  position: relative;
}
.story-cover-card img {
  width: 100%;
  aspect-ratio: 341 / 512;
  object-fit: cover;
  border-radius: 3px 12px 12px 3px;
  box-shadow:
    -8px 0 20px rgba(0,0,0,0.7),
    0 20px 60px rgba(0,0,0,0.6),
    inset -1px 0 0 rgba(255,255,255,0.06);
  display: block;
}
/* حافة الورق */
.story-cover-card::after {
  content: '';
  position: absolute;
  top: 4px; bottom: 4px;
  right: -8px;
  width: 10px;
  background: linear-gradient(90deg, #c4bca8, #e8dfc8, #c4bca8);
  border-radius: 0 2px 2px 0;
  z-index: -1;
}
/* العمود */
.story-cover-card::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 14px;
  background: linear-gradient(90deg, rgba(0,0,0,0.7), rgba(0,0,0,0.05));
  border-radius: 3px 0 0 3px;
  z-index: 2;
}
@media (max-width: 768px) {
  .story-cover-card {
    width: 160px;
    margin: 0 auto;
  }
}

/* معلومات القصة */
.story-hero-info {}

.story-hero-badges {
  display: flex; gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-bottom: var(--sp-lg);
}
.story-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px;
}
.story-badge-genre {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
}
.story-badge-new {
  background: var(--c-gold);
  color: #09090F;
}
.story-badge-free {
  background: rgba(74,222,128,0.15);
  border: 1px solid rgba(74,222,128,0.3);
  color: #4ADE80;
}
.story-badge-rating {
  background: rgba(184,134,11,0.15);
  border: 1px solid rgba(184,134,11,0.3);
  color: var(--c-gold);
  font-size: 10px;
}

.story-hero-title {
  font-family: 'Amiri', serif;
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: var(--sp-sm);
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.story-hero-title-en {
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 300;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  margin-bottom: var(--sp-xl);
}

.story-hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.72);
  line-height: 1.9;
  max-width: 560px;
  margin-bottom: var(--sp-xl);
}

.story-hero-stats {
  display: flex; gap: var(--sp-xl);
  margin-bottom: var(--sp-xl);
  flex-wrap: wrap;
}
.story-stat {
  display: flex; flex-direction: column; gap: 2px;
}
.story-stat-num {
  font-size: 20px; font-weight: 700;
  color: #fff; line-height: 1;
}
.story-stat-lbl {
  font-size: 11px; color: rgba(255,255,255,0.4);
  font-weight: 400;
}

.story-hero-ctas {
  display: flex; gap: var(--sp-md);
  flex-wrap: wrap;
  align-items: center;
}
.btn-story-start {
  padding: 16px 44px;
  background: #F0EAE0;
  color: #09090F;
  border-radius: 8px;
  font-size: 16px; font-weight: 700;
  border: none; cursor: pointer;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 54px;
}
.btn-story-start:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(240,234,224,0.2);
}
.btn-story-start:active { transform: scale(0.97); }

.btn-story-ghost {
  padding: 16px 28px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
  min-height: 54px;
  backdrop-filter: blur(4px);
}
.btn-story-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}

/* ── كيف تعمل القصة — قسم الشرح ─────────────────────────── */
.story-how-section {
  background: var(--c-bg2);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-2xl) 0;
}
.story-how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-xl);
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .story-how-grid { grid-template-columns: 1fr; gap: var(--sp-lg); }
}
.story-how-step {
  text-align: center;
  padding: var(--sp-lg);
}
.story-how-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c-gold-dim);
  border: 1px solid rgba(184,134,11,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto var(--sp-md);
}
.story-how-num {
  font-size: 11px; letter-spacing: 2px;
  color: var(--c-gold); font-weight: 600;
  margin-bottom: var(--sp-sm);
  display: block;
}
.story-how-title {
  font-size: 16px; font-weight: 700;
  color: var(--c-text); margin-bottom: var(--sp-sm);
}
.story-how-desc {
  font-size: 13px; color: var(--c-text2);
  line-height: 1.8;
}

/* ── الفصل التأسيسي (قراءة مجانية) ──────────────────────── */
.story-chapter-section {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--sp-2xl) var(--sp-xl);
}
.story-chapter-label {
  display: flex; align-items: center; gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}
.story-chapter-label-line {
  flex: 1; height: 1px;
  background: var(--c-border);
}
.story-chapter-label-text {
  font-size: 11px; letter-spacing: 3px;
  color: var(--c-gold); font-weight: 600;
  white-space: nowrap;
}
.story-chapter-title {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900; color: var(--c-text);
  margin-bottom: var(--sp-xl);
}
.story-chapter-text {
  font-family: 'Amiri', serif;
  font-size: clamp(17px, 2vw, 19px);
  line-height: 2.1;
  color: var(--c-text);
  white-space: pre-line;
}
.story-chapter-fade {
  position: relative;
  overflow: hidden;
}
.story-chapter-fade::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 180px;
  background: linear-gradient(to bottom, transparent, var(--c-bg) 85%);
  pointer-events: none;
}
.story-chapter-cta {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-xl);
  background: var(--c-bg);
}
.story-chapter-cta h3 {
  font-size: clamp(20px, 3vw, 28px);
  margin-bottom: var(--sp-md);
}
.story-chapter-cta p {
  font-size: 15px; color: var(--c-text2);
  margin-bottom: var(--sp-xl);
  max-width: 440px; margin-left: auto; margin-right: auto;
}

/* ── القارئ التفاعلي (بعد البداية) ───────────────────────── */
.story-reader-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--sp-xl) var(--sp-2xl);
}

.reader-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-xl);
  position: sticky;
  top: var(--nav-h);
  background: var(--c-bg);
  z-index: 50;
}
.reader-progress-wrap {
  flex: 1; margin-left: var(--sp-xl);
}
[dir="ltr"] .reader-progress-wrap { margin-left: 0; margin-right: var(--sp-xl); }

.reader-chapter-label {
  font-size: 12px; color: var(--c-text3);
  margin-bottom: 6px; font-weight: 500;
}
.reader-mods-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--c-gold-dim);
  border: 1px solid rgba(184,134,11,0.25);
  border-radius: var(--r-full);
  padding: 6px 14px;
  flex-shrink: 0;
}
.reader-mods-badge.warn {
  background: rgba(251,191,36,0.1);
  border-color: rgba(251,191,36,0.3);
}
.reader-mods-badge.empty {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.2);
}
.reader-mods-num {
  font-size: 18px; font-weight: 900;
  color: var(--c-gold); line-height: 1;
}
.reader-mods-lbl {
  font-size: 11px; color: var(--c-text3);
}

/* نص الفصل */
.chapter-content {
  font-family: 'Amiri', serif;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 2.2;
  color: var(--c-text);
  margin-bottom: var(--sp-2xl);
  white-space: pre-line;
}
.chapter-title-display {
  font-size: 14px; font-weight: 700;
  color: var(--c-gold);
  letter-spacing: 1px;
  margin-bottom: var(--sp-xl);
  display: flex; align-items: center; gap: var(--sp-md);
}
.chapter-title-display::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--c-border);
}

/* Streaming */
.streaming-wrap {
  display: flex; align-items: center; gap: var(--sp-sm);
  color: var(--c-text3); font-size: 13px;
  margin-bottom: var(--sp-lg);
}
.streaming-dots span {
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--c-gold);
  animation: streamPulse 1.2s ease-in-out infinite;
}
.streaming-dots span:nth-child(2) { animation-delay: 0.2s; }
.streaming-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes streamPulse {
  0%,100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* محرك التعديل */
.mod-panel {
  background: var(--c-bg2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  margin-top: var(--sp-xl);
  position: relative;
}
.mod-panel::before {
  content: '✦ وجّه القصة';
  position: absolute;
  top: -11px; right: var(--sp-lg);
  background: var(--c-bg2);
  padding: 0 var(--sp-sm);
  font-size: 11px; font-weight: 700;
  color: var(--c-gold); letter-spacing: 1px;
}
.mod-suggestions-row {
  display: flex; gap: var(--sp-sm);
  flex-wrap: wrap; margin-bottom: var(--sp-lg);
}
.mod-chip {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  background: rgba(45,27,105,0.15);
  border: 1px solid rgba(45,27,105,0.3);
  color: var(--c-text2);
  cursor: pointer;
  transition: all var(--t-base);
  line-height: 1.4;
}
.mod-chip:hover {
  background: rgba(45,27,105,0.28);
  color: var(--c-text);
  border-color: rgba(45,27,105,0.5);
}
.mod-textarea-wrap { position: relative; }
.mod-ta {
  width: 100%;
  min-height: 90px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  padding-bottom: 52px;
  font-family: var(--font-ar);
  font-size: 15px; color: var(--c-text);
  resize: none; outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  line-height: 1.7;
}
.mod-ta:focus {
  border-color: rgba(184,134,11,0.5);
  box-shadow: 0 0 0 3px rgba(184,134,11,0.08);
}
.mod-ta::placeholder { color: var(--c-text3); }
.mod-ta-footer {
  position: absolute;
  bottom: 10px; left: 10px; right: 10px;
  display: flex; align-items: center;
  justify-content: space-between;
}
.mod-count-display {
  font-size: 11px; color: var(--c-text3);
}
.mod-count-display.warn { color: var(--c-error); }

/* Purchase overlay */
.purchase-gate {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(9,9,15,0.88);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-md);
}
.purchase-gate-card {
  background: var(--c-bg2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-2xl);
  max-width: 440px; width: 100%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.purchase-gate-card::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(184,134,11,0.2), transparent, rgba(45,27,105,0.2));
  z-index: -1;
}
.purchase-gate-icon {
  font-size: 48px; margin-bottom: var(--sp-lg);
}
.purchase-gate-title {
  font-size: 22px; font-weight: 900;
  color: var(--c-text); margin-bottom: var(--sp-sm);
}
.purchase-gate-sub {
  font-size: 14px; color: var(--c-text2);
  line-height: 1.8; margin-bottom: var(--sp-xl);
}
.purchase-gate-close {
  position: absolute; top: var(--sp-md); left: var(--sp-md);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text3);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t-base);
}
.purchase-gate-close:hover { color: var(--c-text); background: var(--c-surface2); }

/* Story complete state */
.story-complete-card {
  text-align: center;
  padding: var(--sp-2xl);
  background: linear-gradient(135deg, var(--c-bg2), var(--c-bg3));
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  margin-top: var(--sp-xl);
}
.story-complete-icon {
  font-size: 56px; margin-bottom: var(--sp-lg);
  animation: completePulse 2s ease-in-out infinite;
}
@keyframes completePulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Quote highlight popup */
.highlight-popup {
  position: fixed;
  background: var(--c-bg2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-sm) var(--sp-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  font-size: 13px;
  display: flex; align-items: center; gap: var(--sp-sm);
}
.highlight-save-btn {
  background: var(--c-gold);
  color: #09090F;
  border: none;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: var(--font-ar);
  transition: all var(--t-base);
}
.highlight-save-btn:hover { background: var(--c-gold-hover); }

/* ── NAV CLASS FIX (story page uses .nav not .navbar) ────────── */
.navbar, .nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-lg);
  background: rgba(9,9,15,0.88);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-container {
  display: flex; align-items: center;
  justify-content: space-between;
  width: 100%; max-width: 1200px; margin: 0 auto;
}
.logo-ar, .nav-logo-ar {
  font-size: 21px; font-weight: 900;
  color: var(--c-text); letter-spacing: 1px;
}
.logo-en, .nav-logo-en {
  font-size: 10px; font-weight: 300;
  color: var(--c-text3); letter-spacing: 4px;
  font-family: var(--font-en);
}
.nav-end { display: flex; align-items: center; gap: var(--sp-sm); }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; font-family: var(--font-en);
  transition: all var(--t-base);
}
.btn-icon:hover { background: var(--c-surface2); color: var(--c-text); }

/* story-main wrapper */
.story-main {
  min-height: 100vh;
  background: var(--c-bg);
}

