:root {
  --gold: #d6ad55;
  --gold-light: #f3d78e;
  --bg: #0b0b0b;
  --surface: #151515;
  --surface2: #1d1b17;
  --text: #f5f0e5;
  --muted: #aaa397;
  --border: rgba(214,173,85,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.8;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #292113, #090909 65%);
  animation: welcomeOut .8s ease 2.3s forwards;
}
.welcome-content { text-align: center; padding: 25px; animation: welcomeIn 1s ease; }
.welcome-symbol { color: var(--gold); font-size: 55px; }
.welcome-content h1 { color: var(--gold-light); font-size: clamp(30px, 7vw, 55px); margin: 5px 0; }
.welcome-content p { color: var(--muted); }
.welcome-line { width: 100px; height: 2px; margin: 20px auto; background: var(--gold); animation: lineGrow 1.2s ease; }
@keyframes welcomeIn { from { opacity: 0; transform: translateY(25px); } to { opacity: 1; transform: translateY(0); } }
@keyframes lineGrow { from { width: 0; } to { width: 100px; } }
@keyframes welcomeOut { to { opacity: 0; visibility: hidden; pointer-events: none; } }

.top-header {
  min-height: 75px;
  padding: 12px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #101010;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold-light); font-weight: bold; font-size: 22px; }
.brand-icon { font-size: 27px; color: var(--gold); }
.top-header nav { display: flex; align-items: center; gap: 24px; }
.top-header nav a { color: #d2cabb; font-size: 14px; transition: .2s; }
.top-header nav a:hover { color: var(--gold); }
.menu-button { display: none; background: transparent; border: 1px solid var(--border); color: var(--gold); padding: 5px 12px; border-radius: 8px; font-size: 22px; }

.ticker { display: flex; align-items: center; background: #201a10; border-bottom: 1px solid var(--border); height: 42px; overflow: hidden; }
.ticker-label { flex-shrink: 0; padding: 0 15px; color: var(--gold-light); font-size: 12px; border-left: 1px solid var(--border); }
.ticker-window { overflow: hidden; flex: 1; }
.ticker-text { display: inline-block; white-space: nowrap; color: #e9d7ae; padding-right: 100%; animation: tickerMove 22s linear infinite; font-size: 13px; }
@keyframes tickerMove { from { transform: translateX(0); } to { transform: translateX(100%); } }

.hero {
  min-height: 440px;
  padding: 75px 9%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  background: radial-gradient(ellipse at 80% 45%, #332718 0%, #17130e 35%, #0b0b0b 75%);
  border-bottom: 1px solid var(--border);
}
.hero-content { max-width: 650px; position: relative; z-index: 1; }
.hero-overline, .section-kicker { color: var(--gold); font-size: 12px; letter-spacing: 1px; }
.hero h1 { font-size: clamp(34px, 6vw, 65px); line-height: 1.3; margin: 12px 0; }
.hero h1 span, .section-heading h2 span { color: var(--gold); }
.hero p { max-width: 560px; color: #bdb4a5; line-height: 2.1; }
.gold-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 7px;
  padding: 11px 23px;
  background: linear-gradient(135deg, #f1d48c, #b48737);
  color: #17120a;
  font-weight: bold;
  cursor: pointer;
  transition: .2s;
}
.gold-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.hero .gold-button { margin-top: 15px; }
.hero-decoration { width: 250px; height: 250px; flex-shrink: 0; position: relative; display: grid; place-items: center; }
.decoration-ring { position: absolute; border: 1px solid rgba(220,177,91,.4); border-radius: 50%; transform: rotate(-25deg); }
.ring-one { width: 220px; height: 220px; }
.ring-two { width: 160px; height: 160px; border-style: dashed; animation: spin 25s linear infinite; }
.decoration-star { color: var(--gold-light); font-size: 85px; text-shadow: 0 0 40px #b88736; }
@keyframes spin { to { transform: rotate(335deg); } }

.stats-section { display: flex; justify-content: center; gap: 65px; padding: 25px 10px; background: #111; border-bottom: 1px solid var(--border); }
.stat-box { display: flex; align-items: center; gap: 10px; }
.stat-box strong { color: var(--gold); font-size: 25px; }
.stat-box span { color: var(--muted); font-size: 13px; }

.section { padding: 65px 7%; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 25px; }
.section-heading h2 { margin: 5px 0 0; font-size: 29px; }
.category-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.category-card {
  min-height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 15px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(145deg, #1b1915, #111);
  color: #e8ddc8;
  cursor: pointer;
  transition: .25s;
}
.category-card:hover, .category-card.active { border-color: var(--gold); background: #292113; color: var(--gold-light); transform: translateY(-3px); }

.stories-section { background: #101010; border-top: 1px solid #211d16; }
.search-row { display: flex; gap: 10px; max-width: 650px; margin-bottom: 18px; }
.search-row input { flex: 1; min-width: 0; background: #1a1a1a; color: white; border: 1px solid var(--border); border-radius: 7px; padding: 12px 15px; outline: none; }
.search-row input:focus { border-color: var(--gold); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 25px; }
.filter-button { background: #1b1b1b; color: #c8beae; border: 1px solid #383126; border-radius: 20px; padding: 7px 16px; cursor: pointer; font-size: 13px; }
.filter-button.active, .filter-button:hover { color: var(--gold-light); border-color: var(--gold); }

.story-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.story-card { background: linear-gradient(150deg, #1d1b17, #111); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; transition: .25s; }
.story-card:hover { transform: translateY(-4px); border-color: #b9904a; }
.story-cover { height: 125px; display: grid; place-items: center; background: radial-gradient(circle, #49371b, #17130d 70%); color: var(--gold); font-size: 44px; position: relative; }
.story-cover img { width: 100%; height: 100%; object-fit: cover; }
.favorite-button { position: absolute; top: 8px; left: 8px; border: 1px solid #69532d; border-radius: 50%; width: 33px; height: 33px; color: white; background: #111c; cursor: pointer; }
.favorite-button.saved { color: #f4c45e; }
.story-info { padding: 13px; }
.story-info h3 { font-size: 16px; margin: 0 0 5px; color: #f2e7d2; }
.story-info p { font-size: 12px; color: var(--muted); min-height: 42px; margin: 5px 0 12px; }
.story-meta { color: #a99b83; font-size: 11px; margin-bottom: 12px; }
.read-button { width: 100%; border: 1px solid var(--gold); border-radius: 6px; padding: 7px; color: var(--gold-light); background: transparent; cursor: pointer; }
.read-button:hover { background: #3a2b14; }
.empty-message, .loading { color: var(--muted); text-align: center; padding: 30px; grid-column: 1 / -1; }

.quote-section { padding: 45px 15px; text-align: center; background: #19150f; color: var(--gold-light); }
.quote-section span { color: var(--gold); }
.quote-section p { font-size: 20px; }
footer { padding: 35px 15px; text-align: center; color: var(--muted); background: #090909; border-top: 1px solid var(--border); }
.footer-brand { color: var(--gold); font-size: 20px; font-weight: bold; }
footer small { font-size: 11px; }

.reader-modal { display: none; position: fixed; inset: 0; z-index: 200; background: #000d; padding: 15px; overflow-y: auto; }
.reader-modal.open { display: flex; justify-content: center; align-items: flex-start; }
.reader-panel { width: min(850px, 100%); margin: 25px auto; padding: 22px; background: #15130f; border: 1px solid var(--gold); border-radius: 12px; }
.reader-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.reader-header h2 { margin: 4px 0; color: var(--gold-light); }
.close-button { width: 38px; height: 38px; border: 1px solid var(--border); background: transparent; color: var(--gold); border-radius: 50%; font-size: 25px; cursor: pointer; }
.reader-description { color: var(--muted); padding: 12px 0; }
.part-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.part-button { background: #252018; color: var(--gold-light); border: 1px solid var(--border); padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.part-button.active { background: #72501e; }
.reader-page { min-height: 250px; padding: 20px; background: #1d1a15; border-radius: 8px; margin-top: 15px; }
.page-number { color: var(--gold); font-size: 12px; margin-bottom: 12px; }
.page-content { color: #eee4d4; white-space: pre-wrap; line-height: 2.2; overflow-wrap: anywhere; }
.reader-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; }
.reader-control { background: #29241b; color: var(--gold-light); border: 1px solid var(--border); padding: 9px 17px; border-radius: 6px; cursor: pointer; }
.reader-control:disabled, .gold-button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
#pageCounter { color: var(--muted); font-size: 13px; }
.toast { position: fixed; bottom: 20px; right: 50%; transform: translate(50%, 100px); background: #2a2418; color: var(--gold-light); border: 1px solid var(--gold); border-radius: 7px; padding: 10px 18px; z-index: 500; transition: .3s; }
.toast.show { transform: translate(50%, 0); }

@media (max-width: 900px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .top-header { min-height: 65px; }
  .brand { font-size: 19px; }
  .menu-button { display: block; }
  .top-header nav { display: none; position: absolute; top: 64px; right: 0; left: 0; padding: 15px 20px; background: #151515; border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; gap: 12px; }
  .top-header nav.open { display: flex; }
  .top-header nav a { padding: 6px; }
  .hero { min-height: 390px; padding: 55px 7%; }
  .hero-decoration { position: absolute; left: -95px; opacity: .25; }
  .hero-content { max-width: 100%; }
  .stats-section { gap: 18px; justify-content: space-around; }
  .stat-box { gap: 5px; flex-direction: column; }
  .stat-box strong { font-size: 21px; }
  .stat-box span { font-size: 11px; }
  .section { padding: 45px 5%; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .category-card { min-height: 72px; font-size: 13px; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .story-cover { height: 100px; }
  .story-info { padding: 10px; }
  .story-info h3 { font-size: 14px; }
  .story-info p { font-size: 11px; }
  .search-row { gap: 6px; }
  .search-row .gold-button { padding: 9px 14px; }
  .reader-panel { padding: 14px; }
  .reader-controls { flex-wrap: wrap; }
  .quote-section p { font-size: 16px; }
}

/* إصلاح ظهور رابط المدير والنقر عليه في الهاتف */
#mainNav {
  position: relative;
  z-index: 100;
}
#mainNav a {
  position: relative;
  z-index: 101;
  pointer-events: auto;
  cursor: pointer;
}
@media (max-width: 650px) {
  .top-header nav.open {
    z-index: 200;
  }
}
