/* ============ الأنِيس — نظام التصميم ============ */
:root {
  --ink: #0c2a29;
  --ink-2: #123b38;
  --ink-3: #1d524d;
  --gold: #d9ad52;
  --gold-2: #f0cf85;
  --gold-soft: #f7ecd2;
  --paper: #f6f1e7;
  --paper-2: #efe7d6;
  --card: #fffdf8;
  --text: #1d2a29;
  --muted: #6b7774;
  --line: rgba(12, 42, 41, 0.1);
  --green: #1f9d6b;
  --green-soft: #e3f4ec;
  --red: #c4532d;
  --red-soft: #fbe9e1;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(12, 42, 41, 0.05), 0 8px 24px -12px rgba(12, 42, 41, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(12, 42, 41, 0.45);
  --ui: "Tajawal", system-ui, sans-serif;
  --classic: "Amiri", "Times New Roman", serif;
  --brand: "Aref Ruqaa", "Amiri", serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23d9ad52' stroke-width='1'%3E%3Crect x='14' y='14' width='28' height='28'/%3E%3Crect x='14' y='14' width='28' height='28' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='6'/%3E%3Cpath d='M0 0l14 14M56 0L42 14M0 56l14-14M56 56L42 42'/%3E%3C/g%3E%3C/svg%3E");
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* متغيرات تتبدل مع الثيم */
  --strong: #0c2a29;
  --strong-2: #1d524d;
  --field: #fff;
  --field-2: rgba(255, 255, 255, 0.6);
  --switch-off: #d6d2c6;
  --soft-3: rgba(12, 42, 41, 0.03); --soft-4: rgba(12, 42, 41, 0.04); --soft-5: rgba(12, 42, 41, 0.05);
  --soft-6: rgba(12, 42, 41, 0.06); --soft-7: rgba(12, 42, 41, 0.07); --soft-8: rgba(12, 42, 41, 0.08);
  --bg-glow: rgba(217, 173, 82, 0.12);
  --warm: #fffaf0;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(18, 59, 56, 0.08), transparent 60%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--strong-2); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- العلامة ---------- */
.logo-mark {
  font-family: var(--brand);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0;
}
.logo-mark.big { font-size: 64px; }
.logo-mark.dark { background: linear-gradient(180deg, var(--ink-3), var(--ink)); -webkit-background-clip: text; background-clip: text; }

.boot { min-height: 100vh; display: grid; place-content: center; gap: 22px; text-align: center; background: var(--ink); }
.boot-dots { display: flex; gap: 8px; justify-content: center; }
.boot-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: dot 1s infinite ease-in-out; }
.boot-dots span:nth-child(2) { animation-delay: 0.15s; }
.boot-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }

/* ---------- تخطيط ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.view { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(12, 42, 41, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(217, 173, 82, 0.18);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.topbar a.brand { text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.topbar .brand small { color: rgba(255, 255, 255, 0.55); font-size: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: #fff; border: 1px solid rgba(255, 255, 255, 0.1);
}
.user-chip .av { width: 30px; height: 30px; font-size: 13px; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 700; font-size: 15px;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, var(--ink-2), var(--ink)); color: var(--gold-2); box-shadow: 0 8px 20px -10px rgba(12, 42, 41, 0.8); }
.btn-primary:hover { box-shadow: 0 12px 26px -10px rgba(12, 42, 41, 0.9); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink); box-shadow: 0 8px 20px -10px rgba(217, 173, 82, 0.9); }
.btn-ghost { background: transparent; color: var(--strong-2); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--soft-4); }
.btn-soft { background: var(--soft-6); color: var(--strong); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.btn-on-dark { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.14); }
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.14); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- حقول ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 700; color: var(--strong-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border-radius: 13px; border: 1.5px solid var(--line);
  background: var(--field); transition: border 0.2s, box-shadow 0.2s; font-size: 15.5px;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(217, 173, 82, 0.18); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
.input.ltr { direction: ltr; text-align: center; letter-spacing: 6px; font-weight: 800; text-transform: uppercase; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }

.seg { display: inline-flex; background: var(--soft-6); padding: 4px; border-radius: 14px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--field); color: var(--strong); box-shadow: 0 2px 8px -3px rgba(12, 42, 41, 0.3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--field); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px;
  color: var(--muted); transition: all 0.15s;
}
.chip.on { background: var(--ink); color: var(--gold-2); border-color: var(--ink); }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--switch-off); transition: 0.2s; }
.switch i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { right: 23px; }

/* ---------- بطاقات ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: var(--ink); flex: none; }
.card-title h3 { margin: 0; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; gap: 10px; }
.section-title h2 { margin: 0; font-size: 21px; }

/* ---------- صفحة الدخول ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 48px;
  background: radial-gradient(600px 400px at 80% 20%, rgba(217, 173, 82, 0.22), transparent 70%), linear-gradient(160deg, var(--ink-2), var(--ink) 60%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
}
.auth-hero::before { content: ""; position: absolute; inset: 0; background: var(--pattern); opacity: 0.12; }
.auth-hero > * { position: relative; }
.auth-hero .tagline { color: rgba(255, 255, 255, 0.7); font-size: 18px; margin-top: 12px; }
.auth-hero .ayah { font-family: var(--classic); color: var(--gold-2); font-size: 22px; }
.big-verse { font-family: var(--classic); font-size: clamp(24px, 3vw, 34px); line-height: 2; }
.big-verse .h { display: block; }
.big-verse .h:nth-child(2) { padding-right: 18%; }
.big-verse cite { display: block; font-family: var(--ui); font-style: normal; font-size: 14px; color: var(--gold); margin-top: 6px; }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.feature { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, 0.85); font-size: 14.5px; }
.feature b { width: 34px; height: 34px; border-radius: 10px; background: rgba(217, 173, 82, 0.16); color: var(--gold-2); display: grid; place-items: center; flex: none; }
.auth-side { display: grid; place-items: center; padding: 40px 22px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .seg { width: 100%; }
.auth-card .seg button { flex: 1; }

/* ---------- الرئيسية ---------- */
.home-hero {
  position: relative; overflow: hidden; border-radius: 28px; margin-top: 22px; color: #fff; padding: 30px;
  background: radial-gradient(500px 300px at 15% 0%, rgba(217, 173, 82, 0.25), transparent 70%), linear-gradient(150deg, var(--ink-2), var(--ink));
  box-shadow: var(--shadow-lg);
}
.home-hero::before { content: ""; position: absolute; inset: 0; background: var(--pattern); opacity: 0.1; }
.home-hero > * { position: relative; }
.home-hero h1 { margin: 6px 0 4px; font-size: clamp(24px, 4vw, 32px); }
.home-hero .date { color: var(--gold-2); font-weight: 700; font-size: 14px; }
.home-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.inspire { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.verse-card { position: relative; overflow: hidden; text-align: center; padding: 26px 22px; }
.verse-card::after { content: ""; position: absolute; inset: auto -40px -40px auto; width: 140px; height: 140px; background: var(--pattern); opacity: 0.35; border-radius: 50%; }
.verse { font-family: var(--classic); font-size: 21px; line-height: 2.1; color: var(--strong); }
.verse .h { display: inline-block; padding: 0 10px; }
.verse .sep { color: var(--gold); padding: 0 4px; }
.verse cite { display: block; font-family: var(--ui); font-style: normal; font-size: 13px; color: var(--muted); margin-top: 6px; }
.quote-card { background: linear-gradient(160deg, var(--warm), var(--card)); }
.quote { font-family: var(--classic); font-size: 19px; line-height: 2; margin: 0; color: var(--strong); position: relative; padding-right: 14px; border-right: 3px solid var(--gold); }
.quote-by { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 700; color: var(--strong-2); flex-wrap: wrap; }
.tag { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: #8a6516; font-size: 12px; font-weight: 700; }

.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.room-card {
  display: flex; gap: 16px; align-items: stretch; text-decoration: none; color: inherit; padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.room-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.room-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.room-card h3 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-card .book { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-card .meta { margin-top: auto; display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: var(--soft-8); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bar.green > i { background: linear-gradient(90deg, #17855a, #39c08a); }

.empty { text-align: center; padding: 44px 20px; }
.empty .art { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; background: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-lg); }

/* ---------- الغلاف ---------- */
.cover {
  width: 86px; aspect-ratio: 2 / 3; border-radius: 6px 12px 12px 6px; overflow: hidden; flex: none; position: relative;
  box-shadow: -4px 6px 16px -6px rgba(0, 0, 0, 0.45), inset 3px 0 0 rgba(0, 0, 0, 0.12);
  background: var(--ink);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .ph {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10px;
  background: var(--pattern), linear-gradient(160deg, var(--ink-3), var(--ink)); background-size: 36px, cover;
  color: var(--gold-2); font-family: var(--classic); font-weight: 700; font-size: 13px; line-height: 1.5;
}
.cover .ph::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(217, 173, 82, 0.45); border-radius: 3px 8px 8px 3px; }
.cover.lg { width: 140px; }
.cover.lg .ph { font-size: 18px; }

/* ---------- الغرفة ---------- */
.room-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(700px 360px at 85% 0%, rgba(217, 173, 82, 0.22), transparent 70%), linear-gradient(160deg, var(--ink-2), var(--ink));
  padding: 28px 0 70px;
}
.room-hero::before { content: ""; position: absolute; inset: 0; background: var(--pattern); opacity: 0.1; }
.room-hero > * { position: relative; }
.room-head { display: flex; gap: 22px; align-items: center; }
.room-head .t { flex: 1; min-width: 0; }
.room-head h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); line-height: 1.3; }
.room-head .bk { color: var(--gold-2); font-family: var(--classic); font-size: 19px; margin-top: 4px; }
.room-head .au { color: rgba(255, 255, 255, 0.6); font-size: 14px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 8px 6px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.08); border: 1px dashed rgba(217, 173, 82, 0.6); font-weight: 800; letter-spacing: 3px; direction: ltr;
}
.code-chip button { border: 0; border-radius: 9px; padding: 5px 10px; background: var(--gold); color: var(--ink); font-weight: 800; letter-spacing: 0; font-size: 12.5px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .bg { stroke: rgba(255, 255, 255, 0.12); }
.ring .fg { stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .lbl b { font-size: 26px; line-height: 1; }
.ring .lbl span { font-size: 11.5px; color: rgba(255, 255, 255, 0.65); margin-top: 4px; }
.ring.light .bg { stroke: rgba(12, 42, 41, 0.08); }
.ring.light .lbl span { color: var(--muted); }

.tabs {
  display: flex; gap: 6px; margin-top: -46px; position: relative; z-index: 2;
  background: rgba(255, 253, 248, 0.92); backdrop-filter: blur(10px); padding: 6px; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 11px 12px; border-radius: 13px; font-weight: 800; color: var(--muted); font-size: 14.5px;
  display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
}
.tabs button.on { background: var(--ink); color: var(--gold-2); }
.tab-body { padding: 20px 0 110px; }

.today-card {
  position: relative; overflow: hidden; padding: 0;
  background: linear-gradient(180deg, var(--warm), var(--card));
}
.today-top { padding: 24px 24px 18px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.today-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.pages { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.pages b { font-size: clamp(34px, 7vw, 46px); line-height: 1; color: var(--strong); font-weight: 800; }
.pages span { color: var(--muted); font-weight: 700; }
.chap { display: inline-flex; gap: 6px; align-items: center; color: #8a6516; background: var(--gold-soft); padding: 5px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 700; margin-top: 8px; }
.check-big {
  width: 124px; height: 124px; border-radius: 50%; border: 0; flex: none; display: grid; place-content: center; gap: 4px; text-align: center;
  background: radial-gradient(circle at 30% 25%, var(--ink-3), var(--ink)); color: var(--gold-2); font-weight: 800; font-size: 14px;
  box-shadow: 0 14px 30px -12px rgba(12, 42, 41, 0.8), inset 0 0 0 6px rgba(217, 173, 82, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.check-big svg { margin: 0 auto; }
.check-big:hover { transform: scale(1.04); }
.check-big.done { background: radial-gradient(circle at 30% 25%, #39c08a, #17855a); color: #fff; box-shadow: 0 14px 30px -12px rgba(23, 133, 90, 0.8), inset 0 0 0 6px rgba(255, 255, 255, 0.25); animation: pop 0.45s; }
@keyframes pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.today-foot { border-top: 1px dashed var(--line); padding: 14px 24px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 24px; line-height: 1.2; color: var(--strong); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.stat.warn b { color: var(--red); }
.stat.good b { color: var(--green); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--red-soft); color: #8d3418; margin-top: 16px; }
.alert.info { background: var(--gold-soft); color: #7a5610; }
.alert.ok { background: var(--green-soft); color: #11603f; }

/* الجدول */
.month-h { margin: 22px 4px 10px; font-weight: 800; color: var(--strong-2); display: flex; align-items: center; gap: 10px; font-size: 15px; }
.month-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-list { display: grid; gap: 8px; }
.day {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); transition: background 0.2s, border 0.2s;
}
.day .dnum { text-align: center; line-height: 1.15; border-radius: 12px; padding: 7px 0; background: var(--soft-5); }
.day .dnum b { display: block; font-size: 19px; }
.day .dnum span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.day .dinfo { min-width: 0; }
.day .dinfo .p { font-weight: 800; font-size: 15.5px; }
.day .dinfo .l { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .dinfo .hij { font-size: 12px; color: #8a6516; font-weight: 700; }
.day.today { border: 2px solid var(--gold); background: var(--warm); }
.day.today .dnum { background: var(--ink); color: var(--gold-2); }
.day.today .dnum span { color: rgba(240, 207, 133, 0.75); }
.day.late { background: #fff8f5; border-color: rgba(196, 83, 45, 0.25); }
.day.done { background: #f6fbf8; border-color: rgba(31, 157, 107, 0.2); }
.day.done .dinfo .p { color: var(--green); }
.tick {
  width: 42px; height: 42px; border-radius: 13px; border: 2px solid var(--line); background: var(--field); display: grid; place-items: center; color: transparent;
  transition: all 0.2s;
}
.tick:hover { border-color: var(--green); }
.tick.on { background: var(--green); border-color: var(--green); color: #fff; animation: pop 0.35s; }

/* المشاركون */
.leader { display: grid; gap: 10px; }
.member { display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; }
.rank { width: 28px; text-align: center; font-weight: 800; color: var(--muted); }
.rank.r1, .rank.r2, .rank.r3 { font-size: 20px; }
.av {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none;
  background: linear-gradient(150deg, var(--ink-3), var(--ink)); font-size: 16px; box-shadow: inset 0 0 0 2px rgba(217, 173, 82, 0.45);
}
.member .nm { font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.member .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.member .pct { font-weight: 800; font-size: 20px; color: var(--strong); text-align: left; min-width: 54px; }
.member.me { border: 2px solid var(--gold); }
.badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--gold-2); }
.badge.late { background: var(--red-soft); color: var(--red); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.group-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }

/* ---------- المعالج ---------- */
.wizard { max-width: 760px; margin: 0 auto; padding: 22px 0 120px; }
.steps { display: flex; gap: 6px; margin: 4px 0 20px; }
.step { flex: 1; text-align: center; }
.step i { display: block; height: 5px; border-radius: 999px; background: rgba(12, 42, 41, 0.1); margin-bottom: 8px; transition: background 0.3s; }
.step span { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.step.on i, .step.done i { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.step.on span { color: var(--strong); }
.wiz-foot {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 20; padding: 12px 18px calc(12px + var(--safe-b));
  background: rgba(246, 241, 231, 0.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.wiz-foot .in { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; justify-content: space-between; }

.drop {
  display: flex; gap: 18px; align-items: center; padding: 16px; border-radius: 18px; border: 2px dashed rgba(12, 42, 41, 0.18);
  background: var(--field-2); cursor: pointer; transition: border 0.2s, background 0.2s;
}
.drop:hover { border-color: var(--gold); background: var(--warm); }
.drop input { display: none; }

.toc-table { display: grid; gap: 6px; max-height: 360px; overflow: auto; padding: 2px; }
.toc-row { display: grid; grid-template-columns: 1fr 86px 72px 36px; gap: 6px; align-items: center; }
.toc-row .input, .toc-row .select { padding: 8px 10px; font-size: 14px; border-radius: 10px; }
.toc-row .btn-icon { width: 36px; height: 36px; }

.holiday { display: grid; grid-template-columns: 1fr 1fr 1fr auto auto; gap: 8px; align-items: center; padding: 10px; border-radius: 14px; background: var(--soft-4); }
.holiday .input { padding: 9px 10px; font-size: 14px; }
.holiday label.rd { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.summary .stat b { font-size: 21px; }
.preview { max-height: 420px; overflow: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--field); }
.preview table { width: 100%; border-collapse: collapse; font-size: 14px; }
.preview th, .preview td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.preview th { position: sticky; top: 0; background: var(--paper-2); font-size: 12.5px; color: var(--strong-2); z-index: 1; }
.preview td.pg { font-weight: 800; white-space: nowrap; }
.preview td.lb { color: var(--muted); font-size: 12.5px; }
.ai-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: linear-gradient(90deg, #ede4ff, #fff1d6); color: #5b3fa3; }

/* ---------- نافذة ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(8, 24, 23, 0.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 18px; animation: fade 0.2s; }
.modal { width: 100%; max-width: 440px; background: var(--card); border-radius: 26px; padding: 26px; box-shadow: var(--shadow-lg); animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: 90vh; overflow: auto; }
.modal h2 { margin: 0 0 6px; font-size: 21px; }
@keyframes fade { from { opacity: 0; } }
.code-show { font-size: 40px; font-weight: 800; letter-spacing: 10px; direction: ltr; text-align: center; padding: 16px; border-radius: 18px; background: var(--ink); color: var(--gold-2); margin: 14px 0; }

/* ---------- تنبيه ---------- */
#toast {
  position: fixed; left: 50%; top: calc(74px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); opacity: 0; z-index: 80; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 16px; font-weight: 700; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); border: 1px solid rgba(217, 173, 82, 0.35); text-align: center;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.err { background: #7c2d12; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

.footer { text-align: center; padding: 30px 18px 40px; color: var(--muted); font-size: 12.5px; }
.footer .logo-mark { font-size: 22px; }

/* ---------- الجوال ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 22px 28px; min-height: auto; }
  .auth-hero .features { display: none; }
  .auth-side { padding: 22px 16px 40px; margin-top: -26px; }
  .auth-card { position: relative; z-index: 2; }
  .inspire { grid-template-columns: 1fr; }
  .stats, .summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .home-hero { padding: 24px 20px; border-radius: 24px; }
  .room-head { gap: 14px; }
  .room-head .cover.lg { width: 92px; }
  .room-head .ring { display: none; }
  .ring-mobile { display: flex !important; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .today-top { flex-direction: column; align-items: stretch; text-align: center; }
  .today-top .pages, .today-top .chap-wrap { justify-content: center; }
  .check-big { margin: 4px auto 0; }
  .holiday { grid-template-columns: 1fr 1fr; }
  .holiday .nm { grid-column: 1 / -1; }
  .toc-row { grid-template-columns: 1fr 70px 36px; }
  .toc-row .lvl { display: none; }
  .member { grid-template-columns: auto 1fr auto; }
  .member .rank { display: none; }
  .verse { font-size: 19px; }
  .preview .hn { display: none; }
  .preview th, .preview td { padding: 9px 8px; }
  .verse .h { display: block; }
  .verse .sep { display: none; }
  .tabs button { font-size: 13.5px; padding: 10px 8px; }
  .tabs button svg { display: none; }
}
.ring-mobile { display: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- الإضافات: الأوسمة، الأدوات، الفوائد، المسؤولون، التثبيت ---------- */
.medals { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; font-size: 17px; line-height: 1; }
.medals span { cursor: help; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 14px; }
.bdg { text-align: center; padding: 10px 4px; border-radius: 14px; background: var(--soft-4); filter: grayscale(1); opacity: 0.45; transition: 0.2s; }
.bdg span { font-size: 26px; display: block; line-height: 1.2; }
.bdg small { font-size: 11px; font-weight: 700; color: var(--muted); display: block; margin-top: 4px; line-height: 1.3; }
.bdg.on { filter: none; opacity: 1; background: var(--gold-soft); box-shadow: inset 0 0 0 1.5px rgba(217, 173, 82, 0.6); }
.bdg.on small { color: #7a5610; }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; text-decoration: none; color: var(--strong);
  padding: 16px 8px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--field); font-weight: 700; font-size: 13.5px; transition: 0.15s;
}
.tool b { font-size: 24px; line-height: 1; }
.tool:hover { border-color: var(--gold); background: var(--warm); transform: translateY(-2px); }

.duties { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 12px; }
.duty { padding: 10px 14px; border-radius: 14px; background: var(--soft-4); display: flex; flex-direction: column; gap: 2px; }
.duty span { font-size: 12px; color: var(--muted); font-weight: 700; }
.duty b { font-size: 15px; }
.duty.me { background: var(--gold-soft); box-shadow: inset 0 0 0 1.5px var(--gold); }

.note { padding: 16px 18px; }
.note-text { font-family: var(--classic); font-size: 18.5px; line-height: 2; margin: 10px 0 8px; white-space: pre-wrap; word-break: break-word; color: var(--strong); }
.like { border: 1.5px solid var(--line); background: var(--field); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted); transition: 0.15s; }
.like.on { background: var(--green-soft); border-color: rgba(31, 157, 107, 0.3); color: var(--green); }

.psec { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.psec h4 { margin: 0 0 10px; font-size: 15px; }
.ios-steps { display: grid; gap: 6px; font-size: 14px; background: var(--soft-4); padding: 12px 14px; border-radius: 14px; }

.install-card { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 16px; background: linear-gradient(90deg, var(--warm), var(--card)); border-color: rgba(217, 173, 82, 0.45); }
.install-ic img { width: 48px; height: 48px; border-radius: 13px; box-shadow: var(--shadow); }

@media (max-width: 560px) {
  .tools { grid-template-columns: repeat(2, 1fr); }
  .member { grid-template-columns: auto 1fr auto; }
  .note-text { font-size: 17.5px; }
}

/* لوحة المدير */
.admin-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.admin-row .cover { width: 54px; }
@media (max-width: 560px) { .hide-sm { display: none; } .admin-row { flex-wrap: wrap; } }

/* الشعار */
.topbar a.brand { align-items: center; }
.brand-mark { width: 38px; height: 38px; }
.auth-mark { width: 110px; height: 110px; margin-bottom: 6px; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.35)); }
@media (max-width: 560px) { .topbar .brand small { display: none; } .brand-mark { width: 34px; height: 34px; } .auth-mark { width: 84px; height: 84px; } }

/* ---------- التنقل السفلي والمكتبة ---------- */
.with-nav { padding-bottom: 96px; }
.bottom-nav {
  position: fixed; bottom: calc(14px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; gap: 4px; padding: 6px; border-radius: 22px; background: rgba(12, 42, 41, 0.94); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg); border: 1px solid rgba(217, 173, 82, 0.25);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 20px; border-radius: 16px; color: rgba(255,255,255,0.65); text-decoration: none; font-weight: 700; font-size: 12.5px; min-width: 76px; }
.bottom-nav a.on { background: var(--gold); color: var(--ink); }
.bottom-nav a svg { width: 20px; height: 20px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.lib-card { display: flex; gap: 14px; padding: 14px; text-decoration: none; color: inherit; transition: transform 0.2s, box-shadow 0.2s; position: relative; }
.lib-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lib-card .cover { width: 72px; }
.lib-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lib-info b { font-size: 15.5px; line-height: 1.4; }
.lib-info small { color: var(--muted); font-size: 13px; }
.lib-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; }
.sh-badge { align-self: flex-start; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: #7a5610; margin-top: 4px; }
.lib-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: t; }
.toc-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 14.5px; }
.toc-list li:nth-child(odd) { background: rgba(12, 42, 41, 0.035); }
.toc-list li.sub { padding-right: 28px; font-size: 13.5px; color: var(--muted); }
.toc-list li a, .toc-list li b { white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--strong-2); text-decoration: none; }
.results { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); text-align: right; }
.result:hover { border-color: var(--gold); background: var(--warm); }
.result b { display: block; font-size: 14.5px; }
.result small { display: block; color: var(--muted); font-size: 12.5px; }
.result .cover { width: 40px; }
.r-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--gold-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.linked-book { background: linear-gradient(90deg, var(--warm), var(--card)); border-color: rgba(217, 173, 82, 0.5); }
.sh-link { font-size: 12px; font-weight: 700; color: var(--strong-2); text-decoration: none; }
@media (max-width: 560px) {
  .bottom-nav { left: 12px; right: 12px; transform: none; justify-content: space-around; }
  .bottom-nav a { padding: 8px 10px; min-width: 0; flex: 1; }
  .lib-grid { grid-template-columns: 1fr; }
  .lib-actions .btn { flex: 1 1 45%; }
}
.footer { padding-bottom: 120px; }

/* ---------- الأغلفة المولّدة ---------- */
.cover .ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 10px; }
.ph-orn { font-size: 13px; opacity: 0.85; }
.ph-t { font-family: var(--classic); font-weight: 700; font-size: 15px; line-height: 1.45; text-align: center; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ph-t.sm { font-size: 13px; }
.ph-t.xs { font-size: 11.5px; }
.ph-a { font-family: var(--ui); font-weight: 500; font-size: 10px; opacity: 0.8; text-align: center; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover.lg .ph-t { font-size: 20px; }
.cover.lg .ph-t.sm { font-size: 17px; }
.cover.lg .ph-t.xs { font-size: 15px; }
.cover.lg .ph-a { font-size: 12.5px; }
.ph.p0, .cat-tile.p0, .cat-head.p0 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #1d524d, #0c2a29); color: #f0cf85; }
.ph.p1, .cat-tile.p1, .cat-head.p1 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #7a2e3a, #3d1219); color: #f3d39a; }
.ph.p2, .cat-tile.p2, .cat-head.p2 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #2d4a7a, #14223d); color: #e9cf8f; }
.ph.p3, .cat-tile.p3, .cat-head.p3 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #4f5b2a, #262c12); color: #efd99a; }
.ph.p4, .cat-tile.p4, .cat-head.p4 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #7a4a26, #3a210e); color: #f2d49b; }
.ph.p5, .cat-tile.p5, .cat-head.p5 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #5a2f5e, #2a1430); color: #f0d29a; }
.ph.p6, .cat-tile.p6, .cat-head.p6 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #1f5e6b, #0d2c33); color: #f1d58f; }
.ph.p7, .cat-tile.p7, .cat-head.p7 { background: url(brand/pattern.svg) 0 0 / 36px, linear-gradient(160deg, #3b3f45, #1b1d21); color: #e8c97e; }

/* ---------- تصفّح المكتبة ---------- */
.lib-search { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 20px 0 6px; }
.lib-search .input { flex: 1 1 260px; }
.hscroll { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.mini { flex: none; width: 126px; scroll-snap-align: start; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.mini .cover { width: 126px; }
.mini b { font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini small { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.author-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 16px 10px; text-decoration: none; color: inherit; transition: transform 0.2s; }
.author-card:hover { transform: translateY(-3px); }
.author-card b { font-size: 14.5px; }
.author-card small { font-size: 12px; color: var(--muted); }
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-tile { border-radius: 16px; padding: 18px 14px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; min-height: 84px; justify-content: flex-end; box-shadow: var(--shadow); transition: transform 0.2s; }
.cat-tile:hover { transform: translateY(-3px); }
.cat-tile b { font-size: 15px; color: #fff; }
.cat-tile small { font-size: 12px; opacity: 0.85; }
.cat-head { border-radius: 22px; padding: 26px 22px; display: flex; flex-direction: column; gap: 4px; }
.cat-head h2 { color: #fff; }
.author-head { display: flex; align-items: center; gap: 16px; }
.author-chip { text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.author-chip small { font-weight: 500; opacity: 0.75; font-size: 11.5px; }
@media (max-width: 560px) { .authors-grid, .cats-grid { grid-template-columns: repeat(2, 1fr); } }

/* =================== الثيمات =================== */
/* سِفر: ورق عتيق وجلد بني، مريح للقراءة الطويلة */
[data-theme="sepia"] {
  --ink: #3b2a17; --ink-2: #4d3720; --ink-3: #6b4a24;
  --paper: #f3e6cc; --paper-2: #ead9b8; --card: #fbf3e2;
  --text: #3a2a17; --muted: #7d6a52; --line: rgba(80, 50, 20, 0.14);
  --strong: #3b2a17; --strong-2: #6b4a24;
  --field: var(--warm); --field-2: rgba(255, 250, 240, 0.6); --switch-off: #d8c7a6;
  --soft-3: rgba(80, 50, 20, 0.04); --soft-4: rgba(80, 50, 20, 0.05); --soft-5: rgba(80, 50, 20, 0.06);
  --soft-6: rgba(80, 50, 20, 0.07); --soft-7: rgba(80, 50, 20, 0.08); --soft-8: rgba(80, 50, 20, 0.1);
  --gold-soft: #f3e2b8; --bg-glow: rgba(180, 120, 40, 0.14); --warm: #fdf5e2;
  --shadow: 0 1px 2px rgba(60, 35, 10, 0.06), 0 8px 24px -12px rgba(60, 35, 10, 0.22);
}
/* ليل: أخضر الهوية الداكن مع ذهب خافت، لقراءة المساء */
[data-theme="night"] {
  --paper: #0a1b1b; --paper-2: #0f2625; --card: #112a29;
  --text: #e8e2d2; --muted: #93a5a0; --line: rgba(240, 207, 133, 0.13);
  --strong: #f3e3b8; --strong-2: #e0c37e;
  --field: #0c2221; --field-2: rgba(255, 255, 255, 0.04); --switch-off: #2c4644;
  --soft-3: rgba(255, 255, 255, 0.03); --soft-4: rgba(255, 255, 255, 0.04); --soft-5: rgba(255, 255, 255, 0.05);
  --soft-6: rgba(255, 255, 255, 0.06); --soft-7: rgba(255, 255, 255, 0.07); --soft-8: rgba(255, 255, 255, 0.09);
  --gold-soft: rgba(217, 173, 82, 0.16); --green-soft: rgba(31, 157, 107, 0.18); --red-soft: rgba(196, 83, 45, 0.2);
  --bg-glow: rgba(217, 173, 82, 0.07); --warm: #153230;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}
[data-theme="night"] .btn-primary { background: linear-gradient(180deg, #1d524d, #143e3a); box-shadow: 0 4px 0 #061312, 0 12px 22px -12px rgba(0, 0, 0, 0.8); }
[data-theme="night"] .card, [data-theme="night"] .modal { border: 1px solid rgba(240, 207, 133, 0.08); }
[data-theme="night"] .verse, [data-theme="night"] .quote { color: #f1e4c2; }
[data-theme="night"] .chap { color: var(--gold-2); }
[data-theme="night"] .check-big:not(.done) { background: radial-gradient(circle at 30% 25%, #2a6a63, #143e3a); }
[data-theme="night"] img { filter: brightness(0.92); }
/* تبديل ناعم بين الثيمات */
html.theme-fade, html.theme-fade * { transition: background-color 0.4s, color 0.4s, border-color 0.4s !important; }

/* =================== ملمس الأزرار =================== */
/* أزرار مجسّمة: ظل سفلي سميك ينزل عند الضغط */
.btn { transition: transform 0.12s cubic-bezier(0.3, 0.7, 0.4, 1), box-shadow 0.12s, background 0.2s, opacity 0.2s, filter 0.2s; }
.btn-primary { box-shadow: 0 4px 0 #051514, 0 12px 22px -12px rgba(12, 42, 41, 0.8); }
.btn-gold { box-shadow: 0 4px 0 #a97f2c, 0 12px 22px -12px rgba(217, 173, 82, 0.9); }
[data-theme="sepia"] .btn-primary { box-shadow: 0 4px 0 #22170b, 0 12px 22px -12px rgba(59, 42, 23, 0.8); }
.btn-primary:hover, .btn-gold:hover { filter: brightness(1.06); }
.btn-primary:active, .btn-gold:active { transform: translateY(3px); box-shadow: 0 1px 0 #051514, 0 4px 10px -6px rgba(12, 42, 41, 0.6); }
.btn-gold:active { box-shadow: 0 1px 0 #a97f2c, 0 4px 10px -6px rgba(217, 173, 82, 0.7); }
.btn-ghost:active, .btn-soft:active, .btn-on-dark:active { transform: scale(0.96); }
.btn-sm.btn-primary, .btn-sm.btn-gold { box-shadow: 0 3px 0 var(--btn-edge, #051514), 0 8px 16px -10px rgba(12, 42, 41, 0.6); }
.btn-sm.btn-gold { --btn-edge: #a97f2c; }
/* زر «أتممت الورد» الكبير: نبضة هادئة قبل الإتمام فقط */
.check-big:not(.done) { animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(217, 173, 82, 0.12), 0 14px 30px -14px rgba(12, 42, 41, 0.5); } }
.tick { transition: transform 0.12s, background 0.2s, border-color 0.2s; }
.tick:active { transform: scale(0.88); }
/* انتقال الصفحات: مرة واحدة عند تغيّر المسار */
.view { animation: view-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =================== الإعدادات =================== */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); font-weight: 700; font-size: 13.5px; color: var(--text); transition: border-color 0.2s, transform 0.12s; }
.theme-opt:active { transform: scale(0.96); }
.theme-opt.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 173, 82, 0.2); }
.theme-opt .sw { width: 100%; height: 34px; border-radius: 9px; border: 1px solid rgba(0, 0, 0, 0.08); }
.sw-day { background: linear-gradient(90deg, #0c2a29 0 30%, #f6f1e7 30%); }
.sw-sepia { background: linear-gradient(90deg, #3b2a17 0 30%, #f3e6cc 30%); }
.sw-night { background: linear-gradient(90deg, #d9ad52 0 30%, #0a1b1b 30%); }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pref b { display: block; font-size: 14.5px; }
.pref small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* =================== القارئ المدمج =================== */
.sh-link.rd-open { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; color: #b07d1c; }
.btn.rd-open svg { width: 16px; height: 16px; }
.sh-link.rd-open svg { width: 14px; height: 14px; }
.reader {
  --rd-bg: #fbf6ea; --rd-text: #2b2418; --rd-muted: #8a7d66; --rd-line: rgba(80, 60, 20, 0.12); --rd-size: 19px;
  position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: auto auto 1fr auto;
  background: var(--rd-bg); color: var(--rd-text);
  animation: rd-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-theme="sepia"] .reader { --rd-bg: #f2e3c4; --rd-text: #3a2a17; --rd-muted: #7d6a52; }
[data-theme="night"] .reader { --rd-bg: #0c1c1c; --rd-text: #e4dac2; --rd-muted: #8d9c97; --rd-line: rgba(240, 207, 133, 0.12); }
.reader.leaving { animation: rd-out 0.22s ease-in both; }
html.reading, html.reading body { overflow: hidden; }
@keyframes rd-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes rd-out { to { opacity: 0; transform: translateY(18px); } }
.rd-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; border-bottom: 1px solid var(--rd-line); }
.rd-title { flex: 1; min-width: 0; text-align: center; }
.rd-title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title small { color: var(--rd-muted); font-size: 12px; }
.rd-icon { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--rd-line); background: transparent; color: inherit; font-weight: 800; font-size: 16px; display: grid; place-items: center; flex: none; }
.rd-icon { display: inline-flex; align-items: baseline; justify-content: center; gap: 1px; line-height: 1; padding-top: 4px; }
.rd-icon small { font-size: 11px; }
.rd-icon:active { transform: scale(0.92); }
.rd-progress { height: 3px; background: var(--rd-line); }
.rd-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.35s; }
.rd-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.rd-page { max-width: 680px; margin: 0 auto; padding: 26px 22px 40px; font-family: var(--classic); font-size: var(--rd-size); line-height: 2.15; transform-origin: 100% 50%; }
.rd-page.turn-next { animation: rd-turn-next 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rd-page.turn-prev { animation: rd-turn-prev 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rd-turn-next { from { opacity: 0; transform: perspective(1200px) translateX(-26px) rotateY(-8deg); } to { opacity: 1; transform: none; } }
@keyframes rd-turn-prev { from { opacity: 0; transform: perspective(1200px) translateX(26px) rotateY(8deg); } to { opacity: 1; transform: none; } }
.rd-text p { margin: 0 0 0.6em; text-align: justify; }
.rd-text sup { font-size: 0.6em; color: var(--rd-muted); font-family: var(--ui); }
.rd-h2 { font-family: var(--classic); font-size: 1.08em; text-align: center; color: #9a6b12; margin: 0.9em 0 0.5em; }
[data-theme="night"] .rd-h2 { color: var(--gold-2); }
.rd-h { font-family: var(--classic); font-size: 1.15em; text-align: center; color: #9a6b12; margin: 0 0 0.6em; }
[data-theme="night"] .rd-h { color: var(--gold-2); }
.rd-verse { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4em; margin: 0.3em 0; text-align: center; }
@media (max-width: 480px) { .rd-verse { grid-template-columns: 1fr; gap: 0; } .rd-verse span:last-child { margin-bottom: 0.4em; } }
.rd-sep, .rd-end { text-align: center; color: var(--gold); margin: 0.8em 0; }
.rd-end { font-family: var(--ui); font-size: 14px; font-weight: 700; padding: 18px 0 0; border-top: 1px dashed var(--rd-line); margin-top: 1.4em; display: grid; gap: 10px; justify-items: center; }
.rd-more { border: 0; background: none; color: var(--rd-muted); font: 500 13px var(--ui); text-decoration: underline; cursor: pointer; }
.rd-loading, .rd-empty { display: grid; place-items: center; min-height: 40vh; color: var(--rd-muted); font-family: var(--ui); font-size: 15px; text-align: center; }
.rd-loading .spin { width: 26px; height: 26px; color: var(--gold); }
.rd-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--rd-line); background: var(--rd-bg); }
.rd-nav .btn { min-width: 112px; }
.rd-nav .btn-ghost { color: var(--rd-text); border-color: var(--rd-line); }
.rd-pno { font-weight: 700; font-size: 13px; color: var(--rd-muted); }

@media (prefers-reduced-motion: reduce) {
  .view, .reader, .rd-page.turn-next, .rd-page.turn-prev, .check-big:not(.done) { animation: none !important; }
}
.rd-verse.one { grid-template-columns: 1fr; }
[data-theme="sepia"] .topbar { background: rgba(59, 42, 23, 0.94); }
[data-theme="sepia"] .bottom-nav { background: rgba(59, 42, 23, 0.95); }
[data-theme="night"] .topbar { background: rgba(7, 25, 26, 0.92); }
[data-theme="night"] .bottom-nav { background: rgba(10, 30, 30, 0.95); }

/* ---------- وضع الضيف ---------- */
.guest-badge { font-size: 12px; font-weight: 700; color: var(--gold-2); border: 1px solid rgba(217, 173, 82, 0.4); padding: 3px 10px; border-radius: 999px; }
.guest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.guest-grid .card b { display: flex; align-items: center; gap: 8px; font-size: 15.5px; color: var(--strong); }
.guest-grid .card b svg { color: var(--gold); width: 20px; height: 20px; }
.guest-grid .card p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.btn-google { background: #fff; color: #1f1f1f; border: 1.5px solid #dadce0; font-weight: 700; padding: 12px; gap: 10px; }
.btn-google:hover { background: #f7f8fa; border-color: #c6cad1; }
.btn-google svg { flex: none; }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--strong-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; align-self: center; font-family: inherit; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
