:root {
  color-scheme: dark;
    --bg: #07070d;
  --bg-deep: #030307;
  --surface: rgba(18, 18, 27, .82);
  --surface-2: rgba(28, 28, 40, .88);
  --surface-3: rgba(43, 38, 28, .52);
  --card: rgba(255, 255, 255, .065);
  --text: #fbf5ea;
  --muted: #b8b3c4;
  --muted-2: #827d93;
  --accent: #d4af37;
  --accent-2: #f4d76a;
  --accent-strong: #b88917;
  --accent-soft: rgba(212, 175, 55, .14);
  --line: rgba(255, 255, 255, .115);
  --line-strong: rgba(244, 215, 106, .42);
  --success: #22c55e;
  --danger: #ef4444;
    --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 28px 90px rgba(0, 0, 0, .45);
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, .28);
  --shadow-gold: 0 18px 55px rgba(212, 175, 55, .18);
  --max: 1180px;
  --transition-fast: .18s ease;
  --transition-normal: .28s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Cairo", "Tahoma", system-ui, sans-serif;
  line-height: 1.85;
  background:
    radial-gradient(circle at 10% 4%, rgba(244, 215, 106, .16), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(112, 88, 255, .12), transparent 28%),
    radial-gradient(circle at 45% 100%, rgba(212, 175, 55, .09), transparent 34%),
    linear-gradient(180deg, var(--bg-deep), #10101a 44%, var(--bg));
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.82), rgba(0,0,0,.16));
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
::selection { background: rgba(212, 175, 55, .38); color: var(--text); }

.container { width: min(var(--max), calc(100% - 36px)); margin-inline: auto; }
.muted { color: var(--muted); }
.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; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
    border-bottom: 1px solid rgba(244, 215, 106, .13);
  background: rgba(7, 7, 13, .76);
  backdrop-filter: blur(22px) saturate(145%);
}
.nav-wrap { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; position: relative; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 900; font-size: 1.09rem; letter-spacing: -.01em; }
.brand-logo { width: 46px; height: 46px; border-radius: 16px; border: 1px solid var(--line-strong); box-shadow: var(--shadow-gold); }
.brand-text { background: linear-gradient(135deg, #fff5d6, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-nav a, .link-button {
  color: var(--muted);
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.site-nav a:hover, .link-button:hover,
.site-nav a:focus-visible, .link-button:focus-visible {
  color: var(--text);
  border-color: rgba(244, 215, 106, .22);
  background: rgba(255,255,255,.06);
  outline: none;
  transform: translateY(-1px);
}
.nav-toggle {
  display: none;
  width: 44px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  cursor: pointer;
}  
.nav-toggle span { width: 18px; height: 2px; border-radius: 999px; background: var(--text); transition: var(--transition-fast); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
 border-radius: 15px;
  padding: 11px 18px;
  color: var(--text);
  background: rgba(255,255,255,.06);
  cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  font-weight: 800;
}
.btn:hover, .btn:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); outline: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #171107; border-color: transparent; box-shadow: var(--shadow-gold); }
.btn-primary:hover { box-shadow: 0 22px 70px rgba(212, 175, 55, .28); }
.btn-secondary { background: rgba(255,255,255,.065); color: var(--text); }
.btn-small { min-height: 38px; padding: 7px 13px; }
.text-link { color: var(--accent-2); font-weight: 900; text-decoration: none; transition: color var(--transition-fast); }
.text-link:hover { color: var(--accent); text-decoration: underline; }

.hero-shell { position: relative; isolation: isolate; padding: 72px 0 38px; overflow: hidden; }
.hero-shell::before, .hero-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  pointer-events: none;
  z-index: -1;
}
.hero-shell::before { width: 520px; height: 520px; inset: 3% auto auto -180px; background: radial-gradient(circle, rgba(244,215,106,.16), transparent 66%); }
.hero-shell::after { width: 560px; height: 560px; inset: auto -180px 0 auto; background: radial-gradient(circle, rgba(103,84,255,.15), transparent 64%); }
.hero-luxe { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(310px, .88fr); gap: 22px; align-items: stretch; }
.reveal-card, .panel, .novel-card, .stat-card, .auth-card, .feature-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(26, 26, 38, .84), rgba(13, 13, 21, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.reveal-card::before, .feature-card::before, .panel::before, .auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(244, 215, 106, .16), transparent 30%, rgba(255,255,255,.035));
  opacity: .74;
}
.reveal-card > *, .feature-card > *, .panel > *, .auth-card > * { position: relative; z-index: 1; }
.hero-copy { min-height: 560px; padding: clamp(28px, 5vw, 58px); display: flex; flex-direction: column; justify-content: flex-end; }
.eyebrow { width: fit-content; padding: 7px 13px; border-radius: 999px; background: var(--accent-soft); color: #ffe8a5; border: 1px solid rgba(244,215,106,.25); font-size: .9rem; font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 840px; font-size: clamp(2.25rem, 5.6vw, 5rem); line-height: 1.06; margin: 18px 0; letter-spacing: -.045em; }
.hero-copy h1 { background: linear-gradient(135deg, #fff8dc 0%, var(--accent-2) 48%, #b88917 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { line-height: 1.28; }
.lead { max-width: 68ch; color: #e2dded; font-size: clamp(1.04rem, 1.35vw, 1.2rem); font-family: "Noto Naskh Arabic", "Cairo", serif; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 30px 0 0; padding: 0; }
.hero-stats div { padding: 15px; border: 1px solid rgba(244,215,106,.18); border-radius: 18px; background: rgba(255,255,255,.045); }
.hero-stats dt { color: var(--accent-2); font-size: 1.55rem; font-weight: 900; line-height: 1.1; }
.hero-stats dd { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.hero-showcase { min-height: 560px; padding: clamp(24px, 4vw, 42px); display: flex; flex-direction: column; justify-content: flex-end; }
.book-stack { position: absolute; inset: 30px 26px auto 26px; height: 260px; pointer-events: none; }
.book-stack span { position: absolute; width: 42%; height: 86%; border-radius: 18px 10px 10px 18px; border: 1px solid rgba(255,255,255,.18); box-shadow: var(--shadow-soft); transform-origin: bottom center; }
.book-stack span:nth-child(1) { right: 11%; top: 24px; background: linear-gradient(145deg, #5f2b22, #d4af37); transform: rotate(-9deg); }
.book-stack span:nth-child(2) { right: 30%; top: 0; background: linear-gradient(145deg, #141421, #6f5dff); transform: rotate(4deg); }
.book-stack span:nth-child(3) { right: 48%; top: 34px; background: linear-gradient(145deg, #171107, #f4d76a); transform: rotate(13deg); }
.hero-showcase h2 { margin: 18px 0 10px; font-size: clamp(1.6rem, 3vw, 2.45rem); }

.section { padding: 42px 0; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { padding: 24px; transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal); }
.feature-card:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: 0 30px 80px rgba(0,0,0,.42); }
.feature-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 18px; background: var(--accent-soft); border: 1px solid rgba(244,215,106,.16); font-size: 1.8rem; }
.feature-card h2 { margin-bottom: 8px; font-size: 1.35rem; }
.feature-card p { color: var(--muted); margin-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin-bottom: 22px; }
.section-head h2 { margin-bottom: 5px; font-size: clamp(1.55rem, 3vw, 2.35rem); }
.library-panel { padding-top: 44px; }
.filters { display: grid; grid-template-columns: minmax(220px, 310px) minmax(150px, 210px); gap: 10px; align-items: center; }
.search-input, .select, .form-control {
  width: 100%;
    min-height: 48px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(5, 5, 10, .58);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.search-input:focus, .select:focus, .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(212,175,55,.13); background: rgba(9,9,16,.72); }
.select option { color: #111827; }

.novels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.novel-card { display: flex; flex-direction: column; min-height: 100%; transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal); }
.novel-card:hover { transform: translateY(-7px); border-color: var(--line-strong); box-shadow: 0 34px 85px rgba(0,0,0,.45); }
.novel-cover { aspect-ratio: 4/5; background: linear-gradient(145deg, rgba(212,175,55,.30), rgba(111,93,255,.18)); display: grid; place-items: center; color: #fff; font-size: 3.4rem; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.novel-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-normal); }
.novel-card:hover .novel-cover img { transform: scale(1.045); }
.cover-fallback { filter: drop-shadow(0 16px 24px rgba(0,0,0,.28)); }
.novel-body { padding: 19px; display: grid; gap: 10px; flex: 1; }
.novel-body h3 { margin-bottom: 0; font-size: 1.25rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.07); color: #e6deee; font-size: .86rem; border: 1px solid rgba(255,255,255,.09); }
.novel-meta { color: var(--muted); font-size: .94rem; }

.panel { padding: clamp(19px, 3vw, 32px); }
.empty-state { text-align: center; color: var(--muted); padding: 40px; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.035); grid-column: 1 / -1; }
.site-footer { margin-top: 58px; border-top: 1px solid rgba(244,215,106,.12); background: rgba(3, 3, 7, .42); }
.footer-grid { padding: 34px 0; display: grid; grid-template-columns: 1.4fr .8fr .8fr 1fr; gap: 22px; color: var(--muted); }
.footer-grid strong, .footer-grid span { color: var(--text); display: block; margin-bottom: 8px; font-weight: 900; }
.footer-grid a { display: block; margin: 5px 0; color: var(--muted); transition: color var(--transition-fast); }
.footer-grid a:hover { color: var(--accent-2); }
.copyright { align-self: end; text-align: left; }
.toast { position: fixed; bottom: 18px; right: 18px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); padding: 13px 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(13, 13, 21, .96); box-shadow: var(--shadow); }
.toast.success { border-color: rgba(34,197,94,.45); }
.toast.error { border-color: rgba(239,68,68,.55); }
.message, .auth-message { padding: 13px 15px; border-radius: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.045); color: var(--muted); white-space: pre-line; }
.message.success, .auth-message.success { border-color: rgba(34,197,94,.38); color: #bbf7d0; background: rgba(34,197,94,.09); }
.message.error, .auth-message.error { border-color: rgba(239,68,68,.42); color: #fecaca; background: rgba(239,68,68,.09); }
.message.info, .auth-message.info { border-color: rgba(244,215,106,.32); color: #fde68a; background: rgba(212,175,55,.09); }

@media (max-width: 980px) {
  .hero-luxe { grid-template-columns: 1fr; }
  .hero-copy, .hero-showcase { min-height: 430px; }
  .features-grid, .footer-grid { grid-template-columns: 1fr 1fr; }
  .novels-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 10px);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(13, 13, 21, .98);
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav.open { display: flex; }
  .site-nav a, .site-nav .link-button { width: 100%; text-align: center; justify-content: center; }
  .section-head, .filters { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
    .hero-shell { padding-top: 36px; }
  .hero-copy, .hero-showcase { min-height: auto; }
  .book-stack { position: relative; inset: auto; height: 220px; margin-bottom: 22px; }
  .hero-stats, .features-grid, .novels-grid, .footer-grid { grid-template-columns: 1fr; }
  .copyright { text-align: right; }
}
@media (max-width: 480px) {
  .container { width: min(var(--max), calc(100% - 24px)); }
    h1 { font-size: clamp(2.05rem, 12vw, 3.1rem); }
  .hero-copy, .hero-showcase, .panel, .feature-card, .novel-card { border-radius: 18px; }
}

.home-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.home-stat {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
}
.home-stat strong {
  display: block;
  color: var(--accent-2);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.1;
}
.home-stat span { color: var(--muted); font-size: .92rem; }
.home-layout {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 22px;
  align-items: start;
}
.home-sidebar { display: grid; gap: 18px; }
.featured-novel-card {
  display: grid;
  grid-template-columns: minmax(180px, .55fr) 1fr;
  gap: 18px;
  align-items: stretch;
}
.featured-cover {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(212,175,55,.24), rgba(112,88,255,.16));
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 3rem;
}
.featured-cover img { width: 100%; height: 100%; object-fit: cover; }
.side-list { display: grid; gap: 10px; }
.side-list a,
.comment-preview {
  display: block;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
}
.side-list a span { color: var(--accent-2); font-weight: 900; margin-left: 5px; }
.side-list small { display: block; color: var(--muted); }
.comment-preview { display: grid; gap: 6px; }
.comment-preview div { display: flex; justify-content: space-between; gap: 12px; }
.comment-preview p { margin: 0; color: var(--muted); }
.btn-danger { background: rgba(239,68,68,.14); color: #fecaca; border-color: rgba(239,68,68,.42); }
.btn-danger:hover { border-color: rgba(239,68,68,.72); }
.btn-small { min-height: auto; padding: 8px 12px; border-radius: 999px; font-size: .9rem; }

@media (max-width: 980px) {
  .home-layout,
  .featured-novel-card { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .home-stat-grid { grid-template-columns: 1fr; }
}
